diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 570e588b71443f121439746d7c8cb609ec8bce03..61d7b2449614639acc01db7bd4180f0835ac498a 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -242,6 +242,7 @@ add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros") add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode") +add_boolean_option(UE_NAS_USE_TUN False "Enable UE NAS TUN device instead of ue_ip.ko") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") @@ -280,16 +281,16 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) # RRC ###### -add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA") +add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "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 +315,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 @@ -639,12 +640,6 @@ add_boolean_option(DEBUG_PHY False "Enable PHY layer debugging opt add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer procedures") add_boolean_option(DEBUG_DLSCH False "Enable debugging of DLSCH physical layer channel") -########################## -# 802.21 options -########################## -add_boolean_option(ENABLE_RAL False "ENABLE 802.21 INTERFACE") -add_boolean_option(USE_3GPP_ADDR_AS_LINK_ADDR False "As per attribute name") - ########################## # NAS LAYER OPTIONS ########################## @@ -713,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/rrc_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}") @@ -745,11 +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("${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") +include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES") +include_directories("${OPENAIR2_DIR}/RRC/LTE") include_directories("${OPENAIR_DIR}/common/utils") include_directories("${OPENAIR_DIR}/common/utils/itti") include_directories("${OPENAIR3_DIR}/NAS/COMMON") @@ -789,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}") @@ -901,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 @@ -911,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}) @@ -970,37 +962,34 @@ set(SECU_CN_SRC ) add_library(SECU_CN ${SECU_CN_SRC}) -# Scheduler +# Physical Channel Procedures Scheduling ################################" 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_NR_SRC ${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c ${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_gNB.c - ${OPENAIR1_DIR}/SCHED_NR/nr_ru_procedures.c ) add_library(SCHED_NR_LIB ${SCHED_NR_SRC}) -set(SCHED_SRC_UE - ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c - ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c +set(SCHED_SRC_RU ${OPENAIR1_DIR}/SCHED/ru_procedures.c + ${OPENAIR1_DIR}/SCHED_NR/nr_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 +) +add_library(SCHED_RU_LIB ${SCHED_SRC_RU}) + +set(SCHED_SRC_UE + ${OPENAIR1_DIR}/SCHED_UE/phy_procedures_lte_ue.c + ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.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}) @@ -1076,59 +1065,24 @@ set(PHY_TURBOIF ${OPENAIR1_DIR}/PHY/CODING/coding_load.c ) -add_library(coding MODULE ${PHY_TURBOSRC} ${PHY_LDPCSRC}) -set(PHY_SRC +add_library(coding MODULE ${PHY_TURBOSRC} ) +set(PHY_SRC_COMMON # 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/power_control.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/dci_tools_common.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_TRANSPORT/group_hopping.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.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/LTE_TRANSPORT/phich_common.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich_common.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch_common.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach_common.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch_common.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/srs_modulation.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 @@ -1138,13 +1092,12 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c + ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c ${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/init_top.c ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c @@ -1162,95 +1115,80 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/TOOLS/lut.c ) +set(PHY_SRC + # 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/dci_tools.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/pmch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c + ${OPENAIR1_DIR}/PHY/INIT/lte_init.c + ) + +set(PHY_SRC_RU + # actual source + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.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/INIT/lte_init_ru.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c + + ) + 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/power_control.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/edci.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.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/dci_tools_ue.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_ue.c - ${OPENAIR1_DIR}/PHY/LTE_UE_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_avx2.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/drs_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_decoding.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_UE_TRANSPORT/pbch_ue.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pcfich_ue.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pch_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/ulsch_coding.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pch_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/drs_modulation.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c - ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_coding.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/initial_sync.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/MODULATION/ul_7_5_kHz_ue.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_ue.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 - ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c - ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c - ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c - ${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c - ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c - ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c - ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c - ${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_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 - ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c - ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c - ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c - ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c - ${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c - ${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c - ${OPENAIR1_DIR}/PHY/TOOLS/cdot_prod.c - ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c - ${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c - ${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c - ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c - ${OPENAIR1_DIR}/PHY/TOOLS/lut.c ) set(PHY_NR_SRC @@ -1311,10 +1249,12 @@ if (${COMPILATION_AVX2} STREQUAL "True") set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c) endif () +add_library(PHY_COMMON ${PHY_SRC_COMMON}) add_library(PHY ${PHY_SRC}) add_library(PHY_UE ${PHY_SRC_UE}) add_library(PHY_NR ${PHY_NR_SRC}) add_library(PHY_NR_UE ${PHY_NR_UE_SRC}) +add_library(PHY_RU ${PHY_SRC_RU}) #Layer 2 library ##################### @@ -1324,7 +1264,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 @@ -1429,6 +1369,7 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_bch.c ${MAC_DIR}/eNB_scheduler_primitives.c ${MAC_DIR}/eNB_scheduler_RA.c + ${MAC_DIR}/eNB_scheduler_phytest.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c #${MAC_DIR}/config_ue.c @@ -1466,32 +1407,6 @@ include_directories(${NFAPI_USER_DIR}) # L3 Libs ########################## -set(RAL_LTE_DIR ${OPENAIR3_DIR}/RAL-LTE/) -if (${ENABLE_RAL}) - set(RAL_LTE_SRC - ${RRC_DIR}/rrc_UE_ral.c - ${RRC_DIR}/rrc_eNB_ral.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_action.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_main.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_parameters.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_process.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_subscribe.c - ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_thresholds.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_action.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_main.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_mih_msg.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_parameters.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_process.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_rrc_msg.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_subscribe.c - ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_thresholds.c - ) - add_library(RAL ${RAL_LTE_SRC}) - set(RAL_LIB RAL) -endif() - # CN libs ########################## @@ -1838,8 +1753,8 @@ ${OPENAIR1_DIR}/SIMULATION/TOOLS/random_channel.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/rangen_double.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_channel.c -${OPENAIR1_DIR}/SIMULATION/TOOLS/abstraction.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_tv_channel.c +${OPENAIR1_DIR}/SIMULATION/TOOLS/abstraction.c ${OPENAIR1_DIR}/SIMULATION/RF/rf.c ${OPENAIR1_DIR}/SIMULATION/RF/dac.c ${OPENAIR1_DIR}/SIMULATION/RF/adc.c @@ -2026,7 +1941,6 @@ add_executable(lte-softmodem ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -2043,7 +1957,7 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) @@ -2065,7 +1979,6 @@ add_executable(lte-softmodem-nos1 ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c @@ -2080,7 +1993,7 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl ) @@ -2128,12 +2041,11 @@ target_link_libraries (lte-hwlat-test ${CMAKE_DL_LIBS} ) add_executable(lte-uesoftmodem ${rrc_h} ${s1ap_h} - ${OPENAIR_BIN_DIR}/messages_xml.h +# ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -2149,7 +2061,7 @@ add_executable(lte-uesoftmodem target_link_libraries (lte-uesoftmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 -Wl,--end-group z dl) @@ -2163,12 +2075,11 @@ target_link_libraries (lte-uesoftmodem ${T_LIB}) add_executable(lte-uesoftmodem-nos1 ${rrc_h} ${s1ap_h} - ${OPENAIR_BIN_DIR}/messages_xml.h +# ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c @@ -2183,7 +2094,7 @@ add_executable(lte-uesoftmodem-nos1 ) target_link_libraries (lte-uesoftmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 -Wl,--end-group z dl ) @@ -2221,7 +2132,7 @@ add_executable(nr-softmodem target_link_libraries (nr-softmodem -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_NR_LIB PHY_NR PHY LFDS GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB S1AP_LIB S1AP_ENB L2 NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB @@ -2270,8 +2181,7 @@ add_executable(oaisim ${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c - ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c - ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c +# ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c ${OPENAIR_TARGETS}/SIMU/USER/sinr_sim.c ${OPENAIR_TARGETS}/SIMU/USER/cor_SF_sim.c ${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c @@ -2294,7 +2204,7 @@ add_executable(oaisim target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim -Wl,-ldl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB} + RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE ${MSC_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group z dl) @@ -2315,10 +2225,10 @@ add_executable(oaisim_nos1 ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c + ${OPENAIR1_DIR}/SCHED/prach_procedures.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c - ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c - ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c +# ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c ${OPENAIR_TARGETS}/SIMU/USER/sinr_sim.c ${OPENAIR_TARGETS}/SIMU/USER/cor_SF_sim.c ${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c @@ -2337,7 +2247,7 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_UE_LIB PHY_UE LFDS ${MSC_LIB} ${ITTI_LIB} SIMU L2_UE ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS ${MSC_LIB} ${ITTI_LIB} SIMU L2_UE ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 -Wl,--end-group z dl ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) @@ -2356,28 +2266,29 @@ target_link_libraries (oaisim_nos1 ${T_LIB}) #special case for dlim TM4, which uses its own version of phy_scope code add_executable(dlsim_tm4 - ${OPENAIR_BIN_DIR}/messages_xml.h +# ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dlsim_tm4.c ${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope_tm4.c ${T_SOURCE} ) target_link_libraries (dlsim_tm4 - -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group + -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} ) foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) add_executable(${myExe} - ${OPENAIR_BIN_DIR}/messages_xml.h +# ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c ${XFORMS_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} ) 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_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ) endforeach(myExe) @@ -2390,7 +2301,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR2_DIR}/COMMON/messages_def.h ${OPENAIR2_DIR}/COMMON/messages_types.h ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h - ${OPENAIR_BIN_DIR}/messages_xml.h +# ${OPENAIR_BIN_DIR}/messages_xml.h ) target_link_libraries (test_epc_generate_scenario -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} @@ -2414,7 +2325,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_COMMON 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} ) @@ -2571,7 +2482,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/build_oai b/cmake_targets/build_oai index 51ec38115157b15e7b9982c8bb1a29a5ff6e503a..6344ad2533947c2f529d54ba9b731df8d5d8e6b6 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -69,6 +69,8 @@ DISABLE_LOG_X="False" USRP_REC_PLAY="False" BUILD_ECLIPSE=0 NR="False" +UE_NAS_USE_TUN="False" + trap handle_ctrl_c INT function print_help() { @@ -164,6 +166,8 @@ Options Build eclipse project files. Paths are auto corrected by fixprj.sh --usrp-recplay Build for I/Q record-playback modes +--ue-nas-use-tun + Use TUN devices for the UEs instead of ue_ip.ko Usage (first build): oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files @@ -376,6 +380,10 @@ function main() { USRP_REC_PLAY="True" echo_info "Enabling USRP record playback mode" shift 1;; + --ue-nas-use-tun) + UE_NAS_USE_TUN="True" + echo_info "Enabling UE NAS TUN device usage instead of ue_ip.ko" + shift 1;; -h | --help) print_help exit 1;; @@ -674,12 +682,17 @@ function main() { if [ "$SIMUS_PHY" = "1" ] ; then # lte unitary simulators compilation echo_info "Compiling unitary tests simulators" - simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim" + # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim + #simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim" + simlist="dlsim ulsim" for f in $simlist ; do compilations \ lte-simulators $f \ $f $dbin/$f.$REL done + compilations \ + lte-simulators coding \ + libcoding.so $dbin/libcoding.so fi # Core simulators @@ -739,6 +752,7 @@ function main() { echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file + echo "set ( UE_NAS_USE_TUN $UE_NAS_USE_TUN )" >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file [ "$CLEAN" = "1" ] && rm -rf $DIR/$oaisim_build_dir/build mkdir -p $DIR/$oaisim_build_dir/build @@ -747,6 +761,12 @@ function main() { compilations \ $oaisim_build_dir $oaisim_exec \ $oaisim_exec $dbin/$oaisim_exec.$REL + compilations \ + $oaisim_build_dir $config_libconfig_shlib \ + lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so + compilations \ + $oaisim_build_dir coding \ + libcoding.so $dbin/libcoding.so if [ "$NOS1" != "1" ] ; then diff --git a/cmake_targets/lte-simulators/CMakeLists.txt b/cmake_targets/lte-simulators/CMakeLists.txt index ca754449d7f9c6bbea10e1dcf726160df18a9f97..b7e83a92a03282f9dfae9b54633a8ea745763cee 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/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 4d95292f088591f06cb16e9bc9a5e9e96188832f..616100768ee1606097d0761ed512605e320ac51c 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -210,7 +210,7 @@ install_protobuf_from_source(){ #cd protobuf-2.6.1/ rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 wget https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $USER --group $USER --no-same-owner + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $USER --group $(groups | cut -d" " -f1) --no-same-owner cd protobuf-3.3.0/ ./configure echo "Compiling protobuf" diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index a73a0737f25849fba1f59d820cc229f5547a063a..cfb0a214cfac14c337f894d67a5f64427d0f685e 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -130,6 +130,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { case TYPE_STRING: +printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.cfg)); fflush(stdout); if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) { fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n", diff --git a/common/ran_context.h b/common/ran_context.h index 8d6b02a31ea7f8fd671a4c4b6aa1cb4e2a8f5869..66ce5299dd43a74c1b4c9bfc2c5d3fb79308cd6d 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/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 6bdda0edacdb8f53ead52a6eea844037de309080..16d35210f2aabf60358910dca52e7a02a1fe57c9 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -32,7 +32,7 @@ typedef struct { #define VCD_NUM_FUNCTIONS 187 /* number of VCD variables (to be kept up to date! see in T_messages.txt) */ -#define VCD_NUM_VARIABLES 128 +#define VCD_NUM_VARIABLES 131 /* first VCD function (to be kept up to date! see in T_messages.txt) */ #define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 8d531f9067708a301b395cb9ca4e2fb5d3bf1ec2..4d59a8d380f65c6d88efdeea2afa81640e81a7fa 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -1442,6 +1442,18 @@ ID = VCD_VARIABLE_UE0_TRX_WRITE_NS_MISSING DESC = VCD variable UE0_TRX_WRITE_NS_MISSING GROUP = ALL:VCD:UE:VCD_VARIABLE FORMAT = ulong,value +ID = VCD_VARIABLE_CPUID_ENB_THREAD_RXTX + DESC = VCD variable CPUID_ENB_THREAD_RXTX + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value +ID = VCD_VARIABLE_CPUID_RU_THREAD + DESC = VCD variable CPUID_RU_THREAD + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value +ID = VCD_VARIABLE_CPUID_RU_THREAD_TX + DESC = VCD variable CPUID_RU_THREAD_TX + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value #functions diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c index 85b5fef5096a4ddabf4f0463ebb07d6675c2d3d0..21a3304e202b6910ce27145b5c807c72b4552912 100644 --- a/common/utils/itti/intertask_interface.c +++ b/common/utils/itti/intertask_interface.c @@ -72,6 +72,9 @@ const int itti_debug = (ITTI_DEBUG_ISSUES | ITTI_DEBUG_MP_STATISTICS); /* Global message size */ #define MESSAGE_SIZE(mESSAGEiD) (sizeof(MessageHeader) + itti_desc.messages_info[mESSAGEiD].size) + +extern int emulate_rf; + typedef enum task_state_s { TASK_STATE_NOT_CONFIGURED, TASK_STATE_STARTING, TASK_STATE_READY, TASK_STATE_ENDED, TASK_STATE_MAX, } task_state_t; @@ -325,8 +328,11 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me /* Increment the global message number */ message_number = itti_increment_message_number (); +#if 0 + /* itti dump is disabled */ itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name, sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize); +#endif if (destination_task_id != TASK_UNKNOWN) { @@ -339,14 +345,16 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me destination_task_id, itti_get_task_name(destination_task_id)); } else { - /* We cannot send a message if the task is not running */ - AssertFatal (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_READY, - "Task %s Cannot send message %s (%d) to thread %d, it is not in ready state (%d)!\n", - itti_get_task_name(origin_task_id), - itti_desc.messages_info[message_id].name, - message_id, - destination_thread_id, - itti_desc.threads[destination_thread_id].task_state); + if(!emulate_rf){ + /* We cannot send a message if the task is not running */ + AssertFatal (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_READY, + "Task %s Cannot send message %s (%d) to thread %d, it is not in ready state (%d)!\n", + itti_get_task_name(origin_task_id), + itti_desc.messages_info[message_id].name, + message_id, + destination_thread_id, + itti_desc.threads[destination_thread_id].task_state); + } /* Allocate new list element */ new = (message_list_t *) itti_malloc (origin_task_id, destination_task_id, sizeof(struct message_list_s)); @@ -421,8 +429,11 @@ int itti_try_send_msg_to_task(task_id_t destination_task_id, instance_t instance /* Increment the global message number */ message_number = itti_increment_message_number (); +#if 0 + /* itti dump is disabled */ itti_dump_queue_message (origin_task_id, message_number, message, itti_desc.messages_info[message_id].name, sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize); +#endif if (destination_task_id != TASK_UNKNOWN) { @@ -716,8 +727,11 @@ void itti_mark_task_ready(task_id_t task_id) AssertFatal (thread_id < itti_desc.thread_max, "Thread id (%d) is out of range (%d)!\n", thread_id, itti_desc.thread_max); +#if 0 + /* itti dump is disabled */ /* Register the thread in itti dump */ itti_dump_thread_use_ring_buffer(); +#endif /* Mark the thread as using LFDS queue */ lfds611_queue_use(itti_desc.tasks[task_id].message_queue); @@ -848,7 +862,10 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i itti_desc.wait_tasks = 0; itti_desc.created_tasks = 0; itti_desc.ready_tasks = 0; +#if 0 + /* itti dump is disabled */ itti_dump_init (messages_definition_xml, dump_file_name); +#endif CHECK_INIT_RETURN(timer_init ()); @@ -915,7 +932,10 @@ void itti_wait_tasks_end(void) exit (0); } +#if 0 + /* itti dump is disabled */ itti_dump_exit(); +#endif } void itti_send_terminate_message(task_id_t task_id) diff --git a/common/utils/load_module_shlib.c b/common/utils/load_module_shlib.c index fecdc2a58c624139f24bb44189b220dbf1f0d1d5..656f6a885224abaf3e6565368bd99d5f95225620 100644 --- a/common/utils/load_module_shlib.c +++ b/common/utils/load_module_shlib.c @@ -37,7 +37,7 @@ #include <errno.h> #include <sys/ioctl.h> #include <dlfcn.h> -#include "openair1/PHY/defs.h" +#include "openair1/PHY/defs_common.h" #define LOAD_MODULE_SHLIB_MAIN #include "common/config/config_userapi.h" diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index c63d504e43d569f2cf9c3045aa2dca1c3b7056d8..cd8d5a89e1566290a367ffd2f40510355e2eba0e 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -47,7 +47,10 @@ extern RAN_CONTEXT_t RC; #include "fapi_stub.h" //#include "fapi_l1.h" #include "UTIL/LOG/log.h" -#include "openair2/LAYER2/MAC/proto.h" +#include "openair2/LAYER2/MAC/mac_proto.h" + +#include "PHY/INIT/phy_init.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" #define NUM_P5_PHY 2 diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 07c3f1aa91fda58261b36dd8c90df3cbaf12d781..74e999528c51fc7d40f4eea48d56cd069a7ced04 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -37,7 +37,8 @@ #include "vendor_ext.h" #include "nfapi_vnf.h" - +#include "PHY/defs_eNB.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -201,8 +202,8 @@ void oai_create_enb(void) { eNB->CC_id = bodge_counter; eNB->abstraction_flag = 0; eNB->single_thread_flag = 0;//single_thread_flag; - eNB->td = ulsch_decoding_data;//(single_thread_flag==1) ? ulsch_decoding_data_2thread : ulsch_decoding_data; - eNB->te = dlsch_encoding;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding; + eNB->td = ulsch_decoding_data_all;//(single_thread_flag==1) ? ulsch_decoding_data_2thread : ulsch_decoding_data; + eNB->te = dlsch_encoding_all;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding; RC.nb_CC[bodge_counter] = 1; diff --git a/openair1/PHY/CODING/3gpplte.c b/openair1/PHY/CODING/3gpplte.c index 61acdb2ad9d3040dca9ed68d4264cc0fe0e332c4..ae476a118f0ab99f777e7ad2270fedfcb467a815 100644 --- a/openair1/PHY/CODING/3gpplte.c +++ b/openair1/PHY/CODING/3gpplte.c @@ -29,7 +29,7 @@ #endif #include <stdint.h> #include <stdio.h> -#include "PHY/CODING/defs.h" +#include "PHY/CODING/coding_defs.h" #include "extern_3GPPinterleaver.h" //#define DEBUG_TURBO_ENCODER 1 diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c index 8150f02da89abd7ed2e5351de2cf25057c238263..e2eb7eb52af2897cfcbf02a5b3407e492cc681d6 100644 --- a/openair1/PHY/CODING/3gpplte_sse.c +++ b/openair1/PHY/CODING/3gpplte_sse.c @@ -26,10 +26,10 @@ date: 09.2012 */ #ifndef TC_MAIN -#include "defs.h" +#include "coding_defs.h" #include "extern_3GPPinterleaver.h" #else -#include "vars.h" +#include "coding_vars.h" #include <stdint.h> #endif #include <stdio.h> diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder.c b/openair1/PHY/CODING/3gpplte_turbo_decoder.c index c0e4ca12db42a30e768718336467da778dac3aa3..572127a5e0bd4118a4082d94e51c402743a33689 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder.c @@ -27,8 +27,8 @@ */ -#include "PHY/defs.h" -#include "PHY/CODING/defs.h" +#include "PHY/defs_common.h" +#include "PHY/CODING/coding_defs.h" #include "PHY/CODING/lte_interleaver_inline.h" #include "PHY/sse_intrin.h" diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c index ef0ca48df465971ed2b89b66068f366a4937a519..a541c223934e00d2d3cf31eaf01d10a748b3dd3a 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c @@ -42,8 +42,9 @@ #ifndef TEST_DEBUG -#include "PHY/defs.h" -#include "PHY/CODING/defs.h" +#include "PHY/impl_defs_top.h" +#include "PHY/defs_common.h" +#include "PHY/CODING/coding_defs.h" #include "PHY/CODING/lte_interleaver_inline.h" #include "extern_3GPPinterleaver.h" #else diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c index ae3ce531d037cce540522aa6454a20ab96733132..7daa86b8bb296218b17955532c96267c2688c24d 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c @@ -41,8 +41,9 @@ #include "PHY/sse_intrin.h" #ifndef TEST_DEBUG -#include "PHY/defs.h" -#include "PHY/CODING/defs.h" +#include "PHY/impl_defs_top.h" +#include "PHY/defs_common.h" +#include "PHY/CODING/coding_defs.h" #include "PHY/CODING/lte_interleaver_inline.h" #include "extern_3GPPinterleaver.h" #else diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index 5b7174e98964b9c9fec7e450fb892778755e57ff..f22ec21ff0ac25bfb876a8bac56c22b02129ca2c 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -39,8 +39,8 @@ #include "PHY/sse_intrin.h" #ifndef TEST_DEBUG -#include "PHY/defs.h" -#include "PHY/CODING/defs.h" +#include "PHY/defs_common.h" +#include "PHY/CODING/coding_defs.h" #include "PHY/CODING/lte_interleaver_inline.h" #include "extern_3GPPinterleaver.h" #else diff --git a/openair1/PHY/CODING/ccoding_byte.c b/openair1/PHY/CODING/ccoding_byte.c index 8511a5ea0f7103cfcf252a9ededf4103ab8e4977..db91e68dc8f020c63b1d610cfbfb6d1f93ebaa3a 100644 --- a/openair1/PHY/CODING/ccoding_byte.c +++ b/openair1/PHY/CODING/ccoding_byte.c @@ -24,7 +24,7 @@ author: raymond.knopp@eurecom.fr, based on similar code for 3GPP convolutional code (UMTS) by P. Humblet (2000) date: 10.2004 */ -#include "defs.h" +#include "coding_defs.h" unsigned short gdot11[] = { 0133, 0171 }; // {A,B} diff --git a/openair1/PHY/CODING/ccoding_byte_lte.c b/openair1/PHY/CODING/ccoding_byte_lte.c index 6eb654827bc874c9d27a405d2975b014a572a32d..870e9ba4700c15e16c42d4b18e3a975ef757e51e 100644 --- a/openair1/PHY/CODING/ccoding_byte_lte.c +++ b/openair1/PHY/CODING/ccoding_byte_lte.c @@ -24,7 +24,7 @@ author: raymond.knopp@eurecom.fr date: 21.10.2009 */ -#include "defs.h" +#include "coding_defs.h" //#define DEBUG_CCODE 1 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 40e19964dfa1abc0d847f84bfc2560ee3f2ea96f..d2975f3f9360dc09a55eb7329e625694895dfb5d 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/coding_load.c b/openair1/PHY/CODING/coding_load.c index 31f71e6b31965e7777cba5fb9b4a2f260c56da51..76ab04f2207734355d209e71e5338567303a92f8 100644 --- a/openair1/PHY/CODING/coding_load.c +++ b/openair1/PHY/CODING/coding_load.c @@ -33,8 +33,8 @@ #include <sys/types.h> -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_common.h" +#include "PHY/phy_extern.h" #include "common/utils/load_module_shlib.h" #include "common/utils/telnetsrv/telnetsrv.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/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index 21427de19b88c1568ac96b4a08b40b4d0813f1f2..0e1f0e065f36b8ade81d103fb2ccc70915a09751 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -31,7 +31,7 @@ */ -#include "defs.h" +#include "coding_defs.h" /*ref 36-212 v8.6.0 , pp 8-9 */ diff --git a/openair1/PHY/CODING/lte_rate_matching.c b/openair1/PHY/CODING/lte_rate_matching.c index 41c3c5e5a91b314c62c2d9a701c1802def0b306c..af5d1a169e950fa0a35b7237c47ad5390a195288 100644 --- a/openair1/PHY/CODING/lte_rate_matching.c +++ b/openair1/PHY/CODING/lte_rate_matching.c @@ -28,8 +28,8 @@ #include <stdio.h> #include <stdlib.h> #endif -#include "PHY/defs.h" -#include "assertions.h" +#include "PHY/defs_eNB.h" +#include "PHY/LTE_TRANSPORT/transport_common.h" //#define cmin(a,b) ((a)<(b) ? (a) : (b)) diff --git a/openair1/PHY/CODING/lte_segmentation.c b/openair1/PHY/CODING/lte_segmentation.c index 3ae65e20900e95323efee6563cbc9d7dd705b856..ba79b0171e4e31dac4d411e07b4ab22b66263cbf 100644 --- a/openair1/PHY/CODING/lte_segmentation.c +++ b/openair1/PHY/CODING/lte_segmentation.c @@ -24,8 +24,9 @@ author: raymond.knopp@eurecom.fr date: 21.10.2009 */ -#include "PHY/defs.h" -#include "SCHED/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/LTE_TRANSPORT/transport_common.h" +#include "PHY/CODING/coding_defs.h" //#define DEBUG_SEGMENTATION diff --git a/openair1/PHY/CODING/viterbi_lte.c b/openair1/PHY/CODING/viterbi_lte.c index 5e11cb3453ab9dd2f425a175389acfd0edcca432..553192a4a8ee723ff3afb12292f53cb10c4463ac 100644 --- a/openair1/PHY/CODING/viterbi_lte.c +++ b/openair1/PHY/CODING/viterbi_lte.c @@ -29,8 +29,8 @@ */ #ifndef TEST_DEBUG -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_common.h" +#include "PHY/phy_extern.h" #else #include <stdio.h> #include <stdlib.h> diff --git a/openair1/PHY/INIT/extern.h b/openair1/PHY/INIT/init_extern.h similarity index 100% rename from openair1/PHY/INIT/extern.h rename to openair1/PHY/INIT/init_extern.h diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c index 6213520b8c8bf042aaf7c7212ea8a5a237156ba8..f033a7e5c17d3db534b91d2008fe49913c2c0c07 100644 --- a/openair1/PHY/INIT/init_top.c +++ b/openair1/PHY/INIT/init_top.c @@ -20,9 +20,50 @@ */ /*!\brief Initilization and reconfiguration routines for LTE PHY */ -#include "defs.h" -#include "PHY/extern.h" -#include "PHY/CODING/extern.h" +#include "phy_init.h" +#include "PHY/phy_extern.h" +#include "PHY/CODING/coding_extern.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" + +void generate_64qam_table(void) +{ + + int a,b,c,index; + + + for (a=-1; a<=1; a+=2) + for (b=-1; b<=1; b+=2) + for (c=-1; c<=1; c+=2) { + index = (1+a)*2 + (1+b) + (1+c)/2; + qam64_table[index] = -a*(QAM64_n1 + b*(QAM64_n2 + (c*QAM64_n3))); // 0 1 2 + } +} + +void generate_16qam_table(void) +{ + + int a,b,index; + + for (a=-1; a<=1; a+=2) + for (b=-1; b<=1; b+=2) { + index = (1+a) + (1+b)/2; + qam16_table[index] = -a*(QAM16_n1 + (b*QAM16_n2)); + } +} + +void generate_qpsk_table(void) +{ + + int a,index; + + for (a=-1; a<=1; a+=2) { + index = (1+a)/2; + qpsk_table[index] = -a*QPSK; + } +} + void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) { diff --git a/openair1/PHY/INIT/vars.h b/openair1/PHY/INIT/init_vars.h similarity index 100% rename from openair1/PHY/INIT/vars.h rename to openair1/PHY/INIT/init_vars.h diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index ff36b0a5e2f4597de8275ff59bad2a286d1d27ac..c226099da90be0ceab3e9a7490208e172794b2bb 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -19,14 +19,17 @@ * contact@openairinterface.org */ -#include "defs.h" -#include "SCHED/defs.h" -#include "PHY/extern.h" -#include "SIMULATION/TOOLS/defs.h" +#include "PHY/defs_eNB.h" +#include "phy_init.h" +#include "SCHED/sched_eNB.h" +#include "PHY/phy_extern.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" +#include "SIMULATION/TOOLS/sim.h" #include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" #include "TDD-Config.h" -#include "LAYER2/MAC/extern.h" #include "MBSFN-SubframeConfigList.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "assertions.h" @@ -721,23 +724,6 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id, -void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups) -{ - // uint8_t i; - - if (eNB_flag == 0 ) { - //LOG_D(PHY,"[UE %d] configure cba group %d with rnti %x, num active cba grp %d\n", index, index, cba_rnti, num_active_cba_groups); - PHY_vars_UE_g[Mod_id][CC_id]->ulsch[index]->num_active_cba_groups=num_active_cba_groups; - PHY_vars_UE_g[Mod_id][CC_id]->ulsch[index]->cba_rnti[cba_group_id]=cba_rnti; - } else { - //for (i=index; i < NUMBER_OF_UE_MAX; i+=num_active_cba_groups){ - // LOG_D(PHY,"[eNB %d] configure cba group %d with rnti %x for UE %d, num active cba grp %d\n",Mod_id, i%num_active_cba_groups, cba_rnti, i, num_active_cba_groups); - RC.eNB[Mod_id][CC_id]->ulsch[index]->num_active_cba_groups=num_active_cba_groups; - RC.eNB[Mod_id][CC_id]->ulsch[index]->cba_rnti[cba_group_id] = cba_rnti; - //} - } -} - int phy_init_lte_eNB(PHY_VARS_eNB *eNB, unsigned char is_secondary_eNB, unsigned char abstraction_flag) diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c index 91681930748052dd38dd69a74cd7a782e1d6cf6d..8c270fe7ba6960cb0a608dfc1877f66b858af66d 100644 --- a/openair1/PHY/INIT/lte_init_ru.c +++ b/openair1/PHY/INIT/lte_init_ru.c @@ -19,14 +19,13 @@ * contact@openairinterface.org */ -#include "defs.h" -#include "SCHED/defs.h" -#include "PHY/extern.h" -#include "SIMULATION/TOOLS/defs.h" +#include "phy_init.h" +#include "SCHED/sched_eNB.h" +#include "PHY/phy_extern.h" +#include "SIMULATION/TOOLS/sim.h" #include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" #include "TDD-Config.h" -#include "LAYER2/MAC/extern.h" #include "MBSFN-SubframeConfigList.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "assertions.h" diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c index 16274d687841098c06042d9c471f2add19900fcb..46fce73314e0300e4011b0799e8852a4e4570c86 100644 --- a/openair1/PHY/INIT/lte_init_ue.c +++ b/openair1/PHY/INIT/lte_init_ue.c @@ -19,19 +19,20 @@ * contact@openairinterface.org */ -#include "defs.h" -#include "SCHED/defs.h" -#include "PHY/extern.h" -#include "SIMULATION/TOOLS/defs.h" +#include "phy_init.h" +#include "SCHED_UE/sched_UE.h" +#include "PHY/phy_extern_ue.h" +#include "SIMULATION/TOOLS/sim.h" #include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" #include "TDD-Config.h" -#include "LAYER2/MAC/extern.h" #include "MBSFN-SubframeConfigList.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "assertions.h" #include <math.h> - +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10}; @@ -651,7 +652,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue, int th_id; LOG_D(PHY,"Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); - LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); + diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c index 6cf05769e52e4ca2b4dfc4a0bba6ac5d4848239f..0830058a8fb4bda41bb692a4e29b9aa460fb7104 100644 --- a/openair1/PHY/INIT/lte_param_init.c +++ b/openair1/PHY/INIT/lte_param_init.c @@ -25,10 +25,14 @@ #include <execinfo.h> #include <signal.h> -#include "SIMULATION/TOOLS/defs.h" +#include "SIMULATION/TOOLS/sim.h" #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern.h" +#include "phy_init.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" extern PHY_VARS_eNB *eNB; extern PHY_VARS_UE *UE; diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c index 2f2bd95617ebcffa60092376e9778935bd3ce877..e7c4ced5d37351977dc61f7d21e9c85ff8516905 100644 --- a/openair1/PHY/INIT/lte_parms.c +++ b/openair1/PHY/INIT/lte_parms.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -#include "defs.h" +#include "phy_init.h" #include "log.h" uint16_t dl_S_table_normal[10]={3,9,10,11,12,3,9,10,11,6}; diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/phy_init.h similarity index 99% rename from openair1/PHY/INIT/defs.h rename to openair1/PHY/INIT/phy_init.h index defeeddbc5be618445366e17da6042490d5fc1cc..097958f842de9e90692ad55e7da3fa1667cc1500 100644 --- a/openair1/PHY/INIT/defs.h +++ b/openair1/PHY/INIT/phy_init.h @@ -22,8 +22,8 @@ #ifndef __INIT_DEFS__H__ #define __INIT_DEFS__H__ -#include "PHY/defs.h" - +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" #include "SystemInformationBlockType2.h" //#include "RadioResourceConfigCommonSIB.h" diff --git a/openair1/PHY/LTE_ESTIMATION/adjust_gain.c b/openair1/PHY/LTE_ESTIMATION/adjust_gain.c index 7272b7247d93f451754d41eadfa5edfaf2b51057..27e6c106863e98a5d317bfad32926583536205bc 100644 --- a/openair1/PHY/LTE_ESTIMATION/adjust_gain.c +++ b/openair1/PHY/LTE_ESTIMATION/adjust_gain.c @@ -20,8 +20,8 @@ */ #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" void phy_adjust_gain (PHY_VARS_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id) diff --git a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c index 2c318d85e401d529bb78f5bdda5ffc6c74be5c05..3fd58a4989701d795401ae296b3a4241e159136a 100644 --- a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c +++ b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" // This is 512/(1:256) in __m128i format diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c index bf1001fc39d648ccafe05c93cd7af6f485f73dd6..8810752398f1991361c2826519d70075bf645a30 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c @@ -20,118 +20,49 @@ */ #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include "UTIL/LOG/vcd_signal_dumper.h" +#include "openair2/LAYER2/MAC/mac_proto.h" #define DEBUG_PHY -int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms, - LTE_eNB_SRS *lte_eNB_srs, - unsigned int *eNB_id, - unsigned char clear, - unsigned char number_of_cards, - short coef) +// Adjust location synchronization point to account for drift +// The adjustment is performed once per frame based on the +// last channel estimate of the receiver +void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, + PHY_VARS_UE *ue, + unsigned char eNB_id, + uint8_t subframe, + unsigned char clear, + short coef) { - static int max_pos_fil2 = 0; - int temp, i, aa, max_pos = 0,ind; - int max_val=0; + static int max_pos_fil = 0; + static int count_max_pos_ok = 0; + static int first_time = 1; + int temp = 0, i, aa, max_val = 0, max_pos = 0; + int diff; short Re,Im,ncoef; -#ifdef DEBUG_PHY - char fname[100],vname[100]; -#endif - - ncoef = 32768 - coef; - for (ind=0; ind<number_of_cards; ind++) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_IN); - if (ind==0) - max_val=0; + ncoef = 32767 - coef; - - for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { - // do ifft of channel estimate - switch(frame_parms->N_RB_DL) { - case 6: - dft128((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; - case 25: - dft512((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; - case 50: - dft1024((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; - case 100: - dft2048((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], - (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], - 1); - break; - } #ifdef DEBUG_PHY - sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa); - sprintf(vname,"srs_time_%d%d",ind,aa); - write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1); -#endif - } + LOG_D(PHY,"AbsSubframe %d.%d: rx_offset (before) = %d\n",ue->proc.proc_rxtx[0].frame_rx%1024,subframe,ue->rx_offset); +#endif //DEBUG_PHY - // we only use channel estimates from tx antenna 0 here - // remember we fixed the SRS to use only every second subcarriers - for (i = 0; i < frame_parms->ofdm_symbol_size/2; i++) { - temp = 0; - - for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { - Re = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[(i<<1)]; - Im = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[1+(i<<1)]; - temp += (Re*Re/2) + (Im*Im/2); - } - if (temp > max_val) { - max_pos = i; - max_val = temp; - *eNB_id = ind; - } - } - } - - // filter position to reduce jitter - if (clear == 1) - max_pos_fil2 = max_pos; - else - max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15; - - return(max_pos_fil2); -} - - -int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id) -{ - int temp, i, aa, max_pos=0, max_val=0; - short Re,Im; - - LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; - LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id]; - int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time; - uint8_t cyclic_shift = 0; - int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size); - - AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size); - AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n", - frame_parms->nb_antennas_rx); - for (i = 0; i < frame_parms->ofdm_symbol_size; i++) { + // we only use channel estimates from tx antenna 0 here + for (i = 0; i < frame_parms->nb_prefix_samples; i++) { temp = 0; for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { - Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)]; - Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)]; + Re = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[(i<<2)]; + Im = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[1+(i<<2)]; temp += (Re*Re/2) + (Im*Im/2); } @@ -141,12 +72,66 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id) } } - if (max_pos>frame_parms->ofdm_symbol_size/2) - max_pos = max_pos-frame_parms->ofdm_symbol_size; + // filter position to reduce jitter + if (clear == 1) + max_pos_fil = max_pos; + else + max_pos_fil = ((max_pos_fil * coef) + (max_pos * ncoef)) >> 15; + + // do not filter to have proactive timing adjustment + max_pos_fil = max_pos; + + if(subframe == 6) + { + diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3); + + if ( abs(diff) < SYNCH_HYST ) + ue->rx_offset = 0; + else + ue->rx_offset = diff; + + if(abs(diff)<5) + count_max_pos_ok ++; + else + count_max_pos_ok = 0; + + if(count_max_pos_ok > 10 && first_time == 1) + { + first_time = 0; + ue->time_sync_cell = 1; + if (ue->mac_enabled==1) { + LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); + //mac_resynch(); + dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id); + ue->UE_mode[0] = PRACH; + } + else { + ue->UE_mode[0] = PUSCH; + } + } + + if ( ue->rx_offset < 0 ) + ue->rx_offset += FRAME_LENGTH_COMPLEX_SAMPLES; + + if ( ue->rx_offset >= FRAME_LENGTH_COMPLEX_SAMPLES ) + ue->rx_offset -= FRAME_LENGTH_COMPLEX_SAMPLES; - //#ifdef DEBUG_PHY - LOG_D(PHY,"frame %d: max_pos = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,sync_pos); - //#endif //DEBUG_PHY - return max_pos - sync_pos; + + #ifdef DEBUG_PHY + LOG_D(PHY,"AbsSubframe %d.%d: ThreadId %d diff =%i rx_offset (final) = %i : clear %d,max_pos = %d,max_pos_fil = %d (peak %d) max_val %d target_pos %d \n", + ue->proc.proc_rxtx[ue->current_thread_id[subframe]].frame_rx, + subframe, + ue->current_thread_id[subframe], + diff, + ue->rx_offset, + clear, + max_pos, + max_pos_fil, + temp,max_val, + (frame_parms->nb_prefix_samples>>3)); + #endif //DEBUG_PHY + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT); + } } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c new file mode 100644 index 0000000000000000000000000000000000000000..3bf4c40adeab61602225124d9d53d8f3ff73e851 --- /dev/null +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c @@ -0,0 +1,153 @@ +/* + * 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/types.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" + +#include "UTIL/LOG/vcd_signal_dumper.h" + +#define DEBUG_PHY + +int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms, + LTE_eNB_SRS *lte_eNB_srs, + unsigned int *eNB_id, + unsigned char clear, + unsigned char number_of_cards, + short coef) + +{ + + static int max_pos_fil2 = 0; + int temp, i, aa, max_pos = 0,ind; + int max_val=0; + short Re,Im,ncoef; +#ifdef DEBUG_PHY + char fname[100],vname[100]; +#endif + + ncoef = 32768 - coef; + + for (ind=0; ind<number_of_cards; ind++) { + + if (ind==0) + max_val=0; + + + for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { + // do ifft of channel estimate + switch(frame_parms->N_RB_DL) { + case 6: + dft128((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], + (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], + 1); + break; + case 25: + dft512((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], + (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], + 1); + break; + case 50: + dft1024((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], + (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], + 1); + break; + case 100: + dft2048((int16_t*) <e_eNB_srs->srs_ch_estimates[aa][0], + (int16_t*) lte_eNB_srs->srs_ch_estimates_time[aa], + 1); + break; + } +#ifdef DEBUG_PHY + sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa); + sprintf(vname,"srs_time_%d%d",ind,aa); + write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1); +#endif + } + + // we only use channel estimates from tx antenna 0 here + // remember we fixed the SRS to use only every second subcarriers + for (i = 0; i < frame_parms->ofdm_symbol_size/2; i++) { + temp = 0; + + for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { + Re = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[(i<<1)]; + Im = ((int16_t*)lte_eNB_srs->srs_ch_estimates_time[aa])[1+(i<<1)]; + temp += (Re*Re/2) + (Im*Im/2); + } + + if (temp > max_val) { + max_pos = i; + max_val = temp; + *eNB_id = ind; + } + } + } + + // filter position to reduce jitter + if (clear == 1) + max_pos_fil2 = max_pos; + else + max_pos_fil2 = ((max_pos_fil2 * coef) + (max_pos * ncoef)) >> 15; + + return(max_pos_fil2); +} + + +int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id) +{ + int temp, i, aa, max_pos=0, max_val=0; + short Re,Im; + + LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; + LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id]; + int32_t **ul_ch_estimates_time= eNB_pusch_vars->drs_ch_estimates_time; + uint8_t cyclic_shift = 0; + int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size); + + AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size); + AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n", + frame_parms->nb_antennas_rx); + for (i = 0; i < frame_parms->ofdm_symbol_size; i++) { + temp = 0; + + for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { + Re = ((int16_t*)ul_ch_estimates_time[aa])[(i<<1)]; + Im = ((int16_t*)ul_ch_estimates_time[aa])[1+(i<<1)]; + temp += (Re*Re/2) + (Im*Im/2); + } + + if (temp > max_val) { + max_pos = i; + max_val = temp; + } + } + + if (max_pos>frame_parms->ofdm_symbol_size/2) + max_pos = max_pos-frame_parms->ofdm_symbol_size; + + //#ifdef DEBUG_PHY + LOG_D(PHY,"frame %d: max_pos = %d, sync_pos=%d\n",eNB->proc.frame_rx,max_pos,sync_pos); + //#endif //DEBUG_PHY + + return max_pos - sync_pos; +} + diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c index 1105f835979e84b85e56f394dcfb3d59cc2f1762..06ef4a5d1a16fd68083c4f03b973ed5a215ef079 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c @@ -20,8 +20,10 @@ */ #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" +#include "PHY/impl_defs_top.h" +#include "openair2/LAYER2/MAC/mac_proto.h" #include "UTIL/LOG/vcd_signal_dumper.h" diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 55d2cf6c5c5f2aae5eb34b045f394fdfeea08f24..8d1fb20d6b79b828130666254a629c9cd255b355 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -20,8 +20,10 @@ */ #include <string.h> -#include "defs.h" -#include "PHY/defs.h" +#include "PHY/defs_UE.h" +#include "lte_estimation.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" + #include "filt16_32.h" //#define DEBUG_BF_CH diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c index a4b29bb25ec407efbbb4ec696bada4557bbd1ec1..a72563f7e6d58754111b3657ea50ec7fa7230576 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c @@ -20,12 +20,13 @@ */ #include <string.h> -#include "defs.h" -#include "SCHED/defs.h" -#include "PHY/defs.h" +#include "PHY/defs_UE.h" #include "filt96_32.h" #include "T.h" //#define DEBUG_CH +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" +#include "SCHED_UE/sched_UE.h" int lte_dl_channel_estimation(PHY_VARS_UE *ue, uint8_t eNB_id, diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c index 17d44b22f8815442a5c10921410e685b02d64f1a..c4fc80a8c11635868e1a7d97590ff048553500ef 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c @@ -20,8 +20,9 @@ */ #include <string.h> -#include "defs.h" -#include "PHY/defs.h" +#include "PHY/defs_UE.h" +#include "lte_estimation.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_CH int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue, diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c index 42409cbaae6c4d9e53029483543adf79430eb14b..b416ff9e79ba3148552b8f57c1931ebfdad4b9a4 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" diff --git a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c index cce1e06df4bce134e149558b4b64c8a4b3f95de5..ed82aeb09e36c602ee2b8d71d2db425176b19b60 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c @@ -25,7 +25,7 @@ date: 19.11.2009 */ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" //#define DEBUG_PHY #if defined(__x86_64__) || defined(__i386__) diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h similarity index 99% rename from openair1/PHY/LTE_ESTIMATION/defs.h rename to openair1/PHY/LTE_ESTIMATION/lte_estimation.h index a7b5d14701874da4fb4894dca2382bfd7102708b..4512fc0d9be15bf9d52efaf1f68248725fc0d8ba 100644 --- a/openair1/PHY/LTE_ESTIMATION/defs.h +++ b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h @@ -22,7 +22,9 @@ #ifndef __LTE_ESTIMATION_DEFS__H__ #define __LTE_ESTIMATION_DEFS__H__ -#include "PHY/defs.h" + +#include "PHY/defs_UE.h" +#include "PHY/defs_eNB.h" /** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_ * @{ */ diff --git a/openair1/PHY/LTE_ESTIMATION/extern.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h similarity index 100% rename from openair1/PHY/LTE_ESTIMATION/extern.h rename to openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h diff --git a/openair1/PHY/LTE_ESTIMATION/vars.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation_vars.h similarity index 100% rename from openair1/PHY/LTE_ESTIMATION/vars.h rename to openair1/PHY/LTE_ESTIMATION/lte_estimation_vars.h diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index 21e33cf1c0ce5325168e1d06b6beaaf047ecb149..587dbed6c506f4221797cd27b83e2d7723ae60d6 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -26,19 +26,15 @@ */ //#include <string.h> -#include "defs.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include <math.h> -#ifdef OPENAIR2 -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" -#include "RRC/LITE/extern.h" -#include "PHY_INTERFACE/extern.h" -#endif -//#define DEBUG_PHY + +#include "LAYER2/MAC/mac.h" +#include "RRC/LTE/rrc_extern.h" +#include "PHY_INTERFACE/phy_interface.h" + int* sync_corr_ue0 = NULL; int* sync_corr_ue1 = NULL; @@ -487,8 +483,6 @@ int lte_sync_time(int **rxdata, ///rx data in time domain } -//#define DEBUG_PHY - int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain LTE_DL_FRAME_PARMS *frame_parms, uint32_t length, @@ -578,3 +572,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain } + + + diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c index d428f8e6e6d9f927da6dbc7be5a0ffd77ebbf501..fd7b8d601ab9db9811c99a7df8b6b75cd0e2a9e0 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c @@ -36,8 +36,8 @@ */ //#include "defs.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #if defined(__x86_64__) || defined(__i386__) #include "pss6144.h" diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index ce6cd869599087d1b4a1258d4d894bc1fbaec717..199fc2d846def40512bf97215c6e43928d082cfc 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -21,10 +21,8 @@ // this function fills the PHY_vars->PHY_measurement structure -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include "log.h" #include "PHY/sse_intrin.h" @@ -454,397 +452,339 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, } -void lte_ue_measurements(PHY_VARS_UE *ue, - unsigned int subframe_offset, - unsigned char N0_symbol, - unsigned char abstraction_flag, - unsigned char rank_adaptation, - uint8_t subframe) +void conjch0_mult_ch1(int *ch0, + int *ch1, + int32_t *ch0conj_ch1, + unsigned short nb_rb, + unsigned char output_shift0) { + //This function is used to compute multiplications in Hhermitian * H matrix + unsigned short rb; + __m128i *dl_ch0_128,*dl_ch1_128, *ch0conj_ch1_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; + dl_ch0_128 = (__m128i *)ch0; + dl_ch1_128 = (__m128i *)ch1; - int aarx,aatx,eNB_id=0; //,gain_offset=0; - //int rx_power[NUMBER_OF_CONNECTED_eNB_MAX]; - int i; - unsigned int limit,subband; -#if defined(__x86_64__) || defined(__i386__) - __m128i *dl_ch0_128,*dl_ch1_128; -#elif defined(__arm__) - int16x8_t *dl_ch0_128, *dl_ch1_128; -#endif - int *dl_ch0,*dl_ch1; - - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - int nb_subbands,subband_size,last_subband_size; - int N_RB_DL = frame_parms->N_RB_DL; + ch0conj_ch1_128 = (__m128i *)ch0conj_ch1; + for (rb=0; rb<3*nb_rb; rb++) { - int rank_tm3_tm4; + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]); + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[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]); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch1_128[0]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + ch0conj_ch1_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx; +#ifdef DEBUG_RANK_EST + printf("\n Computing conjugates \n"); + print_shorts("ch0:",(int16_t*)&dl_ch0_128[0]); + print_shorts("ch1:",(int16_t*)&dl_ch1_128[0]); + print_shorts("pack:",(int16_t*)&ch0conj_ch1_128[0]); +#endif + dl_ch0_128+=1; + dl_ch1_128+=1; + ch0conj_ch1_128+=1; + } + _mm_empty(); + _m_empty(); +} - switch (N_RB_DL) { - case 6: - nb_subbands = 6; - subband_size = 12; - last_subband_size = 0; - break; +void construct_HhH_elements(int *ch0conj_ch0, //00_00 + int *ch1conj_ch1,//01_01 + int *ch2conj_ch2,//11_11 + int *ch3conj_ch3,//10_10 + int *ch0conj_ch1,//00_01 + int *ch1conj_ch0,//01_00 + int *ch2conj_ch3,//10_11 + int *ch3conj_ch2,//11_10 + int32_t *after_mf_00, + int32_t *after_mf_01, + int32_t *after_mf_10, + int32_t *after_mf_11, + unsigned short nb_rb) +{ + unsigned short rb; + __m128i *ch0conj_ch0_128, *ch1conj_ch1_128, *ch2conj_ch2_128, *ch3conj_ch3_128; + __m128i *ch0conj_ch1_128, *ch1conj_ch0_128, *ch2conj_ch3_128, *ch3conj_ch2_128; + __m128i *after_mf_00_128, *after_mf_01_128, *after_mf_10_128, *after_mf_11_128; - default: - case 25: - nb_subbands = 7; - subband_size = 4*12; - last_subband_size = 12; - break; + ch0conj_ch0_128 = (__m128i *)ch0conj_ch0; + ch1conj_ch1_128 = (__m128i *)ch1conj_ch1; + ch2conj_ch2_128 = (__m128i *)ch2conj_ch2; + ch3conj_ch3_128 = (__m128i *)ch3conj_ch3; + ch0conj_ch1_128 = (__m128i *)ch0conj_ch1; + ch1conj_ch0_128 = (__m128i *)ch1conj_ch0; + ch2conj_ch3_128 = (__m128i *)ch2conj_ch3; + ch3conj_ch2_128 = (__m128i *)ch3conj_ch2; + after_mf_00_128 = (__m128i *)after_mf_00; + after_mf_01_128 = (__m128i *)after_mf_01; + after_mf_10_128 = (__m128i *)after_mf_10; + after_mf_11_128 = (__m128i *)after_mf_11; - case 50: - nb_subbands = 9; - subband_size = 6*12; - last_subband_size = 2*12; - break; + for (rb=0; rb<3*nb_rb; rb++) { - case 100: - nb_subbands = 13; - subband_size = 8*12; - last_subband_size = 4*12; - break; - } + after_mf_00_128[0] =_mm_adds_epi16(ch0conj_ch0_128[0],ch3conj_ch3_128[0]);// _mm_adds_epi32(ch0conj_ch0_128[0], ch3conj_ch3_128[0]); //00_00 + 10_10 + after_mf_11_128[0] =_mm_adds_epi16(ch1conj_ch1_128[0], ch2conj_ch2_128[0]); //01_01 + 11_11 + after_mf_01_128[0] =_mm_adds_epi16(ch0conj_ch1_128[0], ch2conj_ch3_128[0]);//00_01 + 10_11 + after_mf_10_128[0] =_mm_adds_epi16(ch1conj_ch0_128[0], ch3conj_ch2_128[0]);//01_00 + 11_10 - // signal measurements - for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) { - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) { - ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = - (signal_energy_nodc(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0], - (N_RB_DL*12))); - //- ue->measurements.n0_power[aarx]; +#ifdef DEBUG_RANK_EST + printf(" \n construct_HhH_elements \n"); + print_shorts("ch0conj_ch0_128:",(int16_t*)&ch0conj_ch0_128[0]); + print_shorts("ch1conj_ch1_128:",(int16_t*)&ch1conj_ch1_128[0]); + print_shorts("ch2conj_ch2_128:",(int16_t*)&ch2conj_ch2_128[0]); + print_shorts("ch3conj_ch3_128:",(int16_t*)&ch3conj_ch3_128[0]); + print_shorts("ch0conj_ch1_128:",(int16_t*)&ch0conj_ch1_128[0]); + print_shorts("ch1conj_ch0_128:",(int16_t*)&ch1conj_ch0_128[0]); + print_shorts("ch2conj_ch3_128:",(int16_t*)&ch2conj_ch3_128[0]); + print_shorts("ch3conj_ch2_128:",(int16_t*)&ch3conj_ch2_128[0]); + print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]); + print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]); + print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]); + print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]); +#endif - if (ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]<0) - ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = 0; //ue->measurements.n0_power[aarx]; + ch0conj_ch0_128+=1; + ch1conj_ch1_128+=1; + ch2conj_ch2_128+=1; + ch3conj_ch3_128+=1; + ch0conj_ch1_128+=1; + ch1conj_ch0_128+=1; + ch2conj_ch3_128+=1; + ch3conj_ch2_128+=1; - ue->measurements.rx_spatial_power_dB[eNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]); + after_mf_00_128+=1; + after_mf_01_128+=1; + after_mf_10_128+=1; + after_mf_11_128+=1; + } + _mm_empty(); + _m_empty(); +} - if (aatx==0) - ue->measurements.rx_power[eNB_id][aarx] = ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]; - else - ue->measurements.rx_power[eNB_id][aarx] += ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]; - } //aatx - ue->measurements.rx_power_dB[eNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[eNB_id][aarx]); +void squared_matrix_element(int32_t *Hh_h_00, + int32_t *Hh_h_00_sq, + unsigned short nb_rb) +{ + unsigned short rb; + __m128i *Hh_h_00_128,*Hh_h_00_sq_128; - if (aarx==0) - ue->measurements.rx_power_tot[eNB_id] = ue->measurements.rx_power[eNB_id][aarx]; - else - ue->measurements.rx_power_tot[eNB_id] += ue->measurements.rx_power[eNB_id][aarx]; - } //aarx + Hh_h_00_128 = (__m128i *)Hh_h_00; + Hh_h_00_sq_128 = (__m128i *)Hh_h_00_sq; - ue->measurements.rx_power_tot_dB[eNB_id] = (unsigned short) dB_fixed(ue->measurements.rx_power_tot[eNB_id]); + for (rb=0; rb<3*nb_rb; rb++) { - } //eNB_id + Hh_h_00_sq_128[0] = _mm_madd_epi16(Hh_h_00_128[0],Hh_h_00_128[0]); - eNB_id=0; - if (ue->transmission_mode[0]==4 || ue->transmission_mode[0]==3){ - if (rank_adaptation == 1) - rank_tm3_tm4 = rank_estimation_tm3_tm4(&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][0][4], - &ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][2][4], - &ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][1][4], - &ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][3][4], - N_RB_DL); - else - rank_tm3_tm4=1; #ifdef DEBUG_RANK_EST - printf("rank tm3 or tm4 %d\n", rank_tm3_tm4); + printf("\n Computing squared_matrix_element \n"); + print_shorts("Hh_h_00_128:",(int16_t*)&Hh_h_00_128[0]); + print_ints("Hh_h_00_sq_128:",(int32_t*)&Hh_h_00_sq_128[0]); #endif + + Hh_h_00_sq_128+=1; + Hh_h_00_128+=1; } + _mm_empty(); + _m_empty(); +} - if (ue->transmission_mode[eNB_id]!=4 && ue->transmission_mode[eNB_id]!=3) - ue->measurements.rank[eNB_id] = 0; - else - ue->measurements.rank[eNB_id] = rank_tm3_tm4; - // printf ("tx mode %d\n", ue->transmission_mode[eNB_id]); - // printf ("rank %d\n", ue->PHY_measurements.rank[eNB_id]); - // filter to remove jitter - if (ue->init_averaging == 0) { - for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) - ue->measurements.rx_power_avg[eNB_id] = (int) - (((k1*((long long int)(ue->measurements.rx_power_avg[eNB_id]))) + - (k2*((long long int)(ue->measurements.rx_power_tot[eNB_id]))))>>10); - //LOG_I(PHY,"Noise Power Computation: k1 %d k2 %d n0 avg %d n0 tot %d\n", k1, k2, ue->measurements.n0_power_avg, - // ue->measurements.n0_power_tot); - ue->measurements.n0_power_avg = (int) - (((k1*((long long int) (ue->measurements.n0_power_avg))) + - (k2*((long long int) (ue->measurements.n0_power_tot))))>>10); - } else { - for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) - ue->measurements.rx_power_avg[eNB_id] = ue->measurements.rx_power_tot[eNB_id]; +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, + unsigned short nb_rb) - ue->measurements.n0_power_avg = ue->measurements.n0_power_tot; - ue->init_averaging = 0; - } +{ + unsigned short rb; + __m128i *after_mf_00_128,*after_mf_01_128, *after_mf_10_128, *after_mf_11_128, ad_re_128, bc_re_128; + __m128i *det_fin_128, det_128; - for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) { - ue->measurements.rx_power_avg_dB[eNB_id] = dB_fixed( ue->measurements.rx_power_avg[eNB_id]); - ue->measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(ue->measurements.rx_power_tot[eNB_id],ue->measurements.n0_power_tot); - ue->measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg); - ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id] - ue->rx_total_gain_dB; -#ifdef DEBUG_MEAS_UE - LOG_I(PHY,"[eNB %d] Subframe %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n", - eNB_id, - subframe, - ue->measurements.rx_rssi_dBm[eNB_id], - ue->measurements.rx_power_avg_dB[eNB_id], - ue->measurements.wideband_cqi_avg[eNB_id], - ue->measurements.rx_power_avg[eNB_id], - ue->measurements.n0_power_tot); -#endif - } + after_mf_00_128 = (__m128i *)after_mf_00; + after_mf_01_128 = (__m128i *)after_mf_01; + after_mf_10_128 = (__m128i *)after_mf_10; + after_mf_11_128 = (__m128i *)after_mf_11; - ue->measurements.n0_power_avg_dB = dB_fixed( ue->measurements.n0_power_avg); + det_fin_128 = (__m128i *)det_fin; - for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) { - if (frame_parms->nb_antenna_ports_eNB!=1) { - // cqi/pmi information + for (rb=0; rb<3*nb_rb; rb++) { - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - dl_ch0 = &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; - dl_ch1 = &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4]; + ad_re_128 = _mm_madd_epi16(after_mf_00_128[0],after_mf_11_128[0]); + bc_re_128 = _mm_madd_epi16(after_mf_01_128[0],after_mf_01_128[0]); + det_128 = _mm_sub_epi32(ad_re_128, bc_re_128); + det_fin_128[0] = _mm_abs_epi32(det_128); - for (subband=0; subband<nb_subbands; subband++) { +#ifdef DEBUG_RANK_EST + printf("\n Computing denominator \n"); + print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]); + print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]); + print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]); + print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]); + print_ints("ad_re_128:",(int32_t*)&ad_re_128); + print_ints("bc_re_128:",(int32_t*)&bc_re_128); + print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]); +#endif - // cqi - if (aarx==0) - ue->measurements.subband_cqi_tot[eNB_id][subband]=0; + det_fin_128+=1; + after_mf_00_128+=1; + after_mf_01_128+=1; + after_mf_10_128+=1; + after_mf_11_128+=1; + } + _mm_empty(); + _m_empty(); +} - if ((subband<(nb_subbands-1))||(N_RB_DL==6)) { - /*for (i=0;i<48;i++) - msg("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); - */ - ue->measurements.subband_cqi[eNB_id][aarx][subband] = - (signal_energy_nodc(dl_ch0,subband_size) + signal_energy_nodc(dl_ch1,subband_size)); +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) - if ( ue->measurements.subband_cqi[eNB_id][aarx][subband] < 0) - ue->measurements.subband_cqi[eNB_id][aarx][subband]=0; +{ + unsigned short rb; + __m128i *h_h_00_sq_128, *h_h_01_sq_128, *h_h_10_sq_128, *h_h_11_sq_128; + __m128i *num_fin_128, sq_a_plus_sq_d_128, sq_b_plus_sq_c_128; - /* - else - ue->measurements.subband_cqi[eNB_id][aarx][subband]-=ue->measurements.n0_power[aarx]; - */ + h_h_00_sq_128 = (__m128i *)Hh_h_00_sq; + h_h_01_sq_128 = (__m128i *)Hh_h_01_sq; + h_h_10_sq_128 = (__m128i *)Hh_h_10_sq; + h_h_11_sq_128 = (__m128i *)Hh_h_11_sq; - ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; - ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], - ue->measurements.n0_power[aarx]); - } else { // this is for the last subband which is smaller in size - // for (i=0;i<12;i++) - // printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); - ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,last_subband_size) + - signal_energy_nodc(dl_ch1,last_subband_size)); // - ue->measurements.n0_power[aarx]; - ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; - ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], - ue->measurements.n0_power[aarx]); - } + num_fin_128 = (__m128i *)num_fin; - dl_ch1+=subband_size; - dl_ch0+=subband_size; - // msg("subband_cqi[%d][%d][%d] => %d (%d dB)\n",eNB_id,aarx,subband,ue->measurements.subband_cqi[eNB_id][aarx][subband],ue->measurements.subband_cqi_dB[eNB_id][aarx][subband]); - } + for (rb=0; rb<3*nb_rb; rb++) { - } + sq_a_plus_sq_d_128 = _mm_add_epi32(h_h_00_sq_128[0],h_h_11_sq_128[0]); + sq_b_plus_sq_c_128 = _mm_add_epi32(h_h_01_sq_128[0],h_h_10_sq_128[0]); + num_fin_128[0] = _mm_add_epi32(sq_a_plus_sq_d_128, sq_b_plus_sq_c_128); - for (subband=0; subband<nb_subbands; subband++) { - ue->measurements.subband_cqi_tot_dB[eNB_id][subband] = dB_fixed2(ue->measurements.subband_cqi_tot[eNB_id][subband],ue->measurements.n0_power_tot); - // msg("subband_cqi_tot[%d][%d] => %d dB (n0 %d)\n",eNB_id,subband,ue->measurements.subband_cqi_tot_dB[eNB_id][subband],ue->measurements.n0_power_tot); - } +#ifdef DEBUG_RANK_EST + printf("\n Computing numerator \n"); + print_ints("h_h_00_sq_128:",(int32_t*)&h_h_00_sq_128[0]); + print_ints("h_h_01_sq_128:",(int32_t*)&h_h_01_sq_128[0]); + print_ints("h_h_10_sq_128:",(int32_t*)&h_h_10_sq_128[0]); + print_ints("h_h_11_sq_128:",(int32_t*)&h_h_11_sq_128[0]); + print_shorts("sq_a_plus_sq_d_128:",(int16_t*)&sq_a_plus_sq_d_128); + print_shorts("sq_b_plus_sq_c_128:",(int16_t*)&sq_b_plus_sq_c_128); + print_shorts("num_fin_128:",(int16_t*)&num_fin_128[0]); +#endif - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - //printf("aarx=%d", aarx); - // skip the first 4 RE due to interpolation filter length of 5 (not possible to skip 5 due to 128i alignment, must be multiple of 128bit) + num_fin_128+=1; + h_h_00_sq_128+=1; + h_h_01_sq_128+=1; + h_h_10_sq_128+=1; + h_h_11_sq_128+=1; + } + _mm_empty(); + _m_empty(); +} -#if defined(__x86_64__) || defined(__i386__) - __m128i pmi128_re,pmi128_im,mmtmpPMI0,mmtmpPMI1 /* ,mmtmpPMI2,mmtmpPMI3 */ ; +void dlsch_channel_level_TM34_meas(int *ch00, + int *ch01, + int *ch10, + int *ch11, + int *avg_0, + int *avg_1, + unsigned short nb_rb) +{ - dl_ch0_128 = (__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; - dl_ch1_128 = (__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4]; -#elif defined(__arm__) - int32x4_t pmi128_re,pmi128_im,mmtmpPMI0,mmtmpPMI1,mmtmpPMI0b,mmtmpPMI1b; +#if defined(__x86_64__)||defined(__i386__) - dl_ch0_128 = (int16x8_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; - dl_ch1_128 = (int16x8_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4]; + short rb; + unsigned char nre=12; + __m128i *ch00_128, *ch01_128, *ch10_128, *ch11_128; + __m128i avg_0_row0_128D, avg_1_row0_128D, avg_0_row1_128D, avg_1_row1_128D; + __m128i ch00_128_tmp, ch01_128_tmp, ch10_128_tmp, ch11_128_tmp; -#endif - for (subband=0; subband<nb_subbands; subband++) { + avg_0[0] = 0; + avg_0[1] = 0; + avg_1[0] = 0; + avg_1[1] = 0; + ch00_128 = (__m128i *)ch00; + ch01_128 = (__m128i *)ch01; + ch10_128 = (__m128i *)ch10; + ch11_128 = (__m128i *)ch11; - // pmi -#if defined(__x86_64__) || defined(__i386__) + avg_0_row0_128D = _mm_setzero_si128(); + avg_1_row0_128D = _mm_setzero_si128(); + avg_0_row1_128D = _mm_setzero_si128(); + avg_1_row1_128D = _mm_setzero_si128(); - pmi128_re = _mm_xor_si128(pmi128_re,pmi128_re); - pmi128_im = _mm_xor_si128(pmi128_im,pmi128_im); -#elif defined(__arm__) + for (rb=0; rb<3*nb_rb; rb++) { + ch00_128_tmp = _mm_load_si128(&ch00_128[0]); + ch01_128_tmp = _mm_load_si128(&ch01_128[0]); + ch10_128_tmp = _mm_load_si128(&ch10_128[0]); + ch11_128_tmp = _mm_load_si128(&ch11_128[0]); - pmi128_re = vdupq_n_s32(0); - pmi128_im = vdupq_n_s32(0); -#endif - // limit is the number of groups of 4 REs in a subband (12 = 4 RBs, 3 = 1 RB) - // for 5 MHz channelization, there are 7 subbands, 6 of size 4 RBs and 1 of size 1 RB - if ((N_RB_DL==6) || (subband<(nb_subbands-1))) - limit = subband_size>>2; - else - limit = last_subband_size>>2; + avg_0_row0_128D = _mm_add_epi32(avg_0_row0_128D,_mm_madd_epi16(ch00_128_tmp,ch00_128_tmp)); + avg_1_row0_128D = _mm_add_epi32(avg_1_row0_128D,_mm_madd_epi16(ch01_128_tmp,ch01_128_tmp)); + avg_0_row1_128D = _mm_add_epi32(avg_0_row1_128D,_mm_madd_epi16(ch10_128_tmp,ch10_128_tmp)); + avg_1_row1_128D = _mm_add_epi32(avg_1_row1_128D,_mm_madd_epi16(ch11_128_tmp,ch11_128_tmp)); - for (i=0; i<limit; i++) { + ch00_128+=1; + ch01_128+=1; + ch10_128+=1; + ch11_128+=1; + } -#if defined(__x86_64__) || defined(__i386__) - mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0); - mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1); + avg_0[0] = (((int*)&avg_0_row0_128D)[0])/(nb_rb*nre) + + (((int*)&avg_0_row0_128D)[1])/(nb_rb*nre) + + (((int*)&avg_0_row0_128D)[2])/(nb_rb*nre) + + (((int*)&avg_0_row0_128D)[3])/(nb_rb*nre); - // For each RE in subband perform ch0 * conj(ch1) - // multiply by conjugated channel - // print_ints("ch0",&dl_ch0_128[0]); - // print_ints("ch1",&dl_ch1_128[0]); + avg_1[0] = (((int*)&avg_1_row0_128D)[0])/(nb_rb*nre) + + (((int*)&avg_1_row0_128D)[1])/(nb_rb*nre) + + (((int*)&avg_1_row0_128D)[2])/(nb_rb*nre) + + (((int*)&avg_1_row0_128D)[3])/(nb_rb*nre); - mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]); - // print_ints("re",&mmtmpPMI0); - mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[0],_MM_SHUFFLE(2,3,0,1)); - // print_ints("_mm_shufflelo_epi16",&mmtmpPMI1); - mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1)); - // print_ints("_mm_shufflehi_epi16",&mmtmpPMI1); - mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate[0]); - // print_ints("_mm_sign_epi16",&mmtmpPMI1); - mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[0]); - // print_ints("mm_madd_epi16",&mmtmpPMI1); - // mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit) - pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0); - // print_ints(" pmi128_re 0",&pmi128_re); - pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1); - // print_ints(" pmi128_im 0 ",&pmi128_im); + avg_0[1] = (((int*)&avg_0_row1_128D)[0])/(nb_rb*nre) + + (((int*)&avg_0_row1_128D)[1])/(nb_rb*nre) + + (((int*)&avg_0_row1_128D)[2])/(nb_rb*nre) + + (((int*)&avg_0_row1_128D)[3])/(nb_rb*nre); - /* mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0); - mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1); + avg_1[1] = (((int*)&avg_1_row1_128D)[0])/(nb_rb*nre) + + (((int*)&avg_1_row1_128D)[1])/(nb_rb*nre) + + (((int*)&avg_1_row1_128D)[2])/(nb_rb*nre) + + (((int*)&avg_1_row1_128D)[3])/(nb_rb*nre); - mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[1],dl_ch1_128[1]); - // print_ints("re",&mmtmpPMI0); - mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[1],_MM_SHUFFLE(2,3,0,1)); - // print_ints("_mm_shufflelo_epi16",&mmtmpPMI1); - mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1)); - // print_ints("_mm_shufflehi_epi16",&mmtmpPMI1); - mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate); - // print_ints("_mm_sign_epi16",&mmtmpPMI1); - mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[1]); - // print_ints("mm_madd_epi16",&mmtmpPMI1); - // mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit) - pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0); - // print_ints(" pmi128_re 1",&pmi128_re); - pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1); - //print_ints(" pmi128_im 1 ",&pmi128_im);*/ + avg_0[0] = avg_0[0] + avg_0[1]; + avg_1[0] = avg_1[0] + avg_1[1]; + avg_0[0] = min (avg_0[0], avg_1[0]); + avg_1[0] = avg_0[0]; + + _mm_empty(); + _m_empty(); #elif defined(__arm__) - mmtmpPMI0 = vmull_s16(((int16x4_t*)dl_ch0_128)[0], ((int16x4_t*)dl_ch1_128)[0]); - mmtmpPMI1 = vmull_s16(((int16x4_t*)dl_ch0_128)[1], ((int16x4_t*)dl_ch1_128)[1]); - pmi128_re = vqaddq_s32(pmi128_re,vcombine_s32(vpadd_s32(vget_low_s32(mmtmpPMI0),vget_high_s32(mmtmpPMI0)),vpadd_s32(vget_low_s32(mmtmpPMI1),vget_high_s32(mmtmpPMI1)))); +#endif +} - mmtmpPMI0b = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)dl_ch0_128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)dl_ch1_128)[0]); - mmtmpPMI1b = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)dl_ch0_128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)dl_ch1_128)[1]); - pmi128_im = vqaddq_s32(pmi128_im,vcombine_s32(vpadd_s32(vget_low_s32(mmtmpPMI0b),vget_high_s32(mmtmpPMI0b)),vpadd_s32(vget_low_s32(mmtmpPMI1b),vget_high_s32(mmtmpPMI1b)))); +uint8_t rank_estimation_tm3_tm4 (int *dl_ch_estimates_00, // please respect the order of channel estimates + int *dl_ch_estimates_01, + int *dl_ch_estimates_10, + int *dl_ch_estimates_11, + unsigned short nb_rb) +{ -#endif - dl_ch0_128++; - dl_ch1_128++; - } - - ue->measurements.subband_pmi_re[eNB_id][subband][aarx] = (((int *)&pmi128_re)[0] + ((int *)&pmi128_re)[1] + ((int *)&pmi128_re)[2] + ((int *)&pmi128_re)[3])>>2; - ue->measurements.subband_pmi_im[eNB_id][subband][aarx] = (((int *)&pmi128_im)[0] + ((int *)&pmi128_im)[1] + ((int *)&pmi128_im)[2] + ((int *)&pmi128_im)[3])>>2; - ue->measurements.wideband_pmi_re[eNB_id][aarx] += ue->measurements.subband_pmi_re[eNB_id][subband][aarx]; - ue->measurements.wideband_pmi_im[eNB_id][aarx] += ue->measurements.subband_pmi_im[eNB_id][subband][aarx]; - } // subband loop - } // rx antenna loop - } // if frame_parms->mode1_flag == 0 - else { - // cqi information only for mode 1 - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - dl_ch0 = &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; - - for (subband=0; subband<7; subband++) { - - // cqi - if (aarx==0) - ue->measurements.subband_cqi_tot[eNB_id][subband]=0; - - if (subband<6) { - // for (i=0;i<48;i++) - // printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); - ue->measurements.subband_cqi[eNB_id][aarx][subband] = - (signal_energy_nodc(dl_ch0,48) ) - ue->measurements.n0_power[aarx]; - - ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; - ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], - ue->measurements.n0_power[aarx]); - } else { - // for (i=0;i<12;i++) - // printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); - ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,12) ) - ue->measurements.n0_power[aarx]; - ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; - ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], - ue->measurements.n0_power[aarx]); - } - - dl_ch1+=48; - // msg("subband_cqi[%d][%d][%d] => %d (%d dB)\n",eNB_id,aarx,subband,ue->measurements.subband_cqi[eNB_id][aarx][subband],ue->measurements.subband_cqi_dB[eNB_id][aarx][subband]); - } - } - - for (subband=0; subband<nb_subbands; subband++) { - ue->measurements.subband_cqi_tot_dB[eNB_id][subband] = dB_fixed2(ue->measurements.subband_cqi_tot[eNB_id][subband],ue->measurements.n0_power_tot); - } - } - - //ue->measurements.rank[eNB_id] = 0; - - for (i=0; i<nb_subbands; i++) { - ue->measurements.selected_rx_antennas[eNB_id][i] = 0; - - if (frame_parms->nb_antennas_rx>1) { - if (ue->measurements.subband_cqi_dB[eNB_id][0][i] >= ue->measurements.subband_cqi_dB[eNB_id][1][i]) - ue->measurements.selected_rx_antennas[eNB_id][i] = 0; - else - ue->measurements.selected_rx_antennas[eNB_id][i] = 1; - } else - ue->measurements.selected_rx_antennas[eNB_id][i] = 0; - } - - // if(eNB_id==0) - // printf("in lte_ue_measurements: selected rx_antenna[eNB_id==0]:%u\n", ue->measurements.selected_rx_antennas[eNB_id][i]); - } // eNB_id loop - -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif -} - - -void lte_ue_measurements_emul(PHY_VARS_UE *ue,uint8_t subframe,uint8_t eNB_id) -{ - - LOG_D(PHY,"EMUL UE lte_ue_measurements_emul subframe %d, eNB_id %d\n",subframe,eNB_id); -} - - -uint8_t rank_estimation_tm3_tm4 (int *dl_ch_estimates_00, // please respect the order of channel estimates - int *dl_ch_estimates_01, - int *dl_ch_estimates_10, - int *dl_ch_estimates_11, - unsigned short nb_rb) -{ - - int i=0; - int rank=0; - int N_RB=nb_rb; - int *ch00_rank, *ch01_rank, *ch10_rank, *ch11_rank; + int i=0; + int rank=0; + int N_RB=nb_rb; + int *ch00_rank, *ch01_rank, *ch10_rank, *ch11_rank; int32_t shift; int avg_0[2]; @@ -1058,328 +998,390 @@ uint8_t rank_estimation_tm3_tm4 (int *dl_ch_estimates_00, // please respect the return(rank); } -void conjch0_mult_ch1(int *ch0, - int *ch1, - int32_t *ch0conj_ch1, - unsigned short nb_rb, - unsigned char output_shift0) -{ - //This function is used to compute multiplications in Hhermitian * H matrix - unsigned short rb; - __m128i *dl_ch0_128,*dl_ch1_128, *ch0conj_ch1_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; - dl_ch0_128 = (__m128i *)ch0; - dl_ch1_128 = (__m128i *)ch1; - ch0conj_ch1_128 = (__m128i *)ch0conj_ch1; - for (rb=0; rb<3*nb_rb; rb++) { - mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]); - mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[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]); - mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch1_128[0]); - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); - mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - ch0conj_ch1_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); -#ifdef DEBUG_RANK_EST - printf("\n Computing conjugates \n"); - print_shorts("ch0:",(int16_t*)&dl_ch0_128[0]); - print_shorts("ch1:",(int16_t*)&dl_ch1_128[0]); - print_shorts("pack:",(int16_t*)&ch0conj_ch1_128[0]); +void lte_ue_measurements(PHY_VARS_UE *ue, + unsigned int subframe_offset, + unsigned char N0_symbol, + unsigned char abstraction_flag, + unsigned char rank_adaptation, + uint8_t subframe) +{ + + + int aarx,aatx,eNB_id=0; //,gain_offset=0; + //int rx_power[NUMBER_OF_CONNECTED_eNB_MAX]; + int i; + unsigned int limit,subband; +#if defined(__x86_64__) || defined(__i386__) + __m128i *dl_ch0_128,*dl_ch1_128; +#elif defined(__arm__) + int16x8_t *dl_ch0_128, *dl_ch1_128; #endif + int *dl_ch0,*dl_ch1; - dl_ch0_128+=1; - dl_ch1_128+=1; - ch0conj_ch1_128+=1; - } - _mm_empty(); - _m_empty(); -} + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + int nb_subbands,subband_size,last_subband_size; + int N_RB_DL = frame_parms->N_RB_DL; -void construct_HhH_elements(int *ch0conj_ch0, //00_00 - int *ch1conj_ch1,//01_01 - int *ch2conj_ch2,//11_11 - int *ch3conj_ch3,//10_10 - int *ch0conj_ch1,//00_01 - int *ch1conj_ch0,//01_00 - int *ch2conj_ch3,//10_11 - int *ch3conj_ch2,//11_10 - int32_t *after_mf_00, - int32_t *after_mf_01, - int32_t *after_mf_10, - int32_t *after_mf_11, - unsigned short nb_rb) -{ - unsigned short rb; - __m128i *ch0conj_ch0_128, *ch1conj_ch1_128, *ch2conj_ch2_128, *ch3conj_ch3_128; - __m128i *ch0conj_ch1_128, *ch1conj_ch0_128, *ch2conj_ch3_128, *ch3conj_ch2_128; - __m128i *after_mf_00_128, *after_mf_01_128, *after_mf_10_128, *after_mf_11_128; - ch0conj_ch0_128 = (__m128i *)ch0conj_ch0; - ch1conj_ch1_128 = (__m128i *)ch1conj_ch1; - ch2conj_ch2_128 = (__m128i *)ch2conj_ch2; - ch3conj_ch3_128 = (__m128i *)ch3conj_ch3; - ch0conj_ch1_128 = (__m128i *)ch0conj_ch1; - ch1conj_ch0_128 = (__m128i *)ch1conj_ch0; - ch2conj_ch3_128 = (__m128i *)ch2conj_ch3; - ch3conj_ch2_128 = (__m128i *)ch3conj_ch2; - after_mf_00_128 = (__m128i *)after_mf_00; - after_mf_01_128 = (__m128i *)after_mf_01; - after_mf_10_128 = (__m128i *)after_mf_10; - after_mf_11_128 = (__m128i *)after_mf_11; + int rank_tm3_tm4; - for (rb=0; rb<3*nb_rb; rb++) { - after_mf_00_128[0] =_mm_adds_epi16(ch0conj_ch0_128[0],ch3conj_ch3_128[0]);// _mm_adds_epi32(ch0conj_ch0_128[0], ch3conj_ch3_128[0]); //00_00 + 10_10 - after_mf_11_128[0] =_mm_adds_epi16(ch1conj_ch1_128[0], ch2conj_ch2_128[0]); //01_01 + 11_11 - after_mf_01_128[0] =_mm_adds_epi16(ch0conj_ch1_128[0], ch2conj_ch3_128[0]);//00_01 + 10_11 - after_mf_10_128[0] =_mm_adds_epi16(ch1conj_ch0_128[0], ch3conj_ch2_128[0]);//01_00 + 11_10 + ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx; -#ifdef DEBUG_RANK_EST - printf(" \n construct_HhH_elements \n"); - print_shorts("ch0conj_ch0_128:",(int16_t*)&ch0conj_ch0_128[0]); - print_shorts("ch1conj_ch1_128:",(int16_t*)&ch1conj_ch1_128[0]); - print_shorts("ch2conj_ch2_128:",(int16_t*)&ch2conj_ch2_128[0]); - print_shorts("ch3conj_ch3_128:",(int16_t*)&ch3conj_ch3_128[0]); - print_shorts("ch0conj_ch1_128:",(int16_t*)&ch0conj_ch1_128[0]); - print_shorts("ch1conj_ch0_128:",(int16_t*)&ch1conj_ch0_128[0]); - print_shorts("ch2conj_ch3_128:",(int16_t*)&ch2conj_ch3_128[0]); - print_shorts("ch3conj_ch2_128:",(int16_t*)&ch3conj_ch2_128[0]); - print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]); - print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]); - print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]); - print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]); -#endif - ch0conj_ch0_128+=1; - ch1conj_ch1_128+=1; - ch2conj_ch2_128+=1; - ch3conj_ch3_128+=1; - ch0conj_ch1_128+=1; - ch1conj_ch0_128+=1; - ch2conj_ch3_128+=1; - ch3conj_ch2_128+=1; + switch (N_RB_DL) { + case 6: + nb_subbands = 6; + subband_size = 12; + last_subband_size = 0; + break; - after_mf_00_128+=1; - after_mf_01_128+=1; - after_mf_10_128+=1; - after_mf_11_128+=1; + default: + case 25: + nb_subbands = 7; + subband_size = 4*12; + last_subband_size = 12; + break; + + case 50: + nb_subbands = 9; + subband_size = 6*12; + last_subband_size = 2*12; + break; + + case 100: + nb_subbands = 13; + subband_size = 8*12; + last_subband_size = 4*12; + break; } - _mm_empty(); - _m_empty(); -} + // signal measurements + for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) { + for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++) { + ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = + (signal_energy_nodc(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0], + (N_RB_DL*12))); + //- ue->measurements.n0_power[aarx]; -void squared_matrix_element(int32_t *Hh_h_00, - int32_t *Hh_h_00_sq, - unsigned short nb_rb) -{ - unsigned short rb; - __m128i *Hh_h_00_128,*Hh_h_00_sq_128; + if (ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]<0) + ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] = 0; //ue->measurements.n0_power[aarx]; - Hh_h_00_128 = (__m128i *)Hh_h_00; - Hh_h_00_sq_128 = (__m128i *)Hh_h_00_sq; + ue->measurements.rx_spatial_power_dB[eNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]); - for (rb=0; rb<3*nb_rb; rb++) { + if (aatx==0) + ue->measurements.rx_power[eNB_id][aarx] = ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]; + else + ue->measurements.rx_power[eNB_id][aarx] += ue->measurements.rx_spatial_power[eNB_id][aatx][aarx]; + } //aatx - Hh_h_00_sq_128[0] = _mm_madd_epi16(Hh_h_00_128[0],Hh_h_00_128[0]); + ue->measurements.rx_power_dB[eNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[eNB_id][aarx]); + + if (aarx==0) + ue->measurements.rx_power_tot[eNB_id] = ue->measurements.rx_power[eNB_id][aarx]; + else + ue->measurements.rx_power_tot[eNB_id] += ue->measurements.rx_power[eNB_id][aarx]; + } //aarx + + ue->measurements.rx_power_tot_dB[eNB_id] = (unsigned short) dB_fixed(ue->measurements.rx_power_tot[eNB_id]); + } //eNB_id + + eNB_id=0; + if (ue->transmission_mode[0]==4 || ue->transmission_mode[0]==3){ + if (rank_adaptation == 1) + rank_tm3_tm4 = rank_estimation_tm3_tm4(&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][0][4], + &ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][2][4], + &ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][1][4], + &ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][3][4], + N_RB_DL); + else + rank_tm3_tm4=1; #ifdef DEBUG_RANK_EST - printf("\n Computing squared_matrix_element \n"); - print_shorts("Hh_h_00_128:",(int16_t*)&Hh_h_00_128[0]); - print_ints("Hh_h_00_sq_128:",(int32_t*)&Hh_h_00_sq_128[0]); + printf("rank tm3 or tm4 %d\n", rank_tm3_tm4); #endif + } - Hh_h_00_sq_128+=1; - Hh_h_00_128+=1; + if (ue->transmission_mode[eNB_id]!=4 && ue->transmission_mode[eNB_id]!=3) + ue->measurements.rank[eNB_id] = 0; + else + ue->measurements.rank[eNB_id] = rank_tm3_tm4; + // printf ("tx mode %d\n", ue->transmission_mode[eNB_id]); + // printf ("rank %d\n", ue->PHY_measurements.rank[eNB_id]); + + // filter to remove jitter + if (ue->init_averaging == 0) { + for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) + ue->measurements.rx_power_avg[eNB_id] = (int) + (((k1*((long long int)(ue->measurements.rx_power_avg[eNB_id]))) + + (k2*((long long int)(ue->measurements.rx_power_tot[eNB_id]))))>>10); + + //LOG_I(PHY,"Noise Power Computation: k1 %d k2 %d n0 avg %d n0 tot %d\n", k1, k2, ue->measurements.n0_power_avg, + // ue->measurements.n0_power_tot); + ue->measurements.n0_power_avg = (int) + (((k1*((long long int) (ue->measurements.n0_power_avg))) + + (k2*((long long int) (ue->measurements.n0_power_tot))))>>10); + } else { + for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) + ue->measurements.rx_power_avg[eNB_id] = ue->measurements.rx_power_tot[eNB_id]; + + ue->measurements.n0_power_avg = ue->measurements.n0_power_tot; + ue->init_averaging = 0; } - _mm_empty(); - _m_empty(); -} + for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) { + ue->measurements.rx_power_avg_dB[eNB_id] = dB_fixed( ue->measurements.rx_power_avg[eNB_id]); + ue->measurements.wideband_cqi_tot[eNB_id] = dB_fixed2(ue->measurements.rx_power_tot[eNB_id],ue->measurements.n0_power_tot); + ue->measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg); + ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id] - ue->rx_total_gain_dB; +#ifdef DEBUG_MEAS_UE + LOG_I(PHY,"[eNB %d] Subframe %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n", + eNB_id, + subframe, + ue->measurements.rx_rssi_dBm[eNB_id], + ue->measurements.rx_power_avg_dB[eNB_id], + ue->measurements.wideband_cqi_avg[eNB_id], + ue->measurements.rx_power_avg[eNB_id], + ue->measurements.n0_power_tot); +#endif + } + ue->measurements.n0_power_avg_dB = dB_fixed( ue->measurements.n0_power_avg); -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, - unsigned short nb_rb) + for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) { + if (frame_parms->nb_antenna_ports_eNB!=1) { + // cqi/pmi information -{ - unsigned short rb; - __m128i *after_mf_00_128,*after_mf_01_128, *after_mf_10_128, *after_mf_11_128, ad_re_128, bc_re_128; - __m128i *det_fin_128, det_128; + for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + dl_ch0 = &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; + dl_ch1 = &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4]; - after_mf_00_128 = (__m128i *)after_mf_00; - after_mf_01_128 = (__m128i *)after_mf_01; - after_mf_10_128 = (__m128i *)after_mf_10; - after_mf_11_128 = (__m128i *)after_mf_11; + for (subband=0; subband<nb_subbands; subband++) { - det_fin_128 = (__m128i *)det_fin; + // cqi + if (aarx==0) + ue->measurements.subband_cqi_tot[eNB_id][subband]=0; - for (rb=0; rb<3*nb_rb; rb++) { + if ((subband<(nb_subbands-1))||(N_RB_DL==6)) { + /*for (i=0;i<48;i++) + msg("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); + */ + ue->measurements.subband_cqi[eNB_id][aarx][subband] = + (signal_energy_nodc(dl_ch0,subband_size) + signal_energy_nodc(dl_ch1,subband_size)); - ad_re_128 = _mm_madd_epi16(after_mf_00_128[0],after_mf_11_128[0]); - bc_re_128 = _mm_madd_epi16(after_mf_01_128[0],after_mf_01_128[0]); - det_128 = _mm_sub_epi32(ad_re_128, bc_re_128); - det_fin_128[0] = _mm_abs_epi32(det_128); + if ( ue->measurements.subband_cqi[eNB_id][aarx][subband] < 0) + ue->measurements.subband_cqi[eNB_id][aarx][subband]=0; -#ifdef DEBUG_RANK_EST - printf("\n Computing denominator \n"); - print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]); - print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]); - print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]); - print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]); - print_ints("ad_re_128:",(int32_t*)&ad_re_128); - print_ints("bc_re_128:",(int32_t*)&bc_re_128); - print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]); -#endif + /* + else + ue->measurements.subband_cqi[eNB_id][aarx][subband]-=ue->measurements.n0_power[aarx]; + */ + + ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; + ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], + ue->measurements.n0_power[aarx]); + } else { // this is for the last subband which is smaller in size + // for (i=0;i<12;i++) + // printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); + ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,last_subband_size) + + signal_energy_nodc(dl_ch1,last_subband_size)); // - ue->measurements.n0_power[aarx]; + ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; + ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], + ue->measurements.n0_power[aarx]); + } + + dl_ch1+=subband_size; + dl_ch0+=subband_size; + // msg("subband_cqi[%d][%d][%d] => %d (%d dB)\n",eNB_id,aarx,subband,ue->measurements.subband_cqi[eNB_id][aarx][subband],ue->measurements.subband_cqi_dB[eNB_id][aarx][subband]); + } + + } - det_fin_128+=1; - after_mf_00_128+=1; - after_mf_01_128+=1; - after_mf_10_128+=1; - after_mf_11_128+=1; - } - _mm_empty(); - _m_empty(); -} + for (subband=0; subband<nb_subbands; subband++) { + ue->measurements.subband_cqi_tot_dB[eNB_id][subband] = dB_fixed2(ue->measurements.subband_cqi_tot[eNB_id][subband],ue->measurements.n0_power_tot); + // msg("subband_cqi_tot[%d][%d] => %d dB (n0 %d)\n",eNB_id,subband,ue->measurements.subband_cqi_tot_dB[eNB_id][subband],ue->measurements.n0_power_tot); + } -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) + for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + //printf("aarx=%d", aarx); + // skip the first 4 RE due to interpolation filter length of 5 (not possible to skip 5 due to 128i alignment, must be multiple of 128bit) -{ - unsigned short rb; - __m128i *h_h_00_sq_128, *h_h_01_sq_128, *h_h_10_sq_128, *h_h_11_sq_128; - __m128i *num_fin_128, sq_a_plus_sq_d_128, sq_b_plus_sq_c_128; +#if defined(__x86_64__) || defined(__i386__) + __m128i pmi128_re,pmi128_im,mmtmpPMI0,mmtmpPMI1 /* ,mmtmpPMI2,mmtmpPMI3 */ ; - h_h_00_sq_128 = (__m128i *)Hh_h_00_sq; - h_h_01_sq_128 = (__m128i *)Hh_h_01_sq; - h_h_10_sq_128 = (__m128i *)Hh_h_10_sq; - h_h_11_sq_128 = (__m128i *)Hh_h_11_sq; + dl_ch0_128 = (__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; + dl_ch1_128 = (__m128i *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4]; +#elif defined(__arm__) + int32x4_t pmi128_re,pmi128_im,mmtmpPMI0,mmtmpPMI1,mmtmpPMI0b,mmtmpPMI1b; - num_fin_128 = (__m128i *)num_fin; + dl_ch0_128 = (int16x8_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; + dl_ch1_128 = (int16x8_t *)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2+aarx][4]; - for (rb=0; rb<3*nb_rb; rb++) { +#endif + for (subband=0; subband<nb_subbands; subband++) { - sq_a_plus_sq_d_128 = _mm_add_epi32(h_h_00_sq_128[0],h_h_11_sq_128[0]); - sq_b_plus_sq_c_128 = _mm_add_epi32(h_h_01_sq_128[0],h_h_10_sq_128[0]); - num_fin_128[0] = _mm_add_epi32(sq_a_plus_sq_d_128, sq_b_plus_sq_c_128); -#ifdef DEBUG_RANK_EST - printf("\n Computing numerator \n"); - print_ints("h_h_00_sq_128:",(int32_t*)&h_h_00_sq_128[0]); - print_ints("h_h_01_sq_128:",(int32_t*)&h_h_01_sq_128[0]); - print_ints("h_h_10_sq_128:",(int32_t*)&h_h_10_sq_128[0]); - print_ints("h_h_11_sq_128:",(int32_t*)&h_h_11_sq_128[0]); - print_shorts("sq_a_plus_sq_d_128:",(int16_t*)&sq_a_plus_sq_d_128); - print_shorts("sq_b_plus_sq_c_128:",(int16_t*)&sq_b_plus_sq_c_128); - print_shorts("num_fin_128:",(int16_t*)&num_fin_128[0]); + // pmi +#if defined(__x86_64__) || defined(__i386__) + + pmi128_re = _mm_xor_si128(pmi128_re,pmi128_re); + pmi128_im = _mm_xor_si128(pmi128_im,pmi128_im); +#elif defined(__arm__) + + pmi128_re = vdupq_n_s32(0); + pmi128_im = vdupq_n_s32(0); #endif + // limit is the number of groups of 4 REs in a subband (12 = 4 RBs, 3 = 1 RB) + // for 5 MHz channelization, there are 7 subbands, 6 of size 4 RBs and 1 of size 1 RB + if ((N_RB_DL==6) || (subband<(nb_subbands-1))) + limit = subband_size>>2; + else + limit = last_subband_size>>2; - num_fin_128+=1; - h_h_00_sq_128+=1; - h_h_01_sq_128+=1; - h_h_10_sq_128+=1; - h_h_11_sq_128+=1; - } - _mm_empty(); - _m_empty(); -} + for (i=0; i<limit; i++) { +#if defined(__x86_64__) || defined(__i386__) + mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0); + mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1); + // For each RE in subband perform ch0 * conj(ch1) + // multiply by conjugated channel + // print_ints("ch0",&dl_ch0_128[0]); + // print_ints("ch1",&dl_ch1_128[0]); + mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]); + // print_ints("re",&mmtmpPMI0); + mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[0],_MM_SHUFFLE(2,3,0,1)); + // print_ints("_mm_shufflelo_epi16",&mmtmpPMI1); + mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1)); + // print_ints("_mm_shufflehi_epi16",&mmtmpPMI1); + mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate[0]); + // print_ints("_mm_sign_epi16",&mmtmpPMI1); + mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[0]); + // print_ints("mm_madd_epi16",&mmtmpPMI1); + // mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit) + pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0); + // print_ints(" pmi128_re 0",&pmi128_re); + pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1); + // print_ints(" pmi128_im 0 ",&pmi128_im); + /* mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0); + mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1); -void dlsch_channel_level_TM34_meas(int *ch00, - int *ch01, - int *ch10, - int *ch11, - int *avg_0, - int *avg_1, - unsigned short nb_rb) -{ + mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[1],dl_ch1_128[1]); + // print_ints("re",&mmtmpPMI0); + mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[1],_MM_SHUFFLE(2,3,0,1)); + // print_ints("_mm_shufflelo_epi16",&mmtmpPMI1); + mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1)); + // print_ints("_mm_shufflehi_epi16",&mmtmpPMI1); + mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate); + // print_ints("_mm_sign_epi16",&mmtmpPMI1); + mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[1]); + // print_ints("mm_madd_epi16",&mmtmpPMI1); + // mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit) + pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0); + // print_ints(" pmi128_re 1",&pmi128_re); + pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1); + //print_ints(" pmi128_im 1 ",&pmi128_im);*/ -#if defined(__x86_64__)||defined(__i386__) +#elif defined(__arm__) - short rb; - unsigned char nre=12; - __m128i *ch00_128, *ch01_128, *ch10_128, *ch11_128; - __m128i avg_0_row0_128D, avg_1_row0_128D, avg_0_row1_128D, avg_1_row1_128D; - __m128i ch00_128_tmp, ch01_128_tmp, ch10_128_tmp, ch11_128_tmp; + mmtmpPMI0 = vmull_s16(((int16x4_t*)dl_ch0_128)[0], ((int16x4_t*)dl_ch1_128)[0]); + mmtmpPMI1 = vmull_s16(((int16x4_t*)dl_ch0_128)[1], ((int16x4_t*)dl_ch1_128)[1]); + pmi128_re = vqaddq_s32(pmi128_re,vcombine_s32(vpadd_s32(vget_low_s32(mmtmpPMI0),vget_high_s32(mmtmpPMI0)),vpadd_s32(vget_low_s32(mmtmpPMI1),vget_high_s32(mmtmpPMI1)))); - avg_0[0] = 0; - avg_0[1] = 0; - avg_1[0] = 0; - avg_1[1] = 0; + mmtmpPMI0b = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)dl_ch0_128)[0],*(int16x4_t*)conjugate)), ((int16x4_t*)dl_ch1_128)[0]); + mmtmpPMI1b = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)dl_ch0_128)[1],*(int16x4_t*)conjugate)), ((int16x4_t*)dl_ch1_128)[1]); + pmi128_im = vqaddq_s32(pmi128_im,vcombine_s32(vpadd_s32(vget_low_s32(mmtmpPMI0b),vget_high_s32(mmtmpPMI0b)),vpadd_s32(vget_low_s32(mmtmpPMI1b),vget_high_s32(mmtmpPMI1b)))); - ch00_128 = (__m128i *)ch00; - ch01_128 = (__m128i *)ch01; - ch10_128 = (__m128i *)ch10; - ch11_128 = (__m128i *)ch11; +#endif + dl_ch0_128++; + dl_ch1_128++; + } - avg_0_row0_128D = _mm_setzero_si128(); - avg_1_row0_128D = _mm_setzero_si128(); - avg_0_row1_128D = _mm_setzero_si128(); - avg_1_row1_128D = _mm_setzero_si128(); + ue->measurements.subband_pmi_re[eNB_id][subband][aarx] = (((int *)&pmi128_re)[0] + ((int *)&pmi128_re)[1] + ((int *)&pmi128_re)[2] + ((int *)&pmi128_re)[3])>>2; + ue->measurements.subband_pmi_im[eNB_id][subband][aarx] = (((int *)&pmi128_im)[0] + ((int *)&pmi128_im)[1] + ((int *)&pmi128_im)[2] + ((int *)&pmi128_im)[3])>>2; + ue->measurements.wideband_pmi_re[eNB_id][aarx] += ue->measurements.subband_pmi_re[eNB_id][subband][aarx]; + ue->measurements.wideband_pmi_im[eNB_id][aarx] += ue->measurements.subband_pmi_im[eNB_id][subband][aarx]; + } // subband loop + } // rx antenna loop + } // if frame_parms->mode1_flag == 0 + else { + // cqi information only for mode 1 + for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + dl_ch0 = &ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][aarx][4]; - for (rb=0; rb<3*nb_rb; rb++) { - ch00_128_tmp = _mm_load_si128(&ch00_128[0]); - ch01_128_tmp = _mm_load_si128(&ch01_128[0]); - ch10_128_tmp = _mm_load_si128(&ch10_128[0]); - ch11_128_tmp = _mm_load_si128(&ch11_128[0]); + for (subband=0; subband<7; subband++) { - avg_0_row0_128D = _mm_add_epi32(avg_0_row0_128D,_mm_madd_epi16(ch00_128_tmp,ch00_128_tmp)); - avg_1_row0_128D = _mm_add_epi32(avg_1_row0_128D,_mm_madd_epi16(ch01_128_tmp,ch01_128_tmp)); - avg_0_row1_128D = _mm_add_epi32(avg_0_row1_128D,_mm_madd_epi16(ch10_128_tmp,ch10_128_tmp)); - avg_1_row1_128D = _mm_add_epi32(avg_1_row1_128D,_mm_madd_epi16(ch11_128_tmp,ch11_128_tmp)); + // cqi + if (aarx==0) + ue->measurements.subband_cqi_tot[eNB_id][subband]=0; - ch00_128+=1; - ch01_128+=1; - ch10_128+=1; - ch11_128+=1; - } + if (subband<6) { + // for (i=0;i<48;i++) + // printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); + ue->measurements.subband_cqi[eNB_id][aarx][subband] = + (signal_energy_nodc(dl_ch0,48) ) - ue->measurements.n0_power[aarx]; - avg_0[0] = (((int*)&avg_0_row0_128D)[0])/(nb_rb*nre) + - (((int*)&avg_0_row0_128D)[1])/(nb_rb*nre) + - (((int*)&avg_0_row0_128D)[2])/(nb_rb*nre) + - (((int*)&avg_0_row0_128D)[3])/(nb_rb*nre); + ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; + ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], + ue->measurements.n0_power[aarx]); + } else { + // for (i=0;i<12;i++) + // printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]); + ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,12) ) - ue->measurements.n0_power[aarx]; + ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband]; + ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband], + ue->measurements.n0_power[aarx]); + } - avg_1[0] = (((int*)&avg_1_row0_128D)[0])/(nb_rb*nre) + - (((int*)&avg_1_row0_128D)[1])/(nb_rb*nre) + - (((int*)&avg_1_row0_128D)[2])/(nb_rb*nre) + - (((int*)&avg_1_row0_128D)[3])/(nb_rb*nre); + dl_ch1+=48; + // msg("subband_cqi[%d][%d][%d] => %d (%d dB)\n",eNB_id,aarx,subband,ue->measurements.subband_cqi[eNB_id][aarx][subband],ue->measurements.subband_cqi_dB[eNB_id][aarx][subband]); + } + } - avg_0[1] = (((int*)&avg_0_row1_128D)[0])/(nb_rb*nre) + - (((int*)&avg_0_row1_128D)[1])/(nb_rb*nre) + - (((int*)&avg_0_row1_128D)[2])/(nb_rb*nre) + - (((int*)&avg_0_row1_128D)[3])/(nb_rb*nre); + for (subband=0; subband<nb_subbands; subband++) { + ue->measurements.subband_cqi_tot_dB[eNB_id][subband] = dB_fixed2(ue->measurements.subband_cqi_tot[eNB_id][subband],ue->measurements.n0_power_tot); + } + } - avg_1[1] = (((int*)&avg_1_row1_128D)[0])/(nb_rb*nre) + - (((int*)&avg_1_row1_128D)[1])/(nb_rb*nre) + - (((int*)&avg_1_row1_128D)[2])/(nb_rb*nre) + - (((int*)&avg_1_row1_128D)[3])/(nb_rb*nre); + //ue->measurements.rank[eNB_id] = 0; - avg_0[0] = avg_0[0] + avg_0[1]; - avg_1[0] = avg_1[0] + avg_1[1]; - avg_0[0] = min (avg_0[0], avg_1[0]); - avg_1[0] = avg_0[0]; + for (i=0; i<nb_subbands; i++) { + ue->measurements.selected_rx_antennas[eNB_id][i] = 0; + + if (frame_parms->nb_antennas_rx>1) { + if (ue->measurements.subband_cqi_dB[eNB_id][0][i] >= ue->measurements.subband_cqi_dB[eNB_id][1][i]) + ue->measurements.selected_rx_antennas[eNB_id][i] = 0; + else + ue->measurements.selected_rx_antennas[eNB_id][i] = 1; + } else + ue->measurements.selected_rx_antennas[eNB_id][i] = 0; + } + // if(eNB_id==0) + // printf("in lte_ue_measurements: selected rx_antenna[eNB_id==0]:%u\n", ue->measurements.selected_rx_antennas[eNB_id][i]); + } // eNB_id loop + +#if defined(__x86_64__) || defined(__i386__) _mm_empty(); _m_empty(); +#endif +} -#elif defined(__arm__) -#endif +void lte_ue_measurements_emul(PHY_VARS_UE *ue,uint8_t subframe,uint8_t eNB_id) +{ + + LOG_D(PHY,"EMUL UE lte_ue_measurements_emul subframe %d, eNB_id %d\n",subframe,eNB_id); } + + + diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index 9ef23f23d06ebcaee853c03d4d110de305ee4130..74ef6798c78c57baaada40d1044b137988a60774 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -19,13 +19,14 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" //#define DEBUG_CH #include "UTIL/LOG/log.h" - +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" #include "T.h" +#include "lte_estimation.h" // round(exp(sqrt(-1)*(pi/2)*[0:1:N-1]/N)*pow2(15)) static int16_t ru_90[2*128] = {32767, 0,32766, 402,32758, 804,32746, 1206,32729, 1608,32706, 2009,32679, 2411,32647, 2811,32610, 3212,32568, 3612,32522, 4011,32470, 4410,32413, 4808,32352, 5205,32286, 5602,32214, 5998,32138, 6393,32058, 6787,31972, 7180,31881, 7571,31786, 7962,31686, 8351,31581, 8740,31471, 9127,31357, 9512,31238, 9896,31114, 10279,30986, 10660,30853, 11039,30715, 11417,30572, 11793,30425, 12167,30274, 12540,30118, 12910,29957, 13279,29792, 13646,29622, 14010,29448, 14373,29269, 14733,29086, 15091,28899, 15447,28707, 15800,28511, 16151,28311, 16500,28106, 16846,27897, 17190,27684, 17531,27467, 17869,27246, 18205,27020, 18538,26791, 18868,26557, 19195,26320, 19520,26078, 19841,25833, 20160,25583, 20475,25330, 20788,25073, 21097,24812, 21403,24548, 21706,24279, 22006,24008, 22302,23732, 22595,23453, 22884,23170, 23170,22884, 23453,22595, 23732,22302, 24008,22006, 24279,21706, 24548,21403, 24812,21097, 25073,20788, 25330,20475, 25583,20160, 25833,19841, 26078,19520, 26320,19195, 26557,18868, 26791,18538, 27020,18205, 27246,17869, 27467,17531, 27684,17190, 27897,16846, 28106,16500, 28311,16151, 28511,15800, 28707,15447, 28899,15091, 29086,14733, 29269,14373, 29448,14010, 29622,13646, 29792,13279, 29957,12910, 30118,12540, 30274,12167, 30425,11793, 30572,11417, 30715,11039, 30853,10660, 30986,10279, 31114,9896, 31238,9512, 31357,9127, 31471,8740, 31581,8351, 31686,7962, 31786,7571, 31881,7180, 31972,6787, 32058,6393, 32138,5998, 32214,5602, 32286,5205, 32352,4808, 32413,4410, 32470,4011, 32522,3612, 32568,3212, 32610,2811, 32647,2411, 32679,2009, 32706,1608, 32729,1206, 32746,804, 32758,402, 32766}; diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c b/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c index 5bf69578d194269b656266e0245d38fbd2a39b56..56d8aaf1dfce1826cedefec58e856a64620aabd7 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c @@ -22,8 +22,9 @@ #include <stdio.h> #include <stdlib.h> -#include "defs.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/impl_defs_top.h" //extern unsigned int lte_gold_table[3][20][2][14]; //#define DEBUG_DL_CELL_SPEC diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c index 35e5fe6affa62885f33bde299fe1d63a7375d475..54f52ef40b9d3990abbf044d48aed421cdb31f78 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c @@ -24,8 +24,10 @@ #include <stdio.h> #include <stdlib.h> -#include "defs.h" -#include "PHY/defs.h" +#include "lte_refsig.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/impl_defs_top.h" //extern unsigned int lte_gold_table[10][3][42]; //#define DEBUG_DL_MBSFN diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c index a7db8fd5aa321848cb1a4b903b5fb2b1cc780842..fc03299f2b60bda1ff969d5307c478b51f9fa686 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c @@ -33,9 +33,11 @@ #include <stdio.h> #include <stdlib.h> -#include "defs.h" -#include "PHY/defs.h" +#include "lte_refsig.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" #include "log.h" +#include "PHY/impl_defs_top.h" //extern unsigned int lte_gold_table[3][20][2][14]; //#define DEBUG_DL_CELL_SPEC diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c index c3a3f42456293460213b3bea994b8757b0be37a0..78fae8b8f3304a69a1d2c0d67cac522e08209135 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -#include "defs.h" +#include "lte_refsig.h" /* c(n) = x1(n+Nc) + x2(n+Nc) mod 2 diff --git a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c index 66d7fa8fb253c3cb3ed3d6220e475f0d526ab7b3..14def309b7bdb11043ef66712b0828d5546898d6 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c @@ -42,7 +42,7 @@ //unsigned int lte_gold_table[10][3][42]; // need 165 bytes for sequence //slot index x pilot within slot x sequence*/ -#include "defs.h" +#include "lte_refsig.h" void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_table[10][3][42],uint16_t Nid_mbsfn) { diff --git a/openair1/PHY/LTE_REFSIG/defs.h b/openair1/PHY/LTE_REFSIG/lte_refsig.h similarity index 99% rename from openair1/PHY/LTE_REFSIG/defs.h rename to openair1/PHY/LTE_REFSIG/lte_refsig.h index 838406b4444222c2ca341f69ad85213fcd27018c..27788e5e1a92c2266b23cad399af48f2506a2580 100644 --- a/openair1/PHY/LTE_REFSIG/defs.h +++ b/openair1/PHY/LTE_REFSIG/lte_refsig.h @@ -23,7 +23,8 @@ /* Author R. Knopp / EURECOM / OpenAirInterface.org */ #ifndef __LTE_REFSIG_DEFS__H__ #define __LTE_REFSIG_DEFS__H__ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" /** @ingroup _PHY_REF_SIG * @{ diff --git a/openair1/PHY/LTE_REFSIG/lte_ul_ref.c b/openair1/PHY/LTE_REFSIG/lte_ul_ref.c index 93ca7646e63cdaabfc0d229d2e8241cdf8480541..01b27205c21b619bc273b8ef43309073de21a7e1 100644 --- a/openair1/PHY/LTE_REFSIG/lte_ul_ref.c +++ b/openair1/PHY/LTE_REFSIG/lte_ul_ref.c @@ -24,7 +24,8 @@ #include <stdlib.h> #include <math.h> #endif -#include "defs.h" +#include "lte_refsig.h" +#include "PHY/defs_eNB.h" uint16_t dftsizes[33] = {12,24,36,48,60,72,96,108,120,144,180,192,216,240,288,300,324,360,384,432,480,540,576,600,648,720,864,900,960,972,1080,1152,1200}; diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 0c39ad6cc40d2810f147bad7bcf9fb493d354c09..2bf3ec50155da7189aef47cf60756379191b57af 100755 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -32,16 +32,19 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "SCHED/sched_eNB.h" +#include "SIMULATION/TOOLS/sim.h" // for taus #include "PHY/sse_intrin.h" - +#include "transport_proto.h" +#include "transport_common_proto.h" #include "assertions.h" #include "T.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" +#include "PHY/LTE_TRANSPORT/transport_extern.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_DCI_ENCODING 1 //#define DEBUG_DCI_DECODING 1 @@ -52,65 +55,7 @@ //extern uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3]; //extern uint16_t pcfich_reg[4]; -uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t lprime,uint8_t mi) -{ - - uint16_t i; - uint16_t Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48; - uint16_t mprime; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - if ((lprime>0) && (frame_parms->Ncp==0) ) - return(0); - - // printf("check_phich_reg : mi %d\n",mi); - - // compute REG based on symbol - if ((lprime == 0)|| - ((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) - mprime = kprime/6; - else - mprime = kprime>>2; - - // check if PCFICH uses mprime - if ((lprime==0) && - ((mprime == pcfich_reg[0]) || - (mprime == pcfich_reg[1]) || - (mprime == pcfich_reg[2]) || - (mprime == pcfich_reg[3]))) { -#ifdef DEBUG_DCI_ENCODING - printf("[PHY] REG %d allocated to PCFICH\n",mprime); -#endif - return(1); - } - - // handle Special subframe case for TDD !!! - - // printf("Checking phich_reg %d\n",mprime); - if (mi > 0) { - if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0) - Ngroup_PHICH++; - if (frame_parms->Ncp == 1) { - Ngroup_PHICH<<=1; - } - - - - for (i=0; i<Ngroup_PHICH; i++) { - if ((mprime == frame_parms->phich_reg[i][0]) || - (mprime == frame_parms->phich_reg[i][1]) || - (mprime == frame_parms->phich_reg[i][2])) { -#ifdef DEBUG_DCI_ENCODING - printf("[PHY] REG %d (lprime %d) allocated to PHICH\n",mprime,lprime); -#endif - return(1); - } - } - } - - return(0); -} static uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96]; static uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)]; @@ -226,15 +171,10 @@ uint8_t *generate_dci0(uint8_t *dci, uint32_t Y; -#define CCEBITS 72 -#define CCEPERSYMBOL 33 // This is for 1200 RE -#define CCEPERSYMBOL0 22 // This is for 1200 RE -#define DCI_BITS_MAX ((2*CCEPERSYMBOL+CCEPERSYMBOL0)*CCEBITS) -#define Msymb (DCI_BITS_MAX/2) -//#define Mquad (Msymb/4) -static uint32_t bitrev_cc_dci[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30}; -static int32_t wtemp[2][Msymb]; + + + void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi) { @@ -247,6 +187,8 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w #ifdef RM_DEBUG int32_t nulled=0; #endif + uint32_t Msymb=(DCI_BITS_MAX/2); + int32_t wtemp[2][Msymb]; // printf("[PHY] PDCCH Interleaving Mquad %d (Nsymb %d)\n",Mquad,n_symbols_pdcch); if ((Mquad&0x1f) > 0) @@ -347,8 +289,9 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, uint32_t gain_lin_QPSK,kprime,kprime_mod12,mprime,nsymb,symbol_offset,tti_offset; int16_t re_offset; uint8_t mi = get_mi(frame_parms,subframe); - static uint8_t e[DCI_BITS_MAX]; - static int32_t yseq0[Msymb],yseq1[Msymb],wbar0[Msymb],wbar1[Msymb]; + uint8_t e[DCI_BITS_MAX]; + uint32_t Msymb=(DCI_BITS_MAX/2); + int32_t yseq0[Msymb],yseq1[Msymb],wbar0[Msymb],wbar1[Msymb]; int32_t *y[2]; int32_t *wbar[2]; @@ -412,7 +355,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, /* clear all bits, the above code may generate too much false detections * (not sure about this, to be checked somehow) */ - // memset(e, 0, DCI_BITS_MAX); + //memset(e, 0, DCI_BITS_MAX); e_ptr = e; @@ -434,6 +377,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, #endif if (dci_alloc[i].firstCCE>=0) { +//printf("generate DCI .%d rnti %d length %d\n", subframe, dci_alloc[i].rnti, dci_alloc[i].dci_length); e_ptr = generate_dci0(dci_alloc[i].dci_pdu, e+(72*dci_alloc[i].firstCCE), dci_alloc[i].dci_length, @@ -676,58 +620,3 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols, } -uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi) -{ - return(get_nquad(num_pdcch_symbols,frame_parms,mi)/9); -} - -uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi) -{ - - uint16_t Nreg=0; - uint8_t 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) { - Ngroup_PHICH<<=1; - } - - Ngroup_PHICH*=mi; - - if ((num_pdcch_symbols>0) && (num_pdcch_symbols<4)) - switch (frame_parms->N_RB_DL) { - case 6: - Nreg=12+(num_pdcch_symbols-1)*18; - break; - - case 25: - Nreg=50+(num_pdcch_symbols-1)*75; - break; - - case 50: - Nreg=100+(num_pdcch_symbols-1)*150; - break; - - case 100: - Nreg=200+(num_pdcch_symbols-1)*300; - break; - - default: - return(0); - } - - // printf("Nreg %d (%d)\n",Nreg,Nreg - 4 - (3*Ngroup_PHICH)); - return(Nreg - 4 - (3*Ngroup_PHICH)); -} - -uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe) -{ - - // check for eNB only ! - return(get_nCCE(num_pdcch_symbols, - &RC.eNB[Mod_id][CC_id]->frame_parms, - get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe))); -} - diff --git a/openair1/PHY/LTE_TRANSPORT/dci.h b/openair1/PHY/LTE_TRANSPORT/dci.h index 9381dd63fdd1a3d49b50e6ce4b27793c1a1074c1..c5654aa7428203ca04b4c709eaedae3612adf84d 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.h +++ b/openair1/PHY/LTE_TRANSPORT/dci.h @@ -30,8 +30,18 @@ * \warning */ +#ifndef __DCI__h__ +#define __DCI__h__ + #include <stdint.h> +#define CCEBITS 72 +#define CCEPERSYMBOL 33 // This is for 1200 RE +#define CCEPERSYMBOL0 22 // This is for 1200 RE +#define DCI_BITS_MAX ((2*CCEPERSYMBOL+CCEPERSYMBOL0)*CCEBITS) + +//#define Mquad (Msymb/4) + /// DCI Format Type 0 (5 MHz,TDD0, 27 bits) struct DCI0_5MHz_TDD0 { /// type = 0 => DCI Format 0, type = 1 => DCI Format 1A @@ -3014,3 +3024,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/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 8f995e12e345bda05e81f43d4ada30de25d1fba9..550ba3b6b8954e7fea023592e585c5e868b889de 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -30,776 +30,23 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "SCHED/sched_eNB.h" #ifdef DEBUG_DCI_TOOLS -#include "PHY/vars.h" +#include "PHY/phy_vars.h" #endif #include "assertions.h" #include "nfapi_interface.h" //#define DEBUG_HARQ -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/defs.h" -//#define DEBUG_DCI - -uint32_t localRIV2alloc_LUT6[32]; -uint32_t distRIV2alloc_even_LUT6[32]; -uint32_t distRIV2alloc_odd_LUT6[32]; -uint16_t RIV2nb_rb_LUT6[32]; -uint16_t RIV2first_rb_LUT6[32]; -uint16_t RIV_max6=0; - -uint32_t localRIV2alloc_LUT25[512]; -uint32_t distRIV2alloc_even_LUT25[512]; -uint32_t distRIV2alloc_odd_LUT25[512]; -uint16_t RIV2nb_rb_LUT25[512]; -uint16_t RIV2first_rb_LUT25[512]; -uint16_t RIV_max25=0; - - -uint32_t localRIV2alloc_LUT50_0[1600]; -uint32_t localRIV2alloc_LUT50_1[1600]; -uint32_t distRIV2alloc_gap0_even_LUT50_0[1600]; -uint32_t distRIV2alloc_gap0_odd_LUT50_0[1600]; -uint32_t distRIV2alloc_gap0_even_LUT50_1[1600]; -uint32_t distRIV2alloc_gap0_odd_LUT50_1[1600]; -uint32_t distRIV2alloc_gap1_even_LUT50_0[1600]; -uint32_t distRIV2alloc_gap1_odd_LUT50_0[1600]; -uint32_t distRIV2alloc_gap1_even_LUT50_1[1600]; -uint32_t distRIV2alloc_gap1_odd_LUT50_1[1600]; -uint16_t RIV2nb_rb_LUT50[1600]; -uint16_t RIV2first_rb_LUT50[1600]; -uint16_t RIV_max50=0; - -uint32_t localRIV2alloc_LUT100_0[6000]; -uint32_t localRIV2alloc_LUT100_1[6000]; -uint32_t localRIV2alloc_LUT100_2[6000]; -uint32_t localRIV2alloc_LUT100_3[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_0[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_0[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_1[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_1[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_2[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_2[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_3[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_3[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_0[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_0[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_1[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_1[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_2[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_2[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_3[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_3[6000]; -uint16_t RIV2nb_rb_LUT100[6000]; -uint16_t RIV2first_rb_LUT100[6000]; -uint16_t RIV_max100=0; - - -extern uint32_t current_dlsch_cqi; - -// Table 8.6.3-3 36.213 -uint16_t beta_cqi[16] = {0, //reserved - 0, //reserved - 9, //1.125 - 10, //1.250 - 11, //1.375 - 13, //1.625 - 14, //1.750 - 16, //2.000 - 18, //2.250 - 20, //2.500 - 23, //2.875 - 25, //3.125 - 28, //3.500 - 32, //4.000 - 40, //5.000 - 50 - }; //6.250 - -// Table 8.6.3-2 36.213 -uint16_t beta_ri[16] = {10, //1.250 - 13, //1.625 - 16, //2.000 - 20, //2.500 - 25, //3.125 - 32, //4.000 - 40, //5.000 - 50, //6.250 - 64, //8.000 - 80, //10.000 - 101, //12.625 - 127, //15.875 - 160, //20.000 - 0, //reserved - 0, //reserved - 0 - }; //reserved - -// Table 8.6.3-2 36.213 -uint16_t beta_ack[16] = {16, //2.000 - 20, //2.500 - 25, //3.125 - 32, //4.000 - 40, //5.000 - 50, //6.250 - 64, //8.000 - 80, //10.000 - 101, //12.625 - 127, //15.875 - 160, //20.000 - 248, //31.000 - 400, //50.000 - 640, //80.000 - 808 - };//126.00 - -int8_t delta_PUSCH_abs[4] = {-4,-1,1,4}; -int8_t delta_PUSCH_acc[4] = {-1,0,1,3}; - -int8_t *delta_PUCCH_lut = delta_PUSCH_acc; - -void conv_eMTC_rballoc(uint16_t resource_block_coding, - uint32_t N_RB_DL, - uint32_t *rb_alloc) { - - - int narrowband = resource_block_coding>>5; - int RIV = resource_block_coding&31; - int N_NB_DL = N_RB_DL/6; - int i0 = (N_RB_DL>>1) - (3*N_NB_DL); - int first_rb = (6*narrowband)+i0; - int alloc = localRIV2alloc_LUT6[RIV]; - int ind = first_rb>>5; - int ind_mod = first_rb&31; - - if (((N_RB_DL&1) > 0) && (narrowband>=(N_NB_DL>>1))) first_rb++; - rb_alloc[0] = 0; - rb_alloc[1] = 0; - rb_alloc[2] = 0; - rb_alloc[3] = 0; - rb_alloc[ind] = alloc<<ind_mod; - if (ind_mod > 26) rb_alloc[ind+1] = alloc>>(6-(ind_mod-26)); -} - -void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2) -{ - - uint32_t i,shift,subset; - rb_alloc2[0] = 0; - rb_alloc2[1] = 0; - rb_alloc2[2] = 0; - rb_alloc2[3] = 0; - - // printf("N_RB_DL %d, ra_header %d, rb_alloc %x\n",N_RB_DL,ra_header,rb_alloc); - - switch (N_RB_DL) { - - case 6: - rb_alloc2[0] = rb_alloc&0x3f; - break; - - case 25: - if (ra_header == 0) {// Type 0 Allocation - - for (i=12; i>0; i--) { - if ((rb_alloc&(1<<i)) != 0) - rb_alloc2[0] |= (3<<((2*(12-i)))); - - // printf("rb_alloc2 (type 0) %x\n",rb_alloc2); - } - - if ((rb_alloc&1) != 0) - rb_alloc2[0] |= (1<<24); - } else { - subset = rb_alloc&1; - shift = (rb_alloc>>1)&1; - - for (i=0; i<11; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - rb_alloc2[0] |= (1<<(2*i)); - - //printf("rb_alloc2 (type 1) %x\n",rb_alloc2); - } - - if ((shift == 0) && (subset == 1)) - rb_alloc2[0]<<=1; - else if ((shift == 1) && (subset == 0)) - rb_alloc2[0]<<=4; - else if ((shift == 1) && (subset == 1)) - rb_alloc2[0]<<=3; - } - - break; - - case 50: - AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=50\n"); - - for (i=16; i>0; i--) { - if ((rb_alloc&(1<<i)) != 0) - rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32)); - } - - // bit mask across - if ((rb_alloc2[0]>>31)==1) - rb_alloc2[1] |= 1; - - if ((rb_alloc&1) != 0) - rb_alloc2[1] |= (3<<16); - break; - - case 100: - AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=100\n"); - for (i=0; i<25; i++) { - if ((rb_alloc&(1<<(24-i))) != 0) - rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32)); - - // printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i)); - } - - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", N_RB_DL); - DevParam (N_RB_DL, 0, 0); - break; - } - -} - - - -uint32_t conv_nprb(uint8_t ra_header,uint32_t rb_alloc,int N_RB_DL) -{ - - uint32_t nprb=0,i; - - switch (N_RB_DL) { - case 6: - for (i=0; i<6; i++) { - if ((rb_alloc&(1<<i)) != 0) - nprb += 1; - } - - break; - - case 25: - if (ra_header == 0) {// Type 0 Allocation - - for (i=12; i>0; i--) { - if ((rb_alloc&(1<<i)) != 0) - nprb += 2; - } - - if ((rb_alloc&1) != 0) - nprb += 1; - } else { - for (i=0; i<11; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - nprb += 1; - } - } - - break; - - case 50: - if (ra_header == 0) {// Type 0 Allocation - - for (i=0; i<16; i++) { - if ((rb_alloc&(1<<(16-i))) != 0) - nprb += 3; - } - - if ((rb_alloc&1) != 0) - nprb += 2; - - } else { - for (i=0; i<17; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - nprb += 1; - } - } - - break; - - case 100: - if (ra_header == 0) {// Type 0 Allocation - - for (i=0; i<25; i++) { - if ((rb_alloc&(1<<(24-i))) != 0) - nprb += 4; - } - } else { - for (i=0; i<25; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - nprb += 1; - } - } - - break; - - default: - LOG_E(PHY,"Invalide N_RB_DL %d\n", N_RB_DL); - DevParam (N_RB_DL, 0, 0); - break; - } - - return(nprb); -} - -uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) -{ - - uint16_t RIV; - - if (Lcrbs<=(1+(N_RB_DL>>1))) - RIV = (N_RB_DL*(Lcrbs-1)) + RBstart; - else - RIV = (N_RB_DL*(N_RB_DL+1-Lcrbs)) + (N_RB_DL-1-RBstart); - - return(RIV); -} - -// Convert a DCI Format 1C RIV to a Format 1A RIV -// This extracts the start and length in PRBs from the 1C rballoc and -// recomputes the RIV as if it were the 1A rballoc - -uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) { - - int NpDLVRB,N_RB_step,LpCRBsm1,RBpstart; - - switch (N_RB_DL) { - - case 6: // N_RB_step = 2, NDLVRB = 6, NpDLVRB = 3 - NpDLVRB = 3; - N_RB_step = 2; - break; - case 25: // N_RB_step = 2, NDLVRB = 24, NpDLVRB = 12 - NpDLVRB = 12; - N_RB_step = 2; - break; - case 50: // N_RB_step = 4, NDLVRB = 46, NpDLVRB = 11 - NpDLVRB = 11; - N_RB_step = 4; - break; - case 100: // N_RB_step = 4, NDLVRB = 96, NpDLVRB = 24 - NpDLVRB = 24; - N_RB_step = 4; - break; - default: - NpDLVRB = 24; - N_RB_step = 4; - break; - } - - // This is the 1C part from 7.1.6.3 in 36.213 - LpCRBsm1 = rballoc/NpDLVRB; - // printf("LpCRBs = %d\n",LpCRBsm1+1); - - if (LpCRBsm1 <= (NpDLVRB/2)) { - RBpstart = rballoc % NpDLVRB; - } - else { - LpCRBsm1 = NpDLVRB-LpCRBsm1; - RBpstart = NpDLVRB-(rballoc%NpDLVRB); - } - // printf("RBpstart %d\n",RBpstart); - return(computeRIV(N_RB_DL,N_RB_step*RBpstart,N_RB_step*(LpCRBsm1+1))); - -} - -uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { - - int offset; - - switch (N_RB_DL) { - - case 6: - // N_RB_DL = tildeN_RB_DL = 6 - // Ngap = 4 , P=1, Nrow = 2, Nnull = 2 - - switch (vrb) { - case 0: // even: 0->0, 1->2, odd: 0->3, 1->5 - case 1: - return ((3*odd_slot) + 2*(vrb&3))%6; - break; - case 2: // even: 2->3, 3->5, odd: 2->0, 3->2 - case 3: - return ((3*odd_slot) + 2*(vrb&3) + 5)%6; - break; - case 4: // even: 4->1, odd: 4->4 - return ((3*odd_slot) + 1)%6; - case 5: // even: 5->4, odd: 5->1 - return ((3*odd_slot) + 4)%6; - break; - } - break; - - case 15: - if (vrb<12) { - if ((vrb&3) < 2) // even: 0->0, 1->4, 4->1, 5->5, 8->2, 9->6 odd: 0->7, 1->11 - return(((7*odd_slot) + 4*(vrb&3) + (vrb>>2))%14) + 14*(vrb/14); - else if (vrb < 12) // even: 2->7, 3->11, 6->8, 7->12, 10->9, 11->13 - return (((7*odd_slot) + 4*(vrb&3) + (vrb>>2) +13 )%14) + 14*(vrb/14); - } - if (vrb==12) - return (3+(7*odd_slot)) % 14; - if (vrb==13) - return (10+(7*odd_slot)) % 14; - return 14; - break; - - case 25: - return (((12*odd_slot) + 6*(vrb&3) + (vrb>>2))%24) + 24*(vrb/24); - break; - - case 50: // P=3 - if (Ngap==0) { - // Nrow=12,Nnull=2,NVRBDL=46,Ngap1= 27 - if (vrb>=23) - offset=4; - else - offset=0; - if (vrb<44) { - if ((vrb&3)>=2) - return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2) + 45)%46; - else - return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2))%46; - } - if (vrb==44) // even: 44->11, odd: 45->34 - return offset+((23*odd_slot) + 22-12+1); - if (vrb==45) // even: 45->10, odd: 45->33 - return offset+((23*odd_slot) + 22+12); - if (vrb==46) - return offset+46+((23*odd_slot) + 23-12+1) % 46; - if (vrb==47) - return offset+46+((23*odd_slot) + 23+12) % 46; - if (vrb==48) - return offset+46+((23*odd_slot) + 23-12+1) % 46; - if (vrb==49) - return offset+46+((23*odd_slot) + 23+12) % 46; - } - else { - // Nrow=6,Nnull=6,NVRBDL=18,Ngap1= 27 - if (vrb>=9) - offset=18; - else - offset=0; - - if (vrb<12) { - if ((vrb&3)>=2) - return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2) + 17)%18; - else - return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2))%18; - } - else { - return offset+((9*odd_slot) + 12*(vrb&1)+(vrb>>1) )%18 + 18*(vrb/18); - } - } - break; - case 75: - // Ngap1 = 32, NVRBRL=64, P=4, Nrow= 16, Nnull=0 - if (Ngap ==0) { - return ((32*odd_slot) + 16*(vrb&3) + (vrb>>2))%64 + (vrb/64); - } else { - // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 - return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); - } - break; - case 100: - // Ngap1 = 48, NVRBDL=96, Nrow=24, Nnull=0 - if (Ngap ==0) { - return ((48*odd_slot) + 24*(vrb&3) + (vrb>>2))%96 + (vrb/96); - } else { - // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 - return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); - } - break; - default: - LOG_E(PHY,"Unknown N_RB_DL %d\n",N_RB_DL); - return 0; - } - return 0; - -} - - -void generate_RIV_tables() -{ - - // 6RBs localized RIV - uint8_t Lcrbs,RBstart; - uint16_t RIV; - uint32_t alloc0,allocdist0_0_even,allocdist0_0_odd,allocdist0_1_even,allocdist0_1_odd; - uint32_t alloc1,allocdist1_0_even,allocdist1_0_odd,allocdist1_1_even,allocdist1_1_odd; - uint32_t alloc2,allocdist2_0_even,allocdist2_0_odd,allocdist2_1_even,allocdist2_1_odd; - uint32_t alloc3,allocdist3_0_even,allocdist3_0_odd,allocdist3_1_even,allocdist3_1_odd; - uint32_t nVRB,nVRB_even_dist,nVRB_odd_dist; - - for (RBstart=0; RBstart<6; RBstart++) { - alloc0 = 0; - allocdist0_0_even = 0; - allocdist0_0_odd = 0; - for (Lcrbs=1; Lcrbs<=(6-RBstart); Lcrbs++) { - //printf("RBstart %d, len %d --> ",RBstart,Lcrbs); - nVRB = Lcrbs-1+RBstart; - alloc0 |= (1<<nVRB); - allocdist0_0_even |= (1<<get_prb(6,0,nVRB,0)); - allocdist0_0_odd |= (1<<get_prb(6,1,nVRB,0)); - RIV=computeRIV(6,RBstart,Lcrbs); - - if (RIV>RIV_max6) - RIV_max6 = RIV; - - // printf("RIV %d (%d) : first_rb %d NBRB %d\n",RIV,localRIV2alloc_LUT25[RIV],RBstart,Lcrbs); - localRIV2alloc_LUT6[RIV] = alloc0; - distRIV2alloc_even_LUT6[RIV] = allocdist0_0_even; - distRIV2alloc_odd_LUT6[RIV] = allocdist0_0_odd; - RIV2nb_rb_LUT6[RIV] = Lcrbs; - RIV2first_rb_LUT6[RIV] = RBstart; - } - } - - - for (RBstart=0; RBstart<25; RBstart++) { - alloc0 = 0; - allocdist0_0_even = 0; - allocdist0_0_odd = 0; - for (Lcrbs=1; Lcrbs<=(25-RBstart); Lcrbs++) { - nVRB = Lcrbs-1+RBstart; - //printf("RBstart %d, len %d --> ",RBstart,Lcrbs); - alloc0 |= (1<<nVRB); - allocdist0_0_even |= (1<<get_prb(25,0,nVRB,0)); - allocdist0_0_odd |= (1<<get_prb(25,1,nVRB,0)); - - //printf("alloc 0 %x, allocdist0_even %x, allocdist0_odd %x\n",alloc0,allocdist0_0_even,allocdist0_0_odd); - RIV=computeRIV(25,RBstart,Lcrbs); - - if (RIV>RIV_max25) - RIV_max25 = RIV;; - - - localRIV2alloc_LUT25[RIV] = alloc0; - distRIV2alloc_even_LUT25[RIV] = allocdist0_0_even; - distRIV2alloc_odd_LUT25[RIV] = allocdist0_0_odd; - RIV2nb_rb_LUT25[RIV] = Lcrbs; - RIV2first_rb_LUT25[RIV] = RBstart; - } - } - - - for (RBstart=0; RBstart<50; RBstart++) { - alloc0 = 0; - alloc1 = 0; - allocdist0_0_even=0; - allocdist1_0_even=0; - allocdist0_0_odd=0; - allocdist1_0_odd=0; - allocdist0_1_even=0; - allocdist1_1_even=0; - allocdist0_1_odd=0; - allocdist1_1_odd=0; - - for (Lcrbs=1; Lcrbs<=(50-RBstart); Lcrbs++) { - - nVRB = Lcrbs-1+RBstart; - - - if (nVRB<32) - alloc0 |= (1<<nVRB); - else - alloc1 |= (1<<(nVRB-32)); - - // Distributed Gap1, even slot - nVRB_even_dist = get_prb(50,0,nVRB,0); - if (nVRB_even_dist<32) - allocdist0_0_even |= (1<<nVRB_even_dist); - else - allocdist1_0_even |= (1<<(nVRB_even_dist-32)); - - // Distributed Gap1, odd slot - nVRB_odd_dist = get_prb(50,1,nVRB,0); - if (nVRB_odd_dist<32) - allocdist0_0_odd |= (1<<nVRB_odd_dist); - else - allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); - - // Distributed Gap2, even slot - nVRB_even_dist = get_prb(50,0,nVRB,1); - if (nVRB_even_dist<32) - allocdist0_1_even |= (1<<nVRB_even_dist); - else - allocdist1_1_even |= (1<<(nVRB_even_dist-32)); - - // Distributed Gap2, odd slot - nVRB_odd_dist = get_prb(50,1,nVRB,1); - if (nVRB_odd_dist<32) - allocdist0_1_odd |= (1<<nVRB_odd_dist); - else - allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); - - RIV=computeRIV(50,RBstart,Lcrbs); - - if (RIV>RIV_max50) - RIV_max50 = RIV; - - // printf("RIV %d : first_rb %d NBRB %d\n",RIV,RBstart,Lcrbs); - localRIV2alloc_LUT50_0[RIV] = alloc0; - localRIV2alloc_LUT50_1[RIV] = alloc1; - distRIV2alloc_gap0_even_LUT50_0[RIV] = allocdist0_0_even; - distRIV2alloc_gap0_even_LUT50_1[RIV] = allocdist1_0_even; - distRIV2alloc_gap0_odd_LUT50_0[RIV] = allocdist0_0_odd; - distRIV2alloc_gap0_odd_LUT50_1[RIV] = allocdist1_0_odd; - distRIV2alloc_gap1_even_LUT50_0[RIV] = allocdist0_1_even; - distRIV2alloc_gap1_even_LUT50_1[RIV] = allocdist1_1_even; - distRIV2alloc_gap1_odd_LUT50_0[RIV] = allocdist0_1_odd; - distRIV2alloc_gap1_odd_LUT50_1[RIV] = allocdist1_1_odd; - RIV2nb_rb_LUT50[RIV] = Lcrbs; - RIV2first_rb_LUT50[RIV] = RBstart; - } - } - - - for (RBstart=0; RBstart<100; RBstart++) { - alloc0 = 0; - alloc1 = 0; - alloc2 = 0; - alloc3 = 0; - allocdist0_0_even=0; - allocdist1_0_even=0; - allocdist2_0_even=0; - allocdist3_0_even=0; - allocdist0_0_odd=0; - allocdist1_0_odd=0; - allocdist2_0_odd=0; - allocdist3_0_odd=0; - allocdist0_1_even=0; - allocdist1_1_even=0; - allocdist2_1_even=0; - allocdist3_1_even=0; - allocdist0_1_odd=0; - allocdist1_1_odd=0; - allocdist2_1_odd=0; - allocdist3_1_odd=0; - - for (Lcrbs=1; Lcrbs<=(100-RBstart); Lcrbs++) { - - nVRB = Lcrbs-1+RBstart; - - if (nVRB<32) - alloc0 |= (1<<nVRB); - else if (nVRB<64) - alloc1 |= (1<<(nVRB-32)); - else if (nVRB<96) - alloc2 |= (1<<(nVRB-64)); - else - alloc3 |= (1<<(nVRB-96)); - - // Distributed Gap1, even slot - nVRB_even_dist = get_prb(100,0,nVRB,0); - -// if ((RBstart==0) && (Lcrbs<=8)) -// printf("nVRB %d => nVRB_even_dist %d\n",nVRB,nVRB_even_dist); - - - if (nVRB_even_dist<32) - allocdist0_0_even |= (1<<nVRB_even_dist); - else if (nVRB_even_dist<64) - allocdist1_0_even |= (1<<(nVRB_even_dist-32)); - else if (nVRB_even_dist<96) - allocdist2_0_even |= (1<<(nVRB_even_dist-64)); - else - allocdist3_0_even |= (1<<(nVRB_even_dist-96)); -/* if ((RBstart==0) && (Lcrbs<=8)) - printf("rballoc =>(%08x.%08x.%08x.%08x)\n", - allocdist0_0_even, - allocdist1_0_even, - allocdist2_0_even, - allocdist3_0_even - ); -*/ - // Distributed Gap1, odd slot - nVRB_odd_dist = get_prb(100,1,nVRB,0); - if (nVRB_odd_dist<32) - allocdist0_0_odd |= (1<<nVRB_odd_dist); - else if (nVRB_odd_dist<64) - allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); - else if (nVRB_odd_dist<96) - allocdist2_0_odd |= (1<<(nVRB_odd_dist-64)); - else - allocdist3_0_odd |= (1<<(nVRB_odd_dist-96)); - - - // Distributed Gap2, even slot - nVRB_even_dist = get_prb(100,0,nVRB,1); - if (nVRB_even_dist<32) - allocdist0_1_even |= (1<<nVRB_even_dist); - else if (nVRB_even_dist<64) - allocdist1_1_even |= (1<<(nVRB_even_dist-32)); - else if (nVRB_even_dist<96) - allocdist2_1_even |= (1<<(nVRB_even_dist-64)); - else - allocdist3_1_even |= (1<<(nVRB_even_dist-96)); - - - // Distributed Gap2, odd slot - nVRB_odd_dist = get_prb(100,1,nVRB,1); - if (nVRB_odd_dist<32) - allocdist0_1_odd |= (1<<nVRB_odd_dist); - else if (nVRB_odd_dist<64) - allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); - else if (nVRB_odd_dist<96) - allocdist2_1_odd |= (1<<(nVRB_odd_dist-64)); - else - allocdist3_1_odd |= (1<<(nVRB_odd_dist-96)); - - - RIV=computeRIV(100,RBstart,Lcrbs); - - if (RIV>RIV_max100) - RIV_max100 = RIV; - - // printf("RIV %d : first_rb %d NBRB %d\n",RIV,RBstart,Lcrbs); - localRIV2alloc_LUT100_0[RIV] = alloc0; - localRIV2alloc_LUT100_1[RIV] = alloc1; - localRIV2alloc_LUT100_2[RIV] = alloc2; - localRIV2alloc_LUT100_3[RIV] = alloc3; - distRIV2alloc_gap0_even_LUT100_0[RIV] = allocdist0_0_even; - distRIV2alloc_gap0_even_LUT100_1[RIV] = allocdist1_0_even; - distRIV2alloc_gap0_even_LUT100_2[RIV] = allocdist2_0_even; - distRIV2alloc_gap0_even_LUT100_3[RIV] = allocdist3_0_even; - distRIV2alloc_gap0_odd_LUT100_0[RIV] = allocdist0_0_odd; - distRIV2alloc_gap0_odd_LUT100_1[RIV] = allocdist1_0_odd; - distRIV2alloc_gap0_odd_LUT100_2[RIV] = allocdist2_0_odd; - distRIV2alloc_gap0_odd_LUT100_3[RIV] = allocdist3_0_odd; - distRIV2alloc_gap1_even_LUT100_0[RIV] = allocdist0_1_even; - distRIV2alloc_gap1_even_LUT100_1[RIV] = allocdist1_1_even; - distRIV2alloc_gap1_even_LUT100_2[RIV] = allocdist2_1_even; - distRIV2alloc_gap1_even_LUT100_3[RIV] = allocdist3_1_even; - distRIV2alloc_gap1_odd_LUT100_0[RIV] = allocdist0_1_odd; - distRIV2alloc_gap1_odd_LUT100_1[RIV] = allocdist1_1_odd; - distRIV2alloc_gap1_odd_LUT100_2[RIV] = allocdist2_1_odd; - distRIV2alloc_gap1_odd_LUT100_3[RIV] = allocdist3_1_odd; - - RIV2nb_rb_LUT100[RIV] = Lcrbs; - RIV2first_rb_LUT100[RIV] = RBstart; - } - } -} - -// Ngap = 3, N_VRB_DL=6, P=1, N_row=2, N_null=4*2-6=2 -// permutation for even slots : -// n_PRB'(0,2,4) = (0,1,2), n_PRB'(1,3,5) = (4,5,6) -// n_PRB''(0,1,2,3) = (0,2,4,6) -// => n_tilde_PRB(5) = (4) -// n_tilde_PRB(4) = (1) -// n_tilde_PRB(2,3) = (3,5) -// n_tilde_PRB(0,1) = (0,2) +#include "LAYER2/MAC/mac.h" +//#define DEBUG_DCI +#include "dci_tools_common_extern.h" +#include "transport_proto.h" int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { @@ -840,25 +87,8 @@ int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) } -uint32_t get_rballoc(vrb_t vrb_type,uint16_t rb_alloc_dci) -{ - - return(localRIV2alloc_LUT25[rb_alloc_dci]); - -} -/* -uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti) -{ - unsigned char UE_id; - // find the UE_index corresponding to rnti - UE_id = find_ue(rnti,RC.eNB[Mod_id][CC_id]); - DevAssert( UE_id != (unsigned char)-1 ); - - return(RC.eNB[Mod_id][CC_id]->transmission_mode[UE_id]); -} -*/ void fill_pdcch_order(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu) { @@ -2183,6 +1413,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t #endif +//printf("DCI %d.%d rnti %d harq %d TBS %d\n", frame, subframe, rel8->rnti, rel8->harq_process, dlsch0_harq->TBS); #if T_TRACER if (dlsch0->active) T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame), T_INT(subframe), @@ -2708,6389 +1939,3 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame ulsch->harq_processes[harq_pid]->TBS, ulsch->harq_processes[harq_pid]->round); } - -int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) -{ - switch (dci->format) { - - case format0: // This is an UL SCH allocation so nothing here, inform MAC - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format0 (TDD, 1.5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 25: - LOG_D(PHY,"DCI format0 (TDD1-6, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 50: - LOG_D(PHY,"DCI format0 (TDD1-6, 10MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 100: - LOG_D(PHY,"DCI format0 (TDD1-6, 20MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - else if (frame_parms->frame_type == FDD) - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format0 (FDD, 1.5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 25: - LOG_D(PHY,"DCI format0 (FDD, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 50: - LOG_D(PHY,"DCI format0 (FDD, 10MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 100: - LOG_D(PHY,"DCI format0 (FDD, 20MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; - - case format1: - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) - - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1 (TDD 1.5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - case 25: - LOG_D(PHY,"DCI format1 (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - case 50: - LOG_D(PHY,"DCI format1 (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - case 100: - LOG_D(PHY,"DCI format1 (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - else if (frame_parms->frame_type == FDD) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1 (FDD, 1.5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format1 (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format1 (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format1 (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; - - case format1A: // This is DLSCH allocation for control traffic - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) { - switch (frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1A (TDD1-6, 1_5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - case 25: - LOG_D(PHY,"DCI format1A (TDD1-6, 5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %d (NB_RB %d)\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - case 50: - LOG_D(PHY,"DCI format1A (TDD1-6, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - case 100: - LOG_D(PHY,"DCI format1A (TDD1-6, 20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT100[((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - - } else if (frame_parms->frame_type == FDD) { - switch (frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1A(FDD, 1.5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format1A(FDD, 5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format1A(FDD, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format1A(FDD, 20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT100[((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - - break; - - case format1C: // This is DLSCH allocation for control traffic - switch (frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1C (1.5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n", - ((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT6[conv_1C_RIV(((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,6)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - case 25: - LOG_D(PHY,"DCI format1C (5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[conv_1C_RIV(((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,25)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - case 50: - LOG_D(PHY,"DCI format1C (10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"Ngap %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->Ngap); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,50)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - case 100: - LOG_D(PHY,"DCI format1C (20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"Ngap %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->Ngap); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,100)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - - - break; - - case format2: - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2 2 antennas (TDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi - ); - break; - - case 25: - LOG_D(PHY,"DCI format2 2 antennas (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 50: - LOG_D(PHY,"DCI format2 2 antennas (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 100: - LOG_D(PHY,"DCI format2 2 antennas (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2 2 antennas (TDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi - ); - break; - - case 25: - LOG_D(PHY,"DCI format2 2 antennas (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 50: - LOG_D(PHY,"DCI format2 2 antennas (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 100: - LOG_D(PHY,"DCI format2 2 antennas (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } else if (frame_parms->frame_type == FDD) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2 2 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - - LOG_D(PHY,"DCI format2 2 antennas (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, swap %d, TPMI %d, TPC %d\n", - - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2 2 antennas (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2 2 antennas (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - - case 6: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } - - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; - - case format2A: - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap - ); - break; - - case 25: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); - break; - - case 50: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); - break; - - case 100: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 1.5 MHz), rnti %x (%"PRIu64"): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi - ); - break; - - case 25: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 50: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 100: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } else if (frame_parms->frame_type == FDD) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - - case 6: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 1.5 MHz), rnti %x (%"PRIu64"): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } - - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; - - case format1E_2A_M10PRB: - - LOG_D(PHY,"DCI format1E_2A_M10PRB, rnti %x (%8x): harq_pid %d, rah %d, rb_alloc %x, mcs %d, rv %d, tpmi %d, ndi %d, dl_power_offset %d\n", - dci->rnti, - ((uint32_t *)&dci->dci_pdu)[0], - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->harq_pid, - //((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->dl_power_off - ); - - break; - - default: - LOG_E(PHY,"dci_tools.c: dump_dci, unknown format %d\n",dci->format); - return(-1); - } - - return(0); -} - -void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) -{ - uint8_t harq_pid=0; - uint32_t rballoc=0; - uint8_t vrb_type=0; - uint8_t mcs=0; - uint8_t rv=0; - uint8_t ndi=0; - uint8_t TPC=0; - - uint8_t dai=0; - - switch (N_RB_DL) { - case 6: - if (frame_type == TDD) { - vrb_type = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rballoc; - rv = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rv; - ndi = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->ndi; - TPC = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid; - dai = ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->dai; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, TPC %d\n",mcs,rballoc,rv,TPC); - } else { - vrb_type = ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rv; - ndi = ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->ndi; - TPC = ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid; - //printf("FDD 1A: mcs %d, rballoc %x,rv %d, TPC %d\n",mcs,rballoc,rv,TPC); - } - break; - - case 25: - - if (frame_type == TDD) { - vrb_type = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rballoc; - rv = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rv; - ndi = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->ndi; - TPC = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid; - dai = ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->dai; - //printf("TDD 1A: mcs %d, rballoc %x,rv %d, TPC %d\n",mcs,rballoc,rv,TPC); - } else { - vrb_type = ((DCI1A_5MHz_FDD_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_5MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_5MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1A_5MHz_FDD_t *)dci_pdu)->rv; - ndi = ((DCI1A_5MHz_FDD_t *)dci_pdu)->ndi; - TPC = ((DCI1A_5MHz_FDD_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_5MHz_FDD_t *)dci_pdu)->harq_pid; - //printf("FDD 1A: mcs %d, rballoc %x,rv %d, TPC %d\n",mcs,rballoc,rv,TPC); - } - - break; - - case 50: - if (frame_type == TDD) { - vrb_type = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rballoc; - rv = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rv; - ndi = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->ndi; - TPC = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->harq_pid; - dai = ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->dai; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, TPC %d\n",mcs,rballoc,rv,TPC); - } else { - vrb_type = ((DCI1A_10MHz_FDD_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_10MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_10MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1A_10MHz_FDD_t *)dci_pdu)->rv; - ndi = ((DCI1A_10MHz_FDD_t *)dci_pdu)->ndi; - TPC = ((DCI1A_10MHz_FDD_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_10MHz_FDD_t *)dci_pdu)->harq_pid; - //printf("FDD 1A: mcs %d, vrb_type %d, rballoc %x,ndi %d, rv %d, TPC %d\n",mcs,vrb_type,rballoc,ndi,rv,TPC); - } - break; - - case 100: - if (frame_type == TDD) { - vrb_type = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rballoc; - rv = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rv; - ndi = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->ndi; - TPC = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid; - dai = ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, TPC %d\n",mcs,rballoc,rv,TPC); - } else { - vrb_type = ((DCI1A_20MHz_FDD_t *)dci_pdu)->vrb_type; - mcs = ((DCI1A_20MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1A_20MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1A_20MHz_FDD_t *)dci_pdu)->rv; - ndi = ((DCI1A_20MHz_FDD_t *)dci_pdu)->ndi; - TPC = ((DCI1A_20MHz_FDD_t *)dci_pdu)->TPC; - harq_pid = ((DCI1A_20MHz_FDD_t *)dci_pdu)->harq_pid; - //printf("FDD 1A: mcs %d, rballoc %x,rv %d, TPC %d\n",mcs,rballoc,rv,TPC); - } - break; - } - - pdci_info_extarcted->vrb_type = vrb_type; - pdci_info_extarcted->mcs1 = mcs; - pdci_info_extarcted->rballoc = rballoc; - pdci_info_extarcted->rv1 = rv; - pdci_info_extarcted->ndi1 = ndi; - pdci_info_extarcted->TPC = TPC; - pdci_info_extarcted->harq_pid = harq_pid; - pdci_info_extarcted->dai = dai; -} - -void extract_dci1C_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) -{ - - uint32_t rballoc=0; - uint8_t mcs=0; - - switch (N_RB_DL) { - case 6: - mcs = ((DCI1C_5MHz_t *)dci_pdu)->mcs; - rballoc = conv_1C_RIV(((DCI1C_5MHz_t *)dci_pdu)->rballoc,6); - - break; - - case 25: - mcs = ((DCI1C_5MHz_t *)dci_pdu)->mcs; - rballoc = conv_1C_RIV(((DCI1C_5MHz_t *)dci_pdu)->rballoc,6); - - break; - - case 50: - mcs = ((DCI1C_10MHz_t *)dci_pdu)->mcs; - rballoc = conv_1C_RIV(((DCI1C_10MHz_t *)dci_pdu)->rballoc,6); - - break; - - case 100: - mcs = ((DCI1C_20MHz_t *)dci_pdu)->mcs; - rballoc = conv_1C_RIV(((DCI1C_20MHz_t *)dci_pdu)->rballoc,6); - break; - - default: - AssertFatal(0,"Format 1C: Unknown N_RB_DL %d\n",N_RB_DL); - break; - } - - pdci_info_extarcted->mcs1 = mcs; - pdci_info_extarcted->rballoc = rballoc; -} - -void extract_dci1_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) -{ - - uint32_t rballoc=0; - uint8_t mcs=0; - uint8_t rah=0; - uint8_t rv=0; - uint8_t TPC=0; - uint8_t ndi=0; - uint8_t harq_pid=0; - - switch (N_RB_DL) { - case 6: - if (frame_type == TDD) { - mcs = ((DCI1_1_5MHz_TDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rah; - rv = ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rv; - TPC = ((DCI1_1_5MHz_TDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_1_5MHz_TDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_1_5MHz_TDD_t *)dci_pdu)->harq_pid; - } else { - mcs = ((DCI1_1_5MHz_FDD_t *)dci_pdu)->mcs; - rah = ((DCI1_1_5MHz_FDD_t *)dci_pdu)->rah; - rballoc = ((DCI1_1_5MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1_1_5MHz_FDD_t *)dci_pdu)->rv; - TPC = ((DCI1_1_5MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_1_5MHz_FDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_1_5MHz_FDD_t *)dci_pdu)->harq_pid; - } - - break; - - case 25: - if (frame_type == TDD) { - mcs = ((DCI1_5MHz_TDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1_5MHz_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI1_5MHz_TDD_t *)dci_pdu)->rah; - rv = ((DCI1_5MHz_TDD_t *)dci_pdu)->rv; - TPC = ((DCI1_5MHz_TDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_5MHz_TDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_5MHz_TDD_t *)dci_pdu)->harq_pid; - } else { - mcs = ((DCI1_5MHz_FDD_t *)dci_pdu)->mcs; - rah = ((DCI1_5MHz_FDD_t *)dci_pdu)->rah; - rballoc = ((DCI1_5MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1_5MHz_FDD_t *)dci_pdu)->rv; - TPC = ((DCI1_5MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_5MHz_FDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_5MHz_FDD_t *)dci_pdu)->harq_pid; - } - - break; - - case 50: - if (frame_type == TDD) { - mcs = ((DCI1_10MHz_TDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1_10MHz_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI1_10MHz_TDD_t *)dci_pdu)->rah; - rv = ((DCI1_10MHz_TDD_t *)dci_pdu)->rv; - TPC = ((DCI1_10MHz_TDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_10MHz_TDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_10MHz_TDD_t *)dci_pdu)->harq_pid; - } else { - mcs = ((DCI1_10MHz_FDD_t *)dci_pdu)->mcs; - rah = ((DCI1_10MHz_FDD_t *)dci_pdu)->rah; - rballoc = ((DCI1_10MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1_10MHz_FDD_t *)dci_pdu)->rv; - TPC = ((DCI1_10MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_10MHz_FDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_10MHz_FDD_t *)dci_pdu)->harq_pid; - } - - break; - - case 100: - if (frame_type == TDD) { - mcs = ((DCI1_20MHz_TDD_t *)dci_pdu)->mcs; - rballoc = ((DCI1_20MHz_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI1_20MHz_TDD_t *)dci_pdu)->rah; - rv = ((DCI1_20MHz_TDD_t *)dci_pdu)->rv; - TPC = ((DCI1_20MHz_TDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_20MHz_TDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_20MHz_TDD_t *)dci_pdu)->harq_pid; - } else { - mcs = ((DCI1_20MHz_FDD_t *)dci_pdu)->mcs; - rah = ((DCI1_20MHz_FDD_t *)dci_pdu)->rah; - rballoc = ((DCI1_20MHz_FDD_t *)dci_pdu)->rballoc; - rv = ((DCI1_20MHz_FDD_t *)dci_pdu)->rv; - TPC = ((DCI1_20MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI1_20MHz_FDD_t *)dci_pdu)->ndi; - harq_pid = ((DCI1_20MHz_FDD_t *)dci_pdu)->harq_pid; - } - - break; - } - - pdci_info_extarcted->mcs1 = mcs; - pdci_info_extarcted->rah = rah; - pdci_info_extarcted->rballoc = rballoc; - pdci_info_extarcted->rv1 = rv; - pdci_info_extarcted->TPC = TPC; - pdci_info_extarcted->ndi1 = ndi; - pdci_info_extarcted->harq_pid = harq_pid; - -} - -void extract_dci2_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) -{ - - uint32_t rballoc=0; - uint8_t rah=0; - uint8_t mcs1=0; - uint8_t mcs2=0; - uint8_t rv1=0; - uint8_t rv2=0; - uint8_t ndi1=0; - uint8_t ndi2=0; - uint8_t tbswap=0; - uint8_t tpmi=0; - uint8_t harq_pid=0; - uint8_t TPC=0; - - switch (N_RB_DL) { - - case 6: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - rah = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->ndi2; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - rah = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->ndi2; - } - } else { - LOG_E(PHY,"UE: Format2 DCI: unsupported number of TX antennas %d\n",nb_antenna_ports_eNB); - } - - break; - - case 25: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - rah = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->ndi2; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - rah = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->ndi2; - } - } else { - LOG_E(PHY,"UE: Format2 DCI: unsupported number of TX antennas %d\n",nb_antenna_ports_eNB); - } - - break; - - case 50: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - rah = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->ndi2; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - rah = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->ndi2; - } - } else { - LOG_E(PHY,"UE: Format2A DCI: unsupported number of TX antennas %d\n",nb_antenna_ports_eNB); - } - - break; - - case 100: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - rah = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->ndi2; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - rah = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->ndi2; - } else { - rah = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->rah; - mcs1 = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->rv2; - harq_pid = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->TPC; - ndi1 = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->ndi2; - } - } else { - LOG_E(PHY,"UE: Format2A DCI: unsupported number of TX antennas %d\n",nb_antenna_ports_eNB); - } - - break; - } - - pdci_info_extarcted->rah = rah; - pdci_info_extarcted->mcs1 = mcs1; - pdci_info_extarcted->mcs2 = mcs2; - pdci_info_extarcted->rv1 = rv1; - pdci_info_extarcted->rv2 = rv2; - pdci_info_extarcted->harq_pid = harq_pid; - pdci_info_extarcted->rballoc = rballoc; - pdci_info_extarcted->tb_swap = tbswap; - pdci_info_extarcted->tpmi = tpmi; - pdci_info_extarcted->TPC = TPC; - pdci_info_extarcted->ndi1 = ndi1; - pdci_info_extarcted->ndi2 = ndi2; - -} - -void extract_dci2A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) -{ - - uint32_t rballoc=0; - uint8_t rah=0; - uint8_t mcs1=0; - uint8_t mcs2=0; - uint8_t rv1=0; - uint8_t rv2=0; - uint8_t ndi1=0; - uint8_t ndi2=0; - uint8_t tbswap=0; - uint8_t tpmi=0; - uint8_t harq_pid=0; - uint8_t TPC=0; - - AssertFatal( (nb_antenna_ports_eNB == 2) || (nb_antenna_ports_eNB == 4), "unsupported nb_antenna_ports_eNB %d\n", nb_antenna_ports_eNB); - switch (N_RB_DL) { - - case 6: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->TPC; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->rballoc; - rv1 = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->TPC; - } - } - - break; - - case 25: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->TPC; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->TPC; - } - } - break; - - case 50: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->TPC; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->TPC; - } - } - - break; - - case 100: - if (nb_antenna_ports_eNB == 2) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->tb_swap; - TPC = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->TPC; - } - } else if (nb_antenna_ports_eNB == 4) { - if (frame_type == TDD) { - mcs1 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->TPC; - } else { - mcs1 = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->mcs1; - mcs2 = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->mcs2; - rballoc = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->rballoc; - rah = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->rah; - rv1 = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->rv1; - rv2 = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->rv2; - ndi1 = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->ndi1; - ndi2 = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->ndi2; - harq_pid = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->harq_pid; - tbswap = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->tb_swap; - tpmi = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->tpmi; - TPC = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->TPC; - } - } - - break; - } - - pdci_info_extarcted->mcs1 = mcs1; - pdci_info_extarcted->mcs2 = mcs2; - pdci_info_extarcted->rballoc = rballoc; - pdci_info_extarcted->rah = rah; - pdci_info_extarcted->rv1 = rv1; - pdci_info_extarcted->rv2 = rv2; - pdci_info_extarcted->ndi1 = ndi1; - pdci_info_extarcted->ndi2 = ndi2; - pdci_info_extarcted->harq_pid = harq_pid; - pdci_info_extarcted->tb_swap = tbswap; - pdci_info_extarcted->TPC = TPC; - pdci_info_extarcted->tpmi = tpmi; -} - -int check_dci_format1_1a_coherency(DCI_format_t dci_format, - uint8_t N_RB_DL, - uint16_t rnti, - uint16_t tc_rnti, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - uint32_t frame, - uint8_t subframe, - DCI_INFO_EXTRACTED_t *pdci_info_extarcted, - LTE_DL_UE_HARQ_t *pdlsch0_harq) -{ - uint8_t harq_pid = pdci_info_extarcted->harq_pid; - uint32_t rballoc = pdci_info_extarcted->rballoc; - uint8_t mcs1 = pdci_info_extarcted->mcs1; - uint8_t TPC = pdci_info_extarcted->TPC; - uint8_t rah = pdci_info_extarcted->rah; -#ifdef DEBUG_DCI - uint8_t rv1 = pdci_info_extarcted->rv1; - uint8_t ndi1 = pdci_info_extarcted->ndi1; -#endif - - uint8_t NPRB = 0; - long long int RIV_max = 0; - -#ifdef DEBUG_DCI - LOG_I(PHY,"[DCI-FORMAT-1-1A] AbsSubframe %d.%d dci_format %d\n", frame, subframe, dci_format); - LOG_I(PHY,"[DCI-FORMAT-1-1A] rnti %x\n", rnti); - LOG_I(PHY,"[DCI-FORMAT-1-1A] harq_pid %d\n", harq_pid); - LOG_I(PHY,"[DCI-FORMAT-1-1A] rah %d\n", rah); - LOG_I(PHY,"[DCI-FORMAT-1-1A] rballoc %x\n", rballoc); - LOG_I(PHY,"[DCI-FORMAT-1-1A] mcs1 %d\n", mcs1); - LOG_I(PHY,"[DCI-FORMAT-1-1A] rv1 %d\n", rv1); - LOG_I(PHY,"[DCI-FORMAT-1-1A] ndi1 %d\n", ndi1); - LOG_I(PHY,"[DCI-FORMAT-1-1A] TPC %d\n", TPC); -#endif - - - // I- check dci content minimum coherency - if( ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) && harq_pid > 0) - { - return(0); - } - - if(harq_pid>=8) - { - // LOG_I(PHY,"bad harq id \n"); - return(0); - } - - if(dci_format == format1 && ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) ) - { - // LOG_I(PHY,"bad dci format \n"); - return(0); - } - - - if( mcs1 > 28) - { - if(pdlsch0_harq->round == 0) - { - // LOG_I(PHY,"bad dci mcs + round \n"); - return(0); - } - - if((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) - { - // LOG_I(PHY,"bad dci mcs + rnti \n"); - return(0); - } - } - - if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) - { - NPRB = (TPC&1) + 2; - switch (N_RB_DL) { - case 6: - RIV_max = RIV_max6; - break; - case 25: - RIV_max = RIV_max25; - break; - case 50: - RIV_max = RIV_max50; - break; - case 100: - RIV_max = RIV_max100; - break; - } - } - else - { - switch (N_RB_DL) { - case 6: - NPRB = RIV2nb_rb_LUT6[rballoc];//NPRB; - if(rah) - RIV_max = RIV_max6; - else - RIV_max = 0x3F; - break; - case 25: - NPRB = RIV2nb_rb_LUT25[rballoc];//NPRB; - if(rah) - RIV_max = RIV_max25; - else - RIV_max = 0x1FFF; - break; - case 50: - NPRB = RIV2nb_rb_LUT50[rballoc];//NPRB; - if(rah) - RIV_max = RIV_max50; - else - RIV_max = 0x1FFFF; - break; - case 100: - NPRB = RIV2nb_rb_LUT100[rballoc];//NPRB; - if(rah) - RIV_max = RIV_max100; - else - RIV_max = 0x1FFFFFF; - break; - } - } - - - if(dci_format == format1) - { - NPRB = conv_nprb(rah, rballoc, N_RB_DL); - } - - - if(rballoc > RIV_max) - { - // LOG_I(PHY,"bad dci rballoc rballoc %d RIV_max %lld \n",rballoc, RIV_max); - // DCI false detection - return(0); - } - - if(NPRB == 0) - { - // DCI false detection - // LOG_I(PHY,"bad NPRB = 0 \n"); - return(0); - } - - // this a retransmission - if(pdlsch0_harq->round>0) - { - // compare old TBS to new TBS - if((mcs1<29) && (pdlsch0_harq->TBS != TBStable[get_I_TBS(mcs1)][NPRB-1])) - { - // this is an eNB issue - // retransmisison but old and new TBS are different !!! - // work around, consider it as a new transmission - LOG_E(PHY,"Format1A Retransmission but TBS are different: consider it as new transmission !!! \n"); - pdlsch0_harq->round = 0; - //return(0); // ?? to cross check - } - } - - return(1); -} - -int check_dci_format1c_coherency(uint8_t N_RB_DL, - DCI_INFO_EXTRACTED_t *pdci_info_extarcted, - uint16_t rnti, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - LTE_DL_UE_HARQ_t *pdlsch0_harq) -{ - uint32_t rballoc = pdci_info_extarcted->rballoc; - - uint8_t NPRB = 0; - uint32_t RIV_max = 0; - - // I- check dci content minimum coherency - - if((rnti!=si_rnti) && (rnti!=p_rnti) && (rnti!=ra_rnti)) - return(0); - - switch (N_RB_DL) { - case 6: - NPRB = RIV2nb_rb_LUT6[rballoc];//NPRB; - RIV_max = RIV_max6; - break; - case 25: - NPRB = RIV2nb_rb_LUT25[rballoc];//NPRB; - RIV_max = RIV_max25; - break; - case 50: - NPRB = RIV2nb_rb_LUT50[rballoc];//NPRB; - RIV_max = RIV_max50; - break; - case 100: - NPRB = RIV2nb_rb_LUT100[rballoc];//NPRB; - RIV_max = RIV_max100; - break; - } - - if(rballoc > RIV_max) - { - // DCI false detection - return(0); - } - - if(NPRB == 0) - { - // DCI false detection - return(0); - } - - return(1); -} - -int check_dci_format2_2a_coherency(DCI_format_t dci_format, - uint8_t N_RB_DL, - DCI_INFO_EXTRACTED_t *pdci_info_extarcted, - uint16_t rnti, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - LTE_DL_UE_HARQ_t *pdlsch0_harq, - LTE_DL_UE_HARQ_t *pdlsch1_harq) -{ - uint8_t rah = pdci_info_extarcted->rah; - uint8_t mcs1 = pdci_info_extarcted->mcs1; - uint8_t mcs2 = pdci_info_extarcted->mcs2; - uint8_t rv1 = pdci_info_extarcted->rv1; - uint8_t rv2 = pdci_info_extarcted->rv2; - uint8_t harq_pid = pdci_info_extarcted->harq_pid; - uint32_t rballoc = pdci_info_extarcted->rballoc; - -#ifdef DEBUG_DCI - uint8_t ndi1 = pdci_info_extarcted->ndi1; - uint8_t ndi2 = pdci_info_extarcted->ndi2; -#endif - - uint8_t NPRB = 0; - long long RIV_max = 0; - -#ifdef DEBUG_DCI - LOG_I(PHY, "extarcted dci - dci_format %d \n", dci_format); - LOG_I(PHY, "extarcted dci - rnti %d \n", rnti); - LOG_I(PHY, "extarcted dci - rah %d \n", rah); - LOG_I(PHY, "extarcted dci - mcs1 %d \n", mcs1); - LOG_I(PHY, "extarcted dci - mcs2 %d \n", mcs2); - LOG_I(PHY, "extarcted dci - rv1 %d \n", rv1); - LOG_I(PHY, "extarcted dci - rv2 %d \n", rv2); - //LOG_I(PHY, "extarcted dci - ndi1 %d \n", ndi1); - //LOG_I(PHY, "extarcted dci - ndi2 %d \n", ndi2); - LOG_I(PHY, "extarcted dci - rballoc %x \n", rballoc); - LOG_I(PHY, "extarcted dci - harq pid %d \n", harq_pid); - LOG_I(PHY, "extarcted dci - round0 %d \n", pdlsch0_harq->round); - LOG_I(PHY, "extarcted dci - round1 %d \n", pdlsch1_harq->round); -#endif - - // I- check dci content minimum coherency - if(harq_pid>=8) - { - // LOG_I(PHY,"bad harq pid\n"); - return(0); - } - - if( (rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti) ) - { - // LOG_I(PHY,"bad rnti\n"); - return(0); - } - - - if( mcs1 > 28) - { - if(pdlsch0_harq->round == 0) - { - // LOG_I(PHY,"bad mcs1\n"); - return(0); - } - } - - if( mcs2 > 28) - { - if(pdlsch1_harq->round == 0) - { - // LOG_I(PHY,"bad mcs2\n"); - return(0); - } - } - - - if((pdlsch0_harq->round == 0) && (rv1 > 0) && (mcs1 != 0)) - { - // DCI false detection - // LOG_I(PHY,"bad rv1\n"); - return(0); - } - - if((pdlsch1_harq->round == 0) && (rv2 > 0) && (mcs2 != 0)) - { - // DCI false detection - // LOG_I(PHY,"bad rv2\n"); - return(0); - } - - - switch (N_RB_DL) { - case 6: - if (rah == 0) - { - //RBG = 1; - RIV_max = 0x3F; - } - else - { - RIV_max = RIV_max6; - } - break; - case 25: - if (rah == 0) - { - //RBG = 2; - RIV_max = 0x1FFF; - } - else - { - RIV_max = RIV_max25; - } - break; - case 50: - if (rah == 0) - { - //RBG = 3; - RIV_max = 0x1FFFF; - } - else - { - RIV_max = RIV_max50; - } - break; - case 100: - if (rah == 0) - { - //RBG = 4; - RIV_max = 0x1FFFFFF; - } - else - { - RIV_max = RIV_max100; - } - break; - } - - NPRB = conv_nprb(rah, - rballoc, - N_RB_DL); - - - - if( (rballoc > RIV_max) && (rah == 1) ) - { - // DCI false detection - // LOG_I(PHY,"bad rballoc %d RIV_max %lld\n", rballoc, RIV_max); - return(0); - } - - if(NPRB == 0) - { - // DCI false detection - // LOG_I(PHY,"bad NPRB\n"); - return(0); - } - - return(1); -} - -void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDCCH *pdcch_vars, - LTE_UE_PDSCH *pdsch_vars, - LTE_DL_UE_HARQ_t *dlsch0_harq, - uint8_t nb_rb_alloc, - uint8_t subframe) -{ - uint32_t pbch_pss_sss_re; - uint32_t crs_re; - uint32_t granted_re; - uint32_t data_re; - uint32_t llr_offset; - uint8_t symbol; - uint8_t symbol_mod; - - pdsch_vars->llr_offset[pdcch_vars->num_pdcch_symbols] = 0; - - LOG_I(PHY,"compute_llr_offset: nb RB %d - Qm %d \n", nb_rb_alloc, dlsch0_harq->Qm); - - //dlsch0_harq->rb_alloc_even; - //dlsch0_harq->rb_alloc_odd; - - for(symbol=pdcch_vars->num_pdcch_symbols; symbol<frame_parms->symbols_per_tti; symbol++) - { - symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; - if((symbol_mod == 0) || symbol_mod == (4-frame_parms->Ncp)) - { - if (frame_parms->nb_antennas_tx == 2) - crs_re = 4; - else - crs_re = 2; - } - else - { - crs_re = 0; - } - - granted_re = nb_rb_alloc * (12-crs_re); - pbch_pss_sss_re = adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,dlsch0_harq->Qm,subframe,symbol); - pbch_pss_sss_re = (double)pbch_pss_sss_re * ((double)(12-crs_re)/12); - data_re = granted_re - pbch_pss_sss_re; - llr_offset = data_re * dlsch0_harq->Qm * 2; - - pdsch_vars->llr_length[symbol] = data_re; - if(symbol < (frame_parms->symbols_per_tti-1)) - pdsch_vars->llr_offset[symbol+1] = pdsch_vars->llr_offset[symbol] + llr_offset; - - LOG_I(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb); - LOG_I(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re); - LOG_I(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re); - LOG_I(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re); - - - - LOG_I(PHY,"Data Re subframe %d-symbol %d => llr length %d, llr offset %d \n", subframe, symbol, - pdsch_vars->llr_length[symbol], pdsch_vars->llr_offset[symbol]); - } -} -void prepare_dl_decoding_format1_1A(DCI_format_t dci_format, - uint8_t N_RB_DL, - DCI_INFO_EXTRACTED_t *pdci_info_extarcted, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDCCH *pdcch_vars, - LTE_UE_PDSCH *pdsch_vars, - uint8_t subframe, - uint16_t rnti, - uint16_t tc_rnti, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - LTE_DL_UE_HARQ_t *pdlsch0_harq, - LTE_UE_DLSCH_t *pdlsch0) -{ - - uint8_t harq_pid = pdci_info_extarcted->harq_pid; - uint8_t vrb_type = pdci_info_extarcted->vrb_type; - uint32_t rballoc = pdci_info_extarcted->rballoc; - uint8_t mcs1 = pdci_info_extarcted->mcs1; - uint8_t rv1 = pdci_info_extarcted->rv1; - uint8_t ndi1 = pdci_info_extarcted->ndi1; - uint8_t TPC = pdci_info_extarcted->TPC; - uint8_t rah = pdci_info_extarcted->rah; - uint8_t dai = pdci_info_extarcted->dai; - - - uint8_t NPRB = 0; - uint8_t NPRB4TBS = 0; - - if(dci_format == format1A) - { - switch (N_RB_DL) { - case 6: - NPRB = RIV2nb_rb_LUT6[rballoc]; - break; - case 25: - NPRB = RIV2nb_rb_LUT25[rballoc]; - break; - case 50: - NPRB = RIV2nb_rb_LUT50[rballoc]; - break; - case 100: - NPRB = RIV2nb_rb_LUT100[rballoc]; - break; - } - if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) - { - NPRB4TBS = (TPC&1) + 2; - } - else - { - NPRB4TBS = NPRB; - /* - switch (N_RB_DL) { - case 6: - NPRB = RIV2nb_rb_LUT6[rballoc];//NPRB; - break; - case 25: - NPRB = RIV2nb_rb_LUT25[rballoc];//NPRB; - break; - case 50: - NPRB = RIV2nb_rb_LUT50[rballoc];//NPRB; - break; - case 100: - NPRB = RIV2nb_rb_LUT100[rballoc];//NPRB; - break; - } - - */ - } - } - else // format1 - { - NPRB = conv_nprb(rah, rballoc, N_RB_DL); - NPRB4TBS=NPRB; - } - - pdlsch0->current_harq_pid = harq_pid; - pdlsch0->active = 1; - pdlsch0->rnti = rnti; - if(dci_format == format1A) - pdlsch0->harq_ack[subframe].vDAI_DL = dai+1; - - if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) - { - pdlsch0_harq->round = 0; - pdlsch0_harq->status = ACTIVE; - } - else //CRNTI - { - if (rnti == tc_rnti) { - //fix for standalone Contention Resolution Id - pdlsch0_harq->DCINdi = (uint8_t)-1; - LOG_D(PHY,"UE (%x/%d): Format1A DCI: C-RNTI is temporary. Set NDI = %d and to be ignored\n", - rnti,harq_pid,pdlsch0_harq->DCINdi); - } - - // NDI has been toggled or this is the first transmission - if ((ndi1!=pdlsch0_harq->DCINdi) || (pdlsch0_harq->first_tx==1)) - { - pdlsch0_harq->round = 0; - pdlsch0_harq->first_tx = 0; - pdlsch0_harq->status = ACTIVE; - - }else if (rv1 != 0 ) - //NDI has not been toggled but rv was increased by eNB: retransmission - { - if (pdlsch0_harq->status == SCH_IDLE) - //packet was actually decoded in previous transmission (ACK was missed by eNB) - //However, the round is not a good check as it might have been decoded in a retransmission prior to this one. - { - // LOG_D(PHY,"skip pdsch decoding and report ack\n"); - // skip pdsch decoding and report ack - //pdlsch0_harq->status = SCH_IDLE; - pdlsch0->active = 0; - pdlsch0->harq_ack[subframe].ack = 1; - pdlsch0->harq_ack[subframe].harq_id = harq_pid; - pdlsch0->harq_ack[subframe].send_harq_status = 1; - - //pdlsch0_harq->first_tx = 0; - } - else //normal retransmission - { - // nothing special to do - } - } - else - { - pdlsch0_harq->status = ACTIVE; - } - } - - pdlsch0_harq->DCINdi = ndi1; - pdlsch0_harq->mcs = mcs1; - pdlsch0_harq->rvidx = rv1; - pdlsch0_harq->nb_rb = NPRB; - - pdlsch0_harq->codeword = 0; - pdlsch0_harq->Nl = 1; - pdlsch0_harq->mimo_mode = frame_parms->nb_antenna_ports_eNB == 1 ?SISO : ALAMOUTI; - pdlsch0_harq->dl_power_off = 1; //no power offset - pdlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC &3]; - - // compute resource allocation - if(dci_format == format1A) - { - switch (N_RB_DL) { - case 6: - if (vrb_type == LOCALIZED) { - pdlsch0_harq->rb_alloc_even[0] = localRIV2alloc_LUT6[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = localRIV2alloc_LUT6[rballoc]; - } - else { - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_even_LUT6[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_odd_LUT6[rballoc]; - } - break; - - case 25: - if (vrb_type == LOCALIZED) { - pdlsch0_harq->rb_alloc_even[0] = localRIV2alloc_LUT25[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = localRIV2alloc_LUT25[rballoc]; - } - else { - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_even_LUT25[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_odd_LUT25[rballoc]; - } - break; - - case 50: - if (vrb_type == LOCALIZED) { - pdlsch0_harq->rb_alloc_even[0] = localRIV2alloc_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = localRIV2alloc_LUT50_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = localRIV2alloc_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = localRIV2alloc_LUT50_1[rballoc]; - } else { // DISTRIBUTED - if ((rballoc&(1<<10)) == 0) { - rballoc = rballoc&(~(1<<10)); - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT50_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT50_1[rballoc]; - } - else { - rballoc = rballoc&(~(1<<10)); - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT50_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT50_1[rballoc]; - } - } - break; - - case 100: - if (vrb_type == LOCALIZED) { - pdlsch0_harq->rb_alloc_even[0] = localRIV2alloc_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = localRIV2alloc_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_even[2] = localRIV2alloc_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_even[3] = localRIV2alloc_LUT100_3[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = localRIV2alloc_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = localRIV2alloc_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[2] = localRIV2alloc_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_odd[3] = localRIV2alloc_LUT100_3[rballoc]; - } else { - if ((rballoc&(1<<10)) == 0) { //Gap 1 - rballoc = rballoc&(~(1<<12)); - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap0_even_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap0_even_LUT100_3[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap0_odd_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap0_odd_LUT100_3[rballoc]; - } - else { //Gap 2 - rballoc = rballoc&(~(1<<12)); - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap1_even_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap1_even_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap1_even_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap1_even_LUT100_3[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap1_odd_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap1_odd_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap1_odd_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap1_odd_LUT100_3[rballoc]; - } - } - break; - } - } - else // format1 - { - conv_rballoc(rah,rballoc,frame_parms->N_RB_DL,pdlsch0_harq->rb_alloc_even); - pdlsch0_harq->rb_alloc_odd[0]= pdlsch0_harq->rb_alloc_even[0]; - pdlsch0_harq->rb_alloc_odd[1]= pdlsch0_harq->rb_alloc_even[1]; - pdlsch0_harq->rb_alloc_odd[2]= pdlsch0_harq->rb_alloc_even[2]; - pdlsch0_harq->rb_alloc_odd[3]= pdlsch0_harq->rb_alloc_even[3]; - } - if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) - { - pdlsch0_harq->TBS = TBStable[mcs1][NPRB4TBS-1]; - pdlsch0_harq->Qm = 2; - } - else - { - if(mcs1 < 29) - { - pdlsch0_harq->TBS = TBStable[get_I_TBS(mcs1)][NPRB4TBS-1]; - pdlsch0_harq->Qm = get_Qm(mcs1); - } - } - - compute_llr_offset(frame_parms, - pdcch_vars, - pdsch_vars, - pdlsch0_harq, - NPRB, - subframe); -} - -void prepare_dl_decoding_format1C(uint8_t N_RB_DL, - DCI_INFO_EXTRACTED_t *pdci_info_extarcted, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDCCH *pdcch_vars, - LTE_UE_PDSCH *pdsch_vars, - uint32_t rnti, - uint32_t si_rnti, - uint32_t ra_rnti, - uint32_t p_rnti, - uint32_t frame, - uint8_t subframe, - LTE_DL_UE_HARQ_t *pdlsch0_harq, - LTE_UE_DLSCH_t *pdlsch0) -{ - - uint8_t harq_pid = pdci_info_extarcted->harq_pid; - uint32_t rballoc = pdci_info_extarcted->rballoc; - uint8_t mcs1 = pdci_info_extarcted->mcs1; - uint8_t Ngap = pdci_info_extarcted->Ngap; - - pdlsch0_harq->round = 0; - pdlsch0_harq->first_tx = 1; - pdlsch0_harq->vrb_type = DISTRIBUTED; - - if (rnti==si_rnti) { // rule from Section 5.3.1 of 36.321 - if (((frame&1) == 0) && (subframe == 5)) - pdlsch0_harq->rvidx = (((3*((frame>>1)&3))+1)>>1)&3; // SIB1 - else - pdlsch0_harq->rvidx = (((3*(subframe&3))+1)>>1)&3; // other SIBs - } - else if ((rnti==p_rnti) || (rnti==ra_rnti)) { // Section 7.1.7.3 - pdlsch0_harq->rvidx = 0; - } - - - pdlsch0_harq->Nl = 1; - pdlsch0_harq->mimo_mode = frame_parms->nb_antenna_ports_eNB == 1 ?SISO : ALAMOUTI; - pdlsch0_harq->dl_power_off = 1; //no power offset - - pdlsch0_harq->codeword = 0; - pdlsch0_harq->mcs = mcs1; - pdlsch0_harq->TBS = TBStable1C[mcs1]; - pdlsch0_harq->Qm = 2; - - - pdlsch0->current_harq_pid = harq_pid; - pdlsch0->active = 1; - pdlsch0->rnti = rnti; - - switch (N_RB_DL) { - case 6: - pdlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rballoc]; - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_even_LUT6[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_odd_LUT6[rballoc]; - - break; - - case 25: - pdlsch0_harq->nb_rb = RIV2nb_rb_LUT25[rballoc]; - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_even_LUT25[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_odd_LUT25[rballoc]; - break; - - case 50: - pdlsch0_harq->nb_rb = RIV2nb_rb_LUT50[rballoc]; - if (Ngap == 0) { - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT50_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT50_1[rballoc]; - } - else { - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap1_even_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap1_odd_LUT50_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap1_even_LUT50_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap1_odd_LUT50_1[rballoc]; - } - break; - - case 100: - pdlsch0_harq->nb_rb = RIV2nb_rb_LUT100[rballoc]; - if (Ngap==0) { - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap0_even_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap0_odd_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap0_even_LUT100_3[rballoc]; - pdlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap0_odd_LUT100_3[rballoc]; - } - else { - pdlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap1_even_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap1_odd_LUT100_0[rballoc]; - pdlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap1_even_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap1_odd_LUT100_1[rballoc]; - pdlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap1_even_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap1_odd_LUT100_2[rballoc]; - pdlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap1_even_LUT100_3[rballoc]; - pdlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap1_odd_LUT100_3[rballoc]; - } - break; - - default: - AssertFatal(0,"Format 1C: Unknown N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - compute_llr_offset(frame_parms, - pdcch_vars, - pdsch_vars, - pdlsch0_harq, - pdlsch0_harq->nb_rb, - subframe); - -} - -void compute_precoding_info_2cw(uint8_t tpmi, uint8_t tbswap, uint16_t pmi_alloc, LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_UE_HARQ_t *dlsch0_harq, LTE_DL_UE_HARQ_t *dlsch1_harq) -{ - -switch (tpmi) { - case 0: - dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1; - dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1; - dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0, 1); - dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,0, 1); - break; - case 1: - dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; - dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; - dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1, 1); - dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,1, 1); - break; - case 2: // PUSCH precoding - dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING; - dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING; - if (tbswap==0){ - dlsch0_harq->pmi_alloc = pmi_alloc; - dlsch1_harq->pmi_alloc = pmi_alloc^0x1555; - } else { - dlsch1_harq->pmi_alloc = pmi_alloc; - dlsch0_harq->pmi_alloc = pmi_alloc^0x1555; - } -#ifdef DEBUG_HARQ - printf ("\n \n compute_precoding_info_2cw pmi_alloc_new = %d\n", dlsch0_harq->pmi_alloc); - #endif - break; - default: - break; - } -} - -void compute_precoding_info_1cw(uint8_t tpmi, uint16_t pmi_alloc, LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_UE_HARQ_t *dlsch_harq) -{ - -switch (tpmi) { - case 0 : - dlsch_harq->mimo_mode = ALAMOUTI; - break; - case 1: - dlsch_harq->mimo_mode = UNIFORM_PRECODING11; - dlsch_harq->pmi_alloc = pmi_extend(frame_parms,0, 0); - break; - case 2: - dlsch_harq->mimo_mode = UNIFORM_PRECODING1m1; - dlsch_harq->pmi_alloc = pmi_extend(frame_parms,1, 0); - break; - case 3: - dlsch_harq->mimo_mode = UNIFORM_PRECODING1j; - dlsch_harq->pmi_alloc = pmi_extend(frame_parms,2, 0); - break; - case 4: - dlsch_harq->mimo_mode = UNIFORM_PRECODING1mj; - dlsch_harq->pmi_alloc = pmi_extend(frame_parms,3, 0); - break; - case 5: - dlsch_harq->mimo_mode = PUSCH_PRECODING0; - dlsch_harq->pmi_alloc = pmi_alloc;//pmi_convert(frame_parms,dlsch0->pmi_alloc,0); - break; - case 6: - dlsch_harq->mimo_mode = PUSCH_PRECODING1; - dlsch_harq->pmi_alloc = pmi_alloc;//pmi_convert(frame_parms,dlsch0->pmi_alloc,1); - break; - } - #ifdef DEBUG_HARQ - printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d with tpmi %d\n", dlsch_harq->pmi_alloc, tpmi); - #endif - } - -void compute_precoding_info_format2A(uint8_t tpmi, - uint8_t nb_antenna_ports_eNB, - uint8_t tb0_active, - uint8_t tb1_active, - LTE_DL_UE_HARQ_t *dlsch0_harq, - LTE_DL_UE_HARQ_t *dlsch1_harq) -{ - - dlsch0_harq->dl_power_off = 0; - dlsch1_harq->dl_power_off = 0; - - if (nb_antenna_ports_eNB == 2) { - if ((tb0_active==1) && (tb1_active==1)) { - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - } else { - dlsch0_harq->mimo_mode = ALAMOUTI; - dlsch1_harq->mimo_mode = ALAMOUTI; - } - } else if (nb_antenna_ports_eNB == 4) { // 4 antenna case - if ((tb0_active==1) && (tb1_active==1)) { - switch (tpmi) { - case 0: // one layer per transport block - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - break; - - case 1: // one-layers on TB 0, two on TB 1 - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->Nl = 2; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - break; - - case 2: // two-layers on TB 0, two on TB 1 - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->Nl = 2; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - break; - - case 3: // - LOG_E(PHY,"Illegal value (3) for TPMI in Format 2A DCI\n"); - break; - } - } else if (tb0_active == 1) { - switch (tpmi) { - case 0: // one layer per transport block - dlsch0_harq->mimo_mode = ALAMOUTI; - dlsch1_harq->mimo_mode = ALAMOUTI; - break; - - case 1: // two-layers on TB 0 - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->Nl = 2; - dlsch0_harq->dl_power_off = 1; - break; - - case 2: // two-layers on TB 0, two on TB 1 - case 3: // - LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",tpmi); - break; - } - } else if (tb1_active == 1) { - switch (tpmi) { - case 0: // one layer per transport block - dlsch0_harq->mimo_mode = ALAMOUTI; - dlsch1_harq->mimo_mode = ALAMOUTI; - break; - - case 1: // two-layers on TB 0 - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->Nl = 2; - dlsch0_harq->dl_power_off = 1; - break; - - case 2: // two-layers on TB 0, two on TB 1 - case 3: // - LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",tpmi); - break; - } - } - } - // printf("Format 2A: NPRB=%d (rballoc %x,mcs1 %d, mcs2 %d, frame_type %d N_RB_DL %d,active %d/%d)\n",NPRB,rballoc,mcs1,mcs2,frame_parms->frame_type,frame_parms->N_RB_DL,dlsch0->active,dlsch1->active); - //printf("UE (%x/%d): Subframe %d Format2A DCI: ndi1 %d, old_ndi1 %d, ndi2 %d, old_ndi2 %d (first tx1 %d, first tx2 %d) harq_status1 %d, harq_status2 %d\n",dlsch0->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi, - // dlsch0_harq->first_tx,dlsch1_harq->first_tx,dlsch0_harq->status,dlsch1_harq->status); - //printf("TBS0 %d, TBS1 %d\n",dlsch0_harq->TBS,dlsch1_harq->TBS); - -} - -void prepare_dl_decoding_format2_2A(DCI_format_t dci_format, - DCI_INFO_EXTRACTED_t *pdci_info_extarcted, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDCCH *pdcch_vars, - LTE_UE_PDSCH *pdsch_vars, - uint16_t rnti, - uint8_t subframe, - LTE_DL_UE_HARQ_t *dlsch0_harq, - LTE_DL_UE_HARQ_t *dlsch1_harq, - LTE_UE_DLSCH_t *pdlsch0, - LTE_UE_DLSCH_t *pdlsch1) -{ - - uint8_t rah = pdci_info_extarcted->rah; - uint8_t mcs1 = pdci_info_extarcted->mcs1; - uint8_t mcs2 = pdci_info_extarcted->mcs2; - uint8_t rv1 = pdci_info_extarcted->rv1; - uint8_t rv2 = pdci_info_extarcted->rv2; - uint8_t harq_pid = pdci_info_extarcted->harq_pid; - uint32_t rballoc = pdci_info_extarcted->rballoc; - uint8_t tbswap = pdci_info_extarcted->tb_swap; - uint8_t tpmi = pdci_info_extarcted->tpmi; - uint8_t TPC = pdci_info_extarcted->TPC; - uint8_t ndi1 = pdci_info_extarcted->ndi1; - uint8_t ndi2 = pdci_info_extarcted->ndi2; - - uint8_t TB0_active = 1; - uint8_t TB1_active = 1; - - // printf("inside prepare pdlsch1->pmi_alloc %d \n",pdlsch1->pmi_alloc); - - - if ((rv1 == 1) && (mcs1 == 0)) { - TB0_active=0; - } - if ((rv2 == 1) && (mcs2 == 0)) { - TB1_active=0; - } - -#ifdef DEBUG_HARQ - printf("[DCI UE]: TB0 status %d , TB1 status %d\n", TB0_active, TB1_active); -#endif - - dlsch0_harq->mcs = mcs1; - dlsch1_harq->mcs = mcs2; - dlsch0_harq->rvidx = rv1; - dlsch1_harq->rvidx = rv2; - dlsch0_harq->DCINdi = ndi1; - dlsch1_harq->DCINdi = ndi2; - - dlsch0_harq->codeword = 0; - dlsch1_harq->codeword = 1; - dlsch0_harq->Nl = 1; - dlsch1_harq->Nl = 1; - dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3]; - dlsch1_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3]; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - - pdlsch0->current_harq_pid = harq_pid; - pdlsch0->harq_ack[subframe].harq_id = harq_pid; - pdlsch1->current_harq_pid = harq_pid; - pdlsch1->harq_ack[subframe].harq_id = harq_pid; - - // assume two CW are active - dlsch0_harq->status = ACTIVE; - dlsch1_harq->status = ACTIVE; - pdlsch0->active = 1; - pdlsch1->active = 1; - pdlsch0->rnti = rnti; - pdlsch1->rnti = rnti; - - - if (TB0_active && TB1_active && tbswap==1) { - dlsch0_harq->codeword = 1; - dlsch1_harq->codeword = 0; - } - - - if (!TB0_active && TB1_active){ - dlsch1_harq->codeword = 0; - } - - if (TB0_active && !TB1_active){ - dlsch0_harq->codeword = 0; - } - - - if (TB0_active==0) { - dlsch0_harq->status = SCH_IDLE; - pdlsch0->active = 0; - #ifdef DEBUG_HARQ - printf("[DCI UE]: TB0 is deactivated, retransmit TB1 transmit in TM6\n"); - #endif - } - - if (TB1_active==0) { - dlsch1_harq->status = SCH_IDLE; - pdlsch1->active = 0; - } - -#ifdef DEBUG_HARQ - printf("[DCI UE]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status); -#endif - - // compute resource allocation - if (TB0_active == 1){ - - dlsch0_harq->nb_rb = conv_nprb(rah, - rballoc, - frame_parms->N_RB_DL); - conv_rballoc(rah, - rballoc, - frame_parms->N_RB_DL, - dlsch0_harq->rb_alloc_even); - - dlsch0_harq->rb_alloc_odd[0]= dlsch0_harq->rb_alloc_even[0]; - dlsch0_harq->rb_alloc_odd[1]= dlsch0_harq->rb_alloc_even[1]; - dlsch0_harq->rb_alloc_odd[2]= dlsch0_harq->rb_alloc_even[2]; - dlsch0_harq->rb_alloc_odd[3]= dlsch0_harq->rb_alloc_even[3]; - - if (TB1_active == 1){ - dlsch1_harq->rb_alloc_even[0]= dlsch0_harq->rb_alloc_even[0]; - dlsch1_harq->rb_alloc_even[1]= dlsch0_harq->rb_alloc_even[1]; - dlsch1_harq->rb_alloc_even[2]= dlsch0_harq->rb_alloc_even[2]; - dlsch1_harq->rb_alloc_even[3]= dlsch0_harq->rb_alloc_even[3]; - dlsch1_harq->rb_alloc_odd[0] = dlsch0_harq->rb_alloc_odd[0]; - dlsch1_harq->rb_alloc_odd[1] = dlsch0_harq->rb_alloc_odd[1]; - dlsch1_harq->rb_alloc_odd[2] = dlsch0_harq->rb_alloc_odd[2]; - dlsch1_harq->rb_alloc_odd[3] = dlsch0_harq->rb_alloc_odd[3]; - - dlsch1_harq->nb_rb = dlsch0_harq->nb_rb; - - //dlsch0_harq->Nl = 1; - //dlsch1_harq->Nl = 1; - } - } else if ((TB0_active == 0) && (TB1_active == 1)){ - - conv_rballoc(rah, - rballoc, - frame_parms->N_RB_DL, - dlsch1_harq->rb_alloc_even); - - dlsch1_harq->rb_alloc_odd[0]= dlsch1_harq->rb_alloc_even[0]; - dlsch1_harq->rb_alloc_odd[1]= dlsch1_harq->rb_alloc_even[1]; - dlsch1_harq->rb_alloc_odd[2]= dlsch1_harq->rb_alloc_even[2]; - dlsch1_harq->rb_alloc_odd[3]= dlsch1_harq->rb_alloc_even[3]; - dlsch1_harq->nb_rb = conv_nprb(rah, - rballoc, - frame_parms->N_RB_DL); - } - - - // compute precoding matrix + mimo mode - if(dci_format == format2) - { - if ((TB0_active) && (TB1_active)){ //two CW active - compute_precoding_info_2cw(tpmi, tbswap, pdlsch0->pmi_alloc,frame_parms, dlsch0_harq, dlsch1_harq); - - // printf("[DCI UE 1]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status); - } else if ((TB0_active) && (!TB1_active)) { // only CW 0 active - compute_precoding_info_1cw(tpmi, pdlsch0->pmi_alloc, frame_parms, dlsch0_harq); - } else { - compute_precoding_info_1cw(tpmi, pdlsch1->pmi_alloc, frame_parms, dlsch1_harq); - // printf("I am doing compute_precoding_info_1cw with tpmi %d \n", tpmi); - } - //printf(" UE DCI harq0 MIMO mode = %d\n", dlsch0_harq->mimo_mode); - if ((frame_parms->nb_antenna_ports_eNB == 1) && (TB0_active)) - dlsch0_harq->mimo_mode = SISO; - } - else - { - compute_precoding_info_format2A( tpmi, - frame_parms->nb_antenna_ports_eNB, - TB0_active, - TB1_active, - dlsch0_harq, - dlsch1_harq); - } - // printf("[DCI UE 2]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status); - // reset round + compute Qm - if (TB0_active) { - // printf("TB0 ndi1 =%d, dlsch0_harq->DCINdi =%d, dlsch0_harq->first_tx = %d\n", ndi1, dlsch0_harq->DCINdi, dlsch0_harq->first_tx); - if ((ndi1!=dlsch0_harq->DCINdi) || (dlsch0_harq->first_tx==1)) { - dlsch0_harq->round = 0; - dlsch0_harq->status = ACTIVE; - dlsch0_harq->DCINdi = ndi1; - - //LOG_I(PHY,"[UE] DLSCH: New Data Indicator CW0 subframe %d (pid %d, round %d)\n", - // subframe,harq_pid,dlsch0_harq->round); - if ( dlsch0_harq->first_tx==1) { - // LOG_D(PHY,"Format 2 DCI First TX0: Clearing flag\n"); - dlsch0_harq->first_tx = 0; - } - } - /*else if (rv1 != 0 ) - //NDI has not been toggled but rv was increased by eNB: retransmission - { - if(dlsch0_harq->status == SCH_IDLE) { - // skip pdsch decoding and report ack - //dlsch0_harq->status = SCH_IDLE; - pdlsch0->active = 0; - pdlsch0->harq_ack[subframe].ack = 1; - pdlsch0->harq_ack[subframe].harq_id = harq_pid; - pdlsch0->harq_ack[subframe].send_harq_status = 1; - }*/ - - // if Imcs in [29..31] TBS is assumed to be as determined from DCI transported in the latest - // PDCCH for the same trasport block using Imcs in [0 .. 28] - if(dlsch0_harq->mcs <= 28) - { - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - LOG_D(PHY,"[UE] DLSCH: New TBS CW0 subframe %d (pid %d, round %d) TBS %d \n", - subframe,harq_pid,dlsch0_harq->round, dlsch0_harq->TBS); - } - else - { - LOG_D(PHY,"[UE] DLSCH: Keep the same TBS CW0 subframe %d (pid %d, round %d) TBS %d \n", - subframe,harq_pid,dlsch0_harq->round, dlsch0_harq->TBS); - } - //if(dlsch0_harq->Nl == 2) - //dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][(dlsch0_harq->nb_rb<<1)-1]; - if (mcs1 <= 28) - dlsch0_harq->Qm = get_Qm(mcs1); - else if (mcs1<=31) - dlsch0_harq->Qm = (mcs1-28)<<1; - } - - // printf("[DCI UE 3]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status); - - if (TB1_active) { - // printf("TB1 ndi2 =%d, dlsch1_harq->DCINdi =%d, dlsch1_harq->first_tx = %d\n", ndi2, dlsch1_harq->DCINdi, dlsch1_harq->first_tx); - if ((ndi2!=dlsch1_harq->DCINdi) || (dlsch1_harq->first_tx==1)) { - dlsch1_harq->round = 0; - dlsch1_harq->status = ACTIVE; - dlsch1_harq->DCINdi = ndi2; - //LOG_I(PHY,"[UE] DLSCH: New Data Indicator CW1 subframe %d (pid %d, round %d)\n", - // subframe,harq_pid,dlsch0_harq->round); - if (dlsch1_harq->first_tx==1) { - // LOG_D(PHY,"Format 2 DCI First TX1: Clearing flag\n"); - dlsch1_harq->first_tx = 0; - } - } - /*else if (rv1 != 0 ) - //NDI has not been toggled but rv was increased by eNB: retransmission - { - if(dlsch1_harq->status == SCH_IDLE) { - // skip pdsch decoding and report ack - //dlsch1_harq->status = SCH_IDLE; - pdlsch1->active = 0; - pdlsch1->harq_ack[subframe].ack = 1; - pdlsch1->harq_ack[subframe].harq_id = harq_pid; - pdlsch1->harq_ack[subframe].send_harq_status = 1; - } - }*/ - - // if Imcs in [29..31] TBS is assumed to be as determined from DCI transported in the latest - // PDCCH for the same trasport block using Imcs in [0 .. 28] - if(dlsch1_harq->mcs <= 28) - { - dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1]; - LOG_D(PHY,"[UE] DLSCH: New TBS CW1 subframe %d (pid %d, round %d) TBS %d \n", - subframe,harq_pid,dlsch1_harq->round, dlsch1_harq->TBS); - } - else - { - LOG_D(PHY,"[UE] DLSCH: Keep the same TBS CW1 subframe %d (pid %d, round %d) TBS %d \n", - subframe,harq_pid,dlsch1_harq->round, dlsch1_harq->TBS); - } - if (mcs2 <= 28) - dlsch1_harq->Qm = get_Qm(mcs2); - else if (mcs1<=31) - dlsch1_harq->Qm = (mcs2-28)<<1; - } - - - compute_llr_offset(frame_parms, - pdcch_vars, - pdsch_vars, - dlsch0_harq, - dlsch0_harq->nb_rb, - subframe); - - - /* #ifdef DEBUG_HARQ - printf("[DCI UE]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status); - printf("[DCI UE]: TB0_active %d , TB1_active %d\n", TB0_active, TB1_active); - if (dlsch0 != NULL && dlsch1 != NULL) - printf("[DCI UE] dlsch0_harq status = %d, dlsch1_harq status = %d\n", dlsch0_harq->status, dlsch1_harq->status); - else if (dlsch0 == NULL && dlsch1 != NULL) - printf("[DCI UE] dlsch0_harq NULL dlsch1_harq status = %d\n", dlsch1_harq->status); - else if (dlsch0 != NULL && dlsch1 == NULL) - printf("[DCI UE] dlsch1_harq NULL dlsch0_harq status = %d\n", dlsch0_harq->status); - #endif*/ -} - -int generate_ue_dlsch_params_from_dci(int frame, - uint8_t subframe, - void *dci_pdu, - uint16_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) -{ - - uint8_t harq_pid=0; - uint8_t frame_type=frame_parms->frame_type; - uint8_t tpmi=0; - LTE_UE_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; - LTE_DL_UE_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; - - DCI_INFO_EXTRACTED_t dci_info_extarcted; - uint8_t status=0; - - if (!dlsch[0]) return -1; - - #ifdef DEBUG_DCI - LOG_D(PHY,"dci_tools.c: Filling ue dlsch params -> rnti %x, SFN/SF %d/%d, dci_format %s\n", - rnti, - frame%1024, - subframe, - (dci_format==format0? "Format 0":( - dci_format==format1? "format 1":( - dci_format==format1A? "format 1A":( - dci_format==format1B? "format 1B":( - dci_format==format1C? "format 1C":( - dci_format==format1D? "format 1D":( - dci_format==format1E_2A_M10PRB? "format 1E_2A_M10PRB":( - dci_format==format2? "format 2":( - dci_format==format2A? "format 2A":( - dci_format==format2B? "format 2B":( - dci_format==format2C? "format 2C":( - dci_format==format2D? "format 2D":( - dci_format==format3? "format 3": "UNKNOWN" - )))))))))))))); - #endif - - memset(&dci_info_extarcted,0,sizeof(dci_info_extarcted)); - switch (dci_format) { - - case format0: // This is an ULSCH allocation so nothing here, inform MAC - LOG_E(PHY,"format0 not possible\n"); - return(-1); - break; - - case format1A: - { - // extract dci infomation -#ifdef DEBUG_DCI - LOG_I(PHY,"[DCI-FORMAT-1A] AbsSubframe %d.%d extarct dci info \n", frame, subframe); -#endif - extract_dci1A_info(frame_parms->N_RB_DL, - frame_type, - dci_pdu, - &dci_info_extarcted); - - - // check dci content - dlsch0 = dlsch[0]; - dlsch0->active = 0; - dlsch0_harq = dlsch[0]->harq_processes[dci_info_extarcted.harq_pid]; -#ifdef DEBUG_DCI - LOG_I(PHY,"[DCI-FORMAT-1A] AbsSubframe %d.%d check dci coherency \n", frame, subframe); -#endif - status = check_dci_format1_1a_coherency(format1A, - frame_parms->N_RB_DL, - rnti, - tc_rnti, - si_rnti, - ra_rnti, - p_rnti,frame,subframe, - &dci_info_extarcted, - dlsch0_harq); - if(status == 0) - { - printf("bad DCI 1A !!! \n"); - return(-1); - } - - // dci is correct ==> update internal structure and prepare dl decoding -#ifdef DEBUG_DCI - LOG_I(PHY,"[DCI-FORMAT-1A] AbsSubframe %d.%d prepare dl decoding \n", frame, subframe); -#endif - prepare_dl_decoding_format1_1A(format1A, - frame_parms->N_RB_DL, - &dci_info_extarcted, - frame_parms, - pdcch_vars, - pdsch_vars, - subframe, - rnti, - tc_rnti, - si_rnti, - ra_rnti, - p_rnti, - dlsch0_harq, - dlsch0); - - - - break; - } - case format1C: - { - // extract dci infomation -#ifdef DEBUG_DL_DECODING - LOG_I(PHY,"[DCI Format-1C] extact dci information \n"); -#endif - extract_dci1C_info(frame_parms->N_RB_DL, - frame_type, - dci_pdu, - &dci_info_extarcted); - - - // check dci content -#ifdef DEBUG_DL_DECODING - LOG_I(PHY,"[DCI Format-1C] check dci content \n"); -#endif - dlsch0 = dlsch[0]; - dlsch0->active = 0; - dlsch0_harq = dlsch[0]->harq_processes[dci_info_extarcted.harq_pid]; - - status = check_dci_format1c_coherency(frame_parms->N_RB_DL, - &dci_info_extarcted, - rnti, - si_rnti, - ra_rnti, - p_rnti, - dlsch0_harq); - if(status == 0) - return(-1); - - // dci is correct ==> update internal structure and prepare dl decoding -#ifdef DEBUG_DL_DECODING - LOG_I(PHY,"[DCI Format-1C] prepare downlink decoding \n"); -#endif - prepare_dl_decoding_format1C(frame_parms->N_RB_DL, - &dci_info_extarcted, - frame_parms, - pdcch_vars, - pdsch_vars, - rnti, - si_rnti, - ra_rnti, - p_rnti, - frame, - subframe, - dlsch0_harq, - dlsch0); - - break; - } - - case format1: - { - // extract dci infomation -#ifdef DEBUG_DCI - LOG_I(PHY,"[DCI-FORMAT-1] AbsSubframe %d.%d extarct dci info \n", frame, subframe); -#endif - extract_dci1_info(frame_parms->N_RB_DL, - frame_type, - dci_pdu, - &dci_info_extarcted); - - // check dci content - dlsch0 = dlsch[0]; - dlsch0->active = 0; - dlsch0_harq = dlsch[0]->harq_processes[dci_info_extarcted.harq_pid]; - -#ifdef DEBUG_DCI - LOG_I(PHY,"[DCI-FORMAT-1] AbsSubframe %d.%d check dci coherency \n", frame, subframe); -#endif - status = check_dci_format1_1a_coherency(format1, - frame_parms->N_RB_DL, - rnti, - tc_rnti, - si_rnti, - ra_rnti, - p_rnti,frame,subframe, - &dci_info_extarcted, - dlsch0_harq); - if(status == 0) - { - printf("bad DCI 1 !!! \n"); - return(-1); - } - - - // dci is correct ==> update internal structure and prepare dl decoding -#ifdef DEBUG_DCI - LOG_I(PHY,"[DCI-FORMAT-1] AbsSubframe %d.%d prepare dl decoding \n", frame, subframe); -#endif - prepare_dl_decoding_format1_1A(format1, - frame_parms->N_RB_DL, - &dci_info_extarcted, - frame_parms, - pdcch_vars, - pdsch_vars, - subframe, - rnti, - tc_rnti, - si_rnti, - ra_rnti, - p_rnti, - dlsch0_harq, - dlsch0); - break; - } - - case format2: - { - // extract dci infomation - //LOG_I(PHY,"[DCI-format2] AbsSubframe %d.%d extract dci infomation \n", frame, subframe); - extract_dci2_info(frame_parms->N_RB_DL, - frame_type, - frame_parms->nb_antenna_ports_eNB, - dci_pdu, - &dci_info_extarcted); - - - // check dci content - dlsch[0]->active = 1; - dlsch[1]->active = 1; - - dlsch0 = dlsch[0]; - dlsch1 = dlsch[1]; - - dlsch0_harq = dlsch0->harq_processes[dci_info_extarcted.harq_pid]; - dlsch1_harq = dlsch1->harq_processes[dci_info_extarcted.harq_pid]; - // printf("before coherency dlsch[1]->pmi_alloc %d\n",dlsch[1]->pmi_alloc); - // printf("before coherency dlsch1->pmi_alloc %d\n",dlsch1->pmi_alloc); - // printf("before coherency dlsch1_harq->pmi_alloc %d\n",dlsch1_harq->pmi_alloc); - - //LOG_I(PHY,"[DCI-format2] check dci content \n"); - status = check_dci_format2_2a_coherency(format2, - frame_parms->N_RB_DL, - &dci_info_extarcted, - rnti, - si_rnti, - ra_rnti, - p_rnti, - dlsch0_harq, - dlsch1_harq); - if(status == 0) - return(-1); - - - // dci is correct ==> update internal structure and prepare dl decoding - //LOG_I(PHY,"[DCI-format2] update internal structure and prepare dl decoding \n"); - prepare_dl_decoding_format2_2A(format2, - &dci_info_extarcted, - frame_parms, - pdcch_vars, - pdsch_vars, - rnti, - subframe, - dlsch0_harq, - dlsch1_harq, - dlsch0, - dlsch1); - } - break; - - case format2A: - { - // extract dci infomation - LOG_I(PHY,"[DCI-format2] AbsSubframe %d.%d extract dci infomation \n", frame%1024, subframe); - extract_dci2A_info(frame_parms->N_RB_DL, - frame_type, - frame_parms->nb_antenna_ports_eNB, - dci_pdu, - &dci_info_extarcted); - - // check dci content - //LOG_I(PHY,"[DCI-format2A] check dci content \n"); - //LOG_I(PHY,"[DCI-format2A] tb_swap %d harq_pid %d\n", dci_info_extarcted.tb_swap, dci_info_extarcted.harq_pid); - //dlsch[0]->active = 0; - //dlsch[1]->active = 0; - - if (dci_info_extarcted.tb_swap == 0) { - dlsch0 = dlsch[0]; - dlsch1 = dlsch[1]; - } else { - dlsch0 = dlsch[1]; - dlsch1 = dlsch[0]; - } - dlsch0_harq = dlsch0->harq_processes[dci_info_extarcted.harq_pid]; - dlsch1_harq = dlsch1->harq_processes[dci_info_extarcted.harq_pid]; - - //LOG_I(PHY,"[DCI-format2A] check dci content \n"); - status = check_dci_format2_2a_coherency(format2A, - frame_parms->N_RB_DL, - &dci_info_extarcted, - rnti, - si_rnti, - ra_rnti, - p_rnti, - dlsch0_harq, - dlsch1_harq); - if(status == 0) - return(-1); - - // dci is correct ==> update internal structure and prepare dl decoding - //LOG_I(PHY,"[DCI-format2A] update internal structure and prepare dl decoding \n"); - prepare_dl_decoding_format2_2A(format2A, - &dci_info_extarcted, - frame_parms, - pdcch_vars, - pdsch_vars, - rnti, - subframe, - dlsch0_harq, - dlsch1_harq, - dlsch0, - dlsch1); - } - break; - - case format1E_2A_M10PRB: - if (!dlsch[0]) return -1; - - harq_pid = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->harq_pid; - - if (harq_pid>=8) { - LOG_E(PHY,"Format 1E_2A_M10PRB: harq_pid=%d >= 8\n", harq_pid); - return(-1); - } - - dlsch[0]->current_harq_pid = harq_pid; - dlsch[0]->harq_ack[subframe].harq_id = harq_pid; - - /* - tbswap = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->tb_swap; - if (tbswap == 0) { - dlsch0 = dlsch[0]; - dlsch1 = dlsch[1]; - } - else{ - dlsch0 = dlsch[1]; - dlsch1 = dlsch[0]; - } - */ - dlsch0 = dlsch[0]; - - dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; - // Needs to be checked - dlsch0_harq->codeword=0; - conv_rballoc(((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rah, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rballoc,frame_parms->N_RB_DL, - dlsch0_harq->rb_alloc_even); - - dlsch0_harq->rb_alloc_odd[0] = dlsch0_harq->rb_alloc_even[0]; - dlsch0_harq->rb_alloc_odd[1] = dlsch0_harq->rb_alloc_even[1]; - dlsch0_harq->rb_alloc_odd[2] = dlsch0_harq->rb_alloc_even[2]; - dlsch0_harq->rb_alloc_odd[3] = dlsch0_harq->rb_alloc_even[3]; - /* - dlsch1_harq->rb_alloc_even[0] = dlsch0_harq->rb_alloc_even[0]; - dlsch1_harq->rb_alloc_even[1] = dlsch0_harq->rb_alloc_even[1]; - dlsch1_harq->rb_alloc_even[2] = dlsch0_harq->rb_alloc_even[2]; - dlsch1_harq->rb_alloc_even[3] = dlsch0_harq->rb_alloc_even[3]; - */ - dlsch0_harq->nb_rb = conv_nprb(((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rah, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rballoc, - frame_parms->N_RB_DL); - //dlsch1_harq->nb_rb = dlsch0_harq->nb_rb; - - dlsch0_harq->mcs = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->mcs; - dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->TPC&3]; - - - - /* - if (dlsch0_harq->mcs>20) { - printf("dci_tools.c: mcs > 20 disabled for now (asked %d)\n",dlsch0_harq->mcs); - return(-1); - } - */ - - //dlsch1_harq->mcs = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->mcs2; - dlsch0_harq->rvidx = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rv; - //dlsch1_harq->rvidx = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rv2; - - // check if either TB is disabled (see 36-213 V8.6 p. 26) - - if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) { - dlsch0_harq->status = DISABLED; - } - - //if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) { - //dlsch1_harq->status = DISABLED; - //} - dlsch0_harq->Nl = 1; - - //dlsch0->layer_index = tbswap; - //dlsch1->layer_index = 1-tbswap; - - - // Fix this - tpmi = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->tpmi; - // printf("ue: tpmi %d\n",tpmi); - - switch (tpmi) { - case 0 : - dlsch0_harq->mimo_mode = ALAMOUTI; - break; - - case 1: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING11; - dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0,0); - break; - - case 2: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1; - dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1, 0); - break; - - case 3: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j; - dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,2, 0); - - break; - - case 4: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj; - dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,3, 0); - break; - - case 5: - dlsch0_harq->mimo_mode = PUSCH_PRECODING0; - // pmi stored from ulsch allocation routine - dlsch0_harq->pmi_alloc = dlsch0->pmi_alloc; - //LOG_I(PHY,"XXX using PMI %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc)); - break; - - - case 6: - dlsch0_harq->mimo_mode = PUSCH_PRECODING1; - LOG_E(PHY,"Unsupported TPMI\n"); - return(-1); - break; - } - - - if (frame_parms->nb_antenna_ports_eNB == 1) - dlsch0_harq->mimo_mode = SISO; - - - if ((dlsch0_harq->DCINdi != ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi) || - (dlsch0_harq->first_tx==1)) { - - dlsch0_harq->round = 0; - dlsch0_harq->first_tx = 0; - dlsch0_harq->status = ACTIVE; - } - /* - else if (dlsch0_harq->status == SCH_IDLE) { // we got same ndi for a previously decoded process, - // this happens if either another harq process in the same - // is NAK or an ACK was not received - - dlsch0->harq_ack[subframe].ack = 1; - dlsch0->harq_ack[subframe].harq_id = harq_pid; - dlsch0->harq_ack[subframe].send_harq_status = 1; - dlsch0->active = 0; - return(0); - } - */ - - dlsch0_harq->DCINdi = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi; - dlsch0_harq->mcs = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->mcs; - - if (dlsch0_harq->nb_rb>1) { - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - } else - dlsch0_harq->TBS =0; - - dlsch0->rnti = rnti; - //dlsch1->rnti = rnti; - - dlsch0->active = 1; - //dlsch1->active = 1; - - dlsch0_harq->dl_power_off = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->dl_power_off; - //dlsch1_harq->dl_power_off = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->dl_power_off; - - - break; - - default: - LOG_E(PHY,"format %d not yet implemented\n",dci_format); - return(-1); - break; - } - -#ifdef UE_DEBUG_TRACE - - if (dlsch[0] && (dlsch[0]->rnti != 0xffff)) { - LOG_I(PHY,"dci_format:%d Abssubframe: %d.%d \n",dci_format,frame%1024,subframe); - LOG_I(PHY,"PDSCH dlsch0 UE: rnti %x\n",dlsch[0]->rnti); - LOG_D(PHY,"PDSCH dlsch0 UE: NBRB %d\n",dlsch0_harq->nb_rb); - LOG_D(PHY,"PDSCH dlsch0 UE: rballoc %x\n",dlsch0_harq->rb_alloc_even[0]); - LOG_I(PHY,"PDSCH dlsch0 UE: harq_pid %d\n",dci_info_extarcted.harq_pid); - LOG_I(PHY,"PDSCH dlsch0 UE: g %d\n",dlsch[0]->g_pucch); - LOG_D(PHY,"PDSCH dlsch0 UE: round %d\n",dlsch0_harq->round); - LOG_D(PHY,"PDSCH dlsch0 UE: DCINdi %d\n",dlsch0_harq->DCINdi); - LOG_D(PHY,"PDSCH dlsch0 UE: rvidx %d\n",dlsch0_harq->rvidx); - LOG_D(PHY,"PDSCH dlsch0 UE: TBS %d\n",dlsch0_harq->TBS); - LOG_D(PHY,"PDSCH dlsch0 UE: mcs %d\n",dlsch0_harq->mcs); - LOG_D(PHY,"PDSCH dlsch0 UE: pwr_off %d\n",dlsch0_harq->dl_power_off); - } -#endif - -#if T_TRACER - if( (dlsch[0]->rnti != si_rnti) && (dlsch[0]->rnti != ra_rnti) && (dlsch[0]->rnti != p_rnti)) - { - T(T_UE_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame%1024), T_INT(subframe), - T_INT(dlsch[0]->rnti), T_INT(dci_format), - T_INT(harq_pid), - T_INT(dlsch0_harq->mcs), - T_INT(dlsch0_harq->TBS)); - } -#endif - - - // compute DL power control parameters - if (dlsch0_harq != NULL){ - computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antenna_ports_eNB); - computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antenna_ports_eNB,dlsch[0],dlsch0_harq->dl_power_off); - } - - if (dlsch1_harq != NULL) { - computeRhoA_UE(pdsch_config_dedicated, dlsch[1],dlsch1_harq->dl_power_off, frame_parms->nb_antenna_ports_eNB); - computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antenna_ports_eNB,dlsch[1],dlsch1_harq->dl_power_off); - } - - - return(0); -} - - -uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe) -{ - uint8_t ret = 255; - - if (frame_parms->frame_type == FDD) { - ret = (((frame*10)+subframe)&7); - } else { - - switch (frame_parms->tdd_config) { - - case 1: - if ((subframe==2) || - (subframe==3) || - (subframe==7) || - (subframe==8)) - switch (subframe) { - case 2: - case 3: - ret = (subframe-2); - break; - - case 7: - case 8: - ret = (subframe-5); - break; - - default: - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - break; - } - - break; - - case 2: - if ((subframe!=2) && (subframe!=7)) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret=255; - } - else ret = (subframe/7); - break; - - case 3: - if ((subframe<2) || (subframe>4)) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - } - else ret = (subframe-2); - break; - - case 4: - if ((subframe<2) || (subframe>3)) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - } - else ret = (subframe-2); - break; - - case 5: - if (subframe!=2) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - } - else ret = (subframe-2); - break; - - default: - LOG_E(PHY,"subframe2_harq_pid, Unsupported TDD mode %d\n",frame_parms->tdd_config); - ret = (255); - } - } - - AssertFatal(ret!=255, - "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frame, subframe); - return ret; -} - -uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) -{ - uint8_t ul_subframe = 255; - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 1) && - ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 - ul_subframe = ((n+6)%10); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - ((n==0)||(n==1)||(n==5)||(n==6))) - ul_subframe = ((n+7)%10); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - (n==9)) // tdd_config 6 SF 9 - ul_subframe = ((n+5)%10); - else - ul_subframe = ((n+4)%10); - - AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n); - - LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe); - return ul_subframe; -} - -uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) -{ - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 1) && - ((n==7)||(n==2))) // tdd_config 0,1 SF 1,5 - return((n==7)? 1 : 6); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - ((n==7)||(n==8)||(n==2)||(n==3))) - return((n+3)%10); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - (n==4)) // tdd_config 6 SF 9 - return(9); - else - return((n+6)%10); -} - -uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n) -{ - uint32_t ul_frame; - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 1) && - ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 - ul_frame = (frame + (n==1 ? 0 : 1)); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - ((n==0)||(n==1)||(n==5)||(n==6))) - ul_frame = (frame + (n>=5 ? 1 : 0)); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - (n==9)) // tdd_config 6 SF 9 - ul_frame = (frame+1); - else - ul_frame = (frame+(n>=6 ? 1 : 0)); - - LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame); - return ul_frame % 1024; -} - -int32_t pmi_convert_rank1_from_rank2(uint16_t pmi_alloc, int tpmi, int nb_rb) -{ - int nb_subbands = 0; - int32_t pmi_alloc_new = 0, pmi_new = 0, pmi_old = 0; - int i; - - switch (nb_rb) { - case 6: - nb_subbands = 6; - break; - default: - case 25: - nb_subbands = 7; - break; - case 50: - nb_subbands = 9; - break; - case 100: - nb_subbands = 13; - break; - } - - for (i = 0; i < nb_subbands; i++) { - pmi_old = (pmi_alloc >> i)&1; - - if (pmi_old == 0) - if (tpmi == 5) - pmi_new = 0; - else - pmi_new = 1; - else - if (tpmi == 5) - pmi_new = 2; - else - pmi_new = 3; - - pmi_alloc_new|=pmi_new<<(2*i); - - } -#ifdef DEBUG_HARQ -printf(" [DCI UE] pmi_alloc_old %d, pmi_alloc_new %d pmi_old %d , pmi_new %d\n", pmi_alloc, pmi_alloc_new,pmi_old, pmi_new ); -#endif -return(pmi_alloc_new); - -} - -uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb) -{ - - int i, aarx; - uint16_t pmiq=0; - uint32_t pmivect = 0; - uint8_t rank = meas->rank[eNB_id]; - int pmi_re,pmi_im; - int nb_subbands=0; - - - switch (nb_rb) { - case 6: - nb_subbands = 6; - break; - default: - case 25: - nb_subbands = 7; - break; - case 50: - nb_subbands = 9; - break; - case 100: - nb_subbands = 13; - break; - } - - - for (i=0; i<nb_subbands; i++) { - pmi_re = 0; - pmi_im = 0; - - if (rank == 0) { - for (aarx=0; aarx<meas->nb_antennas_rx; aarx++) { - pmi_re += meas->subband_pmi_re[eNB_id][i][aarx]; - pmi_im += meas->subband_pmi_im[eNB_id][i][aarx]; - } - - // pmi_re = meas->subband_pmi_re[eNB_id][i][meas->selected_rx_antennas[eNB_id][i]]; - // pmi_im = meas->subband_pmi_im[eNB_id][i][meas->selected_rx_antennas[eNB_id][i]]; - - // printf("pmi => (%d,%d)\n",pmi_re,pmi_im); - if ((pmi_re > pmi_im) && (pmi_re > -pmi_im)) - pmiq = PMI_2A_11; - else if ((pmi_re < pmi_im) && (pmi_re > -pmi_im)) - pmiq = PMI_2A_1j; - else if ((pmi_re < pmi_im) && (pmi_re < -pmi_im)) - pmiq = PMI_2A_1m1; - else if ((pmi_re > pmi_im) && (pmi_re < -pmi_im)) - pmiq = PMI_2A_1mj; - - // printf("subband %d, pmi%d \n",i,pmiq); - pmivect |= (pmiq<<(2*i)); - } - - else if (rank==1) { - for (aarx=0; aarx<meas->nb_antennas_rx; aarx++) { - pmi_re += meas->subband_pmi_re[eNB_id][i][aarx]; - //printf("meas->subband_pmi_re[eNB_id][i][%d]=%d\n", aarx, meas->subband_pmi_re[eNB_id][i][aarx]); - pmi_im += meas->subband_pmi_im[eNB_id][i][aarx]; - //printf("meas->subband_pmi_im[eNB_id][i][%d]=%d\n",aarx, meas->subband_pmi_im[eNB_id][i][aarx]); - } - if (pmi_re >= pmi_im) // this is not orthogonal - // this is orthogonal - //if (((pmi_re >= pmi_im) && (pmi_re >= -pmi_im)) || ((pmi_re <= pmi_im) && (pmi_re >= -pmi_im))) - pmiq = PMI_2A_R1_11; - else - pmiq = PMI_2A_R1_1j; - - // printf("subband %d, pmi_re %d, pmi_im %d, pmiq %d \n",i,pmi_re,pmi_im,pmiq); - // printf("subband %d, pmi%d \n",i,pmiq); - //According to Section 7.2.4 of 36.213 - - pmivect |= ((pmiq-1)<<(i)); //shift 1 since only one bit - } - else { - LOG_E(PHY,"PMI feedback for rank>1 not supported!\n"); - pmivect = 0; - } - - } -#ifdef DEBUG_HARQ - printf( "quantize_subband_pmi pmivect %d \n", pmivect); -#endif - return(pmivect); -} - -uint16_t quantize_subband_pmi2(PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t a_id,int nb_subbands) -{ - - uint8_t i; - uint16_t pmiq=0; - uint16_t pmivect = 0; - uint8_t rank = meas->rank[eNB_id]; - int pmi_re,pmi_im; - - for (i=0; i<nb_subbands; i++) { - - if (rank == 0) { - pmi_re = meas->subband_pmi_re[eNB_id][i][a_id]; - pmi_im = meas->subband_pmi_im[eNB_id][i][a_id]; - - if ((pmi_re > pmi_im) && (pmi_re > -pmi_im)) - pmiq = PMI_2A_11; - else if ((pmi_re < pmi_im) && (pmi_re > -pmi_im)) - pmiq = PMI_2A_1j; - else if ((pmi_re < pmi_im) && (pmi_re < -pmi_im)) - pmiq = PMI_2A_1m1; - else if ((pmi_re > pmi_im) && (pmi_re < -pmi_im)) - pmiq = PMI_2A_1mj; - - pmivect |= (pmiq<<(2*i)); - } else { - // This needs to be done properly!!! - pmivect = 0; - } - } - - return(pmivect); -} - -uint16_t quantize_wideband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id) -{ - - uint16_t pmiq=0; - uint8_t rank = meas->rank[eNB_id]; - //int pmi; - int pmi_re,pmi_im; - - if (rank == 1) { - //pmi = - pmi_re = meas->wideband_pmi_re[eNB_id][meas->selected_rx_antennas[eNB_id][0]]; - pmi_im = meas->wideband_pmi_im[eNB_id][meas->selected_rx_antennas[eNB_id][0]]; - - if ((pmi_re > pmi_im) && (pmi_re > -pmi_im)) - pmiq = PMI_2A_11; - else if ((pmi_re < pmi_im) && (pmi_re > -pmi_im)) - pmiq = PMI_2A_1j; - else if ((pmi_re < pmi_im) && (pmi_re < -pmi_im)) - pmiq = PMI_2A_1m1; - else if ((pmi_re > pmi_im) && (pmi_re < -pmi_im)) - pmiq = PMI_2A_1mj; - - } else { - // This needs to be done properly! - pmiq = PMI_2A_11; - } - - - return(pmiq); -} -/* - uint8_t sinr2cqi(int sinr) { - if (sinr<-3) - return(0); - if (sinr>14) - return(10); - else - return(3+(sinr>>1)); - } -*/ - -uint8_t sinr2cqi(double sinr,uint8_t trans_mode) -{ - // int flag_LA=0; - - uint8_t retValue = 0; - - if(flag_LA==0) { - // Ideal Channel Estimation - if (sinr<=-4.89) - retValue = (0); - else if (sinr < -3.53) - retValue = (3); - else if (sinr <= -1.93) - retValue = (4); - else if (sinr <= -0.43) - retValue = (5); - else if (sinr <= 1.11) - retValue = (6); - else if (sinr <= 3.26) - retValue = (7); - else if (sinr <= 5.0) - retValue = (8); - else if (sinr <= 7.0) - retValue = (9); - else if (sinr <= 9.0) - retValue = (10); - else if (sinr <= 11.0) - retValue = (11); - else if (sinr <= 13.0) - retValue = (12); - else if (sinr <= 15.5) - retValue = (13); - else if (sinr <= 17.5) - retValue = (14); - else - retValue = (15); - } else { - int h=0; - int trans_mode_tmp; - - if (trans_mode ==5) - trans_mode_tmp=2; - else if(trans_mode ==6) - trans_mode_tmp=3; - else - trans_mode_tmp = trans_mode-1; - - for(h=0; h<16; h++) { - if(sinr<=sinr_to_cqi[trans_mode_tmp][h]) - retValue = (h); - } - } - - LOG_D(PHY, "sinr=%f trans_mode=%d cqi=%d\n", sinr, trans_mode, retValue); - return retValue; -} -//uint32_t fill_subband_cqi(PHY_MEASUREMENTS *meas,uint8_t eNB_id) { -// -// uint8_t i; -//// uint16_t cqivect = 0; -// uint32_t cqivect = 0; -// -//// char diff_cqi; -// int diff_cqi=0; -// -// for (i=0;i<NUMBER_OF_SUBBANDS;i++) { -// -// diff_cqi = -sinr2cqi(meas->wideband_cqi_dB[eNB_id][0]) + sinr2cqi(meas->subband_cqi_dB[eNB_id][0][i]); -// -// // Note, this is Table 7.2.1-2 from 36.213 -// if (diff_cqi<=-1) -// diff_cqi = 3; -// else if (diff_cqi>2) -// diff_cqi = 2; -// cqivect |= (diff_cqi<<(2*i)); -// -// } -// -// return(cqivect); -//} - - -uint32_t fill_subband_cqi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t trans_mode,int nb_subbands) -{ - - uint8_t i; - - uint32_t cqivect = 0,offset=0; - - - int diff_cqi=0; - - for (i=0; i<nb_subbands; i++) { - - diff_cqi = -sinr2cqi(meas->wideband_cqi_avg[eNB_id],trans_mode) + sinr2cqi(meas->subband_cqi_tot_dB[eNB_id][i],trans_mode); - - // Note, this is Table 7.2.1-2 from 36.213 - if (diff_cqi<=-1) - offset = 3; - else if (diff_cqi>=2) - offset = 2; - else - offset=(uint32_t)diff_cqi; - - cqivect |= (offset<<(2*i)); - - } - - return(cqivect); -} - -void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t harq_pid,int N_RB_DL,uint16_t rnti, uint8_t trans_mode, double sinr_eff) -{ - - // printf("[PHY][UE] Filling CQI for eNB %d, meas->wideband_cqi_tot[%d] %d\n", - // eNB_id,eNB_id,meas->wideband_cqi_tot[eNB_id]); - double sinr_tmp; - uint8_t *o = ulsch->o; - UCI_format_t uci_format = ulsch->uci_format; - - if(flag_LA==1) - sinr_tmp = sinr_eff; - else - sinr_tmp = (double) meas->wideband_cqi_avg[eNB_id]; - - - - //LOG_I(PHY,"[UE][UCI] Filling CQI format %d for eNB %d N_RB_DL %d\n",uci_format,eNB_id,N_RB_DL); - - switch (N_RB_DL) { - - case 6: - switch (uci_format) { - case wideband_cqi_rank1_2A: - ((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,6); - break; - - case wideband_cqi_rank2_2A: - ((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,6); - break; - - case HLC_subband_cqi_nopmi: - ((HLC_subband_cqi_nopmi_1_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_nopmi_1_5MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,6); - break; - - case HLC_subband_cqi_rank1_2A: - ((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,6); - ((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->pmi = quantize_wideband_pmi(meas,eNB_id); - break; - - case HLC_subband_cqi_rank2_2A: - // This has to be improved!!! - ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,6); - ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2 = fill_subband_cqi(meas,eNB_id,trans_mode,6); - ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,6); - break; - - case HLC_subband_cqi_mcs_CBA: - // this is the cba mcs uci for cba transmission - ((HLC_subband_cqi_mcs_CBA_1_5MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs; - ((HLC_subband_cqi_mcs_CBA_1_5MHz *)o)->crnti = rnti; - LOG_D(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs); - break; - - case ue_selected: - LOG_E(PHY,"fill_CQI ue_selected CQI not supported yet!!!\n"); - AssertFatal(1==0,"fill_CQI ue_selected CQI not supported yet!!!"); - break; - - default: - LOG_E(PHY,"unsupported CQI mode (%d)!!!\n",uci_format); - AssertFatal(1==0,"unsupported CQI mode !!!"); - break; - - } - - break; - - case 25: - switch (uci_format) { - case wideband_cqi_rank1_2A: - ((wideband_cqi_rank1_2A_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((wideband_cqi_rank1_2A_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,7); - break; - - case wideband_cqi_rank2_2A: - ((wideband_cqi_rank2_2A_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_5MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,7); - break; - - case HLC_subband_cqi_nopmi: - ((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,7); - break; - - case HLC_subband_cqi_rank1_2A: - ((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,7); - ((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi = quantize_wideband_pmi(meas,eNB_id); - break; - - case HLC_subband_cqi_rank2_2A: - // This has to be improved!!! - ((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,7); - ((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2 = fill_subband_cqi(meas,eNB_id,trans_mode,7); - ((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,7); - break; - - case HLC_subband_cqi_mcs_CBA: - // this is the cba mcs uci for cba transmission - ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs; - ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti = rnti; - LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs); - break; - - case ue_selected: - LOG_E(PHY,"fill_CQI ue_selected CQI not supported yet!!!\n"); - AssertFatal(1==0,"fill_CQI ue_selected CQI not supported yet!!!"); - break; - - default: - LOG_E(PHY,"unsupported CQI mode (%d)!!!\n",uci_format); - AssertFatal(1==0,"unsupported CQI mode !!!"); - break; - - } - - break; - - case 50: - switch (uci_format) { - case wideband_cqi_rank1_2A: - ((wideband_cqi_rank1_2A_10MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((wideband_cqi_rank1_2A_10MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,9); - break; - - case wideband_cqi_rank2_2A: - ((wideband_cqi_rank2_2A_10MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_10MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_10MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,9); - break; - - case HLC_subband_cqi_nopmi: - ((HLC_subband_cqi_nopmi_10MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_nopmi_10MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,9); - break; - - case HLC_subband_cqi_rank1_2A: - ((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,9); - ((HLC_subband_cqi_rank1_2A_10MHz *)o)->pmi = quantize_wideband_pmi(meas,eNB_id); - break; - - case HLC_subband_cqi_rank2_2A: - // This has to be improved!!! - ((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,9); - ((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2 = fill_subband_cqi(meas,eNB_id,trans_mode,9); - ((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,9); - break; - - case HLC_subband_cqi_mcs_CBA: - // this is the cba mcs uci for cba transmission - ((HLC_subband_cqi_mcs_CBA_10MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs; - ((HLC_subband_cqi_mcs_CBA_10MHz *)o)->crnti = rnti; - LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs); - break; - - case ue_selected: - LOG_E(PHY,"fill_CQI ue_selected CQI not supported yet!!!\n"); - AssertFatal(1==0,"fill_CQI ue_selected CQI not supported yet!!!"); - break; - - default: - LOG_E(PHY,"unsupported CQI mode (%d)!!!\n",uci_format); - AssertFatal(1==0,"unsupported CQI mode !!!"); - break; - - } - - break; - - case 100: - switch (uci_format) { - case wideband_cqi_rank1_2A: - ((wideband_cqi_rank1_2A_20MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((wideband_cqi_rank1_2A_20MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,13); - break; - - case wideband_cqi_rank2_2A: - ((wideband_cqi_rank2_2A_20MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_20MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); //FIXME: calculate rank2 cqi - ((wideband_cqi_rank2_2A_20MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,13); - break; - - case HLC_subband_cqi_nopmi: - ((HLC_subband_cqi_nopmi_20MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_nopmi_20MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,13); - break; - - case HLC_subband_cqi_rank1_2A: - ((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,13); - ((HLC_subband_cqi_rank1_2A_20MHz *)o)->pmi = quantize_wideband_pmi(meas,eNB_id); - break; - - case HLC_subband_cqi_rank2_2A: - // This has to be improved!!! - ((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,13); - ((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2 = sinr2cqi(sinr_tmp,trans_mode); - ((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2 = fill_subband_cqi(meas,eNB_id,trans_mode,13); - ((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi = quantize_subband_pmi(meas,eNB_id,13); - break; - - case HLC_subband_cqi_mcs_CBA: - // this is the cba mcs uci for cba transmission - ((HLC_subband_cqi_mcs_CBA_20MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs; - ((HLC_subband_cqi_mcs_CBA_20MHz *)o)->crnti = rnti; - LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs); - break; - - case ue_selected: - LOG_E(PHY,"fill_CQI ue_selected CQI not supported yet!!!\n"); - AssertFatal(1==0,"fill_CQI ue_selected CQI not supported yet!!!"); - break; - - default: - LOG_E(PHY,"unsupported CQI mode (%d)!!!\n",uci_format); - AssertFatal(1==0,"unsupported CQI mode !!!"); - break; - - } - - break; - - } - - -} - -void reset_cba_uci(void *o) -{ - // this is the cba mcs uci for cba transmission - ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->mcs = 0; //fixme - ((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti = 0x0; -} - - -uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_t rank) -{ - - uint8_t i,wideband_pmi2; - uint32_t pmi_ex = 0; - - if (frame_parms->N_RB_DL!=25) { - LOG_E(PHY,"pmi_extend not yet implemented for anything else than 25PRB\n"); - return(-1); - } - - if (rank==0) { - wideband_pmi2=wideband_pmi&3; - for (i=0; i<14; i+=2) - pmi_ex|=(wideband_pmi2<<i); - } - else if (rank==1) { - wideband_pmi2=wideband_pmi&1; - for (i=0; i<7; i++) - pmi_ex|=(wideband_pmi2<<i); - } - else { - LOG_E(PHY,"unsupported rank\n"); - return(-1); - } - - return(pmi_ex); -} - - -int generate_ue_ulsch_params_from_dci(void *dci_pdu, - uint16_t rnti, - uint8_t subframe, - DCI_format_t dci_format, - PHY_VARS_UE *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) -{ - - uint8_t harq_pid; - uint8_t transmission_mode = ue->transmission_mode[eNB_id]; - ANFBmode_t AckNackFBMode; - LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id]; - LTE_UE_DLSCH_t **dlsch = ue->dlsch[ue->current_thread_id[subframe]][0]; - PHY_MEASUREMENTS *meas = &ue->measurements; - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - // uint32_t current_dlsch_cqi = ue->current_dlsch_cqi[eNB_id]; - - if(frame_parms->frame_type == TDD) - { - AckNackFBMode = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; - } - else - { - AckNackFBMode = 1; // 1: multiplexing for FDD - } - - uint32_t cqi_req; - uint32_t dai=3; - uint32_t cshift; - uint32_t TPC; - uint32_t ndi; - uint32_t mcs; - uint32_t rballoc,RIV_max; - uint16_t* RIV2first_rb_LUT; - uint16_t* RIV2nb_rb_LUT; - - // uint32_t hopping; - // uint32_t type; - - if (dci_format == format0) { - - if (!ulsch) - return -1; - - if (rnti == ra_rnti) - harq_pid = 0; - else - harq_pid = subframe2harq_pid(frame_parms, - pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), - pdcch_alloc2ul_subframe(frame_parms,subframe)); - LOG_D(PHY,"Frame %d, Subframe %d: Programming ULSCH for (%d.%d) => harq_pid %d\n", - proc->frame_rx,subframe, - pdcch_alloc2ul_frame(frame_parms,proc->frame_rx,subframe), - pdcch_alloc2ul_subframe(frame_parms,subframe), harq_pid); - - if (harq_pid == 255) { - LOG_E(PHY, "frame %d, subframe %d, rnti %x, format %d: illegal harq_pid!\n", - proc->frame_rx, subframe, rnti, dci_format); - return(-1); - } - - switch (frame_parms->N_RB_DL) { - case 6: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC; - ndi = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->ndi; - mcs = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->ndi; - mcs = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max6; - RIV2first_rb_LUT = RIV2first_rb_LUT6; - RIV2nb_rb_LUT = RIV2nb_rb_LUT6; - - break; - - case 25: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->TPC; - ndi = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->ndi; - mcs = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_5MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_5MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_5MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI0_5MHz_FDD_t *)dci_pdu)->ndi; - mcs = ((DCI0_5MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_5MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_5MHz_FDD_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_5MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max25; - RIV2first_rb_LUT = RIV2first_rb_LUT25; - RIV2nb_rb_LUT = RIV2nb_rb_LUT25; - // printf("***********rballoc %d, first_rb %d, nb_rb %d (dci %p)\n",rballoc,ulsch->harq_processes[harq_pid]->first_rb,ulsch->harq_processes[harq_pid]->nb_rb,dci_pdu); - break; - - case 50: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->TPC; - ndi = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->ndi; - mcs = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_10MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_10MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_10MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI0_10MHz_FDD_t *)dci_pdu)->ndi; - mcs = ((DCI0_10MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_10MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_10MHz_FDD_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_10MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max50; - RIV2first_rb_LUT = RIV2first_rb_LUT50; - RIV2nb_rb_LUT = RIV2nb_rb_LUT50; - - break; - - case 100: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->TPC; - ndi = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->ndi; - mcs = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_20MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_20MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_20MHz_FDD_t *)dci_pdu)->TPC; - ndi = ((DCI0_20MHz_FDD_t *)dci_pdu)->ndi; - mcs = ((DCI0_20MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_20MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_20MHz_FDD_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_20MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max100; - RIV2first_rb_LUT = RIV2first_rb_LUT100; - RIV2nb_rb_LUT = RIV2nb_rb_LUT100; - - // printf("rb_alloc (20 MHz dci) %d\n",rballoc); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - - - if (rballoc > RIV_max) { - LOG_E(PHY,"frame %d, subframe %d, rnti %x, format %d: FATAL ERROR: generate_ue_ulsch_params_from_dci, rb_alloc[%d] > RIV_max[%d]\n", - proc->frame_rx, subframe, rnti, dci_format,rballoc,RIV_max); - LOG_E(PHY,"Wrong DCI0 detection, do not transmit PUSCH for HARQID: %d\n",harq_pid); - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - return(-1); - } - - - // indicate that this process is to be serviced in subframe n+4 - if ((rnti >= cba_rnti) && (rnti < p_rnti)) - ulsch->harq_processes[harq_pid]->subframe_cba_scheduling_flag = 1; //+=1 this indicates the number of dci / cba group: not supported in the data struct - else - { - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; - //LOG_I(PHY,"[HARQ-UL harqId: %d] DCI0 ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); - - } - - ulsch->harq_processes[harq_pid]->TPC = TPC; - ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT[rballoc]; - ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT[rballoc]; - - if (ue->ul_power_control_dedicated[eNB_id].accumulationEnabled == 1) { - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d: f_pusch (ACC) %d, adjusting by %d (TPC %d)\n", - ue->Mod_id,harq_pid,proc->frame_rx,subframe,ulsch->f_pusch, - delta_PUSCH_acc[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC], - ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC); - ulsch->f_pusch += delta_PUSCH_acc[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC]; - } else { - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d: f_pusch (ABS) %d, adjusting to %d (TPC %d)\n", - ue->Mod_id,harq_pid,proc->frame_rx,subframe,ulsch->f_pusch, - delta_PUSCH_abs[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC], - ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC); - ulsch->f_pusch = delta_PUSCH_abs[ue->ulsch[eNB_id]->harq_processes[harq_pid]->TPC]; - } - - if (ulsch->harq_processes[harq_pid]->first_tx==1) { - // ulsch->harq_processes[harq_pid]->Ndi = 1; - ulsch->harq_processes[harq_pid]->first_tx=0; - ulsch->harq_processes[harq_pid]->DCINdi= ndi; - ulsch->harq_processes[harq_pid]->round = 0; - } else { - if (ulsch->harq_processes[harq_pid]->DCINdi!=ndi) { // new SDU opportunity - // ulsch->harq_processes[harq_pid]->Ndi = 1; - ulsch->harq_processes[harq_pid]->DCINdi= ndi; - ulsch->harq_processes[harq_pid]->round = 0; - } else { - // ulsch->harq_processes[harq_pid]->Ndi = 0; - //ulsch->harq_processes[harq_pid]->round++; // This is done in phich RX - - //#ifdef DEBUG_PHICH - //LOG_I(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d Adaptative Retrans, NDI not toggled => Nack. maxHARQ_Tx %d \n", - // ue->Mod_id,harq_pid, - // proc->frame_rx, - // subframe, - // ulsch->Mlimit); - //#endif -/* - if (ulsch->harq_processes[harq_pid]->round > 0) // NACK detected on phich - { - // ulsch->harq_processes[harq_pid]->round++; already done on phich_rx - // ulsch->harq_processes[harq_pid] = ulsch->harq_processes[8]; - // LOG_I(PHY," Adaptative retransmission - copy temporary harq Process to current harq process. [harqId %d round %d] \n",harq_pid, ulsch->harq_processes[8]->round); - - if (ulsch->harq_processes[harq_pid]->round >= ulsch->Mlimit) //UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) - { - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - ulsch->harq_processes[harq_pid]->round = 0; - ulsch->harq_processes[harq_pid]->status = IDLE; - //LOG_I(PHY," PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); - //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); - } - else - { - // ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; - uint8_t rv_table[4] = {0, 2, 3, 1}; - ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; - ulsch->O_RI = 0; - ulsch->O = 0; - ulsch->uci_format = HLC_subband_cqi_nopmi; - //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); - } - } -*/ - } - } - - ulsch->harq_processes[harq_pid]->n_DMRS = cshift; - - //printf("nb_rb %d, first_rb %d (RIV %d)\n",ulsch->harq_processes[harq_pid]->nb_rb,ulsch->harq_processes[harq_pid]->first_rb,rballoc); - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - // ulsch->cba_rnti[0]=rnti; - } else { - ulsch->rnti = rnti; - } - - // printf("[PHY][UE] DCI format 0: harq_pid %d nb_rb %d, rballoc %d\n",harq_pid,ulsch->harq_processes[harq_pid]->nb_rb, - // ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->rballoc); - //Mapping of cyclic shift field in DCI format0 to n_DMRS2 (3GPP 36.211, Table 5.5.2.1.1-1) - if(cshift == 0) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 0; - else if(cshift == 1) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 6; - else if(cshift == 2) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 3; - else if(cshift == 3) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 4; - else if(cshift == 4) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 2; - else if(cshift == 5) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 8; - else if(cshift == 6) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 10; - else if(cshift == 7) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 9; - - - //reserved for cooperative communication - /* - if(ulsch->n_DMRS2 == 6) - ulsch->cooperation_flag = 2; - else - ulsch->cooperation_flag = 0; - */ - - if ((ulsch->harq_processes[harq_pid]->nb_rb>0) && (ulsch->harq_processes[harq_pid]->nb_rb < 25)) - ulsch->power_offset = ue_power_offsets[ulsch->harq_processes[harq_pid]->nb_rb-1]; - - // if (ulsch->harq_processes[harq_pid]->Ndi == 1) - // ulsch->harq_processes[harq_pid]->status = ACTIVE; - - - if (cqi_req == 1) { - - if( (AntennaInfoDedicated__transmissionMode_tm3 == transmission_mode) || (AntennaInfoDedicated__transmissionMode_tm4 == transmission_mode) ) - { - ulsch->O_RI = 1; - } - else - { - ulsch->O_RI = 0; - } - //ulsch->O_RI = 0; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table - - switch(transmission_mode) { - // The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling - case 1: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_mcs_CBA; - ulsch->o_RI[0] = 0; - } else if(meas->rank[eNB_id] == 0) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 0; - } else { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 1; - } - - break; - - case 2: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_mcs_CBA; - ulsch->o_RI[0] = 0; - } else if(meas->rank[eNB_id] == 0) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 0; - } else { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 1; - } - - break; - - case 3: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_mcs_CBA; - ulsch->o_RI[0] = 0; - } else if(meas->rank[eNB_id] == 0) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 0; - } else { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 1; - } - - break; - - case 4: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_mcs_CBA; - ulsch->o_RI[0] = 0; - } else if(meas->rank[eNB_id] == 0) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_wideband_cqi_rank1_2A_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz; - break; - - case 50: - ulsch->O = sizeof_wideband_cqi_rank1_2A_10MHz; - break; - - case 100: - ulsch->O = sizeof_wideband_cqi_rank1_2A_20MHz; - break; - } - - ulsch->uci_format = wideband_cqi_rank1_2A; - ulsch->o_RI[0] = 0; - } else { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_wideband_cqi_rank2_2A_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz; - break; - - case 50: - ulsch->O = sizeof_wideband_cqi_rank2_2A_10MHz; - break; - - case 100: - ulsch->O = sizeof_wideband_cqi_rank2_2A_20MHz; - break; - } - - ulsch->uci_format = wideband_cqi_rank2_2A; - ulsch->o_RI[0] = 1; - } - - break; - - case 5: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_mcs_CBA; - ulsch->o_RI[0] = 0; - } else if(meas->rank[eNB_id] == 0) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_wideband_cqi_rank1_2A_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz; - break; - - case 50: - ulsch->O = sizeof_wideband_cqi_rank1_2A_10MHz; - break; - - case 100: - ulsch->O = sizeof_wideband_cqi_rank1_2A_20MHz; - break; - } - - ulsch->uci_format = wideband_cqi_rank1_2A; - ulsch->o_RI[0] = 0; - } else { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_wideband_cqi_rank2_2A_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz; - break; - - case 50: - ulsch->O = sizeof_wideband_cqi_rank2_2A_10MHz; - break; - - case 100: - ulsch->O = sizeof_wideband_cqi_rank2_2A_20MHz; - break; - } - - ulsch->uci_format = wideband_cqi_rank2_2A; - ulsch->o_RI[0] = 1; - } - - break; - - case 6: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_mcs_CBA; - ulsch->o_RI[0] = 0; - } else if(meas->rank[eNB_id] == 0) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_wideband_cqi_rank1_2A_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz; - break; - - case 50: - ulsch->O = sizeof_wideband_cqi_rank1_2A_10MHz; - break; - - case 100: - ulsch->O = sizeof_wideband_cqi_rank1_2A_20MHz; - break; - } - - ulsch->uci_format = wideband_cqi_rank1_2A; - ulsch->o_RI[0] = 0; - } else { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_wideband_cqi_rank2_2A_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz; - break; - - case 50: - ulsch->O = sizeof_wideband_cqi_rank2_2A_10MHz; - break; - - case 100: - ulsch->O = sizeof_wideband_cqi_rank2_2A_20MHz; - break; - } - - ulsch->uci_format = wideband_cqi_rank2_2A; - ulsch->o_RI[0] = 1; - } - - break; - - case 7: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_mcs_CBA; - ulsch->o_RI[0] = 0; - } else if(meas->rank[eNB_id] == 0) { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 0; - } else { - switch (ue->frame_parms.N_RB_DL) { - case 6: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - ulsch->o_RI[0] = 1; - } - - break; - - default: - LOG_E(PHY,"Incorrect Transmission Mode \n"); - break; - } - } else { - ulsch->O_RI = 0; - ulsch->O = 0; - ulsch->uci_format = HLC_subband_cqi_nopmi; - } - - print_CQI(ulsch->o,ulsch->uci_format,eNB_id,ue->frame_parms.N_RB_DL); - - ulsch->bundling = 1-AckNackFBMode; - - if (frame_parms->frame_type == FDD) { - //int dl_subframe = (subframe<4) ? (subframe+6) : (subframe-4); - int dl_subframe = subframe; - - if (ue->dlsch[ue->current_thread_id[subframe]][eNB_id][0]->harq_ack[dl_subframe].send_harq_status>0) { // we have downlink transmission - ulsch->harq_processes[harq_pid]->O_ACK = 1; - } else { - ulsch->harq_processes[harq_pid]->O_ACK = 0; - } - /*LOG_I(PHY,"DCI 0 Processing: dl_subframe %d send_harq_status Odd %d send_harq_status Even %d harq_pid %d O_ACK %d\n", dl_subframe, - ue->dlsch[0][eNB_id][0]->harq_ack[dl_subframe].send_harq_status, - ue->dlsch[1][eNB_id][0]->harq_ack[dl_subframe].send_harq_status, - harq_pid, - ulsch->harq_processes[harq_pid]->O_ACK);*/ - - } else { - if (ulsch->bundling) - ulsch->harq_processes[harq_pid]->O_ACK = (dai == 3)? 0 : 1; - else - ulsch->harq_processes[harq_pid]->O_ACK = (dai >= 2)? 2 : (dai+1)&3; //(dai+1)&3; - - // ulsch->harq_processes[harq_pid]->V_UL_DAI = dai+1; - } - - dlsch[0]->harq_ack[subframe].vDAI_UL = dai+1; - - - LOG_D(PHY, "[PUSCH %d] Format0 DCI %s, CQI_req=%d, cshift=%d, TPC=%d, DAI=%d, vDAI_UL[sf#%d]=%d, NDI=%d, MCS=%d, RBalloc=%d, first_rb=%d, harq_pid=%d, nb_rb=%d, subframe_scheduling_flag=%d" - " ulsch->bundling %d, O_ACK %d \n", - harq_pid, - (frame_parms->frame_type == TDD? "TDD" : "FDD"), - cqi_req, cshift, TPC, dai, subframe, dlsch[0]->harq_ack[subframe].vDAI_UL, ndi, mcs, rballoc, - ulsch->harq_processes[harq_pid]->first_rb, harq_pid, ulsch->harq_processes[harq_pid]->nb_rb, - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, - ulsch->bundling, - ulsch->harq_processes[harq_pid]->O_ACK); - - LOG_D(PHY,"Setting beta_offset_cqi_times8 to %d, index %d\n", - beta_cqi[ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index], - ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index); - - ulsch->beta_offset_cqi_times8 = beta_cqi[ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index];//18; - ulsch->beta_offset_ri_times8 = beta_ri[ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index];//10; - ulsch->beta_offset_harqack_times8 = beta_ack[ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index];//16; - - ulsch->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1); - ulsch->srs_active = use_srs; - - if ((rnti >= cba_rnti) && (rnti < p_rnti)) - ulsch->harq_processes[harq_pid]->status = CBA_ACTIVE; - else - ulsch->harq_processes[harq_pid]->status = ACTIVE; - - ulsch->harq_processes[harq_pid]->rvidx = 0; - - // ulsch->harq_processes[harq_pid]->calibration_flag =0; - if (mcs < 29) { - ulsch->harq_processes[harq_pid]->mcs = mcs; - // ulsch->harq_processes[harq_pid]->round = 0; - } else { - ulsch->harq_processes[harq_pid]->rvidx = mcs - 28; - if (ulsch->harq_processes[harq_pid]->round == 0) { - LOG_W(PHY,"PUSCH::mcs = %d and DCI0::mcs(%d) > 28 and round == %d\n", ulsch->harq_processes[harq_pid]->mcs, mcs, ulsch->harq_processes[harq_pid]->round); - } else { - LOG_D(PHY,"PUSCH::mcs = %d and DCI0::mcs(%d) > 28 and round == %d\n", ulsch->harq_processes[harq_pid]->mcs, mcs, ulsch->harq_processes[harq_pid]->round); - } - //LOG_E(PHY,"Fatal: mcs(%d) > 28!!! and round == 0\n", mcs); - } - ulsch->harq_processes[harq_pid]->TBS = TBStable[get_I_TBS_UL(ulsch->harq_processes[harq_pid]->mcs)][ulsch->harq_processes[harq_pid]->nb_rb-1]; - - /* - else if (ulsch->harq_processes[harq_pid]->mcs == 29) { - ulsch->harq_processes[harq_pid]->mcs = 4; - ulsch->harq_processes[harq_pid]->TBS = TBStable[get_I_TBS_UL(ulsch->harq_processes[harq_pid]->mcs)][ulsch->harq_processes[harq_pid]->nb_rb-1]; - // ulsch->harq_processes[harq_pid]->calibration_flag =1; - // printf("Auto-Calibration (UE): mcs %d, TBS %d, nb_rb %d\n",ulsch->harq_processes[harq_pid]->mcs,ulsch->harq_processes[harq_pid]->TBS,ulsch->harq_processes[harq_pid]->nb_rb); - }*/ - ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch->harq_processes[harq_pid]->nb_rb; - ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->Nsymb_pusch; - - // a Ndi=1 automatically acknowledges previous PUSCH transmission - if (ue->ulsch_Msg3_active[eNB_id] == 1) - ue->ulsch_Msg3_active[eNB_id] = 0; - - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d, subframe %d : Programming PUSCH with n_DMRS2 %d (cshift %d), nb_rb %d, first_rb %d, mcs %d, round %d, rv %d, ulsch_ue_Msg3_active %d, cqi_req %d => O %d\n", - ue->Mod_id,harq_pid, - proc->frame_rx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift,ulsch->harq_processes[harq_pid]->nb_rb,ulsch->harq_processes[harq_pid]->first_rb, - ulsch->harq_processes[harq_pid]->mcs,ulsch->harq_processes[harq_pid]->round,ulsch->harq_processes[harq_pid]->rvidx, ue->ulsch_Msg3_active[eNB_id],cqi_req,ulsch->O); - - // ulsch->n_DMRS2 = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift; - -//printf("Format 0 DCI : ulsch (ue): AbsSubframe %d.%d nrb %d harq_pid %d round %d mcs %d\n",proc->frame_rx%1024,nr_tti_rx,ulsch->harq_processes[harq_pid]->nb_rb, - // harq_pid,ulsch->harq_processes[harq_pid]->round,ulsch->harq_processes[harq_pid]->mcs); - -#ifdef UE_DEBUG_TRACE - - LOG_D(PHY,"Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx%1024,subframe); - LOG_D(PHY,"Format 0 DCI : ulsch (ue): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): first_rb %d\n",ulsch->harq_processes[harq_pid]->first_rb); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): rballoc %d\n",rballoc); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): harq_pid %d\n",harq_pid); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): first_tx %d\n",ulsch->harq_processes[harq_pid]->first_tx); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): DCINdi %d\n",ulsch->harq_processes[harq_pid]->DCINdi); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): round %d\n",ulsch->harq_processes[harq_pid]->round); - //LOG_I(PHY,"Format 0 DCI :ulsch (ue): TBS %d\n",ulsch->harq_processes[harq_pid]->TBS); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): mcs %d\n",ulsch->harq_processes[harq_pid]->mcs); - //LOG_I(PHY,"Format 0 DCI :ulsch (ue): O %d\n",ulsch->O); - //LOG_I(PHY,"Format 0 DCI :ulsch (ue): cqiReq %d\n",cqi_req); - //if (frame_parms->frame_type == TDD) - // LOG_I(PHY,"Format 0 DCI :ulsch (ue): O_ACK/DAI %d/%d\n",ulsch->harq_processes[harq_pid]->O_ACK,dai); - //else - // LOG_I(PHY,"Format 0 DCI :ulsch (ue): O_ACK %d\n",ulsch->harq_processes[harq_pid]->O_ACK); - - LOG_D(PHY,"Format 0 DCI :ulsch (ue): Nsymb_pusch %d\n",ulsch->Nsymb_pusch); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): cshift %d\n",ulsch->harq_processes[harq_pid]->n_DMRS2); - LOG_D(PHY,"Format 0 DCI :ulsch (ue): phich status %d\n",ulsch->harq_processes[harq_pid]->status); -#else - UNUSED_VARIABLE(dai); -#endif - return(0); - } else { - LOG_E(PHY,"frame %d, subframe %d: FATAL ERROR, generate_ue_ulsch_params_from_dci, Illegal dci_format %d\n", - proc->frame_rx, subframe,dci_format); - return(-1); - } - -} - -/* -int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, - eNB_rxtx_proc_t *proc, - void *dci_pdu, - uint16_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) -{ - - uint8_t harq_pid; - uint32_t rb_alloc; - uint8_t transmission_mode=eNB->transmission_mode[UE_id]; - ANFBmode_t AckNackFBMode = eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode; - LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id]; - LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; - int subframe = proc->subframe_tx; - - uint32_t cqi_req = 0; - uint32_t dai = 0; - uint32_t cshift = 0; - uint32_t TPC = 0; - uint32_t mcs = 0; - uint32_t rballoc = UINT32_MAX; - uint32_t RIV_max = 0; - // uint32_t hopping; - // uint32_t type; - -#ifdef DEBUG_DCI - printf("filling eNB ulsch params for rnti %x, dci format %d, dci %x, subframe %d\n", - rnti,dci_format,*(uint32_t*)dci_pdu,subframe); -#endif - - if (dci_format == format0) { - - harq_pid = subframe2harq_pid(frame_parms, - pdcch_alloc2ul_frame(frame_parms, - proc->frame_tx, - subframe), - pdcch_alloc2ul_subframe(frame_parms,subframe)); - switch (frame_parms->N_RB_DL) { - case 6: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC; - mcs = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->TPC; - mcs = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->hopping=hopping; - // type = ((DCI0_1_5MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max6; - ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT6[rballoc]; - ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT6[rballoc]; - - break; - - case 25: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->TPC; - mcs = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->hopping; - // type = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_5MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_5MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_5MHz_FDD_t *)dci_pdu)->TPC; - mcs = ((DCI0_5MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_5MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_5MHz_FDD_t *)dci_pdu)->hopping; - // type = ((DCI0_5MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max25; - ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT25[rballoc]; - ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT25[rballoc]; - - break; - - case 50: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->TPC; - mcs = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->hopping; - // type = ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_10MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_10MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_10MHz_FDD_t *)dci_pdu)->TPC; - mcs = ((DCI0_10MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_10MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_10MHz_FDD_t *)dci_pdu)->hopping; - // type = ((DCI0_10MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max50; - ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT50[rballoc]; - ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT50[rballoc]; - - break; - - case 100: - if (frame_parms->frame_type == TDD) { - cqi_req = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->cqi_req; - dai = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->dai; - cshift = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->cshift; - TPC = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->TPC; - mcs = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->mcs; - rballoc = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->hopping; - // type = ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->type; - } else { - cqi_req = ((DCI0_20MHz_FDD_t *)dci_pdu)->cqi_req; - cshift = ((DCI0_20MHz_FDD_t *)dci_pdu)->cshift; - TPC = ((DCI0_20MHz_FDD_t *)dci_pdu)->TPC; - mcs = ((DCI0_20MHz_FDD_t *)dci_pdu)->mcs; - rballoc = ((DCI0_20MHz_FDD_t *)dci_pdu)->rballoc; - // hopping = ((DCI0_20MHz_FDD_t *)dci_pdu)->hopping; - // type = ((DCI0_20MHz_FDD_t *)dci_pdu)->type; - } - - RIV_max = RIV_max100; - ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT100[rballoc]; - ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT100[rballoc]; - - //printf("eNB: rb_alloc (20 MHz dci) %d\n",rballoc); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - - - rb_alloc = rballoc; - AssertFatal(rb_alloc>RIV_max, - "Format 0: rb_alloc (%d) > RIV_max (%d)\n",rb_alloc,RIV_max); -#ifdef DEBUG_DCI - printf("generate_eNB_ulsch_params_from_dci: subframe %d, rnti %x,harq_pid %d,cqi_req %d\n",subframe,rnti,harq_pid,cqi_req); -#endif - - ulsch->harq_processes[harq_pid]->dci_alloc = 1; - ulsch->harq_processes[harq_pid]->rar_alloc = 0; - ulsch->harq_processes[harq_pid]->TPC = TPC; - ulsch->harq_processes[harq_pid]->n_DMRS = cshift; - - - if (cqi_req == 1) { - // 36.213 7.2.1 (release 10) says: - // "RI is only reported for transmission modes 3 and 4, - // as well as transmission modes 8 and 9 with PMI/RI reporting" - // This is for aperiodic reporting. - // TODO: deal with TM 8&9 correctly when they are implemented. - // TODO: deal with periodic reporting if we implement it. - // - if (transmission_mode == 3 || transmission_mode == 4) - ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table - else - ulsch->harq_processes[harq_pid]->O_RI = 0; - - switch(transmission_mode) { - // The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling - case 1: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA; - } else { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi; - } - - break; - - case 2: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA; - } else { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi; - } - - break; - - case 3: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA; - } else { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi; - } - - break; - - case 4: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA; - } else { - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_1_5MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_10MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_20MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_20MHz; - break; - - } - - ulsch->harq_processes[harq_pid]->uci_format = wideband_cqi_rank1_2A; - } - - break; - - case 5: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA; - } else { - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_1_5MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_10MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_20MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = wideband_cqi_rank1_2A; - } - - break; - - case 6: - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA; - } else { - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_1_5MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_10MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_20MHz; - ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = wideband_cqi_rank1_2A; - } - - break; - - case 7: - ulsch->harq_processes[harq_pid]->Or2 = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_1_5MHz; - break; - - case 25: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz; - break; - - case 50: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_10MHz; - break; - - case 100: - ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_20MHz; - break; - } - - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi; - break; - - default: - LOG_E(PHY,"Incorrect Transmission Mode \n"); - break; - } - } else { - ulsch->harq_processes[harq_pid]->O_RI = 0; - ulsch->harq_processes[harq_pid]->Or2 = 0; - ulsch->harq_processes[harq_pid]->Or1 = 0; - ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi; - } - - ulsch->bundling = 1-AckNackFBMode; - - if (frame_parms->frame_type == FDD) { - int dl_subframe = (subframe<4) ? (subframe+6) : (subframe-4); - - if (eNB->dlsch[UE_id][0]->subframe_tx[dl_subframe]>0) { // we have downlink transmission - ulsch->harq_processes[harq_pid]->O_ACK = 1; - } else { - ulsch->harq_processes[harq_pid]->O_ACK = 0; - } - } else { - if (ulsch->bundling) - ulsch->harq_processes[harq_pid]->O_ACK = (dai == 3)? 0 : 1; - else - ulsch->harq_processes[harq_pid]->O_ACK = (dai+1)&3; - - ulsch->harq_processes[harq_pid]->V_UL_DAI = dai+1; - } - - ulsch->beta_offset_cqi_times8 = beta_cqi[eNB->pusch_config_dedicated[UE_id].betaOffset_CQI_Index];//18; - ulsch->beta_offset_ri_times8 = beta_ri[eNB->pusch_config_dedicated[UE_id].betaOffset_RI_Index];//10; - ulsch->beta_offset_harqack_times8 = beta_ack[eNB->pusch_config_dedicated[UE_id].betaOffset_ACK_Index];//16; - - ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1); - ulsch->harq_processes[harq_pid]->srs_active = use_srs; - - //Mapping of cyclic shift field in DCI format0 to n_DMRS2 (3GPP 36.211, Table 5.5.2.1.1-1) - if(cshift == 0) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 0; - else if(cshift == 1) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 6; - else if(cshift == 2) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 3; - else if(cshift == 3) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 4; - else if(cshift == 4) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 2; - else if(cshift == 5) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 8; - else if(cshift == 6) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 10; - else if(cshift == 7) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 9; - - - LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, subframe %d : Programming PUSCH with n_DMRS2 %d (cshift %d)\n", - eNB->Mod_id,harq_pid,proc->frame_tx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift); - - - - if (ulsch->harq_processes[harq_pid]->round == 0) { - if ((rnti >= cba_rnti) && (rnti < p_rnti)) - ulsch->harq_processes[harq_pid]->status = CBA_ACTIVE; - else - ulsch->harq_processes[harq_pid]->status = ACTIVE; - - ulsch->harq_processes[harq_pid]->rvidx = 0; - ulsch->harq_processes[harq_pid]->mcs = mcs; - // ulsch->harq_processes[harq_pid]->calibration_flag = 0; - //if (ulsch->harq_processes[harq_pid]->mcs) - // - //if (ulsch->harq_processes[harq_pid]->mcs == 29) { - //ulsch->harq_processes[harq_pid]->mcs = 4; - // ulsch->harq_processes[harq_pid]->calibration_flag = 1; - // printf("Auto-Calibration (eNB): mcs %d, nb_rb %d\n",ulsch->harq_processes[harq_pid]->mcs,ulsch->harq_processes[harq_pid]->nb_rb); - //} - - ulsch->harq_processes[harq_pid]->TBS = TBStable[get_I_TBS_UL(ulsch->harq_processes[harq_pid]->mcs)][ulsch->harq_processes[harq_pid]->nb_rb-1]; - - ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch->harq_processes[harq_pid]->nb_rb; - ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->harq_processes[harq_pid]->Nsymb_pusch; - ulsch->harq_processes[harq_pid]->round = 0; - } else { - if (mcs>28) - ulsch->harq_processes[harq_pid]->rvidx = mcs - 28; - else { - ulsch->harq_processes[harq_pid]->rvidx = 0; - ulsch->harq_processes[harq_pid]->mcs = mcs; - } - - // ulsch->harq_processes[harq_pid]->round++; - } - - if ((rnti >= cba_rnti) && (rnti < p_rnti)) { - ulsch->cba_rnti[0] = rnti; - } else { - ulsch->rnti = rnti; - } - - //ulsch->n_DMRS2 = cshift; - -#ifdef DEBUG_DCI - printf("ulsch (eNB): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); - printf("ulsch (eNB): first_rb %d\n",ulsch->harq_processes[harq_pid]->first_rb); - printf("ulsch (eNB): harq_pid %d\n",harq_pid); - printf("ulsch (eNB): round %d\n",ulsch->harq_processes[harq_pid]->round); - printf("ulsch (eNB): TBS %d\n",ulsch->harq_processes[harq_pid]->TBS); - printf("ulsch (eNB): mcs %d\n",ulsch->harq_processes[harq_pid]->mcs); - printf("ulsch (eNB): Or1 %d\n",ulsch->harq_processes[harq_pid]->Or1); - printf("ulsch (eNB): Nsymb_pusch %d\n",ulsch->harq_processes[harq_pid]->Nsymb_pusch); - printf("ulsch (eNB): cshift %d\n",ulsch->harq_processes[harq_pid]->n_DMRS2); -#else - UNUSED_VARIABLE(dai); -#endif - return(0); - } else { - LOG_E(PHY,"generate_eNB_ulsch_params_from_dci, Illegal dci_format %d\n",dci_format); - return(-1); - } - -} -*/ - -double sinr_eff_cqi_calc(PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe) -{ - uint8_t transmission_mode = ue->transmission_mode[eNB_id]; - PHY_MEASUREMENTS *meas = &ue->measurements; - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - int32_t **dl_channel_est = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; - double *s_dB; - s_dB = ue->sinr_CQI_dB; - // LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id]; - //for the calculation of SINR_eff for CQI calculation - int count,a_rx,a_tx; - double abs_channel=0; - double channelx=0; - double channely=0; - double channelx_i=0; - double channely_i=0; - uint16_t q = quantize_subband_pmi(meas,eNB_id,7); - uint8_t qq; - - switch(transmission_mode) { - case 1: - for (count=0; count<frame_parms->N_RB_DL*12; count++) { - for(a_tx=0; a_tx<frame_parms->nb_antenna_ports_eNB; a_tx++) { - for (a_rx=0; a_rx<frame_parms->nb_antennas_rx; a_rx++) { - s_dB[count] = 10*log10(pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2],2) + pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2], - 2)) - meas->n0_power_avg_dB; - } - } - } - - break; - - case 2: - for (count=0; count<frame_parms->N_RB_DL*12; count++) { - abs_channel=0; - - for(a_tx=0; a_tx<frame_parms->nb_antenna_ports_eNB; a_tx++) { - for (a_rx=0; a_rx<frame_parms->nb_antennas_rx; a_rx++) { - abs_channel += (pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2],2) + pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2],2)); - } - } - - s_dB[count] = 10*log10(abs_channel/2) - meas->n0_power_avg_dB; - } - - break; - - case 5: - for (count=0; count<frame_parms->N_RB_DL*12; count++) { - channelx=0; - channely=0; - channelx_i=0; - channely_i=0; - qq = (q>>(((count/12)>>2)<<1))&3; - - //printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq); - for(a_tx=0; a_tx<frame_parms->nb_antenna_ports_eNB; a_tx++) { - for (a_rx=0; a_rx<frame_parms->nb_antennas_rx; a_rx++) { - switch(qq) { - case 0: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely_i -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - case 1: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely_i += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - case 2: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channely += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channely_i -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - case 3: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely_i = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channely -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channelx_i -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channely_i += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - default: - printf("Problem in SINR Calculation for TM5 \n"); - break; - }//switch(qq) - }//a_rx - }//a_tx - - s_dB[count] = 10 * log10 ((pow(channelx,2) + pow(channely,2))/2) - 10 * log10 ((pow(channelx_i,2) + pow(channely_i,2))/2) - meas->n0_power_avg_dB; - }//count - - break; - - case 6: - for (count=0; count<frame_parms->N_RB_DL*12; count++) { - channelx=0; - channely=0; - qq = (q>>(((count/12)>>2)<<1))&3; - - //printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq); - for(a_tx=0; a_tx<frame_parms->nb_antenna_ports_eNB; a_tx++) { - for (a_rx=0; a_rx<frame_parms->nb_antennas_rx; a_rx++) { - switch(qq) { - case 0: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - case 1: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - case 2: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channely += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - case 3: - if (channelx==0 || channely==0) { - channelx = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - channely = ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - } else { - channelx += ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2]; - channely -= ((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2]; - } - - break; - - default: - printf("Problem in SINR Calculation for TM6 \n"); - break; - }//switch(qq) - }//a_rx - }//a_tx - - s_dB[count] = 10 * log10 ((pow(channelx,2) + pow(channely,2))/2) - meas->n0_power_avg_dB; - }//count - - break; - - default: - printf("Problem in SINR Calculation for CQI \n"); - break; - } - - int ii; - double sinr_eff = 0; - double sinr_eff_qpsk=0; - double sinr_eff_qam16=0; - double sinr_eff_qam64=0; - double x = 0; - double I_qpsk=0; - double I_qam16=0; - double I_qam64=0; - double I_qpsk_avg=0; - double I_qam16_avg=0; - double I_qam64_avg=0; - double qpsk_max=12.2; - double qam16_max=19.2; - double qam64_max=25.2; - double sinr_min = -20; - int offset=0; - - - for (offset = 0; offset <= 24; offset++) { - for(ii=0; ii<12; ii++) { - //x is the sinr_dB in dB - x = s_dB[(offset*12)+ii]; - - if(x<sinr_min) { - I_qpsk +=0; - I_qam16 +=0; - I_qam64 +=0; - } else { - if(x>qpsk_max) - I_qpsk += 1; - else - I_qpsk += (q_qpsk[0]*pow(x,7) + q_qpsk[1]*pow(x,6) + q_qpsk[2]*pow(x,5) + q_qpsk[3]*pow(x,4) + q_qpsk[4]*pow(x,3) + q_qpsk[5]*pow(x,2) + q_qpsk[6]*x + q_qpsk[7]); - - if(x>qam16_max) - I_qam16 += 1; - else - I_qam16 += (q_qam16[0]*pow(x,7) + q_qam16[1]*pow(x,6) + q_qam16[2]*pow(x,5) + q_qam16[3]*pow(x,4) + q_qam16[4]*pow(x,3) + q_qam16[5]*pow(x,2) + q_qam16[6]*x + q_qam16[7]); - - if(x>qam64_max) - I_qam64 += 1; - else - I_qam64 += (q_qam64[0]*pow(x,7) + q_qam64[1]*pow(x,6) + q_qam64[2]*pow(x,5) + q_qam64[3]*pow(x,4) + q_qam64[4]*pow(x,3) + q_qam64[5]*pow(x,2) + q_qam64[6]*x + q_qam64[7]); - - } - } - } - - // averaging of accumulated MI - I_qpsk_avg = I_qpsk/(12*frame_parms->N_RB_DL); - I_qam16_avg = I_qam16/(12*frame_parms->N_RB_DL); - I_qam64_avg = I_qam64/(12*frame_parms->N_RB_DL); - - // I->SINR_effective Mapping - - sinr_eff_qpsk = (p_qpsk[0]*pow(I_qpsk_avg,7) + p_qpsk[1]*pow(I_qpsk_avg,6) + p_qpsk[2]*pow(I_qpsk_avg,5) + p_qpsk[3]*pow(I_qpsk_avg,4) + p_qpsk[4]*pow(I_qpsk_avg,3) + p_qpsk[5]*pow(I_qpsk_avg, - 2) + p_qpsk[6]*I_qpsk_avg + p_qpsk[7]); - - sinr_eff_qam16 = (p_qam16[0]*pow(I_qam16_avg,7) + p_qam16[1]*pow(I_qam16_avg,6) + p_qam16[2]*pow(I_qam16_avg,5) + p_qam16[3]*pow(I_qam16_avg,4) + p_qam16[4]*pow(I_qam16_avg, - 3) + p_qam16[5]*pow(I_qam16_avg,2) + p_qam16[6]*I_qam16_avg + p_qam16[7]); - - sinr_eff_qam64 = (p_qam64[0]*pow(I_qam64_avg,7) + p_qam64[1]*pow(I_qam64_avg,6) + p_qam64[2]*pow(I_qam64_avg,5) + p_qam64[3]*pow(I_qam64_avg,4) + p_qam64[4]*pow(I_qam64_avg, - 3) + p_qam64[5]*pow(I_qam64_avg,2) + p_qam64[6]*I_qam64_avg + p_qam64[7]); - sinr_eff = cmax3(sinr_eff_qpsk,sinr_eff_qam16,sinr_eff_qam64); - - //printf("SINR_Eff = %e\n",sinr_eff); - - return(sinr_eff); -} -// - - - -#ifdef DEBUG_DLSCH_TOOLS -main() -{ - - int i; - uint8_t rah; - uint32_t rballoc; - - generate_RIV_tables(); - - rah = 0; - rballoc = 0x1fff; - printf("rballoc 0 %x => %x\n",rballoc,conv_rballoc(rah,rballoc)); - rah = 1; - - rballoc = 0x1678; - printf("rballoc 1 %x => %x\n",rballoc,conv_rballoc(rah,rballoc)); - - rballoc = 0xfffc; - printf("rballoc 1 %x => %x\n",rballoc,conv_rballoc(rah,rballoc)); - rballoc = 0xfffd; - printf("rballoc 1 %x => %x\n",rballoc,conv_rballoc(rah,rballoc)); - rballoc = 0xffff; - printf("rballoc 1 %x => %x\n",rballoc,conv_rballoc(rah,rballoc)); - rballoc = 0xfffe; - printf("rballoc 1 %x => %x\n",rballoc,conv_rballoc(rah,rballoc)); -} - -#endif - diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c new file mode 100644 index 0000000000000000000000000000000000000000..8f0f8a6cab6fc308be46b61e562c149de5f74f66 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c @@ -0,0 +1,2276 @@ +/* + * 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/dci_tools.c + * \brief PHY Support routines (eNB/UE) for filling PDSCH/PUSCH/DLSCH/ULSCH data structures based on DCI PDUs generated by eNB MAC scheduler. + * \author R. Knopp + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr + * \note + * \warning + */ + +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "SCHED/sched_eNB.h" +#ifdef DEBUG_DCI_TOOLS +#include "PHY/phy_vars.h" +#endif +#include "assertions.h" +#include "nfapi_interface.h" +#include "transport_common_proto.h" +#include "SCHED/sched_common.h" +//#define DEBUG_HARQ + + +#include "LAYER2/MAC/mac.h" + +//#define DEBUG_DCI + +uint32_t localRIV2alloc_LUT6[32]; +uint32_t distRIV2alloc_even_LUT6[32]; +uint32_t distRIV2alloc_odd_LUT6[32]; +uint16_t RIV2nb_rb_LUT6[32]; +uint16_t RIV2first_rb_LUT6[32]; +uint16_t RIV_max6=0; + +uint32_t localRIV2alloc_LUT25[512]; +uint32_t distRIV2alloc_even_LUT25[512]; +uint32_t distRIV2alloc_odd_LUT25[512]; +uint16_t RIV2nb_rb_LUT25[512]; +uint16_t RIV2first_rb_LUT25[512]; +uint16_t RIV_max25=0; + + +uint32_t localRIV2alloc_LUT50_0[1600]; +uint32_t localRIV2alloc_LUT50_1[1600]; +uint32_t distRIV2alloc_gap0_even_LUT50_0[1600]; +uint32_t distRIV2alloc_gap0_odd_LUT50_0[1600]; +uint32_t distRIV2alloc_gap0_even_LUT50_1[1600]; +uint32_t distRIV2alloc_gap0_odd_LUT50_1[1600]; +uint32_t distRIV2alloc_gap1_even_LUT50_0[1600]; +uint32_t distRIV2alloc_gap1_odd_LUT50_0[1600]; +uint32_t distRIV2alloc_gap1_even_LUT50_1[1600]; +uint32_t distRIV2alloc_gap1_odd_LUT50_1[1600]; +uint16_t RIV2nb_rb_LUT50[1600]; +uint16_t RIV2first_rb_LUT50[1600]; +uint16_t RIV_max50=0; + +uint32_t localRIV2alloc_LUT100_0[6000]; +uint32_t localRIV2alloc_LUT100_1[6000]; +uint32_t localRIV2alloc_LUT100_2[6000]; +uint32_t localRIV2alloc_LUT100_3[6000]; +uint32_t distRIV2alloc_gap0_even_LUT100_0[6000]; +uint32_t distRIV2alloc_gap0_odd_LUT100_0[6000]; +uint32_t distRIV2alloc_gap0_even_LUT100_1[6000]; +uint32_t distRIV2alloc_gap0_odd_LUT100_1[6000]; +uint32_t distRIV2alloc_gap0_even_LUT100_2[6000]; +uint32_t distRIV2alloc_gap0_odd_LUT100_2[6000]; +uint32_t distRIV2alloc_gap0_even_LUT100_3[6000]; +uint32_t distRIV2alloc_gap0_odd_LUT100_3[6000]; +uint32_t distRIV2alloc_gap1_even_LUT100_0[6000]; +uint32_t distRIV2alloc_gap1_odd_LUT100_0[6000]; +uint32_t distRIV2alloc_gap1_even_LUT100_1[6000]; +uint32_t distRIV2alloc_gap1_odd_LUT100_1[6000]; +uint32_t distRIV2alloc_gap1_even_LUT100_2[6000]; +uint32_t distRIV2alloc_gap1_odd_LUT100_2[6000]; +uint32_t distRIV2alloc_gap1_even_LUT100_3[6000]; +uint32_t distRIV2alloc_gap1_odd_LUT100_3[6000]; +uint16_t RIV2nb_rb_LUT100[6000]; +uint16_t RIV2first_rb_LUT100[6000]; +uint16_t RIV_max100=0; + +extern RAN_CONTEXT_t RC; + +extern uint32_t current_dlsch_cqi; + +// Table 8.6.3-3 36.213 +uint16_t beta_cqi[16] = {0, //reserved + 0, //reserved + 9, //1.125 + 10, //1.250 + 11, //1.375 + 13, //1.625 + 14, //1.750 + 16, //2.000 + 18, //2.250 + 20, //2.500 + 23, //2.875 + 25, //3.125 + 28, //3.500 + 32, //4.000 + 40, //5.000 + 50 + }; //6.250 + +// Table 8.6.3-2 36.213 +uint16_t beta_ri[16] = {10, //1.250 + 13, //1.625 + 16, //2.000 + 20, //2.500 + 25, //3.125 + 32, //4.000 + 40, //5.000 + 50, //6.250 + 64, //8.000 + 80, //10.000 + 101, //12.625 + 127, //15.875 + 160, //20.000 + 0, //reserved + 0, //reserved + 0 + }; //reserved + +// Table 8.6.3-2 36.213 +uint16_t beta_ack[16] = {16, //2.000 + 20, //2.500 + 25, //3.125 + 32, //4.000 + 40, //5.000 + 50, //6.250 + 64, //8.000 + 80, //10.000 + 101, //12.625 + 127, //15.875 + 160, //20.000 + 248, //31.000 + 400, //50.000 + 640, //80.000 + 808 + };//126.00 + +int8_t delta_PUSCH_abs[4] = {-4,-1,1,4}; +int8_t delta_PUSCH_acc[4] = {-1,0,1,3}; + +int8_t *delta_PUCCH_lut = delta_PUSCH_acc; + +uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb) +{ + /* + MIMO_mode_t mode = dlsch_harq->mimo_mode; + uint32_t pmi_alloc = dlsch_harq->pmi_alloc; + */ + + switch (N_RB_DL) { + case 6: // 1 PRB per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>(rb<<1))&3); + else + return((pmi_alloc>>rb)&1); + + break; + + default: + case 25: // 4 PRBs per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>((rb>>2)<<1))&3); + else + return((pmi_alloc>>(rb>>2))&1); + + break; + + case 50: // 6 PRBs per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>((rb/6)<<1))&3); + else + return((pmi_alloc>>(rb/6))&1); + + break; + + case 100: // 8 PRBs per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>((rb>>3)<<1))&3); + else + return((pmi_alloc>>(rb>>3))&1); + + break; + } +} + +uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t lprime,uint8_t mi) +{ + + uint16_t i; + uint16_t Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48; + uint16_t mprime; + uint16_t *pcfich_reg = frame_parms->pcfich_reg; + + if ((lprime>0) && (frame_parms->Ncp==0) ) + return(0); + + // printf("check_phich_reg : mi %d\n",mi); + + // compute REG based on symbol + if ((lprime == 0)|| + ((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) + mprime = kprime/6; + else + mprime = kprime>>2; + + // check if PCFICH uses mprime + if ((lprime==0) && + ((mprime == pcfich_reg[0]) || + (mprime == pcfich_reg[1]) || + (mprime == pcfich_reg[2]) || + (mprime == pcfich_reg[3]))) { +#ifdef DEBUG_DCI_ENCODING + printf("[PHY] REG %d allocated to PCFICH\n",mprime); +#endif + return(1); + } + + // handle Special subframe case for TDD !!! + + // printf("Checking phich_reg %d\n",mprime); + if (mi > 0) { + if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0) + Ngroup_PHICH++; + + if (frame_parms->Ncp == 1) { + Ngroup_PHICH<<=1; + } + + + + for (i=0; i<Ngroup_PHICH; i++) { + if ((mprime == frame_parms->phich_reg[i][0]) || + (mprime == frame_parms->phich_reg[i][1]) || + (mprime == frame_parms->phich_reg[i][2])) { +#ifdef DEBUG_DCI_ENCODING + printf("[PHY] REG %d (lprime %d) allocated to PHICH\n",mprime,lprime); +#endif + return(1); + } + } + } + + return(0); +} + +uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi) +{ + + uint16_t Nreg=0; + uint8_t 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) { + Ngroup_PHICH<<=1; + } + + Ngroup_PHICH*=mi; + + if ((num_pdcch_symbols>0) && (num_pdcch_symbols<4)) + switch (frame_parms->N_RB_DL) { + case 6: + Nreg=12+(num_pdcch_symbols-1)*18; + break; + + case 25: + Nreg=50+(num_pdcch_symbols-1)*75; + break; + + case 50: + Nreg=100+(num_pdcch_symbols-1)*150; + break; + + case 100: + Nreg=200+(num_pdcch_symbols-1)*300; + break; + + default: + return(0); + } + + // printf("Nreg %d (%d)\n",Nreg,Nreg - 4 - (3*Ngroup_PHICH)); + return(Nreg - 4 - (3*Ngroup_PHICH)); +} + +uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi) +{ + return(get_nquad(num_pdcch_symbols,frame_parms,mi)/9); +} + + + +uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe) +{ + + // check for eNB only ! + return(get_nCCE(num_pdcch_symbols, + &RC.eNB[Mod_id][CC_id]->frame_parms, + get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe))); +} + + +void conv_eMTC_rballoc(uint16_t resource_block_coding, + uint32_t N_RB_DL, + uint32_t *rb_alloc) { + + + int narrowband = resource_block_coding>>5; + int RIV = resource_block_coding&31; + int N_NB_DL = N_RB_DL/6; + int i0 = (N_RB_DL>>1) - (3*N_NB_DL); + int first_rb = (6*narrowband)+i0; + int alloc = localRIV2alloc_LUT6[RIV]; + int ind = first_rb>>5; + int ind_mod = first_rb&31; + + if (((N_RB_DL&1) > 0) && (narrowband>=(N_NB_DL>>1))) first_rb++; + rb_alloc[0] = 0; + rb_alloc[1] = 0; + rb_alloc[2] = 0; + rb_alloc[3] = 0; + rb_alloc[ind] = alloc<<ind_mod; + if (ind_mod > 26) rb_alloc[ind+1] = alloc>>(6-(ind_mod-26)); +} + +void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2) +{ + + uint32_t i,shift,subset; + rb_alloc2[0] = 0; + rb_alloc2[1] = 0; + rb_alloc2[2] = 0; + rb_alloc2[3] = 0; + + // printf("N_RB_DL %d, ra_header %d, rb_alloc %x\n",N_RB_DL,ra_header,rb_alloc); + + switch (N_RB_DL) { + + case 6: + rb_alloc2[0] = rb_alloc&0x3f; + break; + + case 25: + if (ra_header == 0) {// Type 0 Allocation + + for (i=12; i>0; i--) { + if ((rb_alloc&(1<<i)) != 0) + rb_alloc2[0] |= (3<<((2*(12-i)))); + + // printf("rb_alloc2 (type 0) %x\n",rb_alloc2); + } + + if ((rb_alloc&1) != 0) + rb_alloc2[0] |= (1<<24); + } else { + subset = rb_alloc&1; + shift = (rb_alloc>>1)&1; + + for (i=0; i<11; i++) { + if ((rb_alloc&(1<<(i+2))) != 0) + rb_alloc2[0] |= (1<<(2*i)); + + //printf("rb_alloc2 (type 1) %x\n",rb_alloc2); + } + + if ((shift == 0) && (subset == 1)) + rb_alloc2[0]<<=1; + else if ((shift == 1) && (subset == 0)) + rb_alloc2[0]<<=4; + else if ((shift == 1) && (subset == 1)) + rb_alloc2[0]<<=3; + } + + break; + + case 50: + AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=50\n"); + + for (i=16; i>0; i--) { + if ((rb_alloc&(1<<i)) != 0) + rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32)); + } + + // bit mask across + if ((rb_alloc2[0]>>31)==1) + rb_alloc2[1] |= 1; + + if ((rb_alloc&1) != 0) + rb_alloc2[1] |= (3<<16); + break; + + case 100: + AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=100\n"); + for (i=0; i<25; i++) { + if ((rb_alloc&(1<<(24-i))) != 0) + rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32)); + + // printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i)); + } + + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", N_RB_DL); + DevParam (N_RB_DL, 0, 0); + break; + } + +} + + + +uint32_t conv_nprb(uint8_t ra_header,uint32_t rb_alloc,int N_RB_DL) +{ + + uint32_t nprb=0,i; + + switch (N_RB_DL) { + case 6: + for (i=0; i<6; i++) { + if ((rb_alloc&(1<<i)) != 0) + nprb += 1; + } + + break; + + case 25: + if (ra_header == 0) {// Type 0 Allocation + + for (i=12; i>0; i--) { + if ((rb_alloc&(1<<i)) != 0) + nprb += 2; + } + + if ((rb_alloc&1) != 0) + nprb += 1; + } else { + for (i=0; i<11; i++) { + if ((rb_alloc&(1<<(i+2))) != 0) + nprb += 1; + } + } + + break; + + case 50: + if (ra_header == 0) {// Type 0 Allocation + + for (i=0; i<16; i++) { + if ((rb_alloc&(1<<(16-i))) != 0) + nprb += 3; + } + + if ((rb_alloc&1) != 0) + nprb += 2; + + } else { + for (i=0; i<17; i++) { + if ((rb_alloc&(1<<(i+2))) != 0) + nprb += 1; + } + } + + break; + + case 100: + if (ra_header == 0) {// Type 0 Allocation + + for (i=0; i<25; i++) { + if ((rb_alloc&(1<<(24-i))) != 0) + nprb += 4; + } + } else { + for (i=0; i<25; i++) { + if ((rb_alloc&(1<<(i+2))) != 0) + nprb += 1; + } + } + + break; + + default: + LOG_E(PHY,"Invalide N_RB_DL %d\n", N_RB_DL); + DevParam (N_RB_DL, 0, 0); + break; + } + + return(nprb); +} + +uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) +{ + + uint16_t RIV; + + if (Lcrbs<=(1+(N_RB_DL>>1))) + RIV = (N_RB_DL*(Lcrbs-1)) + RBstart; + else + RIV = (N_RB_DL*(N_RB_DL+1-Lcrbs)) + (N_RB_DL-1-RBstart); + + return(RIV); +} + +// Convert a DCI Format 1C RIV to a Format 1A RIV +// This extracts the start and length in PRBs from the 1C rballoc and +// recomputes the RIV as if it were the 1A rballoc + +uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) { + + int NpDLVRB,N_RB_step,LpCRBsm1,RBpstart; + + switch (N_RB_DL) { + + case 6: // N_RB_step = 2, NDLVRB = 6, NpDLVRB = 3 + NpDLVRB = 3; + N_RB_step = 2; + break; + case 25: // N_RB_step = 2, NDLVRB = 24, NpDLVRB = 12 + NpDLVRB = 12; + N_RB_step = 2; + break; + case 50: // N_RB_step = 4, NDLVRB = 46, NpDLVRB = 11 + NpDLVRB = 11; + N_RB_step = 4; + break; + case 100: // N_RB_step = 4, NDLVRB = 96, NpDLVRB = 24 + NpDLVRB = 24; + N_RB_step = 4; + break; + default: + NpDLVRB = 24; + N_RB_step = 4; + break; + } + + // This is the 1C part from 7.1.6.3 in 36.213 + LpCRBsm1 = rballoc/NpDLVRB; + // printf("LpCRBs = %d\n",LpCRBsm1+1); + + if (LpCRBsm1 <= (NpDLVRB/2)) { + RBpstart = rballoc % NpDLVRB; + } + else { + LpCRBsm1 = NpDLVRB-LpCRBsm1; + RBpstart = NpDLVRB-(rballoc%NpDLVRB); + } + // printf("RBpstart %d\n",RBpstart); + return(computeRIV(N_RB_DL,N_RB_step*RBpstart,N_RB_step*(LpCRBsm1+1))); + +} + +uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { + + int offset; + + switch (N_RB_DL) { + + case 6: + // N_RB_DL = tildeN_RB_DL = 6 + // Ngap = 4 , P=1, Nrow = 2, Nnull = 2 + + switch (vrb) { + case 0: // even: 0->0, 1->2, odd: 0->3, 1->5 + case 1: + return ((3*odd_slot) + 2*(vrb&3))%6; + break; + case 2: // even: 2->3, 3->5, odd: 2->0, 3->2 + case 3: + return ((3*odd_slot) + 2*(vrb&3) + 5)%6; + break; + case 4: // even: 4->1, odd: 4->4 + return ((3*odd_slot) + 1)%6; + case 5: // even: 5->4, odd: 5->1 + return ((3*odd_slot) + 4)%6; + break; + } + break; + + case 15: + if (vrb<12) { + if ((vrb&3) < 2) // even: 0->0, 1->4, 4->1, 5->5, 8->2, 9->6 odd: 0->7, 1->11 + return(((7*odd_slot) + 4*(vrb&3) + (vrb>>2))%14) + 14*(vrb/14); + else if (vrb < 12) // even: 2->7, 3->11, 6->8, 7->12, 10->9, 11->13 + return (((7*odd_slot) + 4*(vrb&3) + (vrb>>2) +13 )%14) + 14*(vrb/14); + } + if (vrb==12) + return (3+(7*odd_slot)) % 14; + if (vrb==13) + return (10+(7*odd_slot)) % 14; + return 14; + break; + + case 25: + return (((12*odd_slot) + 6*(vrb&3) + (vrb>>2))%24) + 24*(vrb/24); + break; + + case 50: // P=3 + if (Ngap==0) { + // Nrow=12,Nnull=2,NVRBDL=46,Ngap1= 27 + if (vrb>=23) + offset=4; + else + offset=0; + if (vrb<44) { + if ((vrb&3)>=2) + return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2) + 45)%46; + else + return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2))%46; + } + if (vrb==44) // even: 44->11, odd: 45->34 + return offset+((23*odd_slot) + 22-12+1); + if (vrb==45) // even: 45->10, odd: 45->33 + return offset+((23*odd_slot) + 22+12); + if (vrb==46) + return offset+46+((23*odd_slot) + 23-12+1) % 46; + if (vrb==47) + return offset+46+((23*odd_slot) + 23+12) % 46; + if (vrb==48) + return offset+46+((23*odd_slot) + 23-12+1) % 46; + if (vrb==49) + return offset+46+((23*odd_slot) + 23+12) % 46; + } + else { + // Nrow=6,Nnull=6,NVRBDL=18,Ngap1= 27 + if (vrb>=9) + offset=18; + else + offset=0; + + if (vrb<12) { + if ((vrb&3)>=2) + return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2) + 17)%18; + else + return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2))%18; + } + else { + return offset+((9*odd_slot) + 12*(vrb&1)+(vrb>>1) )%18 + 18*(vrb/18); + } + } + break; + case 75: + // Ngap1 = 32, NVRBRL=64, P=4, Nrow= 16, Nnull=0 + if (Ngap ==0) { + return ((32*odd_slot) + 16*(vrb&3) + (vrb>>2))%64 + (vrb/64); + } else { + // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 + return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); + } + break; + case 100: + // Ngap1 = 48, NVRBDL=96, Nrow=24, Nnull=0 + if (Ngap ==0) { + return ((48*odd_slot) + 24*(vrb&3) + (vrb>>2))%96 + (vrb/96); + } else { + // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 + return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); + } + break; + default: + LOG_E(PHY,"Unknown N_RB_DL %d\n",N_RB_DL); + return 0; + } + return 0; + +} + + +void generate_RIV_tables(void) +{ + + // 6RBs localized RIV + uint8_t Lcrbs,RBstart; + uint16_t RIV; + uint32_t alloc0,allocdist0_0_even,allocdist0_0_odd,allocdist0_1_even,allocdist0_1_odd; + uint32_t alloc1,allocdist1_0_even,allocdist1_0_odd,allocdist1_1_even,allocdist1_1_odd; + uint32_t alloc2,allocdist2_0_even,allocdist2_0_odd,allocdist2_1_even,allocdist2_1_odd; + uint32_t alloc3,allocdist3_0_even,allocdist3_0_odd,allocdist3_1_even,allocdist3_1_odd; + uint32_t nVRB,nVRB_even_dist,nVRB_odd_dist; + + for (RBstart=0; RBstart<6; RBstart++) { + alloc0 = 0; + allocdist0_0_even = 0; + allocdist0_0_odd = 0; + for (Lcrbs=1; Lcrbs<=(6-RBstart); Lcrbs++) { + //printf("RBstart %d, len %d --> ",RBstart,Lcrbs); + nVRB = Lcrbs-1+RBstart; + alloc0 |= (1<<nVRB); + allocdist0_0_even |= (1<<get_prb(6,0,nVRB,0)); + allocdist0_0_odd |= (1<<get_prb(6,1,nVRB,0)); + RIV=computeRIV(6,RBstart,Lcrbs); + + if (RIV>RIV_max6) + RIV_max6 = RIV; + + // printf("RIV %d (%d) : first_rb %d NBRB %d\n",RIV,localRIV2alloc_LUT25[RIV],RBstart,Lcrbs); + localRIV2alloc_LUT6[RIV] = alloc0; + distRIV2alloc_even_LUT6[RIV] = allocdist0_0_even; + distRIV2alloc_odd_LUT6[RIV] = allocdist0_0_odd; + RIV2nb_rb_LUT6[RIV] = Lcrbs; + RIV2first_rb_LUT6[RIV] = RBstart; + } + } + + + for (RBstart=0; RBstart<25; RBstart++) { + alloc0 = 0; + allocdist0_0_even = 0; + allocdist0_0_odd = 0; + for (Lcrbs=1; Lcrbs<=(25-RBstart); Lcrbs++) { + nVRB = Lcrbs-1+RBstart; + //printf("RBstart %d, len %d --> ",RBstart,Lcrbs); + alloc0 |= (1<<nVRB); + allocdist0_0_even |= (1<<get_prb(25,0,nVRB,0)); + allocdist0_0_odd |= (1<<get_prb(25,1,nVRB,0)); + + //printf("alloc 0 %x, allocdist0_even %x, allocdist0_odd %x\n",alloc0,allocdist0_0_even,allocdist0_0_odd); + RIV=computeRIV(25,RBstart,Lcrbs); + + if (RIV>RIV_max25) + RIV_max25 = RIV;; + + + localRIV2alloc_LUT25[RIV] = alloc0; + distRIV2alloc_even_LUT25[RIV] = allocdist0_0_even; + distRIV2alloc_odd_LUT25[RIV] = allocdist0_0_odd; + RIV2nb_rb_LUT25[RIV] = Lcrbs; + RIV2first_rb_LUT25[RIV] = RBstart; + } + } + + + for (RBstart=0; RBstart<50; RBstart++) { + alloc0 = 0; + alloc1 = 0; + allocdist0_0_even=0; + allocdist1_0_even=0; + allocdist0_0_odd=0; + allocdist1_0_odd=0; + allocdist0_1_even=0; + allocdist1_1_even=0; + allocdist0_1_odd=0; + allocdist1_1_odd=0; + + for (Lcrbs=1; Lcrbs<=(50-RBstart); Lcrbs++) { + + nVRB = Lcrbs-1+RBstart; + + + if (nVRB<32) + alloc0 |= (1<<nVRB); + else + alloc1 |= (1<<(nVRB-32)); + + // Distributed Gap1, even slot + nVRB_even_dist = get_prb(50,0,nVRB,0); + if (nVRB_even_dist<32) + allocdist0_0_even |= (1<<nVRB_even_dist); + else + allocdist1_0_even |= (1<<(nVRB_even_dist-32)); + + // Distributed Gap1, odd slot + nVRB_odd_dist = get_prb(50,1,nVRB,0); + if (nVRB_odd_dist<32) + allocdist0_0_odd |= (1<<nVRB_odd_dist); + else + allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); + + // Distributed Gap2, even slot + nVRB_even_dist = get_prb(50,0,nVRB,1); + if (nVRB_even_dist<32) + allocdist0_1_even |= (1<<nVRB_even_dist); + else + allocdist1_1_even |= (1<<(nVRB_even_dist-32)); + + // Distributed Gap2, odd slot + nVRB_odd_dist = get_prb(50,1,nVRB,1); + if (nVRB_odd_dist<32) + allocdist0_1_odd |= (1<<nVRB_odd_dist); + else + allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); + + RIV=computeRIV(50,RBstart,Lcrbs); + + if (RIV>RIV_max50) + RIV_max50 = RIV; + + // printf("RIV %d : first_rb %d NBRB %d\n",RIV,RBstart,Lcrbs); + localRIV2alloc_LUT50_0[RIV] = alloc0; + localRIV2alloc_LUT50_1[RIV] = alloc1; + distRIV2alloc_gap0_even_LUT50_0[RIV] = allocdist0_0_even; + distRIV2alloc_gap0_even_LUT50_1[RIV] = allocdist1_0_even; + distRIV2alloc_gap0_odd_LUT50_0[RIV] = allocdist0_0_odd; + distRIV2alloc_gap0_odd_LUT50_1[RIV] = allocdist1_0_odd; + distRIV2alloc_gap1_even_LUT50_0[RIV] = allocdist0_1_even; + distRIV2alloc_gap1_even_LUT50_1[RIV] = allocdist1_1_even; + distRIV2alloc_gap1_odd_LUT50_0[RIV] = allocdist0_1_odd; + distRIV2alloc_gap1_odd_LUT50_1[RIV] = allocdist1_1_odd; + RIV2nb_rb_LUT50[RIV] = Lcrbs; + RIV2first_rb_LUT50[RIV] = RBstart; + } + } + + + for (RBstart=0; RBstart<100; RBstart++) { + alloc0 = 0; + alloc1 = 0; + alloc2 = 0; + alloc3 = 0; + allocdist0_0_even=0; + allocdist1_0_even=0; + allocdist2_0_even=0; + allocdist3_0_even=0; + allocdist0_0_odd=0; + allocdist1_0_odd=0; + allocdist2_0_odd=0; + allocdist3_0_odd=0; + allocdist0_1_even=0; + allocdist1_1_even=0; + allocdist2_1_even=0; + allocdist3_1_even=0; + allocdist0_1_odd=0; + allocdist1_1_odd=0; + allocdist2_1_odd=0; + allocdist3_1_odd=0; + + for (Lcrbs=1; Lcrbs<=(100-RBstart); Lcrbs++) { + + nVRB = Lcrbs-1+RBstart; + + if (nVRB<32) + alloc0 |= (1<<nVRB); + else if (nVRB<64) + alloc1 |= (1<<(nVRB-32)); + else if (nVRB<96) + alloc2 |= (1<<(nVRB-64)); + else + alloc3 |= (1<<(nVRB-96)); + + // Distributed Gap1, even slot + nVRB_even_dist = get_prb(100,0,nVRB,0); + +// if ((RBstart==0) && (Lcrbs<=8)) +// printf("nVRB %d => nVRB_even_dist %d\n",nVRB,nVRB_even_dist); + + + if (nVRB_even_dist<32) + allocdist0_0_even |= (1<<nVRB_even_dist); + else if (nVRB_even_dist<64) + allocdist1_0_even |= (1<<(nVRB_even_dist-32)); + else if (nVRB_even_dist<96) + allocdist2_0_even |= (1<<(nVRB_even_dist-64)); + else + allocdist3_0_even |= (1<<(nVRB_even_dist-96)); +/* if ((RBstart==0) && (Lcrbs<=8)) + printf("rballoc =>(%08x.%08x.%08x.%08x)\n", + allocdist0_0_even, + allocdist1_0_even, + allocdist2_0_even, + allocdist3_0_even + ); +*/ + // Distributed Gap1, odd slot + nVRB_odd_dist = get_prb(100,1,nVRB,0); + if (nVRB_odd_dist<32) + allocdist0_0_odd |= (1<<nVRB_odd_dist); + else if (nVRB_odd_dist<64) + allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); + else if (nVRB_odd_dist<96) + allocdist2_0_odd |= (1<<(nVRB_odd_dist-64)); + else + allocdist3_0_odd |= (1<<(nVRB_odd_dist-96)); + + + // Distributed Gap2, even slot + nVRB_even_dist = get_prb(100,0,nVRB,1); + if (nVRB_even_dist<32) + allocdist0_1_even |= (1<<nVRB_even_dist); + else if (nVRB_even_dist<64) + allocdist1_1_even |= (1<<(nVRB_even_dist-32)); + else if (nVRB_even_dist<96) + allocdist2_1_even |= (1<<(nVRB_even_dist-64)); + else + allocdist3_1_even |= (1<<(nVRB_even_dist-96)); + + + // Distributed Gap2, odd slot + nVRB_odd_dist = get_prb(100,1,nVRB,1); + if (nVRB_odd_dist<32) + allocdist0_1_odd |= (1<<nVRB_odd_dist); + else if (nVRB_odd_dist<64) + allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); + else if (nVRB_odd_dist<96) + allocdist2_1_odd |= (1<<(nVRB_odd_dist-64)); + else + allocdist3_1_odd |= (1<<(nVRB_odd_dist-96)); + + + RIV=computeRIV(100,RBstart,Lcrbs); + + if (RIV>RIV_max100) + RIV_max100 = RIV; + + // printf("RIV %d : first_rb %d NBRB %d\n",RIV,RBstart,Lcrbs); + localRIV2alloc_LUT100_0[RIV] = alloc0; + localRIV2alloc_LUT100_1[RIV] = alloc1; + localRIV2alloc_LUT100_2[RIV] = alloc2; + localRIV2alloc_LUT100_3[RIV] = alloc3; + distRIV2alloc_gap0_even_LUT100_0[RIV] = allocdist0_0_even; + distRIV2alloc_gap0_even_LUT100_1[RIV] = allocdist1_0_even; + distRIV2alloc_gap0_even_LUT100_2[RIV] = allocdist2_0_even; + distRIV2alloc_gap0_even_LUT100_3[RIV] = allocdist3_0_even; + distRIV2alloc_gap0_odd_LUT100_0[RIV] = allocdist0_0_odd; + distRIV2alloc_gap0_odd_LUT100_1[RIV] = allocdist1_0_odd; + distRIV2alloc_gap0_odd_LUT100_2[RIV] = allocdist2_0_odd; + distRIV2alloc_gap0_odd_LUT100_3[RIV] = allocdist3_0_odd; + distRIV2alloc_gap1_even_LUT100_0[RIV] = allocdist0_1_even; + distRIV2alloc_gap1_even_LUT100_1[RIV] = allocdist1_1_even; + distRIV2alloc_gap1_even_LUT100_2[RIV] = allocdist2_1_even; + distRIV2alloc_gap1_even_LUT100_3[RIV] = allocdist3_1_even; + distRIV2alloc_gap1_odd_LUT100_0[RIV] = allocdist0_1_odd; + distRIV2alloc_gap1_odd_LUT100_1[RIV] = allocdist1_1_odd; + distRIV2alloc_gap1_odd_LUT100_2[RIV] = allocdist2_1_odd; + distRIV2alloc_gap1_odd_LUT100_3[RIV] = allocdist3_1_odd; + + RIV2nb_rb_LUT100[RIV] = Lcrbs; + RIV2first_rb_LUT100[RIV] = RBstart; + } + } +} + +// Ngap = 3, N_VRB_DL=6, P=1, N_row=2, N_null=4*2-6=2 +// permutation for even slots : +// n_PRB'(0,2,4) = (0,1,2), n_PRB'(1,3,5) = (4,5,6) +// n_PRB''(0,1,2,3) = (0,2,4,6) +// => n_tilde_PRB(5) = (4) +// n_tilde_PRB(4) = (1) +// n_tilde_PRB(2,3) = (3,5) +// n_tilde_PRB(0,1) = (0,2) + +uint32_t get_rballoc(vrb_t vrb_type,uint16_t rb_alloc_dci) +{ + + return(localRIV2alloc_LUT25[rb_alloc_dci]); + +} + +uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe) +{ + uint8_t ret = 255; + + if (frame_parms->frame_type == FDD) { + ret = (((frame*10)+subframe)&7); + } else { + + switch (frame_parms->tdd_config) { + + case 1: + if ((subframe==2) || + (subframe==3) || + (subframe==7) || + (subframe==8)) + switch (subframe) { + case 2: + case 3: + ret = (subframe-2); + break; + + case 7: + case 8: + ret = (subframe-5); + break; + + default: + LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); + ret = (255); + break; + } + + break; + + case 2: + if ((subframe!=2) && (subframe!=7)) { + LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); + ret=255; + } + else ret = (subframe/7); + break; + + case 3: + if ((subframe<2) || (subframe>4)) { + LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); + ret = (255); + } + else ret = (subframe-2); + break; + + case 4: + if ((subframe<2) || (subframe>3)) { + LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); + ret = (255); + } + else ret = (subframe-2); + break; + + case 5: + if (subframe!=2) { + LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); + ret = (255); + } + else ret = (subframe-2); + break; + + default: + LOG_E(PHY,"subframe2_harq_pid, Unsupported TDD mode %d\n",frame_parms->tdd_config); + ret = (255); + } + } + + AssertFatal(ret!=255, + "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frame, subframe); + return ret; +} + +uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) +{ + uint8_t ul_subframe = 255; + + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 1) && + ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 + ul_subframe = ((n+6)%10); + else if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 6) && + ((n==0)||(n==1)||(n==5)||(n==6))) + ul_subframe = ((n+7)%10); + else if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 6) && + (n==9)) // tdd_config 6 SF 9 + ul_subframe = ((n+5)%10); + else + ul_subframe = ((n+4)%10); + + AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n); + + LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe); + return ul_subframe; +} + +uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) +{ + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 1) && + ((n==7)||(n==2))) // tdd_config 0,1 SF 1,5 + return((n==7)? 1 : 6); + else if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 6) && + ((n==7)||(n==8)||(n==2)||(n==3))) + return((n+3)%10); + else if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 6) && + (n==4)) // tdd_config 6 SF 9 + return(9); + else + return((n+6)%10); +} + +uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n) +{ + uint32_t ul_frame; + + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 1) && + ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 + ul_frame = (frame + (n==1 ? 0 : 1)); + else if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 6) && + ((n==0)||(n==1)||(n==5)||(n==6))) + ul_frame = (frame + (n>=5 ? 1 : 0)); + else if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config == 6) && + (n==9)) // tdd_config 6 SF 9 + ul_frame = (frame+1); + else + ul_frame = (frame+(n>=6 ? 1 : 0)); + + LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame); + return ul_frame % 1024; +} + +uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_t rank) +{ + + uint8_t i,wideband_pmi2; + uint32_t pmi_ex = 0; + + if (frame_parms->N_RB_DL!=25) { + LOG_E(PHY,"pmi_extend not yet implemented for anything else than 25PRB\n"); + return(-1); + } + + if (rank==0) { + wideband_pmi2=wideband_pmi&3; + for (i=0; i<14; i+=2) + pmi_ex|=(wideband_pmi2<<i); + } + else if (rank==1) { + wideband_pmi2=wideband_pmi&1; + for (i=0; i<7; i++) + pmi_ex|=(wideband_pmi2<<i); + } + else { + LOG_E(PHY,"unsupported rank\n"); + return(-1); + } + + return(pmi_ex); +} + +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)); +} + + +int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) +{ + switch (dci->format) { + + case format0: // This is an UL SCH allocation so nothing here, inform MAC + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config>0)) + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format0 (TDD, 1.5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, + ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); + break; + + case 25: + LOG_D(PHY,"DCI format0 (TDD1-6, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, + ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); + break; + + case 50: + LOG_D(PHY,"DCI format0 (TDD1-6, 10MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, + ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); + break; + + case 100: + LOG_D(PHY,"DCI format0 (TDD1-6, 20MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, + ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + else if (frame_parms->frame_type == FDD) + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format0 (FDD, 1.5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); + break; + + case 25: + LOG_D(PHY,"DCI format0 (FDD, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); + break; + + case 50: + LOG_D(PHY,"DCI format0 (FDD, 10MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); + break; + + case 100: + LOG_D(PHY,"DCI format0 (FDD, 20MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu[0])[0], + ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->hopping, + ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->cshift, + ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + else + LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); + + break; + + case format1: + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config>0)) + + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format1 (TDD 1.5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->dai); + break; + + case 25: + LOG_D(PHY,"DCI format1 (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->dai); + break; + + case 50: + LOG_D(PHY,"DCI format1 (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->dai); + break; + + case 100: + LOG_D(PHY,"DCI format1 (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->dai); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + else if (frame_parms->frame_type == FDD) { + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format1 (FDD, 1.5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 25: + LOG_D(PHY,"DCI format1 (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 50: + LOG_D(PHY,"DCI format1 (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 100: + LOG_D(PHY,"DCI format1 (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } + + else + LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); + + break; + + case format1A: // This is DLSCH allocation for control traffic + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config>0)) { + switch (frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format1A (TDD1-6, 1_5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); + LOG_D(PHY,"DAI %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); + break; + + case 25: + LOG_D(PHY,"DCI format1A (TDD1-6, 5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %d (NB_RB %d)\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); + LOG_D(PHY,"DAI %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); + break; + + case 50: + LOG_D(PHY,"DCI format1A (TDD1-6, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); + LOG_D(PHY,"DAI %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); + break; + + case 100: + LOG_D(PHY,"DCI format1A (TDD1-6, 20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT100[((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); + LOG_D(PHY,"DAI %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + + } else if (frame_parms->frame_type == FDD) { + switch (frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format1A(FDD, 1.5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 25: + LOG_D(PHY,"DCI format1A(FDD, 5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 50: + LOG_D(PHY,"DCI format1A(FDD, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 100: + LOG_D(PHY,"DCI format1A(FDD, 20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT100[((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); + LOG_D(PHY,"MCS %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs); + LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); + LOG_D(PHY,"NDI %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi); + LOG_D(PHY,"RV %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rv); + LOG_D(PHY,"TPC %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } + + break; + + case format1C: // This is DLSCH allocation for control traffic + switch (frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format1C (1.5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n", + ((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT6[conv_1C_RIV(((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,6)]); + LOG_D(PHY,"MCS %d\n",((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->mcs); + break; + + case 25: + LOG_D(PHY,"DCI format1C (5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[conv_1C_RIV(((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,25)]); + LOG_D(PHY,"MCS %d\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->mcs); + break; + + case 50: + LOG_D(PHY,"DCI format1C (10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"Ngap %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->Ngap); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,50)]); + LOG_D(PHY,"MCS %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->mcs); + break; + + case 100: + LOG_D(PHY,"DCI format1C (20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); + LOG_D(PHY,"Ngap %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->Ngap); + LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,100)]); + LOG_D(PHY,"MCS %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->mcs); + break; + + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + + + break; + + case format2: + + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config>0)) { + if (frame_parms->nb_antenna_ports_eNB == 2) { + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format2 2 antennas (TDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tbswap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi + ); + break; + + case 25: + LOG_D(PHY,"DCI format2 2 antennas (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + case 50: + LOG_D(PHY,"DCI format2 2 antennas (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + case 100: + LOG_D(PHY,"DCI format2 2 antennas (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } else if (frame_parms->nb_antenna_ports_eNB == 4) { + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format2 2 antennas (TDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tbswap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi + ); + break; + + case 25: + LOG_D(PHY,"DCI format2 2 antennas (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + case 50: + LOG_D(PHY,"DCI format2 2 antennas (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + case 100: + LOG_D(PHY,"DCI format2 2 antennas (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } + } else if (frame_parms->frame_type == FDD) { + if (frame_parms->nb_antenna_ports_eNB == 2) { + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format2 2 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 25: + + LOG_D(PHY,"DCI format2 2 antennas (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, swap %d, TPMI %d, TPC %d\n", + + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 50: + LOG_D(PHY,"DCI format2 2 antennas (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 100: + LOG_D(PHY,"DCI format2 2 antennas (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } else if (frame_parms->nb_antenna_ports_eNB == 4) { + switch(frame_parms->N_RB_DL) { + + case 6: + LOG_D(PHY,"DCI format2 4 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 25: + LOG_D(PHY,"DCI format2 4 antennas (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 50: + LOG_D(PHY,"DCI format2 4 antennas (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 100: + LOG_D(PHY,"DCI format2 4 antennas (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } + } + + else + LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); + + break; + + case format2A: + + if ((frame_parms->frame_type == TDD) && + (frame_parms->tdd_config>0)) { + if (frame_parms->nb_antenna_ports_eNB == 2) { + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format2A 2 antennas (FDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap + ); + break; + + case 25: + LOG_D(PHY,"DCI format2A 2 antennas (FDD 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); + break; + + case 50: + LOG_D(PHY,"DCI format2A 2 antennas (FDD 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); + break; + + case 100: + LOG_D(PHY,"DCI format2A 2 antennas (FDD 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } else if (frame_parms->nb_antenna_ports_eNB == 4) { + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format2A 4 antennas (TDD 1.5 MHz), rnti %x (%"PRIu64"): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi + ); + break; + + case 25: + LOG_D(PHY,"DCI format2A 4 antennas (TDD 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + case 50: + LOG_D(PHY,"DCI format2A 4 antennas (TDD 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + case 100: + LOG_D(PHY,"DCI format2A 4 antennas (TDD 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } + } else if (frame_parms->frame_type == FDD) { + if (frame_parms->nb_antenna_ports_eNB == 2) { + switch(frame_parms->N_RB_DL) { + case 6: + LOG_D(PHY,"DCI format2A 2 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", + dci->rnti, + ((uint32_t*)&dci->dci_pdu)[0], + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 25: + LOG_D(PHY,"DCI format2A 2 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 50: + LOG_D(PHY,"DCI format2A 2 antennas (FDD, 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 100: + LOG_D(PHY,"DCI format2A 2 antennas (FDD, 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } else if (frame_parms->nb_antenna_ports_eNB == 4) { + switch(frame_parms->N_RB_DL) { + + case 6: + LOG_D(PHY,"DCI format2A 4 antennas (FDD, 1.5 MHz), rnti %x (%"PRIu64"): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 25: + LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 50: + LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + case 100: + LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", + dci->rnti, + ((uint64_t*)&dci->dci_pdu)[0], + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); + break; + + default: + LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } + } + } + + else + LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); + + break; + + case format1E_2A_M10PRB: + + LOG_D(PHY,"DCI format1E_2A_M10PRB, rnti %x (%8x): harq_pid %d, rah %d, rb_alloc %x, mcs %d, rv %d, tpmi %d, ndi %d, dl_power_offset %d\n", + dci->rnti, + ((uint32_t *)&dci->dci_pdu)[0], + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->harq_pid, + //((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->tb_swap, + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rah, + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rballoc, + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->mcs, + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rv, + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->tpmi, + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->ndi, + ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->dl_power_off + ); + + break; + + default: + LOG_E(PHY,"dci_tools.c: dump_dci, unknown format %d\n",dci->format); + return(-1); + } + + return(0); +} diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common_extern.h b/openair1/PHY/LTE_TRANSPORT/dci_tools_common_extern.h new file mode 100644 index 0000000000000000000000000000000000000000..b0a06fb9f1e2359d0e512eb7a78effd1549d88a9 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common_extern.h @@ -0,0 +1,89 @@ +/* + * 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/dci_tools_common_extern.h + * \brief PHY Support routines (eNB/UE) for filling PDSCH/PUSCH/DLSCH/ULSCH data structures based on DCI PDUs generated by eNB MAC scheduler. + * \author R. Knopp + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr + * \note + * \warning + */ +#include <stdint.h> + +extern uint32_t localRIV2alloc_LUT6[32]; +extern uint32_t distRIV2alloc_even_LUT6[32]; +extern uint32_t distRIV2alloc_odd_LUT6[32]; +extern uint16_t RIV2nb_rb_LUT6[32]; +extern uint16_t RIV2first_rb_LUT6[32]; +extern uint16_t RIV_max6; + +extern uint32_t localRIV2alloc_LUT25[512]; +extern uint32_t distRIV2alloc_even_LUT25[512]; +extern uint32_t distRIV2alloc_odd_LUT25[512]; +extern uint16_t RIV2nb_rb_LUT25[512]; +extern uint16_t RIV2first_rb_LUT25[512]; +extern uint16_t RIV_max25; + + +extern uint32_t localRIV2alloc_LUT50_0[1600]; +extern uint32_t localRIV2alloc_LUT50_1[1600]; +extern uint32_t distRIV2alloc_gap0_even_LUT50_0[1600]; +extern uint32_t distRIV2alloc_gap0_odd_LUT50_0[1600]; +extern uint32_t distRIV2alloc_gap0_even_LUT50_1[1600]; +extern uint32_t distRIV2alloc_gap0_odd_LUT50_1[1600]; +extern uint32_t distRIV2alloc_gap1_even_LUT50_0[1600]; +extern uint32_t distRIV2alloc_gap1_odd_LUT50_0[1600]; +extern uint32_t distRIV2alloc_gap1_even_LUT50_1[1600]; +extern uint32_t distRIV2alloc_gap1_odd_LUT50_1[1600]; +extern uint16_t RIV2nb_rb_LUT50[1600]; +extern uint16_t RIV2first_rb_LUT50[1600]; +extern uint16_t RIV_max50; + +extern uint32_t localRIV2alloc_LUT100_0[6000]; +extern uint32_t localRIV2alloc_LUT100_1[6000]; +extern uint32_t localRIV2alloc_LUT100_2[6000]; +extern uint32_t localRIV2alloc_LUT100_3[6000]; +extern uint32_t distRIV2alloc_gap0_even_LUT100_0[6000]; +extern uint32_t distRIV2alloc_gap0_odd_LUT100_0[6000]; +extern uint32_t distRIV2alloc_gap0_even_LUT100_1[6000]; +extern uint32_t distRIV2alloc_gap0_odd_LUT100_1[6000]; +extern uint32_t distRIV2alloc_gap0_even_LUT100_2[6000]; +extern uint32_t distRIV2alloc_gap0_odd_LUT100_2[6000]; +extern uint32_t distRIV2alloc_gap0_even_LUT100_3[6000]; +extern uint32_t distRIV2alloc_gap0_odd_LUT100_3[6000]; +extern uint32_t distRIV2alloc_gap1_even_LUT100_0[6000]; +extern uint32_t distRIV2alloc_gap1_odd_LUT100_0[6000]; +extern uint32_t distRIV2alloc_gap1_even_LUT100_1[6000]; +extern uint32_t distRIV2alloc_gap1_odd_LUT100_1[6000]; +extern uint32_t distRIV2alloc_gap1_even_LUT100_2[6000]; +extern uint32_t distRIV2alloc_gap1_odd_LUT100_2[6000]; +extern uint32_t distRIV2alloc_gap1_even_LUT100_3[6000]; +extern uint32_t distRIV2alloc_gap1_odd_LUT100_3[6000]; +extern uint16_t RIV2nb_rb_LUT100[6000]; +extern uint16_t RIV2first_rb_LUT100[6000]; +extern uint16_t RIV_max100; + +extern int8_t *delta_PUCCH_lut; +extern int8_t delta_PUSCH_acc[4]; +extern int8_t delta_PUSCH_abs[4]; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index e91665e04eb19e23b7544ba94c1aefb2ab3806fc..a726621022743e5daebaaee5cae84d536da3f267 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -30,18 +30,18 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/CODING/defs.h" -#include "PHY/CODING/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" -#include "PHY/LTE_TRANSPORT/defs.h" -#include "PHY/LTE_TRANSPORT/proto.h" -#include "SCHED/defs.h" -#include "defs.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" +#include "SCHED/sched_eNB.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/log.h" #include <syscall.h> +#include "targets/RT/USER/rt_wrapper.h" //#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_FREE 1 @@ -52,7 +52,13 @@ ((pilots==1)&&(first_pilot==0)&&(((re<3))||((re>5)&&(re<9)))) \ */ #define is_not_pilot(pilots,first_pilot,re) (1) +/*extern void thread_top_init(char *thread_name, + int affinity, + uint64_t runtime, + uint64_t deadline, + uint64_t period);*/ +extern int codingw; void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) { @@ -244,11 +250,15 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) } + + int dlsch_encoding_2threads0(te_params *tep) { LTE_eNB_DLSCH_t *dlsch = tep->dlsch; unsigned int G = tep->G; unsigned char harq_pid = tep->harq_pid; + unsigned int total_worker = tep->total_worker; + unsigned int current_worker = tep->current_worker; unsigned short iind; @@ -261,7 +271,7 @@ int dlsch_encoding_2threads0(te_params *tep) { if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet - for (r=0; r<dlsch->harq_processes[harq_pid]->C>>1; r++) { + for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) { if (r<dlsch->harq_processes[harq_pid]->Cminus) Kr = dlsch->harq_processes[harq_pid]->Kminus; @@ -304,21 +314,34 @@ int dlsch_encoding_2threads0(te_params *tep) { // Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the // outputs for each code segment, see Section 5.1.5 p.20 - for (r=0; r<dlsch->harq_processes[harq_pid]->C>>1; r++) { - r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r], - G, //G - dlsch->harq_processes[harq_pid]->w[r], - dlsch->harq_processes[harq_pid]->e+r_offset, - dlsch->harq_processes[harq_pid]->C, // C - dlsch->Nsoft, // Nsoft, - dlsch->Mdlharq, - dlsch->Kmimo, - dlsch->harq_processes[harq_pid]->rvidx, - dlsch->harq_processes[harq_pid]->Qm, - dlsch->harq_processes[harq_pid]->Nl, - r, - nb_rb); - // m); // r + for (r=0,r_offset=0; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) { + if(r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker)){ + int Nl=dlsch->harq_processes[harq_pid]->Nl; + int Qm=dlsch->harq_processes[harq_pid]->Qm; + int C = dlsch->harq_processes[harq_pid]->C; + int Gp = G/Nl/Qm; + int GpmodC = Gp%C; + if (r < (C-(GpmodC))) + r_offset += Nl*Qm * (Gp/C); + else + r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C)); + } + else{ + r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r], + G, //G + dlsch->harq_processes[harq_pid]->w[r], + dlsch->harq_processes[harq_pid]->e+r_offset, + dlsch->harq_processes[harq_pid]->C, // C + dlsch->Nsoft, // Nsoft, + dlsch->Mdlharq, + dlsch->Kmimo, + dlsch->harq_processes[harq_pid]->rvidx, + dlsch->harq_processes[harq_pid]->Qm, + dlsch->harq_processes[harq_pid]->Nl, + r, + nb_rb); + // m); // r + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_OUT); @@ -326,32 +349,46 @@ int dlsch_encoding_2threads0(te_params *tep) { return(0); } + extern int oai_exit; void *te_thread(void *param) { + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + + thread_top_init("te_thread",1,200000,250000,500000); pthread_setname_np( pthread_self(),"te processing"); - LOG_I(PHY,"thread te created id=%ld", syscall(__NR_gettid)); + LOG_I(PHY,"thread te created id=%ld\n", syscall(__NR_gettid)); + - eNB_proc_t *proc = &((te_params *)param)->eNB->proc; + te_params *tep = (te_params *)param; + + //wait_sync("te_thread"); + while (!oai_exit) { + if (wait_on_condition(&tep->mutex_te,&tep->cond_te,&tep->instance_cnt_te,"te thread")<0) break; + if(oai_exit) break; - if (wait_on_condition(&proc->mutex_te,&proc->cond_te,&proc->instance_cnt_te,"te thread")<0) break; - - dlsch_encoding_2threads0((te_params*)param); - + dlsch_encoding_2threads0(tep); - if (release_thread(&proc->mutex_te,&proc->instance_cnt_te,"te thread")<0) break; + if (release_thread(&tep->mutex_te,&tep->instance_cnt_te,"te thread")<0) break; - if (pthread_cond_signal(&proc->cond_te) != 0) { + if (pthread_cond_signal(&tep->cond_te) != 0) { printf("[eNB] ERROR pthread_cond_signal for te thread exit\n"); exit_fun( "ERROR pthread_cond_signal" ); return(NULL); } + /*if(opp_enabled == 1 && te_wakeup_stats0->diff_now>50*3000){ + print_meas_now(te_wakeup_stats0,"coding_wakeup",stderr); + printf("te_thread0 delay for waking up in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx); + }*/ } return(NULL); } + + int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, unsigned char *a, uint8_t num_pdcch_symbols, @@ -360,9 +397,16 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, uint8_t subframe, time_stats_t *rm_stats, time_stats_t *te_stats, - time_stats_t *i_stats) + time_stats_t *te_wait_stats, + time_stats_t *te_main_stats, + time_stats_t *te_wakeup_stats0, + time_stats_t *te_wakeup_stats1, + time_stats_t *i_stats, + int worker_num) { + //start_meas(&eNB->dlsch_turbo_encoding_preperation_stats); + LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; eNB_proc_t *proc = &eNB->proc; unsigned int G; @@ -382,19 +426,22 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, mod_order = dlsch->harq_processes[harq_pid]->Qm; G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,dlsch->harq_processes[harq_pid]->mimo_mode==TM7?7:0); - if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet + start_meas(&eNB->dlsch_turbo_encoding_preperation_stats); // Add 24-bit crc (polynomial A) to payload crc = crc24a(a, A)>>8; + stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats); a[A>>3] = ((uint8_t*)&crc)[2]; a[1+(A>>3)] = ((uint8_t*)&crc)[1]; a[2+(A>>3)] = ((uint8_t*)&crc)[0]; dlsch->harq_processes[harq_pid]->B = A+24; memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); + //stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats); + start_meas(&eNB->dlsch_turbo_encoding_segmentation_stats); if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, dlsch->harq_processes[harq_pid]->c, dlsch->harq_processes[harq_pid]->B, @@ -406,34 +453,41 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, &dlsch->harq_processes[harq_pid]->F)<0) return(-1); - - - if (proc->instance_cnt_te==0) { - printf("[eNB] TE thread busy\n"); - exit_fun("TE thread busy"); - pthread_mutex_unlock( &proc->mutex_te ); - return(-1); - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT); - ++proc->instance_cnt_te; - - proc->tep.eNB = eNB; - proc->tep.dlsch = dlsch; - proc->tep.G = G; - proc->tep.harq_pid = harq_pid; - - // wakeup worker to do second half segments - if (pthread_cond_signal(&proc->cond_te) != 0) { - printf("[eNB] ERROR pthread_cond_signal for te thread exit\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return (-1); + stop_meas(&eNB->dlsch_turbo_encoding_segmentation_stats); + + start_meas(&eNB->dlsch_turbo_encoding_signal_stats); + for(int i=0;i<worker_num;i++) + { + proc->tep[i].eNB = eNB; + proc->tep[i].dlsch = dlsch; + proc->tep[i].G = G; + proc->tep[i].harq_pid = harq_pid; + proc->tep[i].total_worker = worker_num; + proc->tep[i].current_worker = i; + + pthread_mutex_lock( &proc->tep[i].mutex_te ); + if (proc->tep[i].instance_cnt_te==0) { + printf("[eNB] TE thread busy\n"); + exit_fun("TE thread busy"); + pthread_mutex_unlock( &proc->tep[i].mutex_te ); + return(-1); + } + + ++proc->tep[i].instance_cnt_te; + + // wakeup worker to do segments + if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) { + printf("[eNB] ERROR pthread_cond_signal for te thread %d exit\n",i); + exit_fun( "ERROR pthread_cond_signal" ); + return (-1); + } + + pthread_mutex_unlock( &proc->tep[i].mutex_te ); } - pthread_mutex_unlock( &proc->mutex_te ); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); - for (r=dlsch->harq_processes[harq_pid]->C>>1; r<dlsch->harq_processes[harq_pid]->C; r++) { + stop_meas(&eNB->dlsch_turbo_encoding_signal_stats); + start_meas(te_main_stats); + for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) { if (r<dlsch->harq_processes[harq_pid]->Cminus) Kr = dlsch->harq_processes[harq_pid]->Kminus; @@ -478,15 +532,18 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, } else { - proc->tep.eNB = eNB; - proc->tep.dlsch = dlsch; - proc->tep.G = G; - - // wakeup worker to do second half segments - if (pthread_cond_signal(&proc->cond_te) != 0) { + for(int i=0;i<worker_num;i++) + { + proc->tep[i].eNB = eNB; + proc->tep[i].dlsch = dlsch; + proc->tep[i].G = G; + proc->tep[i].total_worker = worker_num; + proc->tep[i].current_worker = i; + if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) { printf("[eNB] ERROR pthread_cond_signal for te thread exit\n"); exit_fun( "ERROR pthread_cond_signal" ); return (-1); + } } } @@ -496,7 +553,7 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) { // get information for E for the segments that are handled by the worker thread - if (r<(dlsch->harq_processes[harq_pid]->C>>1)) { + if (r<(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num) { int Nl=dlsch->harq_processes[harq_pid]->Nl; int Qm=dlsch->harq_processes[harq_pid]->Qm; int C = dlsch->harq_processes[harq_pid]->C; @@ -526,16 +583,138 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, stop_meas(rm_stats); } } + stop_meas(te_main_stats); - // wait for worker to finish - - wait_on_busy_condition(&proc->mutex_te,&proc->cond_te,&proc->instance_cnt_te,"te thread"); + start_meas(te_wait_stats); + if(worker_num == 1) + { + wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0"); + } + else if(worker_num == 2) + { + wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0"); + wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1"); + } + else + { + wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0"); + wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1"); + wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2"); + } + stop_meas(te_wait_stats); + + /*if(opp_enabled == 1 && te_wait_stats->diff_now>100*3000){ + print_meas_now(te_wait_stats,"coding_wait",stderr); + printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx); + }*/ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT); return(0); } +int dlsch_encoding_all(PHY_VARS_eNB *eNB, + unsigned char *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 *te_wait_stats, + time_stats_t *te_main_stats, + time_stats_t *te_wakeup_stats0, + time_stats_t *te_wakeup_stats1, + time_stats_t *i_stats) +{ + int encoding_return = 0; + unsigned int L,C,B; + B = dlsch->harq_processes[dlsch->harq_ids[subframe]]->B; + if(B<=6144) + { + L=0; + C=1; + } + else + { + L=24; + C = B/(6144-L); + if((6144-L)*C < B) + { + C = C+1; + } + } + + if(C >= 8 && get_nprocs()>=16 && codingw)//one main three worker + { + encoding_return = + dlsch_encoding_2threads(eNB, + a, + num_pdcch_symbols, + dlsch, + frame, + subframe, + rm_stats, + te_stats, + te_wait_stats, + te_main_stats, + te_wakeup_stats0, + te_wakeup_stats1, + i_stats, + 3); + } + else if(C >= 6 && get_nprocs()>=8 && codingw)//one main two worker + { + encoding_return = + dlsch_encoding_2threads(eNB, + a, + num_pdcch_symbols, + dlsch, + frame, + subframe, + rm_stats, + te_stats, + te_wait_stats, + te_main_stats, + te_wakeup_stats0, + te_wakeup_stats1, + i_stats, + 2); + } + else if(C >= 4 && get_nprocs()>=4 && codingw)//one main one worker + { + encoding_return = + dlsch_encoding_2threads(eNB, + a, + num_pdcch_symbols, + dlsch, + frame, + subframe, + rm_stats, + te_stats, + te_wait_stats, + te_main_stats, + te_wakeup_stats0, + te_wakeup_stats1, + i_stats, + 1); + } + else + { + encoding_return = + dlsch_encoding(eNB, + a, + num_pdcch_symbols, + dlsch, + frame, + subframe, + rm_stats, + te_stats, + i_stats); + } + return encoding_return; +} + int dlsch_encoding(PHY_VARS_eNB *eNB, unsigned char *a, @@ -720,186 +899,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, } -int dlsch_encoding_SIC(PHY_VARS_UE *ue, - unsigned char *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) -{ - - unsigned int G; - unsigned int crc=1; - unsigned short iind; - - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - unsigned char harq_pid = ue->dlsch[subframe&2][0][0]->rnti; - unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; - unsigned int A; - unsigned char mod_order; - unsigned int Kr=0,Kr_bytes,r,r_offset=0; - // unsigned short m=dlsch->harq_processes[harq_pid]->mcs; - uint8_t beamforming_mode=0; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); - - A = dlsch->harq_processes[harq_pid]->TBS; //6228 - // printf("Encoder: A: %d\n",A); - mod_order = dlsch->harq_processes[harq_pid]->Qm; - - if(dlsch->harq_processes[harq_pid]->mimo_mode == TM7) - beamforming_mode = 7; - else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM8) - beamforming_mode = 8; - else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10) - beamforming_mode = 9; - G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode); - - - // if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet - if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet -#ifdef DEBUG_DLSCH_CODING - printf("SIC encoding thinks this is a new packet \n"); -#endif - /* - int i; - printf("dlsch (tx): \n"); - for (i=0;i<(A>>3);i++) - printf("%02x.",a[i]); - printf("\n"); - */ - // Add 24-bit crc (polynomial A) to payload - crc = crc24a(a, - A)>>8; - a[A>>3] = ((uint8_t*)&crc)[2]; - a[1+(A>>3)] = ((uint8_t*)&crc)[1]; - a[2+(A>>3)] = ((uint8_t*)&crc)[0]; - // printf("CRC %x (A %d)\n",crc,A); - - dlsch->harq_processes[harq_pid]->B = A+24; - // dlsch->harq_processes[harq_pid]->b = a; - memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); - - if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, - dlsch->harq_processes[harq_pid]->c, - dlsch->harq_processes[harq_pid]->B, - &dlsch->harq_processes[harq_pid]->C, - &dlsch->harq_processes[harq_pid]->Cplus, - &dlsch->harq_processes[harq_pid]->Cminus, - &dlsch->harq_processes[harq_pid]->Kplus, - &dlsch->harq_processes[harq_pid]->Kminus, - &dlsch->harq_processes[harq_pid]->F)<0) - return(-1); - - for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { - - if (r<dlsch->harq_processes[harq_pid]->Cminus) - Kr = dlsch->harq_processes[harq_pid]->Kminus; - else - Kr = dlsch->harq_processes[harq_pid]->Kplus; - - Kr_bytes = Kr>>3; - - // get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14) - if (Kr_bytes<=64) - iind = (Kr_bytes-5); - else if (Kr_bytes <=128) - iind = 59 + ((Kr_bytes-64)>>1); - else if (Kr_bytes <= 256) - iind = 91 + ((Kr_bytes-128)>>2); - else if (Kr_bytes <= 768) - iind = 123 + ((Kr_bytes-256)>>3); - else { - printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes); - return(-1); - } - - -#ifdef DEBUG_DLSCH_CODING - printf("Generating Code Segment %d (%d bits)\n",r,Kr); - // generate codewords - - printf("bits_per_codeword (Kr)= %d, A %d\n",Kr,A); - printf("N_RB = %d\n",nb_rb); - printf("Ncp %d\n",frame_parms->Ncp); - printf("mod_order %d\n",mod_order); -#endif - - -#ifdef DEBUG_DLSCH_CODING - printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]); -#endif - start_meas(te_stats); - encoder(dlsch->harq_processes[harq_pid]->c[r], - Kr>>3, - &dlsch->harq_processes[harq_pid]->d[r][96], - (r==0) ? dlsch->harq_processes[harq_pid]->F : 0, - f1f2mat_old[iind*2], // f1 (see 36121-820, page 14) - f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14) - ); - stop_meas(te_stats); -#ifdef DEBUG_DLSCH_CODING - - if (r==0) - write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4); - -#endif - start_meas(i_stats); - dlsch->harq_processes[harq_pid]->RTC[r] = - sub_block_interleaving_turbo(4+(Kr_bytes*8), - &dlsch->harq_processes[harq_pid]->d[r][96], - dlsch->harq_processes[harq_pid]->w[r]); - stop_meas(i_stats); - } - - } - - // Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the - // outputs for each code segment, see Section 5.1.5 p.20 - - for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { -#ifdef DEBUG_DLSCH_CODING - printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n", - r, - G, - Kr*3, - mod_order,nb_rb); -#endif - - start_meas(rm_stats); -#ifdef DEBUG_DLSCH_CODING - printf("rvidx in SIC encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx); -#endif - r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r], - G, //G - dlsch->harq_processes[harq_pid]->w[r], - dlsch->harq_processes[harq_pid]->e+r_offset, - dlsch->harq_processes[harq_pid]->C, // C - dlsch->Nsoft, // Nsoft, - dlsch->Mdlharq, - dlsch->Kmimo, - dlsch->harq_processes[harq_pid]->rvidx, - dlsch->harq_processes[harq_pid]->Qm, - dlsch->harq_processes[harq_pid]->Nl, - r, - nb_rb); - // m); // r - stop_meas(rm_stats); -#ifdef DEBUG_DLSCH_CODING - - if (r==dlsch->harq_processes[harq_pid]->C-1) - write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4); - -#endif - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT); - - return(0); -} diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index f3a9a05ae5be7f7efe889d6fdafd34b4ad0b4345..a2f8f08073827072f130f0424bc019a3e7e4c97c 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -29,16 +29,17 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/CODING/defs.h" -#include "PHY/CODING/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" -#include "PHY/LTE_TRANSPORT/defs.h" -#include "defs.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" #include "UTIL/LOG/vcd_signal_dumper.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" -//#define DEBUG_DLSCH_MODULATION 1 +//#define DEBUG_DLSCH_MODULATION +#define NEW_ALLOC_RE //#define is_not_pilot(pilots,re,nushift,use2ndpilots) ((pilots==0) || ((re!=nushift) && (re!=nushift+6)&&((re!=nushift+3)||(use2ndpilots==1))&&((re!=nushift+9)||(use2ndpilots==1)))?1:0) @@ -94,32 +95,8 @@ uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, return(0); } -void generate_64qam_table(void) -{ - - int a,b,c,index; - for (a=-1; a<=1; a+=2) - for (b=-1; b<=1; b+=2) - for (c=-1; c<=1; c+=2) { - index = (1+a)*2 + (1+b) + (1+c)/2; - qam64_table[index] = -a*(QAM64_n1 + b*(QAM64_n2 + (c*QAM64_n3))); // 0 1 2 - } -} - -void generate_16qam_table(void) -{ - - int a,b,index; - - for (a=-1; a<=1; a+=2) - for (b=-1; b<=1; b+=2) { - index = (1+a) + (1+b)/2; - qam16_table[index] = -a*(QAM16_n1 + (b*QAM16_n2)); - } -} - @@ -157,6 +134,158 @@ void layer1prec2A(int32_t *antenna0_sample, int32_t *antenna1_sample, uint8_t pr uint32_t FOUR[2]={0,4}; uint32_t TWO[2]={0,2}; +int allocate_REs_in_RB_no_pilots_QPSK_siso(PHY_VARS_eNB* phy_vars_eNB, + int **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) +{ + + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms; + uint8_t *x0 = dlsch0_harq->e; + uint32_t qpsk_table_offset_re = 0; + uint32_t qpsk_table_offset_im = 0; + + uint32_t tti_offset; + uint8_t re; + uint8_t *x0p; + + if (skip_dc == 0) { + for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0; + re<12; + re++,x0p+=2,tti_offset++) { + + qpsk_table_offset_re=x0p[0]; + qpsk_table_offset_im=x0p[1]; + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im]; + } + } + else { + // 1st half of PRB + for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0; + re<6; + re++,x0p+=2,tti_offset++) { + + qpsk_table_offset_re=x0p[0]; + qpsk_table_offset_im=x0p[1]; + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im]; + } + // 2nd half of PRB + for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7; + re<12; + re++,x0p+=2,tti_offset++) { + + qpsk_table_offset_re=x0p[0]; + qpsk_table_offset_im=x0p[1]; + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im]; + } + } + *re_allocated = *re_allocated + 12; + *jj=*jj + 24; + + return(0); +} + +int allocate_REs_in_RB_pilots_QPSK_siso(PHY_VARS_eNB* phy_vars_eNB, + int **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) +{ + + + LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_eNB->frame_parms; + + uint8_t *x0 = dlsch0_harq->e; + uint32_t qpsk_table_offset_re = 0; + uint32_t qpsk_table_offset_im = 0; + + uint32_t tti_offset; + uint8_t re; + uint8_t *x0p; + + + if (skip_dc == 0) { + // printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]); + for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0]; + re<12; + x0p+=2) { + + qpsk_table_offset_re=x0p[0]; + qpsk_table_offset_im=x0p[1]; + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im]; + // printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]); + tti_offset+=P1_SHIFT[re+1]; + re+=P1_SHIFT[re+1]; + } + } + else { + for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0]; + re<6; + x0p+=2) { + + qpsk_table_offset_re+=x0p[0]; + qpsk_table_offset_im+=x0p[1]; + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im]; + tti_offset+=P1_SHIFT[re+1]; + re+=P1_SHIFT[re+1]; + } + + for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6]; + re<12; + x0p+=2) { + + qpsk_table_offset_re+=x0p[0]; + qpsk_table_offset_im+=x0p[1]; + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im]; + tti_offset+=P1_SHIFT[re+1]; + re+=P1_SHIFT[re+1]; + } + } + *re_allocated = *re_allocated + 10; + *jj=*jj + 20; + + return(0); +} + int allocate_REs_in_RB_no_pilots_16QAM_siso(PHY_VARS_eNB* phy_vars_eNB, int **txdataF, uint32_t *jj, @@ -1806,48 +1935,6 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF, return(0); } -uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb) -{ - /* - MIMO_mode_t mode = dlsch_harq->mimo_mode; - uint32_t pmi_alloc = dlsch_harq->pmi_alloc; - */ - - switch (N_RB_DL) { - case 6: // 1 PRB per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>(rb<<1))&3); - else - return((pmi_alloc>>rb)&1); - - break; - - default: - case 25: // 4 PRBs per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>((rb>>2)<<1))&3); - else - return((pmi_alloc>>(rb>>2))&1); - - break; - - case 50: // 6 PRBs per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>((rb/6)<<1))&3); - else - return((pmi_alloc>>(rb/6))&1); - - break; - - case 100: // 8 PRBs per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>((rb>>3)<<1))&3); - else - return((pmi_alloc>>(rb>>3))&1); - - break; - } -} inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms,int l,int nsymb) __attribute__((always_inline)); @@ -2011,11 +2098,11 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, uint8_t mod_order0 = 0; uint8_t mod_order1 = 0; int16_t amp_rho_a, amp_rho_b; - int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8]; - int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8]; + int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8];//qpsk_table_a0[2],qpsk_table_b0[2] + int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8];//qpsk_table_a1[2],qpsk_table_b1[2] int16_t *qam_table_s0=NULL,*qam_table_s1=NULL; -#if 0 +#ifdef NEW_ALLOC_RE /* TODO: variable to be removed? */ int (*allocate_REs)(PHY_VARS_eNB*, int **, @@ -2125,8 +2212,15 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13); } - - if (mod_order0 == 4) + /*if(mod_order0 == 2) + { + for(i=0;i<2;i++) + { + qpsk_table_a0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15); + qpsk_table_b0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15); + } + } + else*/ if (mod_order0 == 4) for (i=0;i<4; i++) { qam16_table_a0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15); qam16_table_b0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15); @@ -2137,7 +2231,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, qam64_table_b0[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15); } - if (mod_order1 == 4) + /*if (mod_order1 == 2) + { + for (i=0; i<2; i++) { + qpsk_table_a1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15); + qpsk_table_b1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15); + } + } + else*/ if (mod_order1 == 4) for (i=0; i<4; i++) { qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15); qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15); @@ -2259,7 +2360,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, re_offset = frame_parms->first_carrier_offset; symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); -#if 0 +#ifdef NEW_ALLOC_RE /* TODO: remove this code? */ allocate_REs = allocate_REs_in_RB; #endif @@ -2267,11 +2368,30 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, switch (mod_order0) { case 2: qam_table_s0 = NULL; + /*if (pilots) { + qam_table_s0 = qpsk_table_b0; +#ifdef NEW_ALLOC_RE + // TODO: remove this code? // + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_pilots_QPSK_siso : + allocate_REs_in_RB; +#endif + } + else { + qam_table_s0 = qpsk_table_a0; +#ifdef NEW_ALLOC_RE + // TODO: remove this code? // + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_no_pilots_QPSK_siso : + allocate_REs_in_RB; +#endif + + }*/ break; case 4: if (pilots) { qam_table_s0 = qam16_table_b0; -#if 0 +#ifdef NEW_ALLOC_RE /* TODO: remove this code? */ allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs_in_RB_pilots_16QAM_siso : @@ -2280,7 +2400,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, } else { qam_table_s0 = qam16_table_a0; -#if 0 +#ifdef NEW_ALLOC_RE /* TODO: remove this code? */ allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs_in_RB_no_pilots_16QAM_siso : @@ -2293,7 +2413,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, case 6: if (pilots) { qam_table_s0 = qam64_table_b0; -#if 0 +#ifdef NEW_ALLOC_RE /* TODO: remove this code? */ allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs_in_RB_pilots_64QAM_siso : @@ -2302,7 +2422,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, } else { qam_table_s0 = qam64_table_a0; -#if 0 +#ifdef NEW_ALLOC_RE /* TODO: remove this code? */ allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs_in_RB_no_pilots_64QAM_siso : @@ -2316,10 +2436,16 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, switch (mod_order1) { case 2: qam_table_s1 = NULL; -#if 0 +#ifdef NEW_ALLOC_RE /* TODO: remove this code? */ allocate_REs = allocate_REs_in_RB; #endif + /*if (pilots) { + qam_table_s1 = qpsk_table_b1; + } + else { + qam_table_s1 = qpsk_table_a1; + }*/ break; case 4: if (pilots) { diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index 8d650bbe217db458bcacef79a463469c66c6813a..21a7018d609ad4359f751cce98014ce03b2602cd 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -32,12 +32,12 @@ //#define DEBUG_SCRAMBLING 1 -#include "PHY/defs.h" -#include "PHY/CODING/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" -#include "defs.h" -#include "extern.h" -#include "PHY/extern.h" +#include "transport_eNB.h" +#include "PHY/phy_extern.h" #include "UTIL/LOG/vcd_signal_dumper.h" static inline unsigned int lte_gold_scram(unsigned int *x1, unsigned int *x2, unsigned char reset) __attribute__((always_inline)); @@ -187,6 +187,20 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, } + + +void init_scrambling_lut(void) { + + uint32_t s; + int i=0,j; + + for (s=0;s<=65535;s++) { + for (j=0;j<16;j++) { + scrambling_lut[i++] = (uint8_t)((s>>j)&1); + } + } +} + void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, int mbsfn_flag, LTE_UE_DLSCH_t *dlsch, @@ -228,7 +242,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, } } -void init_unscrambling_lut() { +void init_unscrambling_lut(void) { uint32_t s; int i=0,j; @@ -239,15 +253,3 @@ void init_unscrambling_lut() { } } } - -void init_scrambling_lut() { - - uint32_t s; - int i=0,j; - - for (s=0;s<=65535;s++) { - for (j=0;j<16;j++) { - scrambling_lut[i++] = (uint8_t)((s>>j)&1); - } - } -} diff --git a/openair1/PHY/LTE_TRANSPORT/edci.c b/openair1/PHY/LTE_TRANSPORT/edci.c index 5caf5bcd710f6da6e42ded836e5eca0ed547082e..bf1309900430282e3c716bde160644774ea89df2 100755 --- a/openair1/PHY/LTE_TRANSPORT/edci.c +++ b/openair1/PHY/LTE_TRANSPORT/edci.c @@ -32,15 +32,17 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "SCHED/sched_eNB.h" +#include "SIMULATION/TOOLS/sim.h" // for taus #include "PHY/sse_intrin.h" - +#include "transport_proto.h" +#include "transport_common_proto.h" #include "assertions.h" #include "T.h" #include "UTIL/LOG/log.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_DCI_ENCODING 1 //#define DEBUG_DCI_DECODING 1 diff --git a/openair1/PHY/LTE_TRANSPORT/group_hopping.c b/openair1/PHY/LTE_TRANSPORT/group_hopping.c index a7c8921c2ca0c10a76b666c9b79995b0fb8e10c1..6fc1f0a3e44ade5363eeaa05ce409ec711f135ee 100644 --- a/openair1/PHY/LTE_TRANSPORT/group_hopping.c +++ b/openair1/PHY/LTE_TRANSPORT/group_hopping.c @@ -29,7 +29,8 @@ * \note * \warning */ -#include "PHY/defs.h" +#include "PHY/defs_common.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_GROUPHOP 1 diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index 88312e4a4611af3cab61f73476e003429fc4e073..cfe4cf85588d882492ba0a81ba3b06e5b1faafd4 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -30,10 +30,10 @@ * \warning */ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" #include "PHY/TOOLS/alaw_lut.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" +#include "PHY/phy_extern.h" +#include "SCHED/sched_eNB.h" //#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.h b/openair1/PHY/LTE_TRANSPORT/if4_tools.h index 0a95e60ead3c7af2bad4c55e73f742fc0308e4f1..4fcf537f832bcbbfb6ffc1a53213f8a1a2bde30f 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.h +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.h @@ -32,7 +32,7 @@ #ifndef __IF4_TOOLS_H__ #define __IF4_TOOLS_H__ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" /// Macro for IF4 packet type #define IF4p5_PACKET_TYPE 0x080A diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c index b160318a6ee9899366430f656c2f300582a53251..06b4a4ad806fd746323c678dc8a568379f73c82a 100644 --- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c @@ -30,7 +30,7 @@ * \warning */ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" #include "PHY/TOOLS/alaw_lut.h" #include "time_utils.h" diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.h b/openair1/PHY/LTE_TRANSPORT/if5_tools.h index 84ad5305261b2fa29bbc6fb20aec20f9013715c4..0f24f7becee0334c1e2d900a5b79133bb9130ba8 100644 --- a/openair1/PHY/LTE_TRANSPORT/if5_tools.h +++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.h @@ -34,7 +34,7 @@ #define __IF5_TOOLS_H__ #include <stdint.h> -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" #define IF5_RRH_GW_DL 0x0022 #define IF5_RRH_GW_UL 0x0023 diff --git a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c index 910610b9694c806262928ccd891a5d38f7128150..a66344611b8c61921472f70b3a2766d9e6586cfe 100644 --- a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c +++ b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c @@ -30,9 +30,9 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/LTE_TRANSPORT/proto.h" +#include "PHY/defs_common.h" +#include "PHY/phy_extern.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" unsigned char get_Qm(unsigned char I_MCS) { diff --git a/openair1/PHY/LTE_TRANSPORT/mdci.h b/openair1/PHY/LTE_TRANSPORT/mdci.h index 060227eac033a3f979d32b29077b5de1f0aaa577..7be278530860fc88792c315130f62e84d77d4292 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/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c index e1846b3c0ab0d8dc7c809183bcfee963f29da793..eae88a6afeb794deade5d27373be0bebf142a91f 100644 --- a/openair1/PHY/LTE_TRANSPORT/pbch.c +++ b/openair1/PHY/LTE_TRANSPORT/pbch.c @@ -29,13 +29,14 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/CODING/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" -#include "defs.h" -#include "extern.h" -#include "PHY/extern.h" +#include "transport_eNB.h" +#include "transport_proto.h" +#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_PBCH 1 //#define DEBUG_PBCH_ENCODING @@ -138,6 +139,31 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, return(0); } +void pbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, + uint8_t *pbch_e, + uint32_t length) +{ + int i; + uint8_t reset; + uint32_t x1, x2, s=0; + + reset = 1; + // x1 is set in lte_gold_generic + x2 = frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.6.1 + // msg("pbch_scrambling: Nid_cell = %d\n",x2); + + for (i=0; i<length; i++) { + if ((i&0x1f)==0) { + s = lte_gold_generic(&x1, &x2, reset); + // printf("lte_gold[%d]=%x\n",i,s); + reset = 0; + } + + pbch_e[i] = (pbch_e[i]&1) ^ ((s>>(i&0x1f))&1); + + } +} + //uint8_t pbch_d[96+(3*(16+PBCH_A))], pbch_w[3*3*(16+PBCH_A)],pbch_e[1920]; //one bit per byte int generate_pbch(LTE_eNB_PBCH *eNB_pbch, int32_t **txdataF, @@ -393,28 +419,5 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, return(0); } -void pbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t *pbch_e, - uint32_t length) -{ - int i; - uint8_t reset; - uint32_t x1, x2, s=0; - - reset = 1; - // x1 is set in lte_gold_generic - x2 = frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.6.1 - // msg("pbch_scrambling: Nid_cell = %d\n",x2); - - for (i=0; i<length; i++) { - if ((i&0x1f)==0) { - s = lte_gold_generic(&x1, &x2, reset); - // printf("lte_gold[%d]=%x\n",i,s); - reset = 0; - } - - pbch_e[i] = (pbch_e[i]&1) ^ ((s>>(i&0x1f))&1); - } -} diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c index b7e24cb87dad212b71f461996a6a6a89f02468fa..18a156c3fbc004f0421c67eb635c08102833d5e8 100644 --- a/openair1/PHY/LTE_TRANSPORT/pcfich.c +++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c @@ -29,48 +29,13 @@ * \note * \warning */ -#include "PHY/defs.h" +#include "PHY/impl_defs_top.h" +#include "PHY/defs_eNB.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_PCFICH +extern uint8_t pcfich_b[4][32]; -void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) -{ - - uint16_t kbar = 6 * (frame_parms->Nid_cell %(2*frame_parms->N_RB_DL)); - uint16_t first_reg; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - pcfich_reg[0] = kbar/6; - first_reg = pcfich_reg[0]; - - frame_parms->pcfich_first_reg_idx=0; - - pcfich_reg[1] = ((kbar + (frame_parms->N_RB_DL>>1)*6)%(frame_parms->N_RB_DL*12))/6; - - if (pcfich_reg[1] < pcfich_reg[0]) { - frame_parms->pcfich_first_reg_idx = 1; - first_reg = pcfich_reg[1]; - } - - pcfich_reg[2] = ((kbar + (frame_parms->N_RB_DL)*6)%(frame_parms->N_RB_DL*12))/6; - - if (pcfich_reg[2] < first_reg) { - frame_parms->pcfich_first_reg_idx = 2; - first_reg = pcfich_reg[2]; - } - - pcfich_reg[3] = ((kbar + ((3*frame_parms->N_RB_DL)>>1)*6)%(frame_parms->N_RB_DL*12))/6; - - if (pcfich_reg[3] < first_reg) { - frame_parms->pcfich_first_reg_idx = 3; - first_reg = pcfich_reg[3]; - } - - - //#ifdef DEBUG_PCFICH - printf("pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]); - //#endif -} void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms, uint8_t subframe, @@ -96,37 +61,7 @@ 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}, - {0,0,0,0,0,0,0,0,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, @@ -215,98 +150,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/pcfich_common.c b/openair1/PHY/LTE_TRANSPORT/pcfich_common.c new file mode 100644 index 0000000000000000000000000000000000000000..d6466862a79ba02d4187ab74ada21bfc431549b9 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/pcfich_common.c @@ -0,0 +1,72 @@ +/* + * 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/pcfich.c +* \brief Top-level routines for generating and decoding the PCFICH/CFI physical/transport channel V8.6 2009-03 +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ +#include "PHY/impl_defs_top.h" +#include "PHY/defs_eNB.h" + +void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) +{ + + uint16_t kbar = 6 * (frame_parms->Nid_cell %(2*frame_parms->N_RB_DL)); + uint16_t first_reg; + uint16_t *pcfich_reg = frame_parms->pcfich_reg; + + pcfich_reg[0] = kbar/6; + first_reg = pcfich_reg[0]; + + frame_parms->pcfich_first_reg_idx=0; + + pcfich_reg[1] = ((kbar + (frame_parms->N_RB_DL>>1)*6)%(frame_parms->N_RB_DL*12))/6; + + if (pcfich_reg[1] < pcfich_reg[0]) { + frame_parms->pcfich_first_reg_idx = 1; + first_reg = pcfich_reg[1]; + } + + pcfich_reg[2] = ((kbar + (frame_parms->N_RB_DL)*6)%(frame_parms->N_RB_DL*12))/6; + + if (pcfich_reg[2] < first_reg) { + frame_parms->pcfich_first_reg_idx = 2; + first_reg = pcfich_reg[2]; + } + + pcfich_reg[3] = ((kbar + ((3*frame_parms->N_RB_DL)>>1)*6)%(frame_parms->N_RB_DL*12))/6; + + if (pcfich_reg[3] < first_reg) { + frame_parms->pcfich_first_reg_idx = 3; + first_reg = pcfich_reg[3]; + } + + + //#ifdef DEBUG_PCFICH + printf("pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]); + //#endif +} diff --git a/openair1/PHY/LTE_TRANSPORT/pch.c b/openair1/PHY/LTE_TRANSPORT/pch.c deleted file mode 100644 index 600c5215bdd5c4bbde741ff86b4dad7196620633..0000000000000000000000000000000000000000 --- 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 2bd7140c32ccc96524b58d9e489280bae5cf7754..2e8a6e410c3a9804d109fb0c72b22f8a610e9df4 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -1,3 +1,4 @@ + /* * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with @@ -20,7 +21,7 @@ */ /*! \file PHY/LTE_TRANSPORT/phich.c -* \brief Top-level routines for generating and decoding the PHICH/HI physical/transport channel V8.6 2009-03 +* \brief Top-level routines for generating the PHICH/HI physical/transport channel V8.6 2009-03 * \author R. Knopp * \date 2011 * \version 0.1 @@ -30,15 +31,11 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "defs.h" - -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/defs.h" - +#include "PHY/defs_eNB.h" +#include "PHY/impl_defs_top.h" #include "T.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" +#include "transport_common_proto.h" //#define DEBUG_PHICH 1 @@ -48,365 +45,6 @@ //unsigned short phich_reg[MAX_NUM_PHICH_GROUPS][3]; -uint8_t rv_table[4] = {0, 2, 3, 1}; - -uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) -{ - - // for FDD - if (frame_parms->frame_type == FDD) - return 1; - - // for TDD - switch (frame_parms->tdd_config) { - - case 0: - if ((subframe==0) || (subframe==5)) - return(2); - else return(1); - - break; - - case 1: - if ((subframe==0) || (subframe==5)) - return(0); - else return(1); - - break; - - case 2: - if ((subframe==3) || (subframe==8)) - return(1); - else return(0); - - break; - - case 3: - if ((subframe==0) || (subframe==8) || (subframe==9)) - return(1); - else return(0); - - break; - - case 4: - if ((subframe==8) || (subframe==9)) - return(1); - else return(0); - - break; - - case 5: - if (subframe==8) - return(1); - else return(0); - - break; - - case 6: - return(1); - break; - - default: - return(0); - } -} - -unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) -{ - - if (frame_parms->frame_type == FDD) - return(subframe&7); - - switch (frame_parms->tdd_config) { - case 3: - if ( (subframe == 8) || (subframe == 9) ) { - return(subframe-8); - } else if (subframe==0) - return(2); - else { - LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - return(0); - } - - break; - - case 4: - if ( (subframe == 8) || (subframe == 9) ) { - return(subframe-8); - } else { - LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - return(0); - } - - break; - - } - - return(0); -} - -int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int subframe) -{ - int pusch_frame; - - if (frame_parms->frame_type == FDD) { - pusch_frame = subframe<4 ? frame + 1024 - 1 : frame; - } else { - // Note this is not true, but it doesn't matter, the frame number is irrelevant for TDD! - pusch_frame = (frame); - } - - //LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame); - return pusch_frame % 1024; -} - -uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) -{ - uint8_t pusch_subframe = 255; - - if (frame_parms->frame_type == FDD) - return subframe < 4 ? subframe + 6 : subframe - 4; - - switch (frame_parms->tdd_config) { - case 0: - if (subframe == 0) - pusch_subframe = (3); - else if (subframe == 5) { - pusch_subframe = (8); - } else if (subframe == 6) - pusch_subframe = (2); - else if (subframe == 1) - pusch_subframe = (7); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 1: - if (subframe == 6) - pusch_subframe = (2); - else if (subframe == 9) - pusch_subframe = (3); - else if (subframe == 1) - pusch_subframe = (7); - else if (subframe == 4) - pusch_subframe = (8); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 2: - if (subframe == 8) - pusch_subframe = (2); - else if (subframe == 3) - pusch_subframe = (7); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 3: - if ( (subframe == 8) || (subframe == 9) ) { - pusch_subframe = (subframe-6); - } else if (subframe==0) - pusch_subframe = (4); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 4: - if ( (subframe == 8) || (subframe == 9) ) { - pusch_subframe = (subframe-6); - } else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 5: - if (subframe == 8) { - pusch_subframe = (2); - } else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 6: - if (subframe == 6) { - pusch_subframe = (2); - } else if (subframe == 9) { - pusch_subframe = (3); - } else if (subframe == 0) { - pusch_subframe = (4); - } else if (subframe == 1) { - pusch_subframe = (7); - } else if (subframe == 5) { - pusch_subframe = (8); - } else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - default: - AssertFatal(1==0, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config); - pusch_subframe = (0); - } - - LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", subframe, pusch_subframe); - return pusch_subframe; -} - -int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg) -{ - - if ((reg == frame_parms->pcfich_reg[0]) || - (reg == frame_parms->pcfich_reg[1]) || - (reg == frame_parms->pcfich_reg[2]) || - (reg == frame_parms->pcfich_reg[3])) - return(1); - - return(0); -} - -void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) -{ - - unsigned short n0 = (frame_parms->N_RB_DL * 2) - 4; // 2 REG per RB less the 4 used by PCFICH in first symbol - unsigned short n1 = (frame_parms->N_RB_DL * 3); // 3 REG per RB in second and third symbol - unsigned short n2 = n1; - unsigned short mprime = 0; - unsigned short Ngroup_PHICH; - // uint16_t *phich_reg = frame_parms->phich_reg; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - // 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++; - - // check if Extended prefix - if (frame_parms->Ncp == 1) { - Ngroup_PHICH<<=1; - } - -#ifdef DEBUG_PHICH - LOG_D(PHY,"Ngroup_PHICH %d (phich_config_common.phich_resource %d,phich_config_common.phich_duration %s, NidCell %d,Ncp %d, frame_type %d), smallest pcfich REG %d, n0 %d, n1 %d (first PHICH REG %d)\n", - ((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)), - frame_parms->phich_config_common.phich_resource, - frame_parms->phich_config_common.phich_duration==normal?"normal":"extended", - frame_parms->Nid_cell,frame_parms->Ncp,frame_parms->frame_type, - pcfich_reg[frame_parms->pcfich_first_reg_idx], - n0, - n1, - ((frame_parms->Nid_cell))%n0); -#endif - - // This is the algorithm from Section 6.9.3 in 36-211, it works only for normal PHICH duration for now ... - - for (mprime=0; - mprime<((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)); - mprime++) { - - if (frame_parms->phich_config_common.phich_duration==normal) { // normal PHICH duration - - frame_parms->phich_reg[mprime][0] = (frame_parms->Nid_cell + mprime)%n0; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[frame_parms->pcfich_first_reg_idx]) - frame_parms->phich_reg[mprime][0]++; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3]) - frame_parms->phich_reg[mprime][0]++; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+2)&3]) - frame_parms->phich_reg[mprime][0]++; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3]) - frame_parms->phich_reg[mprime][0]++; - - frame_parms->phich_reg[mprime][1] = (frame_parms->Nid_cell + mprime + (n0/3))%n0; - - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[frame_parms->pcfich_first_reg_idx]) - frame_parms->phich_reg[mprime][1]++; - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3]) - frame_parms->phich_reg[mprime][1]++; - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+2)&3]) - frame_parms->phich_reg[mprime][1]++; - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3]) - frame_parms->phich_reg[mprime][1]++; - - - frame_parms->phich_reg[mprime][2] = (frame_parms->Nid_cell + mprime + (2*n0/3))%n0; - - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[frame_parms->pcfich_first_reg_idx]) - frame_parms->phich_reg[mprime][2]++; - - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3]) - frame_parms->phich_reg[mprime][2]++; - - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+2)&3]) - frame_parms->phich_reg[mprime][2]++; - - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3]) - frame_parms->phich_reg[mprime][2]++; - -#ifdef DEBUG_PHICH - printf("phich_reg :%d => %d,%d,%d\n",mprime,frame_parms->phich_reg[mprime][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]); -#endif - } else { // extended PHICH duration - frame_parms->phich_reg[mprime<<1][0] = (frame_parms->Nid_cell + mprime)%n0; - frame_parms->phich_reg[1+(mprime<<1)][0] = (frame_parms->Nid_cell + mprime)%n0; - - frame_parms->phich_reg[mprime<<1][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1; - frame_parms->phich_reg[mprime<<1][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2; - - frame_parms->phich_reg[1+(mprime<<1)][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1; - frame_parms->phich_reg[1+(mprime<<1)][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2; - //#ifdef DEBUG_PHICH - printf("phich_reg :%d => %d,%d,%d\n",mprime<<1,frame_parms->phich_reg[mprime<<1][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]); - printf("phich_reg :%d => %d,%d,%d\n",1+(mprime<<1),frame_parms->phich_reg[1+(mprime<<1)][0],frame_parms->phich_reg[1+(mprime<<1)][1],frame_parms->phich_reg[1+(mprime<<1)][2]); - //#endif - } - } // mprime loop -} // 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 @@ -1065,436 +703,6 @@ void generate_phich(LTE_DL_FRAME_PARMS *frame_parms, } // normal/extended prefix } -// This routine demodulates the PHICH and updates PUSCH/ULSCH parameters - -void rx_phich(PHY_VARS_UE *ue, - UE_rxtx_proc_t *proc, - uint8_t subframe, - uint8_t eNB_id) -{ - - - LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - LTE_UE_PDCCH **pdcch_vars = &ue->pdcch_vars[ue->current_thread_id[subframe]][eNB_id]; - - // uint8_t HI; - uint8_t harq_pid = phich_subframe_to_harq_pid(frame_parms,proc->frame_rx,subframe); - LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id]; - int16_t phich_d[24],*phich_d_ptr,HI16; - // unsigned int i,aa; - int8_t d[24],*dp; - uint16_t reg_offset; - - // scrambling - uint32_t x1, x2, s=0; - uint8_t reset = 1; - int16_t cs[12]; - uint32_t i,i2,i3,phich_quad; - int32_t **rxdataF_comp = pdcch_vars[eNB_id]->rxdataF_comp; - uint8_t Ngroup_PHICH,ngroup_PHICH,nseq_PHICH; - uint8_t NSF_PHICH = 4; - uint8_t pusch_subframe; - - int8_t delta_PUSCH_acc[4] = {-1,0,1,3}; - - // check if we're expecting a PHICH in this subframe - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX\n",ue->Mod_id,harq_pid,proc->frame_rx,subframe); - - if (!ulsch) - return; - - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX Status: %d \n",ue->Mod_id,harq_pid,proc->frame_rx,subframe, ulsch->harq_processes[harq_pid]->status); - - if (ulsch->harq_processes[harq_pid]->status == ACTIVE) { - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX ACTIVE\n",ue->Mod_id,harq_pid,proc->frame_rx,subframe); - 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; - - - ngroup_PHICH = (ulsch->harq_processes[harq_pid]->first_rb + - ulsch->harq_processes[harq_pid]->n_DMRS)%Ngroup_PHICH; - - if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == TDD) ) { - pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe); - - if ((pusch_subframe == 4) || (pusch_subframe == 9)) - ngroup_PHICH += Ngroup_PHICH; - } - - nseq_PHICH = ((ulsch->harq_processes[harq_pid]->first_rb/Ngroup_PHICH) + - ulsch->harq_processes[harq_pid]->n_DMRS)%(2*NSF_PHICH); - } else { - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX %s\n", - ue->Mod_id, - harq_pid, - proc->frame_rx, - subframe, - (ulsch->harq_processes[harq_pid]->status==SCH_IDLE? "SCH_IDLE" : - (ulsch->harq_processes[harq_pid]->status==ACTIVE? "ACTIVE" : - (ulsch->harq_processes[harq_pid]->status==CBA_ACTIVE? "CBA_ACTIVE": - (ulsch->harq_processes[harq_pid]->status==DISABLED? "DISABLED" : "UNKNOWN"))))); - - return; - } - - memset(d,0,24*sizeof(int8_t)); - phich_d_ptr = phich_d; - - // 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] = 1-(((s>>(i&0x1f))&1)<<1); - } - - if (frame_parms->Ncp == 0) { // Normal Cyclic Prefix - - - // 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,"PHICH =>"); - - for (i=0; i<24; i++) { - LOG_D(PHY,"%2d,",d[i]); - } - - LOG_D(PHY,"\n"); -#endif - // demodulation here - - - } 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"); - } - } - - HI16 = 0; - - //#ifdef DEBUG_PHICH - - //#endif - /* - for (i=0;i<200;i++) - printf("re %d: %d %d\n",i,((int16_t*)&rxdataF_comp[0][i])[0],((int16_t*)&rxdataF_comp[0][i])[1]); - */ - for (phich_quad=0; phich_quad<3; phich_quad++) { - if (frame_parms->Ncp == 1) - reg_offset = (frame_parms->phich_reg[ngroup_PHICH][phich_quad]*4)+ (phich_quad*frame_parms->N_RB_DL*12); - else - reg_offset = (frame_parms->phich_reg[ngroup_PHICH][phich_quad]*4); - - // msg("\n[PUSCH 0]PHICH (RX) quad %d (%d)=>",phich_quad,reg_offset); - dp = &d[phich_quad*8];; - - for (i=0; i<8; i++) { - phich_d_ptr[i] = ((int16_t*)&rxdataF_comp[0][reg_offset])[i]; - -#ifdef DEBUG_PHICH - LOG_D(PHY,"%d,",((int16_t*)&rxdataF_comp[0][reg_offset])[i]); -#endif - - HI16 += (phich_d_ptr[i] * dp[i]); - } - } - -#ifdef DEBUG_PHICH - LOG_D(PHY,"\n"); - LOG_D(PHY,"HI16 %d\n",HI16); -#endif - - if (HI16>0) { //NACK - if (ue->ulsch_Msg3_active[eNB_id] == 1) { - LOG_D(PHY,"[UE %d][PUSCH %d][RAPROC] Frame %d subframe %d Msg3 PHICH, received NAK (%d) nseq %d, ngroup %d\n", - ue->Mod_id,harq_pid, - proc->frame_rx, - subframe, - HI16, - nseq_PHICH, - ngroup_PHICH); - - ulsch->f_pusch += delta_PUSCH_acc[ulsch->harq_processes[harq_pid]->TPC]; - - LOG_D(PHY,"[PUSCH %d] AbsSubframe %d.%d: f_pusch (ACC) %d, adjusting by %d (TPC %d)\n", - harq_pid,proc->frame_rx,subframe,ulsch->f_pusch, - delta_PUSCH_acc[ulsch->harq_processes[harq_pid]->TPC], - ulsch->harq_processes[harq_pid]->TPC); - - - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; - // ulsch->harq_processes[harq_pid]->Ndi = 0; - ulsch->harq_processes[harq_pid]->round++; - ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; - - if (ulsch->harq_processes[harq_pid]->round>=ue->frame_parms.maxHARQ_Msg3Tx) { - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag =0; - ulsch->harq_processes[harq_pid]->status = SCH_IDLE; - // inform MAC that Msg3 transmission has failed - ue->ulsch_Msg3_active[eNB_id] = 0; - } - } else { -#ifdef UE_DEBUG_TRACE - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received NAK (%d) nseq %d, ngroup %d round %d (Mlimit %d)\n", - ue->Mod_id,harq_pid, - proc->frame_rx%1024, - subframe, - HI16, - nseq_PHICH, - ngroup_PHICH, - ulsch->harq_processes[harq_pid]->round, - ulsch->Mlimit); -#endif - - // ulsch->harq_processes[harq_pid]->Ndi = 0; - ulsch->harq_processes[harq_pid]->round++; - - if ( ulsch->harq_processes[harq_pid]->round >= (ulsch->Mlimit - 1) ) - { - // this is last push re transmission - ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; - ulsch->O_RI = 0; - ulsch->O = 0; - ulsch->uci_format = HLC_subband_cqi_nopmi; - - // disable phich decoding since it is the last retransmission - ulsch->harq_processes[harq_pid]->status = SCH_IDLE; - - //ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - //ulsch->harq_processes[harq_pid]->round = 0; - - //LOG_I(PHY,"PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); - //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->Mlimit, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); - } - else - { - // ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; - ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; - ulsch->O_RI = 0; - ulsch->O = 0; - ulsch->uci_format = HLC_subband_cqi_nopmi; - //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); - } - } -#if T_TRACER - T(T_UE_PHY_ULSCH_UE_NACK, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(subframe), T_INT(ulsch->rnti), - T_INT(harq_pid)); -#endif - - } else { //ACK - if (ue->ulsch_Msg3_active[eNB_id] == 1) { - LOG_D(PHY,"[UE %d][PUSCH %d][RAPROC] Frame %d subframe %d Msg3 PHICH, received ACK (%d) nseq %d, ngroup %d\n\n", - ue->Mod_id,harq_pid, - proc->frame_rx, - subframe, - HI16, - nseq_PHICH,ngroup_PHICH); - } else { -#ifdef UE_DEBUG_TRACE - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received ACK (%d) nseq %d, ngroup %d\n\n", - ue->Mod_id,harq_pid, - proc->frame_rx%1024, - subframe, HI16, - nseq_PHICH,ngroup_PHICH); -#endif - } - - // LOG_I(PHY,"[HARQ-UL harqId: %d] subframe_scheduling_flag = %d \n",harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag); - - // Incase of adaptive retransmission, PHICH is always decoded as ACK (at least with OAI-eNB) - // Workaround: - // rely only on DCI0 decoding and check if NDI has toggled - // save current harq_processes content in temporary struct - // harqId-8 corresponds to the temporary struct. In total we have 8 harq process(0 ..7) + 1 temporary harq process() - //ulsch->harq_processes[8] = ulsch->harq_processes[harq_pid]; - - - ulsch->harq_processes[harq_pid]->status = SCH_IDLE; - ulsch->harq_processes[harq_pid]->round = 0; - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - // inform MAC? - ue->ulsch_Msg3_active[eNB_id] = 0; - -#if T_TRACER - T(T_UE_PHY_ULSCH_UE_ACK, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(subframe), T_INT(ulsch->rnti), - T_INT(harq_pid)); -#endif - - } - -} void generate_phich_top(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, diff --git a/openair1/PHY/LTE_TRANSPORT/pilots.c b/openair1/PHY/LTE_TRANSPORT/pilots.c index 01b4bb7a8ea4e1ec0703e6ff51ce018e51d3da77..921f93ddb103ccf41017644057f97c92137ba320 100644 --- a/openair1/PHY/LTE_TRANSPORT/pilots.c +++ b/openair1/PHY/LTE_TRANSPORT/pilots.c @@ -29,8 +29,8 @@ * \note * \warning */ -//#include "defs.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" void generate_pilots(PHY_VARS_eNB *eNB, int32_t **txdataF, diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c b/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c index 90e9ae329caed2bf17853f64ea511e4315ec21d8..fddc29b5242f4d005851fedf1b95b6d639619d24 100644 --- a/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c +++ b/openair1/PHY/LTE_TRANSPORT/pilots_mbsfn.c @@ -29,9 +29,9 @@ * \note * \warning */ -//#include "defs.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" int generate_mbsfn_pilot(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, 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 63aac7f091b0288eb172e775ca103e5eec6a80f2..0000000000000000000000000000000000000000 --- 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 e756df1fe1a5b4fd4612d0f019bca3bd57c7a64f..23bc07f17448806c4c2a8563f47bf86f647fc024 100644 --- a/openair1/PHY/LTE_TRANSPORT/pmch.c +++ b/openair1/PHY/LTE_TRANSPORT/pmch.c @@ -19,10 +19,11 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/sse_intrin.h" - +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "transport_eNB.h" +#include "transport_proto.h" +#include "transport_common_proto.h" // Mask for identifying subframe for MBMS #define MBSFN_TDD_SF3 0x80// for TDD #define MBSFN_TDD_SF4 0x40 @@ -30,7 +31,7 @@ #define MBSFN_TDD_SF8 0x10 #define MBSFN_TDD_SF9 0x08 -#include "PHY/defs.h" + #define MBSFN_FDD_SF1 0x80// for FDD #define MBSFN_FDD_SF2 0x40 @@ -41,148 +42,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) -{ - - uint32_t period; - uint8_t i; - - // LOG_D(PHY,"is_pmch_subframe: frame %d, subframe %d, num_MBSFN_config %d\n", - // frame,subframe,frame_parms->num_MBSFN_config); - - for (i=0; i<frame_parms->num_MBSFN_config; i++) { // we have at least one MBSFN configuration - period = 1<<frame_parms->MBSFN_config[i].radioframeAllocationPeriod; - - if ((frame % period) == frame_parms->MBSFN_config[i].radioframeAllocationOffset) { - if (frame_parms->MBSFN_config[i].fourFrames_flag == 0) { - if (frame_parms->frame_type == FDD) { - switch (subframe) { - - case 1: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF1) > 0) - return(1); - - break; - - case 2: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF2) > 0) - return(1); - - break; - - case 3: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF3) > 0) - return(1); - - break; - - case 6: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF6) > 0) - return(1); - - break; - - case 7: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF7) > 0) - return(1); - - break; - - case 8: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF8) > 0) - return(1); - - break; - } - } else { - switch (subframe) { - case 3: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF3) > 0) - return(1); - - break; - - case 4: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF4) > 0) - return(1); - - break; - - case 7: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF7) > 0) - return(1); - - break; - - case 8: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF8) > 0) - return(1); - - break; - - case 9: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF9) > 0) - return(1); - - break; - } - } - - } else { // handle 4 frames case - - } - } - } - - return(0); -} void fill_eNB_dlsch_MCH(PHY_VARS_eNB *eNB,int mcs,int ndi,int rvidx) { @@ -221,64 +80,8 @@ void fill_eNB_dlsch_MCH(PHY_VARS_eNB *eNB,int mcs,int ndi,int rvidx) 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) -{ - - 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) { @@ -287,759 +90,36 @@ void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a) 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, - 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; - } + 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); - return(0); } diff --git a/openair1/PHY/LTE_TRANSPORT/pmch_common.c b/openair1/PHY/LTE_TRANSPORT/pmch_common.c new file mode 100644 index 0000000000000000000000000000000000000000..1d12c79621ea403c93c1eaa6389da0fa5065aa8c --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/pmch_common.c @@ -0,0 +1,119 @@ +/* + * 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_eNB.h" +#include "PHY/phy_extern.h" + +int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms) +{ + + uint32_t period; + uint8_t i; + + // LOG_D(PHY,"is_pmch_subframe: frame %d, subframe %d, num_MBSFN_config %d\n", + // frame,subframe,frame_parms->num_MBSFN_config); + + for (i=0; i<frame_parms->num_MBSFN_config; i++) { // we have at least one MBSFN configuration + period = 1<<frame_parms->MBSFN_config[i].radioframeAllocationPeriod; + + if ((frame % period) == frame_parms->MBSFN_config[i].radioframeAllocationOffset) { + if (frame_parms->MBSFN_config[i].fourFrames_flag == 0) { + if (frame_parms->frame_type == FDD) { + switch (subframe) { + + case 1: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF1) > 0) + return(1); + + break; + + case 2: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF2) > 0) + return(1); + + break; + + case 3: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF3) > 0) + return(1); + + break; + + case 6: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF6) > 0) + return(1); + + break; + + case 7: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF7) > 0) + return(1); + + break; + + case 8: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF8) > 0) + return(1); + + break; + } + } else { + switch (subframe) { + case 3: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF3) > 0) + return(1); + + break; + + case 4: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF4) > 0) + return(1); + + break; + + case 7: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF7) > 0) + return(1); + + break; + + case 8: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF8) > 0) + return(1); + + break; + + case 9: + if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF9) > 0) + return(1); + + break; + } + } + + } else { // handle 4 frames case + + } + } + } + + return(0); +} diff --git a/openair1/PHY/LTE_TRANSPORT/power_control.c b/openair1/PHY/LTE_TRANSPORT/power_control.c index 36b2bfbeab81abcaac6287a9219898f24160742e..32273015ce9417bd80cb8f408ffb662f043afcbc 100644 --- a/openair1/PHY/LTE_TRANSPORT/power_control.c +++ b/openair1/PHY/LTE_TRANSPORT/power_control.c @@ -19,7 +19,8 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" #include "PHY/impl_defs_lte.h" //#define DEBUG_PC 0 @@ -94,7 +95,6 @@ double computeRhoB_eNB(uint8_t pa, return(rho_b_dB); } - double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, LTE_UE_DLSCH_t *dlsch_ue, unsigned char dl_power_off, @@ -150,3 +150,4 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, #endif return(rho_b_dB); } + diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index 0c97a307af90be2985c8453290377e7965b07e73..7871239b6d75fd11da8fa93b4efa1a1d0b021009 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -30,438 +30,19 @@ * \warning */ #include "PHY/sse_intrin.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" //#include "prach.h" #include "PHY/LTE_TRANSPORT/if4_tools.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "SCHED/sched_eNB.h" #include "UTIL/LOG/vcd_signal_dumper.h" +#include "prach_extern.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; +<<<<<<< HEAD if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) { n_ra_prb = 6*f_ra; } else { @@ -1088,6 +669,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 return signal_energy( (int*)prach, 256 ); } //__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3; +======= +>>>>>>> develop-uedirectorysplit #ifndef Rel14 #define rx_prach0 rx_prach @@ -1766,8 +1349,6 @@ void rx_prach0(PHY_VARS_eNB *eNB, } - - #ifdef Rel14 void rx_prach(PHY_VARS_eNB *eNB, @@ -1812,189 +1393,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 f135af6d811b5187a2fe5d4892bdce7b7ff88b7b..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..2f39346be2027e4fc1d9460ec6cb508026b9f666 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -0,0 +1,771 @@ +/* + * 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_common.h" +#include "PHY/phy_extern.h" +#include "PHY/phy_extern_ue.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + + +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]; + +// 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); + +} + +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 + } +} + diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h new file mode 100644 index 0000000000000000000000000000000000000000..2f8a83e24f2a052e3359cd499e8dddf395a5671d --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h @@ -0,0 +1,93 @@ +/* + * 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_eNB.h" +#include "PHY/phy_extern.h" + +//#define PRACH_DEBUG 1 +//#define PRACH_WRITE_OUTPUT_DEBUG 1 + +extern uint16_t NCS_unrestricted[16]; +extern uint16_t NCS_restricted[15]; +extern uint16_t NCS_4[7]; + +extern int16_t ru[2*839]; // quantized roots of unity +extern uint32_t ZC_inv[839]; // multiplicative inverse for roots u +extern uint16_t du[838]; + + + +// This is table 5.7.1-4 from 36.211 +extern PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7]; + + + + +extern uint16_t prach_root_sequence_map0_3[838]; + + +extern uint16_t prach_root_sequence_map4[138]; + +void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); + + +// This function computes the du +void fill_du(uint8_t prach_fmt); + + +uint8_t get_num_prach_tdd(module_id_t Mod_id); + + +uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index); + + +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); + + +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); + + +int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe); + +int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe); + + +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]); + diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c deleted file mode 100644 index 22b1adf3b902631b5263c3111f42215c37ef4a14..0000000000000000000000000000000000000000 --- 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) || defined(OAI_ADRV9371_ZC706) -#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) || defined(OAI_ADRV9371_ZC706) - 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) || defined(OAI_ADRV9371_ZC706) - 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/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c index c746a331db246e2e46139d4386120389d3549557..c02d08750bf40e90ef5fd34ce555fb581aee6b12 100644 --- a/openair1/PHY/LTE_TRANSPORT/pss.c +++ b/openair1/PHY/LTE_TRANSPORT/pss.c @@ -36,8 +36,8 @@ */ //#include "defs.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" int generate_pss(int32_t **txdataF, short amp, @@ -105,10 +105,3 @@ int generate_pss(int32_t **txdataF, return(0); } -int generate_pss_emul(PHY_VARS_eNB *phy_vars_eNb,uint8_t sect_id) -{ - - LOG_D(PHY,"EMUL eNB generate_pss_emul eNB %d, sect_id %d\n",phy_vars_eNb->Mod_id,sect_id); - eNB_transport_info[phy_vars_eNb->Mod_id][phy_vars_eNb->CC_id].cntl.pss=sect_id; - return(0); -} diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index 9a19b0ddaf3dee79997ca3af075bd9448b74d43b..39703eebfd3a35ab05ce9c880b90272fa0fc3a9b 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -29,9 +29,10 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "LAYER2/MAC/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "LAYER2/MAC/mac.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -42,6 +43,8 @@ //#define DEBUG_PUCCH_TXS //#define DEBUG_PUCCH_RX +#include "pucch_extern.h" + 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 +64,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 0000000000000000000000000000000000000000..a9181a8b3dfe8107f42ad5b880b5eba3b5171d00 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/pucch_common.c @@ -0,0 +1,270 @@ +/* + * 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_eNB.h" +#include "PHY/phy_extern.h" +#include "LAYER2/MAC/mac.h" + +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "PHY/LTE_REFSIG/lte_refsig.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" +}; + + + +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} }; + +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}; + +// 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/pucch_extern.h b/openair1/PHY/LTE_TRANSPORT/pucch_extern.h new file mode 100644 index 0000000000000000000000000000000000000000..899b90430670af54af65a918d859689646e1129c --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/pucch_extern.h @@ -0,0 +1,78 @@ +/* + * 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 <stdint.h> + +/* 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 + +extern int16_t W4[3][4]; + +extern int16_t W3_re[3][6]; + + +extern int16_t W3_im[3][6]; + +extern int16_t alpha_re[12]; +extern int16_t alpha_im[12]; + +extern char *pucch_format_string[]; + +extern uint8_t chcod_tbl[128][48]; + +extern int16_t W5_fmt3_re[5][5]; + +extern int16_t W5_fmt3_im[5][5]; + +extern int16_t W4_fmt3[4][4]; + +extern int16_t W2[2]; + +extern int16_t RotTBL_re[4]; +extern int16_t RotTBL_im[4]; + +//np4_tbl, np5_tbl +extern uint8_t Np5_TBL[5]; +extern uint8_t Np4_TBL[4]; + +// alpha_TBL +extern int16_t alphaTBL_re[12]; +extern int16_t alphaTBL_im[12]; diff --git a/openair1/PHY/LTE_TRANSPORT/rar_tools.c b/openair1/PHY/LTE_TRANSPORT/rar_tools.c index 9934b71d78b0165c32d9b4df855e97779c43ee33..ab4656716bcc509cfddf46ba96582c81adcc89fd 100644 --- a/openair1/PHY/LTE_TRANSPORT/rar_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/rar_tools.c @@ -20,7 +20,7 @@ */ /*! \file PHY/LTE_TRANSPORT/rar_tools.c -* \brief Routine for filling the PUSCH/ULSCH data structures based on a random-access response (RAR) SDU from MAC. Note this is both for UE and eNB. V8.6 2009-03 +* \brief Routine for filling the PUSCH/ULSCH data structures based on a random-access response (RAR) SDU from MAC. Note this is for eNB. * \author R. Knopp * \date 2011 * \version 0.1 @@ -29,14 +29,12 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/defs.h" -#include "SCHED/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "SCHED/sched_eNB.h" +#include "LAYER2/MAC/mac.h" #include "UTIL/LOG/vcd_signal_dumper.h" - +#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "assertions.h" extern uint16_t RIV2nb_rb_LUT6[32]; @@ -194,159 +192,3 @@ int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB, return(0); } -int8_t delta_PUSCH_msg2[8] = {-6,-4,-2,0,2,4,6,8}; - -int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *ue, - UE_rxtx_proc_t *proc, - unsigned char eNB_id ) -{ - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_IN); - - // RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)rar_pdu; - uint8_t transmission_mode = ue->transmission_mode[eNB_id]; - unsigned char *rar_pdu = ue->dlsch_ra[eNB_id]->harq_processes[0]->b; - unsigned char subframe = ue->ulsch_Msg3_subframe[eNB_id]; - LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id]; - PHY_MEASUREMENTS *meas = &ue->measurements; - - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - // int current_dlsch_cqi = ue->current_dlsch_cqi[eNB_id]; - - uint8_t *rar = (uint8_t *)(rar_pdu+1); - uint8_t harq_pid = subframe2harq_pid(frame_parms,proc->frame_tx,subframe); - uint16_t rballoc; - uint8_t cqireq; - uint16_t *RIV2nb_rb_LUT, *RIV2first_rb_LUT; - uint16_t RIV_max = 0; - - LOG_D(PHY,"[eNB][RAPROC] Frame %d: generate_ue_ulsch_params_from_rar: subframe %d (harq_pid %d)\n",proc->frame_tx,subframe,harq_pid); - - switch (frame_parms->N_RB_DL) { - case 6: - RIV2nb_rb_LUT = &RIV2nb_rb_LUT6[0]; - RIV2first_rb_LUT = &RIV2first_rb_LUT6[0]; - RIV_max = RIV_max6; - break; - - case 25: - RIV2nb_rb_LUT = &RIV2nb_rb_LUT25[0]; - RIV2first_rb_LUT = &RIV2first_rb_LUT25[0]; - RIV_max = RIV_max25; - break; - - case 50: - RIV2nb_rb_LUT = &RIV2nb_rb_LUT50[0]; - RIV2first_rb_LUT = &RIV2first_rb_LUT50[0]; - RIV_max = RIV_max50; - break; - - case 100: - RIV2nb_rb_LUT = &RIV2nb_rb_LUT100[0]; - RIV2first_rb_LUT = &RIV2first_rb_LUT100[0]; - RIV_max = RIV_max100; - break; - - default: - DevParam(frame_parms->N_RB_DL, eNB_id, harq_pid); - break; - } - - - - ulsch->harq_processes[harq_pid]->TPC = (rar[3]>>2)&7;//rar->TPC; - - rballoc = (((uint16_t)(rar[1]&7))<<7)|(rar[2]>>1); - cqireq=rar[3]&1; - - if (rballoc>RIV_max) { - LOG_D(PHY,"rar_tools.c: ERROR: rb_alloc (%x) > RIV_max\n",rballoc); - return(-1); - } - - ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT[rballoc]; - ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT[rballoc]; - - AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb >0, "nb_rb == 0\n"); - - ulsch->power_offset = ue_power_offsets[ulsch->harq_processes[harq_pid]->nb_rb]; - - AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb <= 6,"unlikely rb count for RAR grant : nb_rb > 6\n"); - - // ulsch->harq_processes[harq_pid]->Ndi = 1; - if (ulsch->harq_processes[harq_pid]->round == 0) - ulsch->harq_processes[harq_pid]->status = ACTIVE; - - if (cqireq==1) { - ulsch->O_RI = 1; - - if (meas->rank[eNB_id] == 1) { - ulsch->uci_format = wideband_cqi_rank2_2A; - ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz; - ulsch->o_RI[0] = 1; - } else { - ulsch->uci_format = wideband_cqi_rank1_2A; - ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz; - ulsch->o_RI[0] = 0; - } - - ulsch->uci_format = HLC_subband_cqi_nopmi; - fill_CQI(ulsch,meas,eNB_id,0,ue->frame_parms.N_RB_DL,0, transmission_mode,ue->sinr_eff); - - if (((proc->frame_tx % 100) == 0) || (proc->frame_tx < 10)) - print_CQI(ulsch->o,ulsch->uci_format,eNB_id,ue->frame_parms.N_RB_DL); - } else { - ulsch->O_RI = 0; - ulsch->O = 0; - } - - ulsch->harq_processes[harq_pid]->O_ACK = 0;//2; - - ulsch->beta_offset_cqi_times8 = 18; - ulsch->beta_offset_ri_times8 = 10; - ulsch->beta_offset_harqack_times8 = 16; - - ulsch->Nsymb_pusch = 12-(frame_parms->Ncp<<1); - ulsch->rnti = (((uint16_t)rar[4])<<8)+rar[5]; //rar->t_crnti; - - if (ulsch->harq_processes[harq_pid]->round == 0) { - ulsch->harq_processes[harq_pid]->status = ACTIVE; - ulsch->harq_processes[harq_pid]->rvidx = 0; - ulsch->harq_processes[harq_pid]->mcs = ((rar[2]&1)<<3)|(rar[3]>>5); - ulsch->harq_processes[harq_pid]->TPC = (rar[3]>>2)&7; - //ulsch->harq_processes[harq_pid]->TBS = dlsch_tbs25[ulsch->harq_processes[harq_pid]->mcs][ulsch->harq_processes[harq_pid]->nb_rb-1]; - ulsch->harq_processes[harq_pid]->TBS = TBStable[get_I_TBS_UL(ulsch->harq_processes[harq_pid]->mcs)][ulsch->harq_processes[harq_pid]->nb_rb-1]; - ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch->harq_processes[harq_pid]->nb_rb; - ulsch->harq_processes[harq_pid]->Nsymb_initial = 9; - ulsch->harq_processes[harq_pid]->round = 0; - } else { - ulsch->harq_processes[harq_pid]->rvidx = 0; - ulsch->harq_processes[harq_pid]->round++; - } - - // initialize power control based on PRACH power - ulsch->f_pusch = delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC] + - get_deltaP_rampup(ue->Mod_id,ue->CC_id); - LOG_D(PHY,"[UE %d][PUSCH PC] Initializing f_pusch to %d dB, TPC %d (delta_PUSCH_msg2 %d dB), deltaP_rampup %d dB\n", - ue->Mod_id,ulsch->f_pusch,ulsch->harq_processes[harq_pid]->TPC,delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC], - get_deltaP_rampup(ue->Mod_id,ue->CC_id)); - - - //#ifdef DEBUG_RAR - LOG_D(PHY,"ulsch ra (UE): harq_pid %d\n",harq_pid); - LOG_D(PHY,"ulsch ra (UE): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); - LOG_D(PHY,"ulsch ra (UE): first_rb %x\n",ulsch->harq_processes[harq_pid]->first_rb); - LOG_D(PHY,"ulsch ra (UE): nb_rb %d\n",ulsch->harq_processes[harq_pid]->nb_rb); - LOG_D(PHY,"ulsch ra (UE): round %d\n",ulsch->harq_processes[harq_pid]->round); - LOG_D(PHY,"ulsch ra (UE): TBS %d\n",ulsch->harq_processes[harq_pid]->TBS); - LOG_D(PHY,"ulsch ra (UE): mcs %d\n",ulsch->harq_processes[harq_pid]->mcs); - LOG_D(PHY,"ulsch ra (UE): TPC %d\n",ulsch->harq_processes[harq_pid]->TPC); - LOG_D(PHY,"ulsch ra (UE): O %d\n",ulsch->O); - LOG_D(PHY,"ulsch ra (UE): ORI %d\n",ulsch->O_RI); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_OUT); - - //#endif - return(0); -} - diff --git a/openair1/PHY/LTE_TRANSPORT/sss.c b/openair1/PHY/LTE_TRANSPORT/sss.c index 17a4680c54f7a19beee1b91225b9ef54095ea672..bf03c185ef9664790957fafbb22a2295c8e24bfd 100644 --- a/openair1/PHY/LTE_TRANSPORT/sss.c +++ b/openair1/PHY/LTE_TRANSPORT/sss.c @@ -29,9 +29,9 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "transport_eNB.h" +#include "PHY/phy_extern.h" //#define DEBUG_SSS @@ -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 0000000000000000000000000000000000000000..a236fa5f55ce045c5d0232df5c86083837d1fc5a --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h @@ -0,0 +1,187 @@ +/* + * 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; + +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; + +/**@}*/ +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h new file mode 100644 index 0000000000000000000000000000000000000000..ebf0d99c4e45a9966f47c39dc0dd736d713e343f --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h @@ -0,0 +1,294 @@ +/* + * 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_COMMON_PROTO__H__ +#define __LTE_TRANSPORT_COMMON_PROTO__H__ +#include "PHY/defs_common.h" + + + + +// Functions below implement minor procedures from 36-211 and 36-212 + +/** \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); + + +/*! + \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. +*/ + + +/*! + \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); + + +int32_t compareints (const void * a, const void * b); + +uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe); + +int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci); + +void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms); + +void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms); + +uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t lprime,uint8_t mi); + +void generate_RIV_tables(void); + +/** \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); + +uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); + +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 init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]); + +/*! + \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 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); + +/*! + \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); + + +/** \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); + +uint64_t pmi2hex_2Ar1(uint32_t pmi); + +uint64_t pmi2hex_2Ar2(uint32_t pmi); + +uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); + +// DL power control functions +double get_pa_dB(uint8_t pa); + +void init_scrambling_lut(void); + +void init_unscrambling_lut(void); + + +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 subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe); +uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); + +uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL); + +void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2); + +#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 f1f4be3072c86b166168fc906a061b599aa0cfc5..a54353c022e73814a47cbd203a7932c683320c44 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/extern.h b/openair1/PHY/LTE_TRANSPORT/transport_extern.h similarity index 95% rename from openair1/PHY/LTE_TRANSPORT/extern.h rename to openair1/PHY/LTE_TRANSPORT/transport_extern.h index e791bec9a0c27f45fd047acc46f510d590684f69..6a9fa49405a9bb3d8d3161aedc4ab4b1159b44c7 100644 --- a/openair1/PHY/LTE_TRANSPORT/extern.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_extern.h @@ -30,7 +30,7 @@ extern short *ul_ref_sigs_rx[30][2][33]; extern unsigned short dftsizes[33]; extern unsigned short ref_primes[33]; -extern int qam64_table[8],qam16_table[4]; +extern int qam64_table[8],qam16_table[4],qpsk_table[2]; extern unsigned char cs_ri_normal[4]; extern unsigned char cs_ri_extended[4]; @@ -48,3 +48,5 @@ extern int16_t d0_sss[504*62],d5_sss[504*62]; extern uint8_t wACK[5][4]; extern int8_t wACK_RX[5][4]; + +extern uint32_t bitrev_cc_dci[32]; diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h new file mode 100644 index 0000000000000000000000000000000000000000..5547c308e9c320d1ea2c003b927f2f9e1776d3e0 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h @@ -0,0 +1,621 @@ +/* + * 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_eNB.h" +#include <math.h> +#include "nfapi_interface.h" +#include "transport_common_proto.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); + +int dlsch_encoding_all(PHY_VARS_eNB *eNB, + unsigned char *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 *te_wait_stats, + time_stats_t *te_main_stats, + time_stats_t *te_wakeup_stats0, + time_stats_t *te_wakeup_stats1, + time_stats_t *i_stats); + +/** \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); + + + + +/** \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 *te_wait_stats, + time_stats_t *te_main_stats, + time_stats_t *te_wakeup_stats0, + time_stats_t *te_wakeup_stats1, + time_stats_t *i_stats, + int worker_num); + +// 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); + + +int ulsch_decoding_data_all(PHY_VARS_eNB *eNB, + int UE_id, + int harq_pid, + int llr8_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); + +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); + + + +void conv_eMTC_rballoc(uint16_t resource_block_coding, + uint32_t N_RB_DL, + uint32_t *rb_alloc); + +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/vars.h b/openair1/PHY/LTE_TRANSPORT/transport_vars.h similarity index 88% rename from openair1/PHY/LTE_TRANSPORT/vars.h rename to openair1/PHY/LTE_TRANSPORT/transport_vars.h index 4b6fa920ea76b863d1e6d2b0f5b8dae19c9c9ea1..611028e1e9805d748de9c9c4f77ba0b8856b2170 100644 --- a/openair1/PHY/LTE_TRANSPORT/vars.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_vars.h @@ -62,7 +62,7 @@ unsigned char ue_power_offsets[25] = {14,11,9,8,7,6,6,5,4,4,4,3,3,3,2,2,2,1,1,1, short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; -int qam64_table[8],qam16_table[4]; +int qam64_table[8],qam16_table[4],qpsk_table[2]; unsigned char cs_ri_normal[4] = {1,4,7,10}; unsigned char cs_ri_extended[4] = {0,3,5,8}; @@ -78,3 +78,11 @@ char dci_format_strings[15][13] = {"0","1","1A","1B","1C","1D","1E_2A_M10PRB", uint8_t wACK[5][4] = {{1,1,1,1},{1,0,1,0},{1,1,0,0},{1,0,0,1},{0,0,0,0}}; int8_t wACK_RX[5][4] = {{-1,-1,-1,-1},{-1,1,-1,1},{-1,-1,1,1},{-1,1,1,-1},{1,1,1,1}}; + +uint32_t bitrev_cc_dci[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30}; + +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} +}; diff --git a/openair1/PHY/LTE_TRANSPORT/uci.h b/openair1/PHY/LTE_TRANSPORT/uci_common.h similarity index 99% rename from openair1/PHY/LTE_TRANSPORT/uci.h rename to openair1/PHY/LTE_TRANSPORT/uci_common.h index c7741533da543b909aa00bbaad4151274b210595..78555d4928c2f8b45f95092212ddc9ff36c924cd 100644 --- a/openair1/PHY/LTE_TRANSPORT/uci.h +++ b/openair1/PHY/LTE_TRANSPORT/uci_common.h @@ -19,6 +19,8 @@ * contact@openairinterface.org */ +#ifndef __UCI_COMMON__H +#define __UCI_COMMON__H #include "PHY/types.h" @@ -318,3 +320,5 @@ HLC_subband_cqi_mcs_CBA_20MHz; #define MAX_CQI_BYTES (sizeof(HLC_subband_cqi_rank2_2A_20MHz)) #define MAX_ACK_PAYLOAD 18 #define MAX_RI_PAYLOAD 6 + +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c index 65640e2ec713331c9531e5b852dd953a45707bea..539d5476ab8a92ff67b9ec8e36f1a685e2551fd1 100644 --- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c @@ -29,765 +29,13 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.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 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/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 0d9bf8fd7611b89703fcfed195490a30294570ed..50f469011f0237923c090dc48c0c59d8492d0cf7 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -30,22 +30,22 @@ * \warning */ -//#include "defs.h" - -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/CODING/extern.h" -#include "extern.h" -#include "SCHED/extern.h" -#ifdef OPENAIR2 -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" -#include "RRC/LITE/extern.h" -#include "PHY_INTERFACE/extern.h" -#endif + +#include <syscall.h> +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "PHY/CODING/coding_extern.h" +#include "SCHED/sched_eNB.h" +#include "LAYER2/MAC/mac.h" +#include "RRC/LTE/rrc_extern.h" +#include "PHY_INTERFACE/phy_interface.h" #include "UTIL/LOG/vcd_signal_dumper.h" //#define DEBUG_ULSCH_DECODING +#include "targets/RT/USER/rt_wrapper.h" +#include "transport_proto.h" + +extern int codingw; void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch) { @@ -221,8 +221,6 @@ uint8_t extract_cqi_crc(uint8_t *cqi,uint8_t CQI_LENGTH) - - int ulsch_decoding_data_2thread0(td_params* tdp) { PHY_VARS_eNB *eNB = tdp->eNB; @@ -414,13 +412,20 @@ int ulsch_decoding_data_2thread0(td_params* tdp) { extern int oai_exit; void *td_thread(void *param) { - pthread_setname_np( pthread_self(), "td processing"); PHY_VARS_eNB *eNB = ((td_params*)param)->eNB; eNB_proc_t *proc = &eNB->proc; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + + thread_top_init("td_thread",1,200000,250000,500000); + pthread_setname_np( pthread_self(),"td processing"); + LOG_I(PHY,"thread td created id=%ld\n", syscall(__NR_gettid)); + //wait_sync("td_thread"); while (!oai_exit) { if (wait_on_condition(&proc->mutex_td,&proc->cond_td,&proc->instance_cnt_td,"td thread")<0) break; + if(oai_exit) break; ((td_params*)param)->ret = ulsch_decoding_data_2thread0((td_params*)param); @@ -623,6 +628,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr break; } stop_meas(&eNB->ulsch_turbo_decoding_stats); + //printf("/////////////////////////////////////////**************************loop for %d time in ulsch_decoding main\n",r); } // wait for worker to finish @@ -782,6 +788,20 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) return(ret); } +int ulsch_decoding_data_all(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) +{ + int ret = 0; + /*if(codingw) + { + ret = ulsch_decoding_data_2thread(eNB,UE_id,harq_pid,llr8_flag); + } + else*/ + { + ret = ulsch_decoding_data(eNB,UE_id,harq_pid,llr8_flag); + } + return ret; +} + static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2, unsigned char reset) __attribute__((always_inline)); static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2, unsigned char reset) { diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 920d8ff3fdbdfd1505d6f7e059217ec844bd632e..0ffe3d735b23f86748fac00508501f9d24c07c65 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -30,12 +30,14 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "defs.h" -#include "extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "transport_eNB.h" //#define DEBUG_ULSCH #include "PHY/sse_intrin.h" +#include "transport_common_proto.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" +#include "PHY/MODULATION/modulation_eNB.h" #include "T.h" @@ -1104,7 +1106,7 @@ void ulsch_channel_level(int32_t **drs_ch_estimates_ext, int ulsch_power_LUT[750]; -void init_ulsch_power_LUT() { +void init_ulsch_power_LUT(void) { int i; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index 4b73de6fcc72864fa1a55d7924819dab46cd5e14..82dedd9bc999895101ce99aeb0b00879227e8867 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file PHY/LTE_TRANSPORT/dci_tools.c +/*! \file PHY/LTE_UE_TRANSPORT/dci_tools_ue.c * \brief PHY Support routines (eNB/UE) for filling PDSCH/PUSCH/DLSCH/ULSCH data structures based on DCI PDUs generated by eNB MAC scheduler. * \author R. Knopp * \date 2011 @@ -30,3795 +30,31 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" +#include "SCHED_UE/sched_UE.h" #ifdef DEBUG_DCI_TOOLS -#include "PHY/vars.h" +#include "PHY/phy_vars.h" #endif #include "assertions.h" -#include "nfapi_interface.h" -//#define DEBUG_HARQ - -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/defs.h" - -//#define DEBUG_DCI - -uint32_t localRIV2alloc_LUT6[32]; -uint32_t distRIV2alloc_even_LUT6[32]; -uint32_t distRIV2alloc_odd_LUT6[32]; -uint16_t RIV2nb_rb_LUT6[32]; -uint16_t RIV2first_rb_LUT6[32]; -uint16_t RIV_max6=0; - -uint32_t localRIV2alloc_LUT25[512]; -uint32_t distRIV2alloc_even_LUT25[512]; -uint32_t distRIV2alloc_odd_LUT25[512]; -uint16_t RIV2nb_rb_LUT25[512]; -uint16_t RIV2first_rb_LUT25[512]; -uint16_t RIV_max25=0; - - -uint32_t localRIV2alloc_LUT50_0[1600]; -uint32_t localRIV2alloc_LUT50_1[1600]; -uint32_t distRIV2alloc_gap0_even_LUT50_0[1600]; -uint32_t distRIV2alloc_gap0_odd_LUT50_0[1600]; -uint32_t distRIV2alloc_gap0_even_LUT50_1[1600]; -uint32_t distRIV2alloc_gap0_odd_LUT50_1[1600]; -uint32_t distRIV2alloc_gap1_even_LUT50_0[1600]; -uint32_t distRIV2alloc_gap1_odd_LUT50_0[1600]; -uint32_t distRIV2alloc_gap1_even_LUT50_1[1600]; -uint32_t distRIV2alloc_gap1_odd_LUT50_1[1600]; -uint16_t RIV2nb_rb_LUT50[1600]; -uint16_t RIV2first_rb_LUT50[1600]; -uint16_t RIV_max50=0; - -uint32_t localRIV2alloc_LUT100_0[6000]; -uint32_t localRIV2alloc_LUT100_1[6000]; -uint32_t localRIV2alloc_LUT100_2[6000]; -uint32_t localRIV2alloc_LUT100_3[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_0[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_0[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_1[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_1[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_2[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_2[6000]; -uint32_t distRIV2alloc_gap0_even_LUT100_3[6000]; -uint32_t distRIV2alloc_gap0_odd_LUT100_3[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_0[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_0[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_1[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_1[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_2[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_2[6000]; -uint32_t distRIV2alloc_gap1_even_LUT100_3[6000]; -uint32_t distRIV2alloc_gap1_odd_LUT100_3[6000]; -uint16_t RIV2nb_rb_LUT100[6000]; -uint16_t RIV2first_rb_LUT100[6000]; -uint16_t RIV_max100=0; - - -extern uint32_t current_dlsch_cqi; - -// Table 8.6.3-3 36.213 -uint16_t beta_cqi[16] = {0, //reserved - 0, //reserved - 9, //1.125 - 10, //1.250 - 11, //1.375 - 13, //1.625 - 14, //1.750 - 16, //2.000 - 18, //2.250 - 20, //2.500 - 23, //2.875 - 25, //3.125 - 28, //3.500 - 32, //4.000 - 40, //5.000 - 50 - }; //6.250 - -// Table 8.6.3-2 36.213 -uint16_t beta_ri[16] = {10, //1.250 - 13, //1.625 - 16, //2.000 - 20, //2.500 - 25, //3.125 - 32, //4.000 - 40, //5.000 - 50, //6.250 - 64, //8.000 - 80, //10.000 - 101, //12.625 - 127, //15.875 - 160, //20.000 - 0, //reserved - 0, //reserved - 0 - }; //reserved - -// Table 8.6.3-2 36.213 -uint16_t beta_ack[16] = {16, //2.000 - 20, //2.500 - 25, //3.125 - 32, //4.000 - 40, //5.000 - 50, //6.250 - 64, //8.000 - 80, //10.000 - 101, //12.625 - 127, //15.875 - 160, //20.000 - 248, //31.000 - 400, //50.000 - 640, //80.000 - 808 - };//126.00 - -int8_t delta_PUSCH_abs[4] = {-4,-1,1,4}; -int8_t delta_PUSCH_acc[4] = {-1,0,1,3}; - -int8_t *delta_PUCCH_lut = delta_PUSCH_acc; - -void conv_eMTC_rballoc(uint16_t resource_block_coding, - uint32_t N_RB_DL, - uint32_t *rb_alloc) { - - - int narrowband = resource_block_coding>>5; - int RIV = resource_block_coding&31; - int N_NB_DL = N_RB_DL/6; - int i0 = (N_RB_DL>>1) - (3*N_NB_DL); - int first_rb = (6*narrowband)+i0; - int alloc = localRIV2alloc_LUT6[RIV]; - int ind = first_rb>>5; - int ind_mod = first_rb&31; - - if (((N_RB_DL&1) > 0) && (narrowband>=(N_NB_DL>>1))) first_rb++; - rb_alloc[0] = 0; - rb_alloc[1] = 0; - rb_alloc[2] = 0; - rb_alloc[3] = 0; - rb_alloc[ind] = alloc<<ind_mod; - if (ind_mod > 26) rb_alloc[ind+1] = alloc>>(6-(ind_mod-26)); -} - -void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2) -{ - - uint32_t i,shift,subset; - rb_alloc2[0] = 0; - rb_alloc2[1] = 0; - rb_alloc2[2] = 0; - rb_alloc2[3] = 0; - - // printf("N_RB_DL %d, ra_header %d, rb_alloc %x\n",N_RB_DL,ra_header,rb_alloc); - - switch (N_RB_DL) { - - case 6: - rb_alloc2[0] = rb_alloc&0x3f; - break; - - case 25: - if (ra_header == 0) {// Type 0 Allocation - - for (i=12; i>0; i--) { - if ((rb_alloc&(1<<i)) != 0) - rb_alloc2[0] |= (3<<((2*(12-i)))); - - // printf("rb_alloc2 (type 0) %x\n",rb_alloc2); - } - - if ((rb_alloc&1) != 0) - rb_alloc2[0] |= (1<<24); - } else { - subset = rb_alloc&1; - shift = (rb_alloc>>1)&1; - - for (i=0; i<11; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - rb_alloc2[0] |= (1<<(2*i)); - - //printf("rb_alloc2 (type 1) %x\n",rb_alloc2); - } - - if ((shift == 0) && (subset == 1)) - rb_alloc2[0]<<=1; - else if ((shift == 1) && (subset == 0)) - rb_alloc2[0]<<=4; - else if ((shift == 1) && (subset == 1)) - rb_alloc2[0]<<=3; - } - - break; - - case 50: - AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=50\n"); - - for (i=16; i>0; i--) { - if ((rb_alloc&(1<<i)) != 0) - rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32)); - } - - // bit mask across - if ((rb_alloc2[0]>>31)==1) - rb_alloc2[1] |= 1; - - if ((rb_alloc&1) != 0) - rb_alloc2[1] |= (3<<16); - break; - - case 100: - AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=100\n"); - for (i=0; i<25; i++) { - if ((rb_alloc&(1<<(24-i))) != 0) - rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32)); - - // printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i)); - } - - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", N_RB_DL); - DevParam (N_RB_DL, 0, 0); - break; - } - -} - - - -uint32_t conv_nprb(uint8_t ra_header,uint32_t rb_alloc,int N_RB_DL) -{ - - uint32_t nprb=0,i; - - switch (N_RB_DL) { - case 6: - for (i=0; i<6; i++) { - if ((rb_alloc&(1<<i)) != 0) - nprb += 1; - } - - break; - - case 25: - if (ra_header == 0) {// Type 0 Allocation - - for (i=12; i>0; i--) { - if ((rb_alloc&(1<<i)) != 0) - nprb += 2; - } - - if ((rb_alloc&1) != 0) - nprb += 1; - } else { - for (i=0; i<11; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - nprb += 1; - } - } - - break; - - case 50: - if (ra_header == 0) {// Type 0 Allocation - - for (i=0; i<16; i++) { - if ((rb_alloc&(1<<(16-i))) != 0) - nprb += 3; - } - - if ((rb_alloc&1) != 0) - nprb += 2; - - } else { - for (i=0; i<17; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - nprb += 1; - } - } - - break; - - case 100: - if (ra_header == 0) {// Type 0 Allocation - - for (i=0; i<25; i++) { - if ((rb_alloc&(1<<(24-i))) != 0) - nprb += 4; - } - } else { - for (i=0; i<25; i++) { - if ((rb_alloc&(1<<(i+2))) != 0) - nprb += 1; - } - } - - break; - - default: - LOG_E(PHY,"Invalide N_RB_DL %d\n", N_RB_DL); - DevParam (N_RB_DL, 0, 0); - break; - } - - return(nprb); -} - -uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) -{ - - uint16_t RIV; - - if (Lcrbs<=(1+(N_RB_DL>>1))) - RIV = (N_RB_DL*(Lcrbs-1)) + RBstart; - else - RIV = (N_RB_DL*(N_RB_DL+1-Lcrbs)) + (N_RB_DL-1-RBstart); - - return(RIV); -} - -// Convert a DCI Format 1C RIV to a Format 1A RIV -// This extracts the start and length in PRBs from the 1C rballoc and -// recomputes the RIV as if it were the 1A rballoc - -uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) { - - int NpDLVRB,N_RB_step,LpCRBsm1,RBpstart; - - switch (N_RB_DL) { - - case 6: // N_RB_step = 2, NDLVRB = 6, NpDLVRB = 3 - NpDLVRB = 3; - N_RB_step = 2; - break; - case 25: // N_RB_step = 2, NDLVRB = 24, NpDLVRB = 12 - NpDLVRB = 12; - N_RB_step = 2; - break; - case 50: // N_RB_step = 4, NDLVRB = 46, NpDLVRB = 11 - NpDLVRB = 11; - N_RB_step = 4; - break; - case 100: // N_RB_step = 4, NDLVRB = 96, NpDLVRB = 24 - NpDLVRB = 24; - N_RB_step = 4; - break; - default: - NpDLVRB = 24; - N_RB_step = 4; - break; - } - - // This is the 1C part from 7.1.6.3 in 36.213 - LpCRBsm1 = rballoc/NpDLVRB; - // printf("LpCRBs = %d\n",LpCRBsm1+1); - - if (LpCRBsm1 <= (NpDLVRB/2)) { - RBpstart = rballoc % NpDLVRB; - } - else { - LpCRBsm1 = NpDLVRB-LpCRBsm1; - RBpstart = NpDLVRB-(rballoc%NpDLVRB); - } - // printf("RBpstart %d\n",RBpstart); - return(computeRIV(N_RB_DL,N_RB_step*RBpstart,N_RB_step*(LpCRBsm1+1))); - -} - -uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { - - int offset; - - switch (N_RB_DL) { - - case 6: - // N_RB_DL = tildeN_RB_DL = 6 - // Ngap = 4 , P=1, Nrow = 2, Nnull = 2 - - switch (vrb) { - case 0: // even: 0->0, 1->2, odd: 0->3, 1->5 - case 1: - return ((3*odd_slot) + 2*(vrb&3))%6; - break; - case 2: // even: 2->3, 3->5, odd: 2->0, 3->2 - case 3: - return ((3*odd_slot) + 2*(vrb&3) + 5)%6; - break; - case 4: // even: 4->1, odd: 4->4 - return ((3*odd_slot) + 1)%6; - case 5: // even: 5->4, odd: 5->1 - return ((3*odd_slot) + 4)%6; - break; - } - break; - - case 15: - if (vrb<12) { - if ((vrb&3) < 2) // even: 0->0, 1->4, 4->1, 5->5, 8->2, 9->6 odd: 0->7, 1->11 - return(((7*odd_slot) + 4*(vrb&3) + (vrb>>2))%14) + 14*(vrb/14); - else if (vrb < 12) // even: 2->7, 3->11, 6->8, 7->12, 10->9, 11->13 - return (((7*odd_slot) + 4*(vrb&3) + (vrb>>2) +13 )%14) + 14*(vrb/14); - } - if (vrb==12) - return (3+(7*odd_slot)) % 14; - if (vrb==13) - return (10+(7*odd_slot)) % 14; - return 14; - break; - - case 25: - return (((12*odd_slot) + 6*(vrb&3) + (vrb>>2))%24) + 24*(vrb/24); - break; - - case 50: // P=3 - if (Ngap==0) { - // Nrow=12,Nnull=2,NVRBDL=46,Ngap1= 27 - if (vrb>=23) - offset=4; - else - offset=0; - if (vrb<44) { - if ((vrb&3)>=2) - return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2) + 45)%46; - else - return offset+((23*odd_slot) + 12*(vrb&3) + (vrb>>2))%46; - } - if (vrb==44) // even: 44->11, odd: 45->34 - return offset+((23*odd_slot) + 22-12+1); - if (vrb==45) // even: 45->10, odd: 45->33 - return offset+((23*odd_slot) + 22+12); - if (vrb==46) - return offset+46+((23*odd_slot) + 23-12+1) % 46; - if (vrb==47) - return offset+46+((23*odd_slot) + 23+12) % 46; - if (vrb==48) - return offset+46+((23*odd_slot) + 23-12+1) % 46; - if (vrb==49) - return offset+46+((23*odd_slot) + 23+12) % 46; - } - else { - // Nrow=6,Nnull=6,NVRBDL=18,Ngap1= 27 - if (vrb>=9) - offset=18; - else - offset=0; - - if (vrb<12) { - if ((vrb&3)>=2) - return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2) + 17)%18; - else - return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2))%18; - } - else { - return offset+((9*odd_slot) + 12*(vrb&1)+(vrb>>1) )%18 + 18*(vrb/18); - } - } - break; - case 75: - // Ngap1 = 32, NVRBRL=64, P=4, Nrow= 16, Nnull=0 - if (Ngap ==0) { - return ((32*odd_slot) + 16*(vrb&3) + (vrb>>2))%64 + (vrb/64); - } else { - // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 - return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); - } - break; - case 100: - // Ngap1 = 48, NVRBDL=96, Nrow=24, Nnull=0 - if (Ngap ==0) { - return ((48*odd_slot) + 24*(vrb&3) + (vrb>>2))%96 + (vrb/96); - } else { - // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 - return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); - } - break; - default: - LOG_E(PHY,"Unknown N_RB_DL %d\n",N_RB_DL); - return 0; - } - return 0; - -} - - -void generate_RIV_tables() -{ - - // 6RBs localized RIV - uint8_t Lcrbs,RBstart; - uint16_t RIV; - uint32_t alloc0,allocdist0_0_even,allocdist0_0_odd,allocdist0_1_even,allocdist0_1_odd; - uint32_t alloc1,allocdist1_0_even,allocdist1_0_odd,allocdist1_1_even,allocdist1_1_odd; - uint32_t alloc2,allocdist2_0_even,allocdist2_0_odd,allocdist2_1_even,allocdist2_1_odd; - uint32_t alloc3,allocdist3_0_even,allocdist3_0_odd,allocdist3_1_even,allocdist3_1_odd; - uint32_t nVRB,nVRB_even_dist,nVRB_odd_dist; - - for (RBstart=0; RBstart<6; RBstart++) { - alloc0 = 0; - allocdist0_0_even = 0; - allocdist0_0_odd = 0; - for (Lcrbs=1; Lcrbs<=(6-RBstart); Lcrbs++) { - //printf("RBstart %d, len %d --> ",RBstart,Lcrbs); - nVRB = Lcrbs-1+RBstart; - alloc0 |= (1<<nVRB); - allocdist0_0_even |= (1<<get_prb(6,0,nVRB,0)); - allocdist0_0_odd |= (1<<get_prb(6,1,nVRB,0)); - RIV=computeRIV(6,RBstart,Lcrbs); - - if (RIV>RIV_max6) - RIV_max6 = RIV; - - // printf("RIV %d (%d) : first_rb %d NBRB %d\n",RIV,localRIV2alloc_LUT25[RIV],RBstart,Lcrbs); - localRIV2alloc_LUT6[RIV] = alloc0; - distRIV2alloc_even_LUT6[RIV] = allocdist0_0_even; - distRIV2alloc_odd_LUT6[RIV] = allocdist0_0_odd; - RIV2nb_rb_LUT6[RIV] = Lcrbs; - RIV2first_rb_LUT6[RIV] = RBstart; - } - } - - - for (RBstart=0; RBstart<25; RBstart++) { - alloc0 = 0; - allocdist0_0_even = 0; - allocdist0_0_odd = 0; - for (Lcrbs=1; Lcrbs<=(25-RBstart); Lcrbs++) { - nVRB = Lcrbs-1+RBstart; - //printf("RBstart %d, len %d --> ",RBstart,Lcrbs); - alloc0 |= (1<<nVRB); - allocdist0_0_even |= (1<<get_prb(25,0,nVRB,0)); - allocdist0_0_odd |= (1<<get_prb(25,1,nVRB,0)); - - //printf("alloc 0 %x, allocdist0_even %x, allocdist0_odd %x\n",alloc0,allocdist0_0_even,allocdist0_0_odd); - RIV=computeRIV(25,RBstart,Lcrbs); - - if (RIV>RIV_max25) - RIV_max25 = RIV;; - - - localRIV2alloc_LUT25[RIV] = alloc0; - distRIV2alloc_even_LUT25[RIV] = allocdist0_0_even; - distRIV2alloc_odd_LUT25[RIV] = allocdist0_0_odd; - RIV2nb_rb_LUT25[RIV] = Lcrbs; - RIV2first_rb_LUT25[RIV] = RBstart; - } - } - - - for (RBstart=0; RBstart<50; RBstart++) { - alloc0 = 0; - alloc1 = 0; - allocdist0_0_even=0; - allocdist1_0_even=0; - allocdist0_0_odd=0; - allocdist1_0_odd=0; - allocdist0_1_even=0; - allocdist1_1_even=0; - allocdist0_1_odd=0; - allocdist1_1_odd=0; - - for (Lcrbs=1; Lcrbs<=(50-RBstart); Lcrbs++) { - - nVRB = Lcrbs-1+RBstart; - - - if (nVRB<32) - alloc0 |= (1<<nVRB); - else - alloc1 |= (1<<(nVRB-32)); - - // Distributed Gap1, even slot - nVRB_even_dist = get_prb(50,0,nVRB,0); - if (nVRB_even_dist<32) - allocdist0_0_even |= (1<<nVRB_even_dist); - else - allocdist1_0_even |= (1<<(nVRB_even_dist-32)); - - // Distributed Gap1, odd slot - nVRB_odd_dist = get_prb(50,1,nVRB,0); - if (nVRB_odd_dist<32) - allocdist0_0_odd |= (1<<nVRB_odd_dist); - else - allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); - - // Distributed Gap2, even slot - nVRB_even_dist = get_prb(50,0,nVRB,1); - if (nVRB_even_dist<32) - allocdist0_1_even |= (1<<nVRB_even_dist); - else - allocdist1_1_even |= (1<<(nVRB_even_dist-32)); - - // Distributed Gap2, odd slot - nVRB_odd_dist = get_prb(50,1,nVRB,1); - if (nVRB_odd_dist<32) - allocdist0_1_odd |= (1<<nVRB_odd_dist); - else - allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); - - RIV=computeRIV(50,RBstart,Lcrbs); - - if (RIV>RIV_max50) - RIV_max50 = RIV; - - // printf("RIV %d : first_rb %d NBRB %d\n",RIV,RBstart,Lcrbs); - localRIV2alloc_LUT50_0[RIV] = alloc0; - localRIV2alloc_LUT50_1[RIV] = alloc1; - distRIV2alloc_gap0_even_LUT50_0[RIV] = allocdist0_0_even; - distRIV2alloc_gap0_even_LUT50_1[RIV] = allocdist1_0_even; - distRIV2alloc_gap0_odd_LUT50_0[RIV] = allocdist0_0_odd; - distRIV2alloc_gap0_odd_LUT50_1[RIV] = allocdist1_0_odd; - distRIV2alloc_gap1_even_LUT50_0[RIV] = allocdist0_1_even; - distRIV2alloc_gap1_even_LUT50_1[RIV] = allocdist1_1_even; - distRIV2alloc_gap1_odd_LUT50_0[RIV] = allocdist0_1_odd; - distRIV2alloc_gap1_odd_LUT50_1[RIV] = allocdist1_1_odd; - RIV2nb_rb_LUT50[RIV] = Lcrbs; - RIV2first_rb_LUT50[RIV] = RBstart; - } - } - - - for (RBstart=0; RBstart<100; RBstart++) { - alloc0 = 0; - alloc1 = 0; - alloc2 = 0; - alloc3 = 0; - allocdist0_0_even=0; - allocdist1_0_even=0; - allocdist2_0_even=0; - allocdist3_0_even=0; - allocdist0_0_odd=0; - allocdist1_0_odd=0; - allocdist2_0_odd=0; - allocdist3_0_odd=0; - allocdist0_1_even=0; - allocdist1_1_even=0; - allocdist2_1_even=0; - allocdist3_1_even=0; - allocdist0_1_odd=0; - allocdist1_1_odd=0; - allocdist2_1_odd=0; - allocdist3_1_odd=0; - - for (Lcrbs=1; Lcrbs<=(100-RBstart); Lcrbs++) { - - nVRB = Lcrbs-1+RBstart; - - if (nVRB<32) - alloc0 |= (1<<nVRB); - else if (nVRB<64) - alloc1 |= (1<<(nVRB-32)); - else if (nVRB<96) - alloc2 |= (1<<(nVRB-64)); - else - alloc3 |= (1<<(nVRB-96)); - - // Distributed Gap1, even slot - nVRB_even_dist = get_prb(100,0,nVRB,0); - -// if ((RBstart==0) && (Lcrbs<=8)) -// printf("nVRB %d => nVRB_even_dist %d\n",nVRB,nVRB_even_dist); - - - if (nVRB_even_dist<32) - allocdist0_0_even |= (1<<nVRB_even_dist); - else if (nVRB_even_dist<64) - allocdist1_0_even |= (1<<(nVRB_even_dist-32)); - else if (nVRB_even_dist<96) - allocdist2_0_even |= (1<<(nVRB_even_dist-64)); - else - allocdist3_0_even |= (1<<(nVRB_even_dist-96)); -/* if ((RBstart==0) && (Lcrbs<=8)) - printf("rballoc =>(%08x.%08x.%08x.%08x)\n", - allocdist0_0_even, - allocdist1_0_even, - allocdist2_0_even, - allocdist3_0_even - ); -*/ - // Distributed Gap1, odd slot - nVRB_odd_dist = get_prb(100,1,nVRB,0); - if (nVRB_odd_dist<32) - allocdist0_0_odd |= (1<<nVRB_odd_dist); - else if (nVRB_odd_dist<64) - allocdist1_0_odd |= (1<<(nVRB_odd_dist-32)); - else if (nVRB_odd_dist<96) - allocdist2_0_odd |= (1<<(nVRB_odd_dist-64)); - else - allocdist3_0_odd |= (1<<(nVRB_odd_dist-96)); - - - // Distributed Gap2, even slot - nVRB_even_dist = get_prb(100,0,nVRB,1); - if (nVRB_even_dist<32) - allocdist0_1_even |= (1<<nVRB_even_dist); - else if (nVRB_even_dist<64) - allocdist1_1_even |= (1<<(nVRB_even_dist-32)); - else if (nVRB_even_dist<96) - allocdist2_1_even |= (1<<(nVRB_even_dist-64)); - else - allocdist3_1_even |= (1<<(nVRB_even_dist-96)); - - - // Distributed Gap2, odd slot - nVRB_odd_dist = get_prb(100,1,nVRB,1); - if (nVRB_odd_dist<32) - allocdist0_1_odd |= (1<<nVRB_odd_dist); - else if (nVRB_odd_dist<64) - allocdist1_1_odd |= (1<<(nVRB_odd_dist-32)); - else if (nVRB_odd_dist<96) - allocdist2_1_odd |= (1<<(nVRB_odd_dist-64)); - else - allocdist3_1_odd |= (1<<(nVRB_odd_dist-96)); - - - RIV=computeRIV(100,RBstart,Lcrbs); - - if (RIV>RIV_max100) - RIV_max100 = RIV; - - // printf("RIV %d : first_rb %d NBRB %d\n",RIV,RBstart,Lcrbs); - localRIV2alloc_LUT100_0[RIV] = alloc0; - localRIV2alloc_LUT100_1[RIV] = alloc1; - localRIV2alloc_LUT100_2[RIV] = alloc2; - localRIV2alloc_LUT100_3[RIV] = alloc3; - distRIV2alloc_gap0_even_LUT100_0[RIV] = allocdist0_0_even; - distRIV2alloc_gap0_even_LUT100_1[RIV] = allocdist1_0_even; - distRIV2alloc_gap0_even_LUT100_2[RIV] = allocdist2_0_even; - distRIV2alloc_gap0_even_LUT100_3[RIV] = allocdist3_0_even; - distRIV2alloc_gap0_odd_LUT100_0[RIV] = allocdist0_0_odd; - distRIV2alloc_gap0_odd_LUT100_1[RIV] = allocdist1_0_odd; - distRIV2alloc_gap0_odd_LUT100_2[RIV] = allocdist2_0_odd; - distRIV2alloc_gap0_odd_LUT100_3[RIV] = allocdist3_0_odd; - distRIV2alloc_gap1_even_LUT100_0[RIV] = allocdist0_1_even; - distRIV2alloc_gap1_even_LUT100_1[RIV] = allocdist1_1_even; - distRIV2alloc_gap1_even_LUT100_2[RIV] = allocdist2_1_even; - distRIV2alloc_gap1_even_LUT100_3[RIV] = allocdist3_1_even; - distRIV2alloc_gap1_odd_LUT100_0[RIV] = allocdist0_1_odd; - distRIV2alloc_gap1_odd_LUT100_1[RIV] = allocdist1_1_odd; - distRIV2alloc_gap1_odd_LUT100_2[RIV] = allocdist2_1_odd; - distRIV2alloc_gap1_odd_LUT100_3[RIV] = allocdist3_1_odd; - - RIV2nb_rb_LUT100[RIV] = Lcrbs; - RIV2first_rb_LUT100[RIV] = RBstart; - } - } -} - -// Ngap = 3, N_VRB_DL=6, P=1, N_row=2, N_null=4*2-6=2 -// permutation for even slots : -// n_PRB'(0,2,4) = (0,1,2), n_PRB'(1,3,5) = (4,5,6) -// n_PRB''(0,1,2,3) = (0,2,4,6) -// => n_tilde_PRB(5) = (4) -// n_tilde_PRB(4) = (1) -// n_tilde_PRB(2,3) = (3,5) -// n_tilde_PRB(0,1) = (0,2) - - -int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) -{ - uint8_t i; - int8_t first_free_index=-1; - - AssertFatal(eNB!=NULL,"eNB is null\n"); - for (i=0; i<NUMBER_OF_UE_MAX; i++) { - AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i); - AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i); - LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index); - if ((eNB->dlsch[i][0]->harq_mask >0) && - (eNB->dlsch[i][0]->rnti==rnti)) return i; - else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; - } - if (type == SEARCH_EXIST) return -1; - if (first_free_index != -1) - eNB->dlsch[first_free_index][0]->rnti = 0; - return first_free_index; -} - -int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) -{ - uint8_t i; - int8_t first_free_index=-1; - - AssertFatal(eNB!=NULL,"eNB is null\n"); - for (i=0; i<NUMBER_OF_UE_MAX; i++) { - AssertFatal(eNB->ulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i); - if ((eNB->ulsch[i]->harq_mask >0) && - (eNB->ulsch[i]->rnti==rnti)) return i; - else if ((eNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; - } - if (type == SEARCH_EXIST) return -1; - if (first_free_index != -1) - eNB->ulsch[first_free_index]->rnti = 0; - return first_free_index; -} - - -uint32_t get_rballoc(vrb_t vrb_type,uint16_t rb_alloc_dci) -{ - - return(localRIV2alloc_LUT25[rb_alloc_dci]); - -} - -/* -uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti) -{ - unsigned char UE_id; - - // find the UE_index corresponding to rnti - UE_id = find_ue(rnti,RC.eNB[Mod_id][CC_id]); - DevAssert( UE_id != (unsigned char)-1 ); - - return(RC.eNB[Mod_id][CC_id]->transmission_mode[UE_id]); -} -*/ - -void fill_pdcch_order(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,nfapi_dl_config_dci_dl_pdu *pdu) -{ - LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - uint8_t *dci_pdu = &dci_alloc->dci_pdu[0]; - nfapi_dl_config_dci_dl_pdu_rel8_t *rel8 = &pdu->dci_dl_pdu_rel8; - - dci_alloc->firstCCE = rel8->cce_idx; - dci_alloc->L = rel8->aggregation_level; - dci_alloc->rnti = rel8->rnti; - dci_alloc->harq_pid = rel8->harq_process; - dci_alloc->ra_flag = 0; - dci_alloc->format = format1A; - - LOG_D(PHY,"NFAPI: DCI format %d, nCCE %d, L %d, rnti %x,harq_pid %d\n", - rel8->dci_format,rel8->cce_idx,rel8->aggregation_level,rel8->rnti,rel8->harq_process); - - switch (fp->N_RB_DL) { - case 6: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - } else { - dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_FDD_t; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 25: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1A_5MHz_FDD_t; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 50: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1A_10MHz_FDD_t; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 100: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1A_20MHz_FDD_t; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - } - - LOG_I(PHY,"%d.%d: DCI 1A: rnti %x, PDCCH order to do PRACH\n", - proc->frame_tx, proc->subframe_tx, rel8->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) -{ - LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - uint8_t *dci_pdu = &dci_alloc->dci_pdu[0]; - nfapi_dl_config_dci_dl_pdu_rel8_t *rel8 = &pdu->dci_dl_pdu_rel8; - - /* check if this is a DCI 1A PDCCH order for RAPROC */ - if (rel8->dci_format == NFAPI_DL_DCI_FORMAT_1A && rel8->rnti_type == 1) { - int full_rb; - switch (fp->N_RB_DL) { - case 6: full_rb = 63; break; - case 25: full_rb = 511; break; - case 50: full_rb = 2047; break; - case 100: full_rb = 8191; break; - default: abort(); - } - if (rel8->resource_block_coding == full_rb) - return fill_pdcch_order(eNB, proc, dci_alloc, pdu); - } - - LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; - LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; - int beamforming_mode = 0; - int UE_id=-1; - int NPRB; - int TB0_active; - int TB1_active; - uint16_t DL_pmi_single=0; // This should be taken from DLSCH parameters for PUSCH precoding - uint8_t I_mcs = 0; - - dci_alloc->firstCCE = rel8->cce_idx; - dci_alloc->L = rel8->aggregation_level; - dci_alloc->rnti = rel8->rnti; - dci_alloc->harq_pid = rel8->harq_process; - dci_alloc->ra_flag = 0; - - LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[SFN/SF:%04d%d] DCI format %d, nCCE %d, L %d, rnti %x, harq_pid %d\n", - frame,subframe,proc->frame_tx,proc->subframe_tx,rel8->dci_format,rel8->cce_idx,rel8->aggregation_level,rel8->rnti,rel8->harq_process); - if ((rel8->rnti_type == 2 ) && (rel8->rnti != SI_RNTI) && (rel8->rnti != P_RNTI)) dci_alloc->ra_flag = 1; - - UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); - AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); - dlsch0 = eNB->dlsch[UE_id][0]; - dlsch1 = eNB->dlsch[UE_id][1]; - - - beamforming_mode = eNB->transmission_mode[(uint8_t)UE_id]<7?0:eNB->transmission_mode[(uint8_t)UE_id]; - dlsch0_harq = dlsch0->harq_processes[rel8->harq_process]; - dlsch0_harq->codeword = 0; - dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; - dlsch1_harq->codeword = 1; - dlsch0->subframe_tx[subframe] = 1; - - LOG_D(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d dlsch0[rnti:%x harq_mask:%04x] dci_pdu[rnti:%x rnti_type:%d harq_process:%d ndi1:%d] dlsch0_harq[round:%d harq_mask:%x ndi:%d]\n", - frame,subframe, - proc->frame_tx,proc->subframe_tx, - dlsch0->rnti,dlsch0->harq_mask, - rel8->rnti, rel8->rnti_type, rel8->harq_process, rel8->new_data_indicator_1, - dlsch0_harq->round, dlsch0->harq_mask, dlsch0_harq->ndi); - - if (dlsch0->rnti != rel8->rnti) { // if rnti of dlsch is not the same as in the config, this is a new entry - dlsch0_harq->round=0; - dlsch0->harq_mask=0; - } - if ((dlsch0->harq_mask & (1<<rel8->harq_process)) > 0 ) { - if (rel8->new_data_indicator_1 != dlsch0_harq->ndi) - dlsch0_harq->round=0; - } - else { // process is inactive, so activate and set round to 0 - dlsch0_harq->round=0; - } - dlsch0_harq->ndi = rel8->new_data_indicator_1; - - dlsch0->active = 1; - if (rel8->rnti_type == 2) - dlsch0_harq->round = 0; - - LOG_D(PHY,"NFAPI: rel8[rnti %x dci_format %d harq_process %d ndi1 %d rnti type %d] dlsch0[rnti %x harq_mask %x] dlsch0_harq[round %d ndi %d]\n", - rel8->rnti,rel8->dci_format,rel8->harq_process, rel8->new_data_indicator_1, rel8->rnti_type, - dlsch0->rnti,dlsch0->harq_mask, - dlsch0_harq->round,dlsch0_harq->ndi - ); - - switch (rel8->dci_format) { - - case NFAPI_DL_DCI_FORMAT_1A: - - AssertFatal(rel8->resource_block_coding < 8192, "SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: rel8->resource_block_coding (%p) %u >= 8192 (rnti %x, rnti_type %d, format %d, harq_id %d\n", - frame,subframe,proc->frame_tx,subframe, - &rel8->resource_block_coding,rel8->resource_block_coding,rel8->rnti,rel8->rnti_type,rel8->dci_format,rel8->harq_process); - - - dci_alloc->format = format1A; - - switch (fp->N_RB_DL) { - case 6: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_TDD_1_6_t; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_1_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - - } else { - dci_alloc->dci_length = sizeof_DCI1A_1_5MHz_FDD_t; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_1_5MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n"); - dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT6[rel8->resource_block_coding]; - dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag; - dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel8->resource_block_coding];//NPRB; - break; - case 25: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1A_5MHz_FDD_t; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_5MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n"); - dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT25[rel8->resource_block_coding]; - dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag; - dlsch0_harq->nb_rb = RIV2nb_rb_LUT25[rel8->resource_block_coding];//NPRB; - break; - case 50: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_10MHz_TDD_1_6_t; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_10MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1A_10MHz_FDD_t; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_10MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n"); - dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT50_0[rel8->resource_block_coding]; - dlsch0_harq->rb_alloc[1] = localRIV2alloc_LUT50_1[rel8->resource_block_coding]; - dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag; - dlsch0_harq->nb_rb = RIV2nb_rb_LUT50[rel8->resource_block_coding];//NPRB; - break; - case 100: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1A_20MHz_TDD_1_6_t; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->type = 1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1A_20MHz_FDD_t; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->type = 1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->vrb_type = rel8->virtual_resource_block_assignment_flag; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1A_20MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - AssertFatal(rel8->virtual_resource_block_assignment_flag==LOCALIZED,"Distributed RB allocation not done yet\n"); - dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT100_0[rel8->resource_block_coding]; - dlsch0_harq->rb_alloc[1] = localRIV2alloc_LUT100_1[rel8->resource_block_coding]; - dlsch0_harq->rb_alloc[2] = localRIV2alloc_LUT100_2[rel8->resource_block_coding]; - dlsch0_harq->rb_alloc[3] = localRIV2alloc_LUT100_3[rel8->resource_block_coding]; - dlsch0_harq->vrb_type = rel8->virtual_resource_block_assignment_flag; - dlsch0_harq->nb_rb = RIV2nb_rb_LUT100[rel8->resource_block_coding];//NPRB; - break; - } - - if (rel8->rnti_type == 2 ) { - // see 36-212 V8.6.0 p. 45 - NPRB = (rel8->tpc&1)+2; - // 36-213 sec.7.1.7.2 p.26 - I_mcs = rel8->mcs_1; - } - else { - NPRB = dlsch0_harq->nb_rb; - I_mcs = get_I_TBS(rel8->mcs_1); - } - AssertFatal(NPRB>0,"DCI 1A: NPRB = 0 (rnti %x, rnti type %d, tpc %d, round %d, resource_block_coding %d, harq process %d)\n",rel8->rnti,rel8->rnti_type,rel8->tpc,dlsch0_harq->round,rel8->resource_block_coding,rel8->harq_process); - dlsch0_harq->rvidx = rel8->redundancy_version_1; - dlsch0_harq->Nl = 1; - dlsch0_harq->mimo_mode = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI; - dlsch0_harq->dl_power_off = 1; - - - - dlsch0_harq->mcs = rel8->mcs_1; - dlsch0_harq->Qm = 2; - dlsch0_harq->TBS = TBStable[I_mcs][NPRB-1]; - dlsch0->harq_ids[subframe] = rel8->harq_process; - dlsch0->active = 1; - dlsch0->rnti = rel8->rnti; - dlsch0->harq_ids[subframe] = rel8->harq_process; - if (dlsch0_harq->round == 0) - dlsch0_harq->status = ACTIVE; - - dlsch0->harq_mask |= (1<<rel8->harq_process); - - if (rel8->rnti_type == 1) LOG_I(PHY,"DCI 1A: round %d, mcs %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,rel8->rnti,rel8->harq_process); - - break; - case NFAPI_DL_DCI_FORMAT_1: - - dci_alloc->format = format1; - dlsch0->active = 1; - - LOG_D(PHY,"SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: Programming DLSCH for Format 1 DCI, harq_pid %d\n",frame,subframe,proc->frame_tx,subframe,rel8->harq_process); - - switch (fp->N_RB_DL) { - case 6: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1_1_5MHz_TDD_t; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1_1_5MHz_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1_1_5MHz_FDD_t; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_1_5MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 25: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1_5MHz_TDD_t; - ((DCI1_5MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_5MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_5MHz_TDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_5MHz_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_5MHz_TDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_5MHz_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_5MHz_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_5MHz_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1_5MHz_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1_5MHz_FDD_t; - ((DCI1_5MHz_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_5MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_5MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_5MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_5MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_5MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_5MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_5MHz_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 50: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1_10MHz_TDD_t; - ((DCI1_10MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_10MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_10MHz_TDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_10MHz_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_10MHz_TDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_10MHz_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_10MHz_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_10MHz_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1_10MHz_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1_10MHz_FDD_t; - ((DCI1_10MHz_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_10MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_10MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_10MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_10MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_10MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_10MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_10MHz_FDD_t *)dci_pdu)->padding = 0; - } - break; - case 100: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI1_20MHz_TDD_t; - ((DCI1_20MHz_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_20MHz_TDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_20MHz_TDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_20MHz_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_20MHz_TDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_20MHz_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_20MHz_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_20MHz_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI1_20MHz_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI1_20MHz_FDD_t; - ((DCI1_20MHz_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI1_20MHz_FDD_t *)dci_pdu)->mcs = rel8->mcs_1; - ((DCI1_20MHz_FDD_t *)dci_pdu)->ndi = rel8->new_data_indicator_1; - ((DCI1_20MHz_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI1_20MHz_FDD_t *)dci_pdu)->rv = rel8->redundancy_version_1; - ((DCI1_20MHz_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI1_20MHz_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI1_20MHz_FDD_t *)dci_pdu)->padding = 0; - } - break; - } - - AssertFatal(rel8->harq_process<8,"Format 1: harq_pid=%d >= 8\n", rel8->harq_process); - - - dlsch0_harq = dlsch0->harq_processes[rel8->harq_process]; - dlsch0_harq->codeword=0; - - // printf("DCI: Setting subframe_tx for subframe %d\n",subframe); - dlsch0->subframe_tx[subframe] = 1; - - conv_rballoc(rel8->resource_allocation_type, - rel8->resource_block_coding, - fp->N_RB_DL, - dlsch0_harq->rb_alloc); - - dlsch0_harq->nb_rb = conv_nprb(rel8->resource_allocation_type, - rel8->resource_block_coding, - fp->N_RB_DL); - - NPRB = dlsch0_harq->nb_rb; - - - AssertFatal(NPRB>0,"NPRB == 0\n"); - - dlsch0_harq->rvidx = rel8->redundancy_version_1; - - dlsch0_harq->Nl = 1; - // dlsch[0]->layer_index = 0; - if (beamforming_mode == 0) - dlsch0_harq->mimo_mode = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI; - else if (beamforming_mode == 7) - dlsch0_harq->mimo_mode = TM7; - else - LOG_E(PHY,"Invalid beamforming mode %dL\n", beamforming_mode); - - dlsch0_harq->dl_power_off = 1; - - dlsch0->active = 1; - - - - if (dlsch0_harq->round == 0) { - dlsch0_harq->status = ACTIVE; - - // printf("Setting DLSCH process %d to ACTIVE\n",rel8->harq_process); - // MCS and TBS don't change across HARQ rounds - dlsch0_harq->mcs = rel8->mcs_1; - dlsch0_harq->Qm = get_Qm(rel8->mcs_1); - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][NPRB-1]; - - } - - LOG_D(PHY,"DCI: Set harq_ids[%d] to %d (%p)\n",subframe,rel8->harq_process,dlsch0); - dlsch0->harq_ids[subframe] = rel8->harq_process; - - dlsch0->harq_mask |= (1<<rel8->harq_process); - - - dlsch0->rnti = rel8->rnti; - - - break; - case NFAPI_DL_DCI_FORMAT_2A: - - dci_alloc->format = format2A; - switch (fp->N_RB_DL) { - case 6: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2A_1_5MHz_2A_TDD_t; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - /* there is no padding in this structure, it is exactly 32 bits */ - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2A_1_5MHz_2A_FDD_t; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 25: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2A_5MHz_2A_TDD_t; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2A_5MHz_2A_FDD_t; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 50: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2A_10MHz_2A_TDD_t; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2A_10MHz_2A_FDD_t; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->padding = 0; - } - break; - case 100: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2A_20MHz_2A_TDD_t; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2A_20MHz_2A_FDD_t; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->padding = 0; - } - break; - - } - - AssertFatal(rel8->harq_process<8,"Format 2_2A: harq_pid=%d >= 8\n", rel8->harq_process); - - - // Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0 - // note that we must set tbswap=0 in eNB scheduler if one TB is deactivated - - // This must be set as in TM4, does not work properly now. - if (rel8->transport_block_to_codeword_swap_flag == 1) { - dlsch0 = eNB->dlsch[UE_id][1]; - dlsch1 = eNB->dlsch[UE_id][0]; - } - - dlsch0_harq = dlsch0->harq_processes[rel8->harq_process]; - dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; - - dlsch0->subframe_tx[subframe] = 1; - - dlsch0->harq_ids[subframe] = rel8->harq_process; - dlsch1->harq_ids[subframe] = rel8->harq_process; - // printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe); - - - conv_rballoc(rel8->resource_allocation_type, - rel8->resource_block_coding, - fp->N_RB_DL, - dlsch0_harq->rb_alloc); - - dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0]; - dlsch0_harq->nb_rb = conv_nprb(rel8->resource_allocation_type, - rel8->resource_block_coding, - fp->N_RB_DL); - dlsch1_harq->nb_rb = dlsch0_harq->nb_rb; - - AssertFatal(dlsch0_harq->nb_rb > 0,"nb_rb=0\n"); - - dlsch0_harq->mcs = rel8->mcs_1; - dlsch1_harq->mcs = rel8->mcs_2; - dlsch0_harq->Qm = get_Qm(rel8->mcs_1); - dlsch1_harq->Qm = get_Qm(rel8->mcs_2); - dlsch0_harq->rvidx = rel8->redundancy_version_1; - dlsch1_harq->rvidx = rel8->redundancy_version_2; - - // assume both TBs are active - dlsch0_harq->Nl = 1; - dlsch1_harq->Nl = 1; - dlsch0->active = 1; - dlsch1->active = 1; - dlsch0->harq_mask |= (1<<rel8->harq_process); - dlsch1->harq_mask |= (1<<rel8->harq_process); - - // check if either TB is disabled (see 36-213 V11.3 Section ) - if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) { - dlsch0->active = 0; - dlsch0->harq_mask &= ~(1<<rel8->harq_process); - } - - if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) { - dlsch1->active = 0; - dlsch1->harq_mask &= ~(1<<rel8->harq_process); - } - - // dlsch0_harq->dl_power_off = 0; - // dlsch1_harq->dl_power_off = 0; - - - if (fp->nb_antenna_ports_eNB == 2) { - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1]; - - if ((dlsch0->active==1) && (dlsch1->active==1)) { - - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - } else { - dlsch0_harq->mimo_mode = ALAMOUTI; - dlsch1_harq->mimo_mode = ALAMOUTI; - } - } else if (fp->nb_antenna_ports_eNB == 4) { // 4 antenna case - if ((dlsch0->active==1) && (dlsch1->active==1)) { - switch (rel8->precoding_information) { - case 0: // one layer per transport block - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - break; - - case 1: // one-layers on TB 0, two on TB 1 - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->Nl = 2; - dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][(dlsch1_harq->nb_rb<<1)-1]; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - break; - - case 2: // two-layers on TB 0, two on TB 1 - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->Nl = 2; - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - - if (fp->N_RB_DL <= 56) { - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][(dlsch0_harq->nb_rb<<1)-1]; - dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][(dlsch1_harq->nb_rb<<1)-1]; - } else { - LOG_E(PHY,"Add implementation of Table 7.1.7.2.2-1 for two-layer TBS conversion with N_RB_DL > 56\n"); - } - - break; - - case 3: // - LOG_E(PHY,"Illegal value (3) for TPMI in Format 2A DCI\n"); - break; - } - } else if (dlsch0->active == 1) { - switch (rel8->precoding_information) { - case 0: // one layer per transport block - dlsch0_harq->mimo_mode = ALAMOUTI; - dlsch1_harq->mimo_mode = ALAMOUTI; - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - break; - - case 1: // two-layers on TB 0 - dlsch0_harq->mimo_mode = LARGE_CDD; - dlsch0_harq->Nl = 2; - dlsch0_harq->dl_power_off = 1; - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][(dlsch0_harq->nb_rb<<1)-1]; - break; - - case 2: // two-layers on TB 0, two on TB 1 - case 3: // - LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",rel8->precoding_information); - break; - } - } else if (dlsch1->active == 1) { - switch (rel8->precoding_information) { - case 0: // one layer per transport block - dlsch0_harq->mimo_mode = ALAMOUTI; - dlsch1_harq->mimo_mode = ALAMOUTI; - dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1]; - break; - - case 1: // two-layers on TB 0 - dlsch1_harq->mimo_mode = LARGE_CDD; - dlsch1_harq->Nl = 2; - dlsch1_harq->dl_power_off = 1; - dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][(dlsch1_harq->nb_rb<<1)-1]; - break; - - case 2: // two-layers on TB 0, two on TB 1 - case 3: // - LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",rel8->precoding_information); - break; - } - } - } else { - LOG_E(PHY,"Illegal number of antennas for eNB %d\n",fp->nb_antenna_ports_eNB); - } - - // reset HARQ process if this is the first transmission - if ((dlsch0->active==1) && (dlsch0_harq->round == 0)) - dlsch0_harq->status = ACTIVE; - - if ((dlsch1->active==1) && (dlsch1_harq->round == 0)) - dlsch1_harq->status = ACTIVE; - - dlsch0->rnti = rel8->rnti; - dlsch1->rnti = rel8->rnti; - - - break; - - case NFAPI_DL_DCI_FORMAT_2: - - dci_alloc->format = format2; - switch (fp->N_RB_DL) { - case 6: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2_1_5MHz_2A_TDD_t; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2_1_5MHz_2A_FDD_t; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 25: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2_5MHz_2A_TDD_t; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2_5MHz_2A_FDD_t; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->padding = 0; - // printf("FDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } - break; - case 50: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2_10MHz_2A_TDD_t; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2_10MHz_2A_FDD_t; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->padding = 0; - } - break; - case 100: - if (fp->frame_type == TDD) { - dci_alloc->dci_length = sizeof_DCI2_20MHz_2A_TDD_t; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->dai = rel8->downlink_assignment_index; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->padding = 0; - // printf("TDD 1: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); - } else { - dci_alloc->dci_length = sizeof_DCI2_20MHz_2A_FDD_t; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rah = rel8->resource_allocation_type; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->mcs1 = rel8->mcs_1; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->mcs2 = rel8->mcs_2; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->ndi1 = rel8->new_data_indicator_1; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->ndi2 = rel8->new_data_indicator_2; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rballoc = rel8->resource_block_coding; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rv1 = rel8->redundancy_version_1; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->rv2 = rel8->redundancy_version_2; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->TPC = rel8->tpc; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->harq_pid = rel8->harq_process; - ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->tb_swap = rel8->transport_block_to_codeword_swap_flag; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->tpmi = rel8->precoding_information; - ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->padding = 0; - } - break; - - } - - AssertFatal(rel8->harq_process>=8, "Format 2_2A: harq_pid=%d >= 8\n", rel8->harq_process); - - - // Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0 - // note that we must set tbswap=0 in eNB scheduler if one TB is deactivated - TB0_active = 1; - TB1_active = 1; - - if ((rel8->redundancy_version_1 == 1) && (rel8->mcs_1 == 0)) { - TB0_active=0; - } - if ((rel8->redundancy_version_2 == 1) && (rel8->mcs_2 == 0)) { - TB1_active=0; - } -#ifdef DEBUG_HARQ - printf("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rel8->redundancy_version_1, rel8->redundancy_version_2, rel8->mcs_1, rel8->mcs_2); -#endif - if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==0) { - dlsch0->active = 1; - dlsch1->active = 1; - dlsch0->harq_mask |= (1<<rel8->harq_process); - dlsch1->harq_mask |= (1<<rel8->harq_process); - dlsch0_harq = dlsch0->harq_processes[rel8->harq_process]; - dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; - dlsch0_harq->mcs = rel8->mcs_1; - dlsch1_harq->mcs = rel8->mcs_2; - dlsch0_harq->Qm = get_Qm(rel8->mcs_1); - dlsch1_harq->Qm = get_Qm(rel8->mcs_2); - dlsch0_harq->rvidx = rel8->redundancy_version_1; - dlsch1_harq->rvidx = rel8->redundancy_version_2; - dlsch0_harq->status = ACTIVE; - dlsch1_harq->status = ACTIVE; - dlsch0_harq->codeword=0; - dlsch1_harq->codeword=1; -#ifdef DEBUG_HARQ - printf("\n ENB: BOTH ACTIVE\n"); -#endif - } - else if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==1) { - dlsch0 = eNB->dlsch[UE_id][1]; - dlsch1 = eNB->dlsch[UE_id][0]; - dlsch0->active = 1; - dlsch1->active = 1; - - dlsch0->harq_mask |= (1<<rel8->harq_process); - dlsch1->harq_mask |= (1<<rel8->harq_process); - - dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; - dlsch0_harq->mcs = rel8->mcs_1; - dlsch1_harq->mcs = rel8->mcs_2; - dlsch0_harq->Qm = get_Qm(rel8->mcs_1); - dlsch1_harq->Qm = get_Qm(rel8->mcs_2); - dlsch0_harq->rvidx = rel8->redundancy_version_1; - dlsch1_harq->rvidx = rel8->redundancy_version_2; - dlsch0_harq->status = ACTIVE; - dlsch1_harq->status = ACTIVE; - dlsch0_harq->codeword=1; - dlsch1_harq->codeword=0; - } - else if (TB0_active && (TB1_active==0)) { - dlsch0->active = 1; - dlsch0->harq_mask |= (1<<rel8->harq_process); - dlsch0_harq = dlsch0->harq_processes[rel8->harq_process]; - dlsch0_harq->mcs = rel8->mcs_1; - dlsch0_harq->Qm = get_Qm(rel8->mcs_1); - dlsch0_harq->rvidx = rel8->redundancy_version_1; - dlsch0_harq->status = ACTIVE; - dlsch0_harq->codeword = 0; - dlsch1=NULL; - dlsch1_harq = NULL; -#ifdef DEBUG_HARQ - printf("\n ENB: TB1 is deactivated, retransmit TB0 transmit in TM6\n"); -#endif - } - else if ((TB0_active==0) && TB1_active) { - dlsch1->active = 1; - dlsch1->harq_mask |= (1<<rel8->harq_process); - dlsch1_harq = dlsch1->harq_processes[rel8->harq_process]; - dlsch1_harq->mcs = rel8->mcs_2; - dlsch1_harq->Qm = get_Qm(rel8->mcs_2); - dlsch1_harq->rvidx = rel8->redundancy_version_2; - dlsch1_harq->status = ACTIVE; - dlsch1_harq->codeword = 0; - dlsch0=NULL; - dlsch0_harq = NULL; -#ifdef DEBUG_HARQ - printf("\n ENB: TB0 is deactivated, retransmit TB1 transmit in TM6\n"); -#endif - } - - if (dlsch0 != NULL){ - dlsch0->subframe_tx[subframe] = 1; - - dlsch0->harq_ids[subframe] = rel8->harq_process; - } - - if (dlsch1_harq != NULL){ - dlsch1->harq_ids[subframe] = rel8->harq_process; - } - - - if (dlsch0 != NULL ){ - conv_rballoc(rel8->resource_allocation_type, - rel8->resource_block_coding, - fp->N_RB_DL, - dlsch0_harq->rb_alloc); - - dlsch0_harq->nb_rb = conv_nprb(rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL); - - if (dlsch1 != NULL){ - dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0]; - dlsch1_harq->nb_rb = dlsch0_harq->nb_rb; - } - } else if ((dlsch0 == NULL ) && (dlsch1 != NULL )){ - conv_rballoc(rel8->resource_allocation_type, - rel8->resource_block_coding, - fp->N_RB_DL, - dlsch1_harq->rb_alloc); - - dlsch1_harq->nb_rb = conv_nprb(rel8->resource_allocation_type, rel8->resource_block_coding, fp->N_RB_DL); - } - - - // assume both TBs are active - if (dlsch0_harq != NULL) - dlsch0_harq->Nl = 1; - if (dlsch1_harq != NULL) - dlsch1_harq->Nl = 1; - - - // check if either TB is disabled (see 36-213 V11.3 Section ) - - if (fp->nb_antenna_ports_eNB == 2) { - if ((dlsch0 != NULL) && (dlsch1 != NULL)) { //two CW active - - dlsch0_harq->dl_power_off = 1; - dlsch1_harq->dl_power_off = 1; - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1]; - switch (rel8->precoding_information) { - case 0: - dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1; - dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1; - dlsch0_harq->pmi_alloc = pmi_extend(fp,0,1); - dlsch1_harq->pmi_alloc = pmi_extend(fp,0,1); - break; - case 1: - dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; - dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; - dlsch0_harq->pmi_alloc = pmi_extend(fp,1,1); - dlsch0_harq->pmi_alloc = pmi_extend(fp,1,1); - - break; - case 2: // PUSCH precoding - dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING; - dlsch0_harq->pmi_alloc = DL_pmi_single; - dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING; - dlsch1_harq->pmi_alloc = DL_pmi_single; - break; - default: - break; - } - } else if ((dlsch0 != NULL) && (dlsch1 == NULL)) { // only CW 0 active - dlsch0_harq->dl_power_off = 1; - dlsch0_harq->TBS= TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - switch (rel8->precoding_information) { - case 0 : - dlsch0_harq->mimo_mode = ALAMOUTI; - break; - case 1: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING11; - dlsch0_harq->pmi_alloc = pmi_extend(fp,0,0); - break; - case 2: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1; - dlsch0_harq->pmi_alloc = pmi_extend(fp,1,0); - break; - case 3: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j; - dlsch0_harq->pmi_alloc = pmi_extend(fp,2,0); - break; - case 4: - dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj; - dlsch0_harq->pmi_alloc = pmi_extend(fp,3,0); - break; - case 5: - dlsch0_harq->mimo_mode = PUSCH_PRECODING0; - dlsch0_harq->pmi_alloc = DL_pmi_single; - break; - case 6: - dlsch0_harq->mimo_mode = PUSCH_PRECODING1; - dlsch0_harq->pmi_alloc = DL_pmi_single; - break; - } - } else if ((dlsch0 == NULL) && (dlsch1 != NULL)) { - dlsch1_harq->dl_power_off = 1; - dlsch1_harq->TBS= TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1]; - switch (rel8->precoding_information) { - case 0 : - dlsch1_harq->mimo_mode = ALAMOUTI; - break; - case 1: - dlsch1_harq->mimo_mode = UNIFORM_PRECODING11; - dlsch1_harq->pmi_alloc = pmi_extend(fp,0,0); - break; - case 2: - dlsch1_harq->mimo_mode = UNIFORM_PRECODING1m1; - dlsch1_harq->pmi_alloc = pmi_extend(fp,1,0); - break; - case 3: - dlsch1_harq->mimo_mode = UNIFORM_PRECODING1j; - dlsch1_harq->pmi_alloc = pmi_extend(fp,2,0); - break; - case 4: - dlsch1_harq->mimo_mode = UNIFORM_PRECODING1mj; - dlsch1_harq->pmi_alloc = pmi_extend(fp,3,0); - break; - case 5: - dlsch1_harq->mimo_mode = PUSCH_PRECODING0; - dlsch1_harq->pmi_alloc = DL_pmi_single; - break; - case 6: - dlsch1_harq->mimo_mode = PUSCH_PRECODING1; - dlsch1_harq->pmi_alloc = DL_pmi_single; - break; - } - } - - } else if (fp->nb_antenna_ports_eNB == 4) { - // fill in later - } - - // reset HARQ process if this is the first transmission - /* if (dlsch0_harq->round == 0) - dlsch0_harq->status = ACTIVE; - - if (dlsch1_harq->round == 0) - dlsch1_harq->status = ACTIVE;*/ - if (dlsch0_harq != NULL) - dlsch0->rnti = rel8->rnti; - if (dlsch1 != NULL) - dlsch1->rnti = rel8->rnti; - - break; - } - - if (dlsch0_harq) { - dlsch0_harq->frame = frame; - dlsch0_harq->subframe = subframe; - } - if (dlsch1_harq) { - dlsch1_harq->frame = frame; - dlsch1_harq->subframe = subframe; - } - -#ifdef DEBUG_DCI - - if (dlsch0) { - printf("dlsch0 eNB: dlsch0 %p\n",dlsch0); - printf("dlsch0 eNB: rnti %x\n",dlsch0->rnti); - printf("dlsch0 eNB: NBRB %d\n",dlsch0_harq->nb_rb); - printf("dlsch0 eNB: rballoc %x\n",dlsch0_harq->rb_alloc[0]); - printf("dlsch0 eNB: harq_pid %d\n",harq_pid); - printf("dlsch0 eNB: round %d\n",dlsch0_harq->round); - printf("dlsch0 eNB: rvidx %d\n",dlsch0_harq->rvidx); - printf("dlsch0 eNB: TBS %d (NPRB %d)\n",dlsch0_harq->TBS,NPRB); - printf("dlsch0 eNB: mcs %d\n",dlsch0_harq->mcs); - printf("dlsch0 eNB: tpmi %d\n",rel8->precoding_information); - printf("dlsch0 eNB: mimo_mode %d\n",dlsch0_harq->mimo_mode); - } - - if (dlsch1) { - printf("dlsch1 eNB: dlsch1 %p\n",dlsch1); - printf("dlsch1 eNB: rnti %x\n",dlsch1->rnti); - printf("dlsch1 eNB: NBRB %d\n",dlsch1_harq->nb_rb); - printf("dlsch1 eNB: rballoc %x\n",dlsch1_harq->rb_alloc[0]); - printf("dlsch1 eNB: harq_pid %d\n",harq_pid); - printf("dlsch1 eNB: round %d\n",dlsch1_harq->round); - printf("dlsch1 eNB: rvidx %d\n",dlsch1_harq->rvidx); - printf("dlsch1 eNB: TBS %d (NPRB %d)\n",dlsch1_harq->TBS,NPRB); - printf("dlsch1 eNB: mcs %d\n",dlsch1_harq->mcs); - printf("dlsch1 eNB: tpmi %d\n",rel8->precoding_information); - printf("dlsch1 eNB: mimo_mode %d\n",dlsch1_harq->mimo_mode); - } - -#endif - -#if T_TRACER - if (dlsch0->active) - T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame), T_INT(subframe), - T_INT(rel8->rnti), T_INT(rel8->dci_format), T_INT(rel8->harq_process), - T_INT(rel8->mcs_1), T_INT(dlsch0_harq->TBS)); -#endif - -} - -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) { - - LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - - uint8_t *dci_pdu = &dci_alloc->dci_pdu[0]; - nfapi_dl_config_mpdcch_pdu_rel13_t *rel13 = &pdu->mpdcch_pdu_rel13; - - LTE_eNB_DLSCH_t *dlsch0=NULL; - LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL; - int UE_id; - int subframe = proc->subframe_tx; - - dci_alloc->firstCCE = rel13->ecce_index; - dci_alloc->L = rel13->aggregation_level; - dci_alloc->rnti = rel13->rnti; - dci_alloc->harq_pid = rel13->harq_process; - dci_alloc->narrowband = rel13->mpdcch_narrow_band; - dci_alloc->number_of_prb_pairs = rel13->number_of_prb_pairs; - dci_alloc->resource_block_assignment = rel13->resource_block_assignment; - dci_alloc->transmission_type = rel13->mpdcch_tansmission_type; - dci_alloc->start_symbol = rel13->start_symbol; - dci_alloc->ce_mode = rel13->ce_mode; - dci_alloc->dmrs_scrambling_init = rel13->drms_scrambling_init; - dci_alloc->i0 = rel13->initial_transmission_sf_io; - - dci_alloc->ra_flag = 0; - if (rel13->rnti_type == 2 ) dci_alloc->ra_flag = 1; - - UE_id = find_dlsch(rel13->rnti,eNB,SEARCH_EXIST_OR_FREE); - AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); - dlsch0 = eNB->dlsch[UE_id][0]; - dlsch0_harq = dlsch0->harq_processes[rel13->harq_process]; - - AssertFatal(fp->frame_type==FDD,"TDD is not supported yet for eMTC\n"); - AssertFatal(fp->N_RB_DL==25 || fp->N_RB_DL==50 ||fp->N_RB_DL==100, - "eMTC only with N_RB_DL = 25,50,100\n"); - - switch (rel13->dci_format) { - - case 10: // Format 6-1A - dci_alloc->format = format6_1A; - dlsch0->active = 1; - switch (fp->N_RB_DL) { - - case 25: - dci_alloc->dci_length = sizeof_DCI6_1A_5MHz_t; - ((DCI6_1A_5MHz_t *)dci_pdu)->type = 1; - ((DCI6_1A_5MHz_t *)dci_pdu)->hopping = rel13->frequency_hopping_enabled_flag; - ((DCI6_1A_5MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_1A_5MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_1A_5MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_1A_5MHz_t *)dci_pdu)->harq_pid = rel13->harq_process; - ((DCI6_1A_5MHz_t *)dci_pdu)->ndi = rel13->new_data_indicator; - ((DCI6_1A_5MHz_t *)dci_pdu)->rv = rel13->redundancy_version; - ((DCI6_1A_5MHz_t *)dci_pdu)->TPC = rel13->tpc; - ((DCI6_1A_5MHz_t *)dci_pdu)->srs_req = rel13->srs_request; - ((DCI6_1A_5MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset; - ((DCI6_1A_5MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_1A_5MHz_t *)dci_pdu)->padding = 0; - - break; - case 50: - dci_alloc->dci_length = sizeof_DCI6_1A_10MHz_t; - ((DCI6_1A_10MHz_t *)dci_pdu)->type = 1; - ((DCI6_1A_10MHz_t *)dci_pdu)->hopping = rel13->frequency_hopping_enabled_flag; - ((DCI6_1A_10MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_1A_10MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_1A_10MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_1A_10MHz_t *)dci_pdu)->harq_pid = rel13->harq_process; - ((DCI6_1A_10MHz_t *)dci_pdu)->ndi = rel13->new_data_indicator; - ((DCI6_1A_10MHz_t *)dci_pdu)->rv = rel13->redundancy_version; - ((DCI6_1A_10MHz_t *)dci_pdu)->TPC = rel13->tpc; - ((DCI6_1A_10MHz_t *)dci_pdu)->srs_req = rel13->srs_request; - ((DCI6_1A_10MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset; - ((DCI6_1A_10MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_1A_10MHz_t *)dci_pdu)->padding = 0; - break; - case 100: - dci_alloc->dci_length = sizeof_DCI6_1A_20MHz_t; - ((DCI6_1A_20MHz_t *)dci_pdu)->type = 1; - ((DCI6_1A_20MHz_t *)dci_pdu)->hopping = rel13->frequency_hopping_enabled_flag; - ((DCI6_1A_20MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_1A_20MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_1A_20MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_1A_20MHz_t *)dci_pdu)->harq_pid = rel13->harq_process; - ((DCI6_1A_20MHz_t *)dci_pdu)->ndi = rel13->new_data_indicator; - ((DCI6_1A_20MHz_t *)dci_pdu)->rv = rel13->redundancy_version; - ((DCI6_1A_20MHz_t *)dci_pdu)->TPC = rel13->tpc; - ((DCI6_1A_20MHz_t *)dci_pdu)->srs_req = rel13->srs_request; - ((DCI6_1A_20MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset; - ((DCI6_1A_20MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_1A_20MHz_t *)dci_pdu)->padding = 0; - break; - } - break; - case 11: // Format 6-1B - dci_alloc->format = format6_1B; - dlsch0->active = 1; - switch (fp->N_RB_DL) { - - case 25: - dci_alloc->dci_length = sizeof_DCI6_1B_5MHz_t; - ((DCI6_1B_5MHz_t *)dci_pdu)->type = 1; - ((DCI6_1B_5MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_1B_5MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_1B_5MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_1B_5MHz_t *)dci_pdu)->harq_pid = rel13->harq_process; - ((DCI6_1B_5MHz_t *)dci_pdu)->ndi = rel13->new_data_indicator; - ((DCI6_1B_5MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset; - ((DCI6_1B_5MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_1B_5MHz_t *)dci_pdu)->padding = 0; - - break; - case 50: - dci_alloc->dci_length = sizeof_DCI6_1B_10MHz_t; - ((DCI6_1B_10MHz_t *)dci_pdu)->type = 1; - ((DCI6_1B_10MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_1B_10MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_1B_10MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_1B_10MHz_t *)dci_pdu)->harq_pid = rel13->harq_process; - ((DCI6_1B_10MHz_t *)dci_pdu)->ndi = rel13->new_data_indicator; - ((DCI6_1B_10MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset; - ((DCI6_1B_10MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_1B_10MHz_t *)dci_pdu)->padding = 0; - break; - case 100: - dci_alloc->dci_length = sizeof_DCI6_1B_20MHz_t; - ((DCI6_1B_20MHz_t *)dci_pdu)->type = 1; - ((DCI6_1B_20MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_1B_20MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_1B_20MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_1B_20MHz_t *)dci_pdu)->harq_pid = rel13->harq_process; - ((DCI6_1B_20MHz_t *)dci_pdu)->ndi = rel13->new_data_indicator; - ((DCI6_1B_20MHz_t *)dci_pdu)->harq_ack_off = rel13->harq_resource_offset; - ((DCI6_1B_20MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_1B_20MHz_t *)dci_pdu)->padding = 0; - break; - } - case 12: // Format 6-2 - dci_alloc->format = format6_2; - dlsch0->active = 1; - switch (fp->N_RB_DL) { - case 25: - dci_alloc->dci_length = sizeof_DCI6_2_5MHz_t; - if (rel13->paging_direct_indication_differentiation_flag==0) { - ((DCI6_2_di_5MHz_t *)dci_pdu)->type = 0; - ((DCI6_2_di_5MHz_t *)dci_pdu)->di_info = rel13->direct_indication; - ((DCI6_2_di_5MHz_t *)dci_pdu)->padding = 0; - } - else { - ((DCI6_2_paging_5MHz_t *)dci_pdu)->type = 1; - ((DCI6_2_paging_5MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_2_paging_5MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_2_paging_5MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_2_paging_5MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_2_paging_5MHz_t *)dci_pdu)->padding = 0; - } - - break; - case 50: - dci_alloc->dci_length = sizeof_DCI6_2_10MHz_t; - if (rel13->paging_direct_indication_differentiation_flag==0) { - ((DCI6_2_di_10MHz_t *)dci_pdu)->type = 0; - ((DCI6_2_di_10MHz_t *)dci_pdu)->di_info = rel13->direct_indication; - ((DCI6_2_di_10MHz_t *)dci_pdu)->padding = 0; - } - else { - ((DCI6_2_paging_10MHz_t *)dci_pdu)->type = 1; - ((DCI6_2_paging_10MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_2_paging_10MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_2_paging_10MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_2_paging_10MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_2_paging_10MHz_t *)dci_pdu)->padding = 0; - } - - break; - case 100: - dci_alloc->dci_length = sizeof_DCI6_2_20MHz_t; - if (rel13->paging_direct_indication_differentiation_flag==0) { - ((DCI6_2_di_20MHz_t *)dci_pdu)->type = 0; - ((DCI6_2_di_20MHz_t *)dci_pdu)->di_info = rel13->direct_indication; - ((DCI6_2_di_20MHz_t *)dci_pdu)->padding = 0; - } - else { - ((DCI6_2_paging_20MHz_t *)dci_pdu)->type = 1; - ((DCI6_2_paging_20MHz_t *)dci_pdu)->rballoc = rel13->resource_block_coding; - ((DCI6_2_paging_20MHz_t *)dci_pdu)->mcs = rel13->mcs; - ((DCI6_2_paging_20MHz_t *)dci_pdu)->rep = (rel13->pdsch_reptition_levels-1); - ((DCI6_2_paging_20MHz_t *)dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number-1; - ((DCI6_2_paging_20MHz_t *)dci_pdu)->padding = 0; - } - - break; - } - } - AssertFatal(rel13->harq_process<8, - "ERROR: Format 6_1A: harq_pid=%d >= 8\n", rel13->harq_process); - - dlsch0_harq = dlsch0->harq_processes[rel13->harq_process]; - dlsch0_harq->codeword=0; - - // printf("DCI: Setting subframe_tx for subframe %d\n",subframe); - dlsch0->subframe_tx[subframe] = 1; - - conv_eMTC_rballoc(rel13->resource_block_coding, - fp->N_RB_DL, - dlsch0_harq->rb_alloc); - - dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel13->resource_block_coding&31]; // this is the 6PRB RIV - - - dlsch0_harq->rvidx = rel13->redundancy_version; - - dlsch0_harq->Nl = 1; - // dlsch[0]->layer_index = 0; - // if (beamforming_mode == 0) - dlsch0_harq->mimo_mode = (fp->nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI; - //else if (beamforming_mode == 7) - // dlsch0_harq->mimo_mode = TM7; - //else - //LOG_E(PHY,"Invalid beamforming mode %dL\n", beamforming_mode); - - dlsch0_harq->dl_power_off = 1; - - dlsch0->active = 1; - dlsch0->harq_mask |= (1<<rel13->harq_process); - - - if (dlsch0_harq->round == 0) { - dlsch0_harq->status = ACTIVE; - // printf("Setting DLSCH process %d to ACTIVE\n",rel8->harq_process); - // MCS and TBS don't change across HARQ rounds - dlsch0_harq->mcs = rel13->mcs; - dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; - - } - - dlsch0->harq_ids[subframe] = rel13->harq_process; - - - - dlsch0->rnti = rel13->rnti; - - - - - - - -} - -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) -{ - LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; - - uint32_t cqi_req = pdu->dci_pdu_rel8.cqi_csi_request; - uint32_t dai = pdu->dci_pdu_rel8.dl_assignment_index; - uint32_t cshift = pdu->dci_pdu_rel8.cyclic_shift_2_for_drms; - uint32_t TPC = pdu->dci_pdu_rel8.tpc; - uint32_t mcs = pdu->dci_pdu_rel8.mcs_1; - uint32_t hopping = pdu->dci_pdu_rel8.frequency_hopping_enabled_flag; - uint32_t rballoc = computeRIV(frame_parms->N_RB_DL, - pdu->dci_pdu_rel8.resource_block_start, - pdu->dci_pdu_rel8.number_of_resource_block); - - uint32_t ndi = pdu->dci_pdu_rel8.new_data_indication_1; - -#ifdef T_TRACER - T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), - T_INT(pdu->dci_pdu_rel8.rnti), T_INT(((frame*10+subframe+4) % 8) /* TODO: correct harq pid */), - T_INT(mcs), T_INT(-1 /* TODO: remove round? */), - T_INT(pdu->dci_pdu_rel8.resource_block_start), - T_INT(pdu->dci_pdu_rel8.number_of_resource_block), - T_INT(get_TBS_UL(mcs, pdu->dci_pdu_rel8.number_of_resource_block) * 8), - T_INT(pdu->dci_pdu_rel8.aggregation_level), - T_INT(pdu->dci_pdu_rel8.cce_index)); -#endif - - void *dci_pdu = (void*)dci_alloc->dci_pdu; - - LOG_D(PHY,"SFN/SF:%04d%d DCI0[rnti %x cqi %d mcs %d hopping %d rballoc %x (%d,%d) ndi %d TPC %d cshift %d]\n", - frame,subframe, - pdu->dci_pdu_rel8.rnti,cqi_req, mcs,hopping,rballoc, - pdu->dci_pdu_rel8.resource_block_start, - pdu->dci_pdu_rel8.number_of_resource_block, ndi,TPC,cshift); - - dci_alloc->format = format0; - dci_alloc->firstCCE = pdu->dci_pdu_rel8.cce_index; - dci_alloc->L = pdu->dci_pdu_rel8.aggregation_level; - dci_alloc->rnti = pdu->dci_pdu_rel8.rnti; - dci_alloc->ra_flag = 0; - - switch (frame_parms->N_RB_DL) { - case 6: - if (frame_parms->frame_type == TDD) { - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->dai = dai; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->cshift = cshift; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->TPC = TPC; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->mcs = mcs; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->ndi = ndi; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->hopping = hopping; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->type = 0; - ((DCI0_1_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - dci_alloc->dci_length = sizeof_DCI0_1_5MHz_TDD_1_6_t; - } else { - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->cshift = cshift; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->TPC = TPC; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->mcs = mcs; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->ndi = ndi; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->hopping = hopping; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->type = 0; - ((DCI0_1_5MHz_FDD_t *)dci_pdu)->padding = 0; - dci_alloc->dci_length = sizeof_DCI0_1_5MHz_FDD_t; - } - - break; - - case 25: - if (frame_parms->frame_type == TDD) { - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->dai = dai; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift = cshift; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->TPC = TPC; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->mcs = mcs; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->ndi = ndi; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->hopping = hopping; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->type = 0; - ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - dci_alloc->dci_length = sizeof_DCI0_5MHz_TDD_1_6_t; - } else { - ((DCI0_5MHz_FDD_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_5MHz_FDD_t *)dci_pdu)->cshift = cshift; - ((DCI0_5MHz_FDD_t *)dci_pdu)->TPC = TPC; - ((DCI0_5MHz_FDD_t *)dci_pdu)->mcs = mcs; - ((DCI0_5MHz_FDD_t *)dci_pdu)->ndi = ndi; - ((DCI0_5MHz_FDD_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_5MHz_FDD_t *)dci_pdu)->hopping = hopping; - ((DCI0_5MHz_FDD_t *)dci_pdu)->type = 0; - ((DCI0_5MHz_FDD_t *)dci_pdu)->padding = 0; - dci_alloc->dci_length = sizeof_DCI0_5MHz_FDD_t; - } - - break; - - case 50: - if (frame_parms->frame_type == TDD) { - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->dai = dai; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->cshift = cshift; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->TPC = TPC; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->mcs = mcs; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->ndi = ndi; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->hopping = hopping; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->type = 0; - ((DCI0_10MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - dci_alloc->dci_length = sizeof_DCI0_10MHz_TDD_1_6_t; - } else { - ((DCI0_10MHz_FDD_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_10MHz_FDD_t *)dci_pdu)->cshift = cshift; - ((DCI0_10MHz_FDD_t *)dci_pdu)->TPC = TPC; - ((DCI0_10MHz_FDD_t *)dci_pdu)->mcs = mcs; - ((DCI0_10MHz_FDD_t *)dci_pdu)->ndi = ndi; - ((DCI0_10MHz_FDD_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_10MHz_FDD_t *)dci_pdu)->hopping = hopping; - ((DCI0_10MHz_FDD_t *)dci_pdu)->type = 0; - ((DCI0_10MHz_FDD_t *)dci_pdu)->padding = 0; - dci_alloc->dci_length = sizeof_DCI0_10MHz_FDD_t; - } - - break; - - case 100: - if (frame_parms->frame_type == TDD) { - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->dai = dai; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->cshift = cshift; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->TPC = TPC; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->mcs = mcs; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->ndi = ndi; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->hopping = hopping; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->type = 0; - ((DCI0_20MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - - dci_alloc->dci_length = sizeof_DCI0_20MHz_TDD_1_6_t; - } else { - ((DCI0_20MHz_FDD_t *)dci_pdu)->cqi_req = cqi_req; - ((DCI0_20MHz_FDD_t *)dci_pdu)->cshift = cshift; - ((DCI0_20MHz_FDD_t *)dci_pdu)->TPC = TPC; - ((DCI0_20MHz_FDD_t *)dci_pdu)->mcs = mcs; - ((DCI0_20MHz_FDD_t *)dci_pdu)->ndi = ndi; - ((DCI0_20MHz_FDD_t *)dci_pdu)->rballoc = rballoc; - ((DCI0_20MHz_FDD_t *)dci_pdu)->hopping = hopping; - ((DCI0_20MHz_FDD_t *)dci_pdu)->type = 0; - ((DCI0_20MHz_FDD_t *)dci_pdu)->padding = 0; - dci_alloc->dci_length = sizeof_DCI0_20MHz_FDD_t; - } - - //printf("eNB: rb_alloc (20 MHz dci) %d\n",rballoc); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } -} - -void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe) -{ - uint8_t harq_pid; - uint8_t UE_id; - boolean_t new_ulsch = (find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST)==-1) ? TRUE : FALSE; - - AssertFatal((UE_id=find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0, - "No existing/free UE ULSCH for rnti %x\n",ulsch_pdu->ulsch_pdu_rel8.rnti); - - LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id]; - LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; - - int use_srs = 0; - - harq_pid = ulsch_pdu->ulsch_pdu_rel8.harq_process_number; - - ulsch->harq_mask |= 1 << harq_pid; - - ulsch->harq_processes[harq_pid]->frame = frame; - ulsch->harq_processes[harq_pid]->subframe = subframe; - ulsch->harq_processes[harq_pid]->handled = 0; - - ulsch->harq_processes[harq_pid]->first_rb = ulsch_pdu->ulsch_pdu_rel8.resource_block_start; - ulsch->harq_processes[harq_pid]->nb_rb = ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks; - - AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n"); - - ulsch->harq_processes[harq_pid]->dci_alloc = 1; - ulsch->harq_processes[harq_pid]->rar_alloc = 0; - ulsch->harq_processes[harq_pid]->n_DMRS = ulsch_pdu->ulsch_pdu_rel8.cyclic_shift_2_for_drms; - - ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1); - ulsch->harq_processes[harq_pid]->srs_active = use_srs; - - //Mapping of cyclic shift field in DCI format0 to n_DMRS2 (3GPP 36.211, Table 5.5.2.1.1-1) - if(ulsch->harq_processes[harq_pid]->n_DMRS == 0) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 0; - else if(ulsch->harq_processes[harq_pid]->n_DMRS == 1) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 6; - else if(ulsch->harq_processes[harq_pid]->n_DMRS == 2) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 3; - else if(ulsch->harq_processes[harq_pid]->n_DMRS == 3) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 4; - else if(ulsch->harq_processes[harq_pid]->n_DMRS == 4) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 2; - else if(ulsch->harq_processes[harq_pid]->n_DMRS == 5) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 8; - else if(ulsch->harq_processes[harq_pid]->n_DMRS == 6) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 10; - else if(ulsch->harq_processes[harq_pid]->n_DMRS == 7) - ulsch->harq_processes[harq_pid]->n_DMRS2 = 9; - - LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d\n", - eNB->Mod_id,harq_pid,frame,subframe, - ulsch->harq_processes[harq_pid]->n_DMRS2, - ulsch->harq_processes[harq_pid]->n_DMRS, - ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status, - ulsch_pdu->ulsch_pdu_rel8.redundancy_version); - - ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version; - ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type; - // Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be - ulsch->harq_processes[harq_pid]->O_ACK = 0; - - if ((ulsch->harq_processes[harq_pid]->status == SCH_IDLE) || - (ulsch->harq_processes[harq_pid]->ndi != ulsch_pdu->ulsch_pdu_rel8.new_data_indication) || - (new_ulsch == TRUE)){ - ulsch->harq_processes[harq_pid]->status = ACTIVE; - - ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3; - - ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks; - ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->harq_processes[harq_pid]->Nsymb_pusch; - ulsch->harq_processes[harq_pid]->round = 0; - ulsch->harq_processes[harq_pid]->ndi = ulsch_pdu->ulsch_pdu_rel8.new_data_indication; - // note here, the CQI bits need to be kept constant as in initial transmission - // set to 0 in initial transmission, and don't touch them during retransmissions - // will be set if MAC has activated ULSCH_CQI_RI_PDU or ULSCH_CQI_HARQ_RI_PDU - ulsch->harq_processes[harq_pid]->Or1 = 0; - ulsch->harq_processes[harq_pid]->Or2 = 0; - } - else ulsch->harq_processes[harq_pid]->round++; - - ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti; - LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n", - ulsch->rnti, - UE_id, - new_ulsch, - frame, - subframe, - harq_pid, - ulsch->harq_processes[harq_pid]->status, - ulsch->harq_processes[harq_pid]->handled, - ulsch->harq_processes[harq_pid]->first_rb, - ulsch->harq_processes[harq_pid]->nb_rb, - ulsch->harq_processes[harq_pid]->rvidx, - ulsch->harq_processes[harq_pid]->Qm, - ulsch->harq_processes[harq_pid]->TBS, - ulsch->harq_processes[harq_pid]->round); -} - -int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) -{ - switch (dci->format) { - - case format0: // This is an UL SCH allocation so nothing here, inform MAC - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format0 (TDD, 1.5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 25: - LOG_D(PHY,"DCI format0 (TDD1-6, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 50: - LOG_D(PHY,"DCI format0 (TDD1-6, 10MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 100: - LOG_D(PHY,"DCI format0 (TDD1-6, 20MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, dai %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai, - ((DCI0_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->cqi_req); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - else if (frame_parms->frame_type == FDD) - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format0 (FDD, 1.5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_1_5MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 25: - LOG_D(PHY,"DCI format0 (FDD, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 50: - LOG_D(PHY,"DCI format0 (FDD, 10MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_10MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - case 100: - LOG_D(PHY,"DCI format0 (FDD, 20MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu[0])[0], - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->hopping, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->cshift, - ((DCI0_20MHz_FDD_t *)&dci->dci_pdu[0])->cqi_req); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; - - case format1: - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) - - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1 (TDD 1.5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_1_5MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - case 25: - LOG_D(PHY,"DCI format1 (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_5MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - case 50: - LOG_D(PHY,"DCI format1 (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_10MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - case 100: - LOG_D(PHY,"DCI format1 (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d, dai %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI1_20MHz_TDD_t *)&dci->dci_pdu[0])->dai); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - else if (frame_parms->frame_type == FDD) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1 (FDD, 1.5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format1 (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format1 (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format1 (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; - - case format1A: // This is DLSCH allocation for control traffic - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) { - switch (frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1A (TDD1-6, 1_5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_1_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - case 25: - LOG_D(PHY,"DCI format1A (TDD1-6, 5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %d (NB_RB %d)\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_5MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - case 50: - LOG_D(PHY,"DCI format1A (TDD1-6, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_10MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - case 100: - LOG_D(PHY,"DCI format1A (TDD1-6, 20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT100[((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->TPC); - LOG_D(PHY,"DAI %d\n",((DCI1A_20MHz_TDD_1_6_t *)&dci->dci_pdu[0])->dai); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - - } else if (frame_parms->frame_type == FDD) { - switch (frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1A(FDD, 1.5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_1_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format1A(FDD, 5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_5MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format1A(FDD, 10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_10MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format1A(FDD, 20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"VRB_TYPE %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->vrb_type); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT100[((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rballoc]); - LOG_D(PHY,"MCS %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->mcs); - LOG_D(PHY,"HARQ_PID %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->harq_pid); - LOG_D(PHY,"NDI %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->ndi); - LOG_D(PHY,"RV %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->rv); - LOG_D(PHY,"TPC %d\n",((DCI1A_20MHz_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - - break; - - case format1C: // This is DLSCH allocation for control traffic - switch (frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format1C (1.5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n", - ((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT6[conv_1C_RIV(((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,6)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - case 25: - LOG_D(PHY,"DCI format1C (5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[conv_1C_RIV(((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,25)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - case 50: - LOG_D(PHY,"DCI format1C (10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"Ngap %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->Ngap); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,50)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - case 100: - LOG_D(PHY,"DCI format1C (20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); - LOG_D(PHY,"Ngap %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->Ngap); - LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,100)]); - LOG_D(PHY,"MCS %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->mcs); - break; - - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - - - break; - - case format2: - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2 2 antennas (TDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi - ); - break; - - case 25: - LOG_D(PHY,"DCI format2 2 antennas (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 50: - LOG_D(PHY,"DCI format2 2 antennas (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 100: - LOG_D(PHY,"DCI format2 2 antennas (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2 2 antennas (TDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi - ); - break; - - case 25: - LOG_D(PHY,"DCI format2 2 antennas (TDD 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 50: - LOG_D(PHY,"DCI format2 2 antennas (TDD 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 100: - LOG_D(PHY,"DCI format2 2 antennas (TDD 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, TPC %d, dai %d, tb_swap %d, tpmi %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } else if (frame_parms->frame_type == FDD) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2 2 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - - LOG_D(PHY,"DCI format2 2 antennas (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, swap %d, TPMI %d, TPC %d\n", - - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2 2 antennas (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2 2 antennas (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - - case 6: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 10 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2 4 antennas (FDD, 20 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d|%d, harq_pid %d, ndi %d|%d, RV %d|%d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } - - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; - - case format2A: - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config>0)) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_1_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap - ); - break; - - case 25: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_5MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); - break; - case 50: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_10MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); - break; - - case 100: - LOG_D(PHY,"DCI format2A 2 antennas (FDD 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_20MHz_2A_TDD_t *)&dci->dci_pdu[0])->tb_swap); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 1.5 MHz), rnti %x (%"PRIu64"): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_1_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi - ); - break; - - case 25: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_5MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 50: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_10MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - case 100: - LOG_D(PHY,"DCI format2A 4 antennas (TDD 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->TPC, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->dai, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_20MHz_4A_TDD_t *)&dci->dci_pdu[0])->tpmi); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } else if (frame_parms->frame_type == FDD) { - if (frame_parms->nb_antenna_ports_eNB == 2) { - switch(frame_parms->N_RB_DL) { - case 6: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint32_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_1_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 10 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_10MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2A 2 antennas (FDD, 20 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_20MHz_2A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } else if (frame_parms->nb_antenna_ports_eNB == 4) { - switch(frame_parms->N_RB_DL) { - - case 6: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 1.5 MHz), rnti %x (%"PRIu64"): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_1_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 25: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_5MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 50: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_10MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - case 100: - LOG_D(PHY,"DCI format2A 4 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, tpmi %d, TPC %d\n", - dci->rnti, - ((uint64_t*)&dci->dci_pdu)[0], - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rah, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs1, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->mcs2, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->harq_pid, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi1, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->ndi2, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv1, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->rv2, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI2A_20MHz_4A_FDD_t *)&dci->dci_pdu[0])->TPC); - break; - - default: - LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); - DevParam (frame_parms->N_RB_DL, 0, 0); - break; - } - } - } - - else - LOG_E(PHY,"Don't know how to handle TDD format 0 yet\n"); - - break; +//#define DEBUG_HARQ - case format1E_2A_M10PRB: - - LOG_D(PHY,"DCI format1E_2A_M10PRB, rnti %x (%8x): harq_pid %d, rah %d, rb_alloc %x, mcs %d, rv %d, tpmi %d, ndi %d, dl_power_offset %d\n", - dci->rnti, - ((uint32_t *)&dci->dci_pdu)[0], - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->harq_pid, - //((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->tb_swap, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rah, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rballoc, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->mcs, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->rv, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->tpmi, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->ndi, - ((DCI1E_5MHz_2A_M10PRB_TDD_t *)&dci->dci_pdu[0])->dl_power_off - ); - break; +#include "LAYER2/MAC/mac.h" - default: - LOG_E(PHY,"dci_tools.c: dump_dci, unknown format %d\n",dci->format); - return(-1); - } +//#define DEBUG_DCI - return(0); -} +#include "../LTE_TRANSPORT/dci_tools_common_extern.h" +#include "../LTE_TRANSPORT/transport_proto.h" +#include "transport_proto_ue.h" +#include "../LTE_TRANSPORT/transport_common_proto.h" +#include "SCHED/sched_common.h" + +extern uint16_t beta_cqi[16]; +extern uint16_t beta_ri[16]; +extern uint16_t beta_ack[16]; void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { @@ -5027,7 +1263,7 @@ void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms, pdsch_vars->llr_offset[pdcch_vars->num_pdcch_symbols] = 0; - LOG_I(PHY,"compute_llr_offset: nb RB %d - Qm %d \n", nb_rb_alloc, dlsch0_harq->Qm); + LOG_D(PHY,"compute_llr_offset: nb RB %d - Qm %d \n", nb_rb_alloc, dlsch0_harq->Qm); //dlsch0_harq->rb_alloc_even; //dlsch0_harq->rb_alloc_odd; @@ -5057,14 +1293,14 @@ void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms, if(symbol < (frame_parms->symbols_per_tti-1)) pdsch_vars->llr_offset[symbol+1] = pdsch_vars->llr_offset[symbol] + llr_offset; - LOG_I(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb); - LOG_I(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re); - LOG_I(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re); - LOG_I(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re); + LOG_D(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb); + LOG_D(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re); + LOG_D(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re); + LOG_D(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re); - LOG_I(PHY,"Data Re subframe %d-symbol %d => llr length %d, llr offset %d \n", subframe, symbol, + LOG_D(PHY,"Data Re subframe %d-symbol %d => llr length %d, llr offset %d \n", subframe, symbol, pdsch_vars->llr_length[symbol], pdsch_vars->llr_offset[symbol]); } } @@ -6461,148 +2697,6 @@ int generate_ue_dlsch_params_from_dci(int frame, } -uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe) -{ - uint8_t ret = 255; - - if (frame_parms->frame_type == FDD) { - ret = (((frame*10)+subframe)&7); - } else { - - switch (frame_parms->tdd_config) { - - case 1: - if ((subframe==2) || - (subframe==3) || - (subframe==7) || - (subframe==8)) - switch (subframe) { - case 2: - case 3: - ret = (subframe-2); - break; - - case 7: - case 8: - ret = (subframe-5); - break; - - default: - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - break; - } - - break; - - case 2: - if ((subframe!=2) && (subframe!=7)) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret=255; - } - else ret = (subframe/7); - break; - - case 3: - if ((subframe<2) || (subframe>4)) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - } - else ret = (subframe-2); - break; - - case 4: - if ((subframe<2) || (subframe>3)) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - } - else ret = (subframe-2); - break; - - case 5: - if (subframe!=2) { - LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); - ret = (255); - } - else ret = (subframe-2); - break; - - default: - LOG_E(PHY,"subframe2_harq_pid, Unsupported TDD mode %d\n",frame_parms->tdd_config); - ret = (255); - } - } - - AssertFatal(ret!=255, - "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frame, subframe); - return ret; -} - -uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) -{ - uint8_t ul_subframe = 255; - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 1) && - ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 - ul_subframe = ((n+6)%10); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - ((n==0)||(n==1)||(n==5)||(n==6))) - ul_subframe = ((n+7)%10); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - (n==9)) // tdd_config 6 SF 9 - ul_subframe = ((n+5)%10); - else - ul_subframe = ((n+4)%10); - - AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n); - - LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe); - return ul_subframe; -} - -uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) -{ - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 1) && - ((n==7)||(n==2))) // tdd_config 0,1 SF 1,5 - return((n==7)? 1 : 6); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - ((n==7)||(n==8)||(n==2)||(n==3))) - return((n+3)%10); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - (n==4)) // tdd_config 6 SF 9 - return(9); - else - return((n+6)%10); -} - -uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n) -{ - uint32_t ul_frame; - - if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 1) && - ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 - ul_frame = (frame + (n==1 ? 0 : 1)); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - ((n==0)||(n==1)||(n==5)||(n==6))) - ul_frame = (frame + (n>=5 ? 1 : 0)); - else if ((frame_parms->frame_type == TDD) && - (frame_parms->tdd_config == 6) && - (n==9)) // tdd_config 6 SF 9 - ul_frame = (frame+1); - else - ul_frame = (frame+(n>=6 ? 1 : 0)); - - LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame); - return ul_frame % 1024; -} int32_t pmi_convert_rank1_from_rank2(uint16_t pmi_alloc, int tpmi, int nb_rb) { @@ -7172,34 +3266,7 @@ void reset_cba_uci(void *o) } -uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_t rank) -{ - - uint8_t i,wideband_pmi2; - uint32_t pmi_ex = 0; - - if (frame_parms->N_RB_DL!=25) { - LOG_E(PHY,"pmi_extend not yet implemented for anything else than 25PRB\n"); - return(-1); - } - - if (rank==0) { - wideband_pmi2=wideband_pmi&3; - for (i=0; i<14; i+=2) - pmi_ex|=(wideband_pmi2<<i); - } - else if (rank==1) { - wideband_pmi2=wideband_pmi&1; - for (i=0; i<7; i++) - pmi_ex|=(wideband_pmi2<<i); - } - else { - LOG_E(PHY,"unsupported rank\n"); - return(-1); - } - return(pmi_ex); -} int generate_ue_ulsch_params_from_dci(void *dci_pdu, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c index b496f69a0628d63328e170e4f4416e7f8416fd47..f7afb08286ddb8f58e359bec492d0bdbfca0258d 100755 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_ue.c @@ -32,11 +32,15 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "PHY/defs_UE.h" +#include "PHY/phy_extern.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "SCHED_UE/sched_UE.h" +#include "SIMULATION/TOOLS/sim.h" // for taus #include "PHY/sse_intrin.h" +#include "PHY/LTE_TRANSPORT/transport_extern.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" +#include "SCHED/sched_common.h" #include "assertions.h" #include "T.h" @@ -49,77 +53,6 @@ //#undef ALL_AGGREGATION -//extern uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3]; -//extern uint16_t pcfich_reg[4]; - -#define CCEBITS 72 -#define CCEPERSYMBOL 33 // This is for 1200 RE -#define CCEPERSYMBOL0 22 // This is for 1200 RE -#define DCI_BITS_MAX ((2*CCEPERSYMBOL+CCEPERSYMBOL0)*CCEBITS) -#define Msymb (DCI_BITS_MAX/2) -//#define Mquad (Msymb/4) - -static uint32_t bitrev_cc_dci[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30}; - -uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t lprime,uint8_t mi) -{ - - uint16_t i; - uint16_t Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48; - uint16_t mprime; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - if ((lprime>0) && (frame_parms->Ncp==0) ) - return(0); - - // printf("check_phich_reg : mi %d\n",mi); - - // compute REG based on symbol - if ((lprime == 0)|| - ((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) - mprime = kprime/6; - else - mprime = kprime>>2; - - // check if PCFICH uses mprime - if ((lprime==0) && - ((mprime == pcfich_reg[0]) || - (mprime == pcfich_reg[1]) || - (mprime == pcfich_reg[2]) || - (mprime == pcfich_reg[3]))) { -#ifdef DEBUG_DCI_ENCODING - printf("[PHY] REG %d allocated to PCFICH\n",mprime); -#endif - return(1); - } - - // handle Special subframe case for TDD !!! - - // printf("Checking phich_reg %d\n",mprime); - if (mi > 0) { - if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0) - Ngroup_PHICH++; - - if (frame_parms->Ncp == 1) { - Ngroup_PHICH<<=1; - } - - - - for (i=0; i<Ngroup_PHICH; i++) { - if ((mprime == frame_parms->phich_reg[i][0]) || - (mprime == frame_parms->phich_reg[i][1]) || - (mprime == frame_parms->phich_reg[i][2])) { -#ifdef DEBUG_DCI_ENCODING - printf("[PHY] REG %d (lprime %d) allocated to PHICH\n",mprime,lprime); -#endif - return(1); - } - } - } - - return(0); -} uint16_t extract_crc(uint8_t *dci,uint8_t dci_len) { @@ -172,6 +105,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm uint32_t i, lprime; uint16_t kprime,kprime_mod12,mprime,symbol_offset,tti_offset,tti_offset0; int16_t re_offset,re_offset0; + uint32_t Msymb=(DCI_BITS_MAX/2); // This is the REG allocation algorithm from 36-211, second part of Section 6.8.5 @@ -223,11 +157,11 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm // if REG is allocated to PHICH, skip it if (check_phich_reg(frame_parms,kprime,lprime,mi) == 1) { - // printf("dci_demapping : skipping REG %d (RE %d)\n",(lprime==0)?kprime/6 : kprime>>2,kprime); +// printf("dci_demapping : skipping REG %d (RE %d)\n",(lprime==0)?kprime/6 : kprime>>2,kprime); if ((lprime == 0)&&((kprime%6)==0)) re_offset0+=4; } else { // not allocated to PHICH/PCFICH - // printf("dci_demapping: REG %d\n",(lprime==0)?kprime/6 : kprime>>2); + // printf("dci_demapping: REG %d\n",(lprime==0)?kprime/6 : kprime>>2); if (lprime == 0) { // first symbol, or second symbol+4 TX antennas skip pilots kprime_mod12 = kprime%12; @@ -238,7 +172,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm for (i=0; i<4; i++) { wbar[mprime] = llr[tti_offset0+i]; #ifdef DEBUG_DCI_DECODING -// LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset0+i,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); + LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset0+i,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); #endif mprime++; re_offset0++; @@ -272,12 +206,13 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm } // kprime loop } -static uint16_t wtemp_rx[Msymb]; + void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t *wbar,uint8_t number_pdcch_symbols,uint8_t mi) { uint16_t *wptr,*zptr,*wptr2; - + uint32_t Msymb=(DCI_BITS_MAX/2); + uint16_t wtemp_rx[Msymb]; uint16_t Mquad=get_nquad(number_pdcch_symbols,frame_parms,mi); uint32_t RCC = (Mquad>>5), ND; uint32_t row,col,Kpi,index; @@ -373,56 +308,6 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t } -int32_t pdcch_qpsk_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho_i, - int16_t *pdcch_llr16, - int16_t *pdcch_llr8in, - uint8_t symbol) -{ - - int16_t *rxF=(int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; - int16_t *rxF_i=(int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; - int16_t *rho=(int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; - int16_t *llr128; - int32_t i; - char *pdcch_llr8; - int16_t *pdcch_llr; - pdcch_llr8 = (char *)&pdcch_llr8in[symbol*frame_parms->N_RB_DL*12]; - pdcch_llr = &pdcch_llr16[symbol*frame_parms->N_RB_DL*12]; - - // printf("dlsch_qpsk_qpsk: symbol %d\n",symbol); - - llr128 = (int16_t*)pdcch_llr; - - if (!llr128) { - printf("dlsch_qpsk_qpsk_llr: llr is null, symbol %d\n",symbol); - return -1; - } - - qpsk_qpsk(rxF, - rxF_i, - llr128, - rho, - frame_parms->N_RB_DL*12); - - //prepare for Viterbi which accepts 8 bit, but prefers 4 bit, soft input. - for (i=0; i<(frame_parms->N_RB_DL*24); i++) { - if (*pdcch_llr>7) - *pdcch_llr8=7; - else if (*pdcch_llr<-8) - *pdcch_llr8=-8; - else - *pdcch_llr8 = (char)(*pdcch_llr); - - pdcch_llr++; - pdcch_llr8++; - } - - return(0); -} - int32_t pdcch_llr(LTE_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp, @@ -452,7 +337,7 @@ int32_t pdcch_llr(LTE_DL_FRAME_PARMS *frame_parms, else *pdcch_llr8 = (char)(*rxF); - // printf("%d %d => %d\n",i,*rxF,*pdcch_llr8); + // printf("rxF->llr : %d %d => %d\n",i,*rxF,*pdcch_llr8); rxF++; pdcch_llr8++; } @@ -513,7 +398,7 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext, ((int32_t*)&avg128P)[2] + ((int32_t*)&avg128P)[3])/(nb_rb*12); - // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); + // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); } #if defined(__x86_64__) || defined(__i386__) @@ -523,120 +408,6 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext, } -#if defined(__x86_64) || defined(__i386__) -__m128i mmtmpPD0,mmtmpPD1,mmtmpPD2,mmtmpPD3; -#elif defined(__arm__) - -#endif -void pdcch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t symbol, - int32_t **dl_ch_estimates_ext, - int32_t **dl_ch_estimates_ext_i, - int32_t **dl_ch_rho_ext, - uint8_t output_shift) -{ - - uint16_t rb; -#if defined(__x86_64__) || defined(__i386__) - __m128i *dl_ch128,*dl_ch128i,*dl_ch_rho128; -#elif defined(__arm__) - -#endif - uint8_t aarx; - - // printf("dlsch_dual_stream_correlation: symbol %d\n",symbol); - - - 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_ch128i = (__m128i *)&dl_ch_estimates_ext_i[aarx][symbol*frame_parms->N_RB_DL*12]; - dl_ch_rho128 = (__m128i *)&dl_ch_rho_ext[aarx][symbol*frame_parms->N_RB_DL*12]; - -#elif defined(__arm__) - -#endif - - for (rb=0; rb<frame_parms->N_RB_DL; rb++) { - // multiply by conjugated channel -#if defined(__x86_64__) || defined(__i386__) - mmtmpPD0 = _mm_madd_epi16(dl_ch128[0],dl_ch128i[0]); - // print_ints("re",&mmtmpPD0); - - // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpPD1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1)); - mmtmpPD1 = _mm_shufflehi_epi16(mmtmpPD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpPD1 = _mm_sign_epi16(mmtmpPD1,*(__m128i*)&conjugate[0]); - // print_ints("im",&mmtmpPD1); - mmtmpPD1 = _mm_madd_epi16(mmtmpPD1,dl_ch128i[0]); - // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpPD0 = _mm_srai_epi32(mmtmpPD0,output_shift); - // print_ints("re(shift)",&mmtmpPD0); - mmtmpPD1 = _mm_srai_epi32(mmtmpPD1,output_shift); - // print_ints("im(shift)",&mmtmpPD1); - mmtmpPD2 = _mm_unpacklo_epi32(mmtmpPD0,mmtmpPD1); - mmtmpPD3 = _mm_unpackhi_epi32(mmtmpPD0,mmtmpPD1); - // print_ints("c0",&mmtmpPD2); - // print_ints("c1",&mmtmpPD3); - dl_ch_rho128[0] = _mm_packs_epi32(mmtmpPD2,mmtmpPD3); - - //print_shorts("rx:",dl_ch128_2); - //print_shorts("ch:",dl_ch128); - //print_shorts("pack:",rho128); - - // multiply by conjugated channel - mmtmpPD0 = _mm_madd_epi16(dl_ch128[1],dl_ch128i[1]); - // mmtmpPD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpPD1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1)); - mmtmpPD1 = _mm_shufflehi_epi16(mmtmpPD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpPD1 = _mm_sign_epi16(mmtmpPD1,*(__m128i*)conjugate); - mmtmpPD1 = _mm_madd_epi16(mmtmpPD1,dl_ch128i[1]); - // mmtmpPD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpPD0 = _mm_srai_epi32(mmtmpPD0,output_shift); - mmtmpPD1 = _mm_srai_epi32(mmtmpPD1,output_shift); - mmtmpPD2 = _mm_unpacklo_epi32(mmtmpPD0,mmtmpPD1); - mmtmpPD3 = _mm_unpackhi_epi32(mmtmpPD0,mmtmpPD1); - - - dl_ch_rho128[1] =_mm_packs_epi32(mmtmpPD2,mmtmpPD3); - //print_shorts("rx:",dl_ch128_2+1); - //print_shorts("ch:",dl_ch128+1); - //print_shorts("pack:",rho128+1); - // multiply by conjugated channel - mmtmpPD0 = _mm_madd_epi16(dl_ch128[2],dl_ch128i[2]); - // mmtmpPD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpPD1 = _mm_shufflelo_epi16(dl_ch128[2],_MM_SHUFFLE(2,3,0,1)); - mmtmpPD1 = _mm_shufflehi_epi16(mmtmpPD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpPD1 = _mm_sign_epi16(mmtmpPD1,*(__m128i*)conjugate); - mmtmpPD1 = _mm_madd_epi16(mmtmpPD1,dl_ch128i[2]); - // mmtmpPD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpPD0 = _mm_srai_epi32(mmtmpPD0,output_shift); - mmtmpPD1 = _mm_srai_epi32(mmtmpPD1,output_shift); - mmtmpPD2 = _mm_unpacklo_epi32(mmtmpPD0,mmtmpPD1); - mmtmpPD3 = _mm_unpackhi_epi32(mmtmpPD0,mmtmpPD1); - - dl_ch_rho128[2] = _mm_packs_epi32(mmtmpPD2,mmtmpPD3); - //print_shorts("rx:",dl_ch128_2+2); - //print_shorts("ch:",dl_ch128+2); - //print_shorts("pack:",rho128+2); - - dl_ch128+=3; - dl_ch128i+=3; - dl_ch_rho128+=3; - - -#elif defined(__arm__) - -#endif - } - } -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif - -} void pdcch_detection_mrc_i(LTE_DL_FRAME_PARMS *frame_parms, @@ -741,7 +512,6 @@ void pdcch_extract_rbs_single(int32_t **rxdataF, int nushiftmod3 = frame_parms->nushift%3; uint8_t symbol_mod; - symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; #ifdef DEBUG_DCI_DECODING LOG_I(PHY, "extract_rbs_single: symbol_mod %d\n",symbol_mod); @@ -794,9 +564,9 @@ void pdcch_extract_rbs_single(int32_t **rxdataF, (i!=(nushiftmod3+6)) && (i!=(nushiftmod3+9))) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i]; - // printf("ch %d => (%d,%d)\n",i,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i])); + //printf("ch %d => (%d,%d)\n",i,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i])); } } @@ -1205,9 +975,11 @@ void pdcch_channel_compensation(int32_t **rxdataF_ext, { uint16_t rb; + #if defined(__x86_64__) || defined(__i386__) __m128i *dl_ch128,*rxdataF128,*rxdataF_comp128; __m128i *dl_ch128_2, *rho128; + __m128i mmtmpPD0,mmtmpPD1,mmtmpPD2,mmtmpPD3; #elif defined(__arm__) #endif @@ -1518,8 +1290,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, uint8_t subframe, uint8_t eNB_id, MIMO_mode_t mimo_mode, - uint32_t high_speed_flag, - uint8_t is_secondary_ue) + uint32_t high_speed_flag) { LTE_UE_COMMON *common_vars = &ue->common_vars; @@ -1527,50 +1298,30 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, LTE_UE_PDCCH **pdcch_vars = ue->pdcch_vars[ue->current_thread_id[subframe]]; uint8_t log2_maxh,aatx,aarx; -#ifdef MU_RECEIVER - uint8_t eNB_id_i=eNB_id+1;//add 1 to eNB_id to separate from wanted signal, chosen as the B/F'd pilots from the SeNB are shifted by 1 -#endif int32_t avgs; uint8_t n_pdcch_symbols; uint8_t mi = get_mi(frame_parms,subframe); - //printf("In rx_pdcch, subframe %d, eNB_id %d, pdcch_vars %d \n",subframe,eNB_id,pdcch_vars); + // printf("In rx_pdcch, subframe %d, eNB_id %d, pdcch_vars %d, handling symbol 0 \n",subframe,eNB_id,pdcch_vars); // procress ofdm symbol 0 - if (is_secondary_ue == 1) { - pdcch_extract_rbs_single(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+1], //add 1 to eNB_id to compensate for the shifted B/F'd pilots from the SeNB - pdcch_vars[eNB_id]->rxdataF_ext, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - 0, - high_speed_flag, - frame_parms); -#ifdef MU_RECEIVER - pdcch_extract_rbs_single(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_i - 1],//subtract 1 to eNB_id_i to compensate for the non-shifted pilots from the PeNB - pdcch_vars[eNB_id_i]->rxdataF_ext,//shift by two to simulate transmission from a second antenna - pdcch_vars[eNB_id_i]->dl_ch_estimates_ext,//shift by two to simulate transmission from a second antenna - 0, - high_speed_flag, - frame_parms); -#endif //MU_RECEIVER - } else if (frame_parms->nb_antenna_ports_eNB>1) { - pdcch_extract_rbs_dual(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], - pdcch_vars[eNB_id]->rxdataF_ext, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - 0, - high_speed_flag, - frame_parms); - } else { - pdcch_extract_rbs_single(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], - pdcch_vars[eNB_id]->rxdataF_ext, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - 0, - high_speed_flag, - frame_parms); - } - + if (frame_parms->nb_antenna_ports_eNB>1) { + pdcch_extract_rbs_dual(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], + pdcch_vars[eNB_id]->rxdataF_ext, + pdcch_vars[eNB_id]->dl_ch_estimates_ext, + 0, + high_speed_flag, + frame_parms); + } else { + pdcch_extract_rbs_single(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], + pdcch_vars[eNB_id]->rxdataF_ext, + pdcch_vars[eNB_id]->dl_ch_estimates_ext, + 0, + high_speed_flag, + frame_parms); + } + // compute channel level based on ofdm symbol 0 pdcch_channel_level(pdcch_vars[eNB_id]->dl_ch_estimates_ext, @@ -1586,7 +1337,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, log2_maxh = (log2_approx(avgs)/2) + 5; //+frame_parms->nb_antennas_rx; #ifdef UE_DEBUG_TRACE - LOG_D(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs); + LOG_I(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs); #endif T(T_UE_PHY_PDCCH_ENERGY, T_INT(eNB_id), T_INT(frame%1024), T_INT(subframe), @@ -1604,55 +1355,16 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, #ifdef DEBUG_PHY - if (subframe==5) - write_output("rxF_comp_d.m","rxF_c_d",&pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - -#endif - -#ifdef MU_RECEIVER - - if (is_secondary_ue) { - //get MF output for interfering stream - pdcch_channel_compensation(pdcch_vars[eNB_id_i]->rxdataF_ext, - pdcch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdcch_vars[eNB_id_i]->rxdataF_comp, - (aatx>1) ? pdcch_vars[eNB_id_i]->rho : NULL, - frame_parms, - 0, - log2_maxh); // log2_maxh+I0_shift -#ifdef DEBUG_PHY - write_output("rxF_comp_i.m","rxF_c_i",&pdcch_vars[eNB_id_i]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + if (subframe==5) { + printf("Writing output s0\n"); + write_output("rxF_comp_d0.m","rxF_c_d",&pdcch_vars[eNB_id]->rxdataF_comp[0][0*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + } #endif - pdcch_dual_stream_correlation(frame_parms, - 0, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - pdcch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdcch_vars[eNB_id]->dl_ch_rho_ext, - log2_maxh); - } - -#endif //MU_RECEIVER - if (frame_parms->nb_antennas_rx > 1) { -#ifdef MU_RECEIVER - - if (is_secondary_ue) { - pdcch_detection_mrc_i(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - pdcch_vars[eNB_id_i]->rxdataF_comp, - pdcch_vars[eNB_id]->rho, - pdcch_vars[eNB_id]->dl_ch_rho_ext, - 0); -#ifdef DEBUG_PHY - write_output("rxF_comp_d.m","rxF_c_d",&pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - write_output("rxF_comp_i.m","rxF_c_i",&pdcch_vars[eNB_id_i]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); -#endif - } else -#endif //MU_RECEIVER - pdcch_detection_mrc(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - 0); + pdcch_detection_mrc(frame_parms, + pdcch_vars[eNB_id]->rxdataF_comp, + 0); } if (mimo_mode == SISO) @@ -1660,38 +1372,10 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, else pdcch_alamouti(frame_parms,pdcch_vars[eNB_id]->rxdataF_comp,0); - -#ifdef MU_RECEIVER - - if (is_secondary_ue) { - pdcch_qpsk_qpsk_llr(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - pdcch_vars[eNB_id_i]->rxdataF_comp, - pdcch_vars[eNB_id]->dl_ch_rho_ext, - pdcch_vars[eNB_id]->llr16, //subsequent function require 16 bit llr, but output must be 8 bit (actually clipped to 4, because of the Viterbi decoder) - pdcch_vars[eNB_id]->llr, - 0); - /* - #ifdef DEBUG_PHY - if (subframe==5) { - write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4); - write_output("llr16_seq.m","llr16",&pdcch_vars[eNB_id]->llr16[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4); - } - #endif*/ - } else { -#endif //MU_RECEIVER - pdcch_llr(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - (char *)pdcch_vars[eNB_id]->llr, - 0); - /*#ifdef DEBUG_PHY - write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4); - #endif*/ - -#ifdef MU_RECEIVER - } - -#endif //MU_RECEIVER + pdcch_llr(frame_parms, + pdcch_vars[eNB_id]->rxdataF_comp, + (char *)pdcch_vars[eNB_id]->llr, + 0); // decode pcfich here and find out pdcch ofdm symbol number @@ -1700,6 +1384,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, pdcch_vars[eNB_id], mimo_mode); + // printf("In rx_pdcch, subframe %d, num_pdcch_symbols %d \n",subframe,n_pdcch_symbols); if (n_pdcch_symbols>3) n_pdcch_symbols=1; @@ -1713,170 +1398,93 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, #ifdef DEBUG_DCI_DECODING - LOG_I(PHY,"demapping: subframe %d, mi %d, tdd_config %d\n",subframe,get_mi(frame_parms,subframe),frame_parms->tdd_config); + if (subframe==5) LOG_I(PHY,"demapping: subframe %d, num_pdcch_symbols %d\n",subframe,n_pdcch_symbols); #endif // process pdcch ofdm symbol 1 and 2 if necessary - for (int s=1; s<n_pdcch_symbols; s++){ - if (is_secondary_ue == 1) { - pdcch_extract_rbs_single(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+1], //add 1 to eNB_id to compensate for the shifted B/F'd pilots from the SeNB - pdcch_vars[eNB_id]->rxdataF_ext, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - s, - high_speed_flag, - frame_parms); -#ifdef MU_RECEIVER -pdcch_extract_rbs_single(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_i - 1],//subtract 1 to eNB_id_i to compensate for the non-shifted pilots from the PeNB - pdcch_vars[eNB_id_i]->rxdataF_ext,//shift by two to simulate transmission from a second antenna - pdcch_vars[eNB_id_i]->dl_ch_estimates_ext,//shift by two to simulate transmission from a second antenna - s, - high_speed_flag, - frame_parms); -#endif //MU_RECEIVER - } else if (frame_parms->nb_antenna_ports_eNB>1) { - pdcch_extract_rbs_dual(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], - pdcch_vars[eNB_id]->rxdataF_ext, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - s, - high_speed_flag, - frame_parms); + for (int s=1; s<n_pdcch_symbols; s++){ + // printf("In rx_pdcch, subframe %d, eNB_id %d, pdcch_vars %d, handling symbol %d \n",subframe,eNB_id,pdcch_vars,s); + if (frame_parms->nb_antenna_ports_eNB>1) { + pdcch_extract_rbs_dual(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], + pdcch_vars[eNB_id]->rxdataF_ext, + pdcch_vars[eNB_id]->dl_ch_estimates_ext, + s, + high_speed_flag, + frame_parms); } else { - pdcch_extract_rbs_single(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], - pdcch_vars[eNB_id]->rxdataF_ext, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - s, - high_speed_flag, - frame_parms); + pdcch_extract_rbs_single(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], + pdcch_vars[eNB_id]->rxdataF_ext, + pdcch_vars[eNB_id]->dl_ch_estimates_ext, + s, + high_speed_flag, + frame_parms); } - - + + pdcch_channel_compensation(pdcch_vars[eNB_id]->rxdataF_ext, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - pdcch_vars[eNB_id]->rxdataF_comp, - (aatx>1) ? pdcch_vars[eNB_id]->rho : NULL, - frame_parms, - s, - log2_maxh); // log2_maxh+I0_shift - - + pdcch_vars[eNB_id]->dl_ch_estimates_ext, + pdcch_vars[eNB_id]->rxdataF_comp, + (aatx>1) ? pdcch_vars[eNB_id]->rho : NULL, + frame_parms, + s, + log2_maxh); // log2_maxh+I0_shift + + #ifdef DEBUG_PHY - -if (subframe==5) - write_output("rxF_comp_d.m","rxF_c_d",&pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - -#endif - -#ifdef MU_RECEIVER - -if (is_secondary_ue) { - //get MF output for interfering stream - pdcch_channel_compensation(pdcch_vars[eNB_id_i]->rxdataF_ext, - pdcch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdcch_vars[eNB_id_i]->rxdataF_comp, - (aatx>1) ? pdcch_vars[eNB_id_i]->rho : NULL, - frame_parms, - s, - log2_maxh); // log2_maxh+I0_shift -#ifdef DEBUG_PHY -write_output("rxF_comp_i.m","rxF_c_i",&pdcch_vars[eNB_id_i]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); -#endif -pdcch_dual_stream_correlation(frame_parms, - s, - pdcch_vars[eNB_id]->dl_ch_estimates_ext, - pdcch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdcch_vars[eNB_id]->dl_ch_rho_ext, - log2_maxh); -} - -#endif //MU_RECEIVER - - -if (frame_parms->nb_antennas_rx > 1) { -#ifdef MU_RECEIVER - - if (is_secondary_ue) { - pdcch_detection_mrc_i(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - pdcch_vars[eNB_id_i]->rxdataF_comp, - pdcch_vars[eNB_id]->rho, - pdcch_vars[eNB_id]->dl_ch_rho_ext, - s); -#ifdef DEBUG_PHY -write_output("rxF_comp_d.m","rxF_c_d",&pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); -write_output("rxF_comp_i.m","rxF_c_i",&pdcch_vars[eNB_id_i]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + + if (subframe==5) { + write_output("rxF_comp_ds.m","rxF_c_ds",&pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + } #endif - } else -#endif //MU_RECEIVER + + + + if (frame_parms->nb_antennas_rx > 1) { pdcch_detection_mrc(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - s); - -} - -if (mimo_mode == SISO) - pdcch_siso(frame_parms,pdcch_vars[eNB_id]->rxdataF_comp,s); -else - pdcch_alamouti(frame_parms,pdcch_vars[eNB_id]->rxdataF_comp,s); - - -#ifdef MU_RECEIVER - -if (is_secondary_ue) { - pdcch_qpsk_qpsk_llr(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - pdcch_vars[eNB_id_i]->rxdataF_comp, - pdcch_vars[eNB_id]->dl_ch_rho_ext, - pdcch_vars[eNB_id]->llr16, //subsequent function require 16 bit llr, but output must be 8 bit (actually clipped to 4, because of the Viterbi decoder) - pdcch_vars[eNB_id]->llr, - s); - /* - #ifdef DEBUG_PHY - if (subframe==5) { - write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4); - write_output("llr16_seq.m","llr16",&pdcch_vars[eNB_id]->llr16[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4); - } - #endif*/ -} else { -#endif //MU_RECEIVER - pdcch_llr(frame_parms, - pdcch_vars[eNB_id]->rxdataF_comp, - (char *)pdcch_vars[eNB_id]->llr, - s); - /*#ifdef DEBUG_PHY + pdcch_vars[eNB_id]->rxdataF_comp, + s); + + } + + if (mimo_mode == SISO) + pdcch_siso(frame_parms,pdcch_vars[eNB_id]->rxdataF_comp,s); + else + pdcch_alamouti(frame_parms,pdcch_vars[eNB_id]->rxdataF_comp,s); + + + // printf("subframe %d computing llrs for symbol %d : %p\n",subframe,s,pdcch_vars[eNB_id]->llr); + pdcch_llr(frame_parms, + pdcch_vars[eNB_id]->rxdataF_comp, + (char *)pdcch_vars[eNB_id]->llr, + s); + /*#ifdef DEBUG_PHY write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4); #endif*/ - -#ifdef MU_RECEIVER -} - -#endif //MU_RECEIVER - - } - - pdcch_demapping(pdcch_vars[eNB_id]->llr, - pdcch_vars[eNB_id]->wbar, - frame_parms, - n_pdcch_symbols, - get_mi(frame_parms,subframe)); - - pdcch_deinterleaving(frame_parms, - (uint16_t*)pdcch_vars[eNB_id]->e_rx, - pdcch_vars[eNB_id]->wbar, - n_pdcch_symbols, - mi); - - pdcch_unscrambling(frame_parms, - subframe, - pdcch_vars[eNB_id]->e_rx, - get_nCCE(n_pdcch_symbols,frame_parms,mi)*72); - - pdcch_vars[eNB_id]->num_pdcch_symbols = n_pdcch_symbols; - - return(0); + } + + pdcch_demapping(pdcch_vars[eNB_id]->llr, + pdcch_vars[eNB_id]->wbar, + frame_parms, + n_pdcch_symbols, + get_mi(frame_parms,subframe)); + + pdcch_deinterleaving(frame_parms, + (uint16_t*)pdcch_vars[eNB_id]->e_rx, + pdcch_vars[eNB_id]->wbar, + n_pdcch_symbols, + mi); + + pdcch_unscrambling(frame_parms, + subframe, + pdcch_vars[eNB_id]->e_rx, + get_nCCE(n_pdcch_symbols,frame_parms,mi)*72); + + pdcch_vars[eNB_id]->num_pdcch_symbols = n_pdcch_symbols; + + // if ((frame&1) ==0 && subframe==5) exit(-1); + return(0); } @@ -1903,10 +1511,10 @@ void pdcch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, } - // printf("unscrambling %d : e %d, c %d => ",i,llr[i],((s>>(i&0x1f))&1)); + // if (subframe == 5) printf("unscrambling %d : e %d, c %d => ",i,llr[i],((s>>(i&0x1f))&1)); if (((s>>(i%32))&1)==0) llr[i] = -llr[i]; - // printf("%d\n",llr[i]); + // if (subframe == 5) printf("%d\n",llr[i]); } } @@ -2020,7 +1628,7 @@ void dci_decoding(uint8_t DCI_LENGTH, #ifdef DEBUG_DCI_DECODING - LOG_I(PHY," Doing DCI Rate Matching RCC %d, w %p\n",RCC,w); + LOG_I(PHY," Doing DCI Rate Matching RCC %d, w %p\n",RCC,w_rx); #endif lte_rate_matching_cc_rx(RCC,coded_bits,w_rx,dummy_w_rx,e); @@ -2030,10 +1638,10 @@ void dci_decoding(uint8_t DCI_LENGTH, &w_rx[0]); #ifdef DEBUG_DCI_DECODING - - for (i=0; i<16+DCI_LENGTH; i++) - LOG_I(PHY," DCI %d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); - + if (DCI_LENGTH==27 && ((1<<aggregation_level) == 4)) + for (int i=0; i<16+DCI_LENGTH; i++) + LOG_I(PHY," DCI %d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); + #endif memset(decoded_output,0,2+((16+DCI_LENGTH)>>3)); @@ -2052,60 +1660,7 @@ void dci_decoding(uint8_t DCI_LENGTH, static uint8_t dci_decoded_output[RX_NB_TH][(MAX_DCI_SIZE_BITS+64)/8]; -uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi) -{ - return(get_nquad(num_pdcch_symbols,frame_parms,mi)/9); -} - -uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi) -{ - - uint16_t Nreg=0; - uint8_t 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) { - Ngroup_PHICH<<=1; - } - - Ngroup_PHICH*=mi; - - if ((num_pdcch_symbols>0) && (num_pdcch_symbols<4)) - switch (frame_parms->N_RB_DL) { - case 6: - Nreg=12+(num_pdcch_symbols-1)*18; - break; - - case 25: - Nreg=50+(num_pdcch_symbols-1)*75; - break; - case 50: - Nreg=100+(num_pdcch_symbols-1)*150; - break; - - case 100: - Nreg=200+(num_pdcch_symbols-1)*300; - break; - - default: - return(0); - } - - // printf("Nreg %d (%d)\n",Nreg,Nreg - 4 - (3*Ngroup_PHICH)); - return(Nreg - 4 - (3*Ngroup_PHICH)); -} - -uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe) -{ - - // check for eNB only ! - return(get_nCCE(num_pdcch_symbols, - &RC.eNB[Mod_id][CC_id]->frame_parms, - get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe))); -} int get_nCCE_offset_l1(int *CCE_table, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c index 4020056e6f68043a591f4792c287202e49a76ab0..30f7733be24ad0459eacc25df2d2e0a385a6bb1e 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c @@ -31,11 +31,12 @@ */ //#include "defs.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/CODING/extern.h" -#include "SCHED/extern.h" -#include "SIMULATION/TOOLS/defs.h" +#include "PHY/defs_UE.h" +#include "PHY/CODING/coding_extern.h" +#include "SCHED/sched_common_extern.h" +#include "SIMULATION/TOOLS/sim.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" //#define DEBUG_DLSCH_DECODING //#define UE_DEBUG_TRACE 1 @@ -746,3 +747,183 @@ decoder_if_t tc; return(ret); } +int dlsch_encoding_SIC(PHY_VARS_UE *ue, + unsigned char *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) +{ + + unsigned int G; + unsigned int crc=1; + unsigned short iind; + + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + unsigned char harq_pid = ue->dlsch[subframe&2][0][0]->rnti; + unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; + unsigned int A; + unsigned char mod_order; + unsigned int Kr=0,Kr_bytes,r,r_offset=0; + // unsigned short m=dlsch->harq_processes[harq_pid]->mcs; + uint8_t beamforming_mode=0; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); + + A = dlsch->harq_processes[harq_pid]->TBS; //6228 + // printf("Encoder: A: %d\n",A); + mod_order = dlsch->harq_processes[harq_pid]->Qm; + + if(dlsch->harq_processes[harq_pid]->mimo_mode == TM7) + beamforming_mode = 7; + else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM8) + beamforming_mode = 8; + else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10) + beamforming_mode = 9; + G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode); + + + // if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet + if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet +#ifdef DEBUG_DLSCH_CODING + printf("SIC encoding thinks this is a new packet \n"); +#endif + /* + int i; + printf("dlsch (tx): \n"); + for (i=0;i<(A>>3);i++) + printf("%02x.",a[i]); + printf("\n"); + */ + // Add 24-bit crc (polynomial A) to payload + crc = crc24a(a, + A)>>8; + a[A>>3] = ((uint8_t*)&crc)[2]; + a[1+(A>>3)] = ((uint8_t*)&crc)[1]; + a[2+(A>>3)] = ((uint8_t*)&crc)[0]; + // printf("CRC %x (A %d)\n",crc,A); + + dlsch->harq_processes[harq_pid]->B = A+24; + // dlsch->harq_processes[harq_pid]->b = a; + memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); + + if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, + dlsch->harq_processes[harq_pid]->c, + dlsch->harq_processes[harq_pid]->B, + &dlsch->harq_processes[harq_pid]->C, + &dlsch->harq_processes[harq_pid]->Cplus, + &dlsch->harq_processes[harq_pid]->Cminus, + &dlsch->harq_processes[harq_pid]->Kplus, + &dlsch->harq_processes[harq_pid]->Kminus, + &dlsch->harq_processes[harq_pid]->F)<0) + return(-1); + + for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { + + if (r<dlsch->harq_processes[harq_pid]->Cminus) + Kr = dlsch->harq_processes[harq_pid]->Kminus; + else + Kr = dlsch->harq_processes[harq_pid]->Kplus; + + Kr_bytes = Kr>>3; + + // get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14) + if (Kr_bytes<=64) + iind = (Kr_bytes-5); + else if (Kr_bytes <=128) + iind = 59 + ((Kr_bytes-64)>>1); + else if (Kr_bytes <= 256) + iind = 91 + ((Kr_bytes-128)>>2); + else if (Kr_bytes <= 768) + iind = 123 + ((Kr_bytes-256)>>3); + else { + printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes); + return(-1); + } + + +#ifdef DEBUG_DLSCH_CODING + printf("Generating Code Segment %d (%d bits)\n",r,Kr); + // generate codewords + + printf("bits_per_codeword (Kr)= %d, A %d\n",Kr,A); + printf("N_RB = %d\n",nb_rb); + printf("Ncp %d\n",frame_parms->Ncp); + printf("mod_order %d\n",mod_order); +#endif + + +#ifdef DEBUG_DLSCH_CODING + printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]); +#endif + start_meas(te_stats); + encoder(dlsch->harq_processes[harq_pid]->c[r], + Kr>>3, + &dlsch->harq_processes[harq_pid]->d[r][96], + (r==0) ? dlsch->harq_processes[harq_pid]->F : 0, + f1f2mat_old[iind*2], // f1 (see 36121-820, page 14) + f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14) + ); + stop_meas(te_stats); +#ifdef DEBUG_DLSCH_CODING + + if (r==0) + write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4); + +#endif + start_meas(i_stats); + dlsch->harq_processes[harq_pid]->RTC[r] = + sub_block_interleaving_turbo(4+(Kr_bytes*8), + &dlsch->harq_processes[harq_pid]->d[r][96], + dlsch->harq_processes[harq_pid]->w[r]); + stop_meas(i_stats); + } + + } + + // Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the + // outputs for each code segment, see Section 5.1.5 p.20 + + for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { +#ifdef DEBUG_DLSCH_CODING + printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n", + r, + G, + Kr*3, + mod_order,nb_rb); +#endif + + start_meas(rm_stats); +#ifdef DEBUG_DLSCH_CODING + printf("rvidx in SIC encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx); +#endif + r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r], + G, //G + dlsch->harq_processes[harq_pid]->w[r], + dlsch->harq_processes[harq_pid]->e+r_offset, + dlsch->harq_processes[harq_pid]->C, // C + dlsch->Nsoft, // Nsoft, + dlsch->Mdlharq, + dlsch->Kmimo, + dlsch->harq_processes[harq_pid]->rvidx, + dlsch->harq_processes[harq_pid]->Qm, + dlsch->harq_processes[harq_pid]->Nl, + r, + nb_rb); + // m); // r + stop_meas(rm_stats); +#ifdef DEBUG_DLSCH_CODING + + if (r==dlsch->harq_processes[harq_pid]->C-1) + write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4); + +#endif + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT); + + return(0); +} diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 6284f279d895d04590cf44ca3d792c1fcda40f47..665d5cead04d59a18aaebce0701066b9f1861600 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -29,11 +29,11 @@ * \note * \warning */ -//#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "defs.h" -#include "extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" +#include "SCHED_UE/sched_UE.h" +#include "transport_ue.h" +#include "transport_proto_ue.h" #include "PHY/sse_intrin.h" #include "T.h" @@ -48,7 +48,7 @@ int16_t interf_unaw_shift = 13; //#define DEBUG_HARQ -#define DEBUG_PHY 1 +//#define DEBUG_PHY 1 //#define DEBUG_DLSCH_DEMOD 1 //#define DISABLE_LOG_X @@ -842,7 +842,7 @@ int rx_pdsch(PHY_VARS_UE *ue, pllr_symbol_cw1 = (int8_t*)pdsch_vars[eNB_id]->llr[1]; pllr_symbol_cw0 += llr_offset_symbol; pllr_symbol_cw1 += llr_offset_symbol; - + /* LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n", frame, subframe,symbol, nb_rb,dlsch0_harq->Qm, @@ -850,7 +850,7 @@ int rx_pdsch(PHY_VARS_UE *ue, pdsch_vars[eNB_id]->llr_offset[symbol], (int16_t*)pdsch_vars[eNB_id]->llr[0], pllr_symbol_cw0); - + */ switch (dlsch0_harq->Qm) { case 2 : if ((rx_type==rx_standard) || (codeword_TB1 == -1)) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c index 7682045ae1307ca6a10ee83ef071091f7e28528d..525c8db676b1e60f76e751fee197ff56352e18c1 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c @@ -30,11 +30,12 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/TOOLS/defs.h" -#include "PHY/extern.h" -#include "defs.h" -#include "extern.h" +#include "PHY/defs_UE.h" +#include "PHY/TOOLS/tools_defs.h" +#include "PHY/phy_extern_ue.h" +#include "transport_ue.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" +#include "transport_proto_ue.h" #include "PHY/sse_intrin.h" //#define DEBUG_LLR_SIC diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c index 588adfbc55c65f736444797013a08ab37ade4a65..81cd18c954f647ceb9bd58c50a828fdf94a35b14 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c @@ -30,11 +30,10 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/TOOLS/defs.h" -#include "PHY/extern.h" -#include "defs.h" -#include "extern.h" +#include "PHY/defs_UE.h" +#include "PHY/TOOLS/tools_defs.h" +#include "PHY/phy_extern_ue.h" +#include "transport_ue.h" #include "PHY/sse_intrin.h" int16_t ones256[16] __attribute__ ((aligned(32))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff}; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c index a0bde219b57706e59b5d5746f8408bc1307f46be..96ff82ba162d2cd6278c54a77a4129a65f7c186a 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/drs_modulation.c @@ -29,9 +29,11 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include "PHY/sse_intrin.h" +#include "transport_proto_ue.h" + //#define DEBUG_DRS int generate_drs_pusch(PHY_VARS_UE *ue, diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c similarity index 98% rename from openair1/PHY/LTE_TRANSPORT/initial_sync.c rename to openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c index ab987c4a4f6c8f7173091222ea95c17b038531af..69976a1b3ee9573ea945733e3e325630dc03718e 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c @@ -30,18 +30,20 @@ * \warning */ #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" -#include "defs.h" -#include "extern.h" - - +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" +#include "SCHED_UE/sched_UE.h" +#include "transport_proto_ue.h" +#include "PHY/MODULATION/modulation_UE.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" +#include "openair2/LAYER2/MAC/mac_proto.h" #include "common_lib.h" +#include "PHY/INIT/phy_init.h" + extern openair0_config_t openair0_cfg[]; -#define DEBUG_INITIAL_SYNCH +//#define DEBUG_INITIAL_SYNCH int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c index fe2c4e28c85d08152610a18e3b9a625d9fb3d9c9..a6acec9ca3762499a8c7fbed3032f253c3f1a7cf 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c @@ -29,13 +29,14 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/CODING/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" -#include "defs.h" -#include "extern.h" -#include "PHY/extern.h" +#include "transport_ue.h" +#include "PHY/phy_extern_ue.h" #include "PHY/sse_intrin.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_PBCH 1 //#define DEBUG_PBCH_ENCODING diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c index b7e24cb87dad212b71f461996a6a6a89f02468fa..82bb0a2659ed9ff4e4ea8a09fc4d068f2c516092 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c @@ -29,72 +29,15 @@ * \note * \warning */ -#include "PHY/defs.h" +#include "PHY/defs_UE.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_PCFICH -void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) -{ - - uint16_t kbar = 6 * (frame_parms->Nid_cell %(2*frame_parms->N_RB_DL)); - uint16_t first_reg; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - pcfich_reg[0] = kbar/6; - first_reg = pcfich_reg[0]; - - frame_parms->pcfich_first_reg_idx=0; +extern uint8_t pcfich_b[4][32]; - pcfich_reg[1] = ((kbar + (frame_parms->N_RB_DL>>1)*6)%(frame_parms->N_RB_DL*12))/6; - if (pcfich_reg[1] < pcfich_reg[0]) { - frame_parms->pcfich_first_reg_idx = 1; - first_reg = pcfich_reg[1]; - } - - pcfich_reg[2] = ((kbar + (frame_parms->N_RB_DL)*6)%(frame_parms->N_RB_DL*12))/6; - - if (pcfich_reg[2] < first_reg) { - frame_parms->pcfich_first_reg_idx = 2; - first_reg = pcfich_reg[2]; - } - pcfich_reg[3] = ((kbar + ((3*frame_parms->N_RB_DL)>>1)*6)%(frame_parms->N_RB_DL*12))/6; - - if (pcfich_reg[3] < first_reg) { - frame_parms->pcfich_first_reg_idx = 3; - first_reg = pcfich_reg[3]; - } - - - //#ifdef DEBUG_PCFICH - printf("pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]); - //#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 +65,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/pch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c index 600c5215bdd5c4bbde741ff86b4dad7196620633..aed3ddabc15b6279393c7405961edde780c51cd2 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pch_ue.c @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include "assertions.h" const unsigned int Ttab[4] = {32,64,128,256}; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c index 2bd7140c32ccc96524b58d9e489280bae5cf7754..669e0937c6c57bc559d4e2f87c546fd550419ac5 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -/*! \file PHY/LTE_TRANSPORT/phich.c -* \brief Top-level routines for generating and decoding the PHICH/HI physical/transport channel V8.6 2009-03 +/*! \file PHY/LTE_TRANSPORT/phich_ue.c +* \brief Top-level routines for decoding the PHICH/HI physical/transport channel V8.6 2009-03 * \author R. Knopp * \date 2011 * \version 0.1 @@ -30,13 +30,14 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "defs.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" +#include "SCHED_UE/sched_UE.h" +#include "transport_ue.h" +#include "transport_proto_ue.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" #include "T.h" @@ -50,1020 +51,10 @@ uint8_t rv_table[4] = {0, 2, 3, 1}; -uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) -{ - - // for FDD - if (frame_parms->frame_type == FDD) - return 1; - - // for TDD - switch (frame_parms->tdd_config) { - - case 0: - if ((subframe==0) || (subframe==5)) - return(2); - else return(1); - - break; - - case 1: - if ((subframe==0) || (subframe==5)) - return(0); - else return(1); - - break; - - case 2: - if ((subframe==3) || (subframe==8)) - return(1); - else return(0); - - break; - - case 3: - if ((subframe==0) || (subframe==8) || (subframe==9)) - return(1); - else return(0); - - break; - - case 4: - if ((subframe==8) || (subframe==9)) - return(1); - else return(0); - - break; - - case 5: - if (subframe==8) - return(1); - else return(0); - - break; - - case 6: - return(1); - break; - - default: - return(0); - } -} - -unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) -{ - - if (frame_parms->frame_type == FDD) - return(subframe&7); - - switch (frame_parms->tdd_config) { - case 3: - if ( (subframe == 8) || (subframe == 9) ) { - return(subframe-8); - } else if (subframe==0) - return(2); - else { - LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - return(0); - } - - break; - case 4: - if ( (subframe == 8) || (subframe == 9) ) { - return(subframe-8); - } else { - LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - return(0); - } - break; - - } - - return(0); -} - -int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int subframe) -{ - int pusch_frame; - - if (frame_parms->frame_type == FDD) { - pusch_frame = subframe<4 ? frame + 1024 - 1 : frame; - } else { - // Note this is not true, but it doesn't matter, the frame number is irrelevant for TDD! - pusch_frame = (frame); - } - - //LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, subframe, pusch_frame); - return pusch_frame % 1024; -} - -uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) -{ - uint8_t pusch_subframe = 255; - - if (frame_parms->frame_type == FDD) - return subframe < 4 ? subframe + 6 : subframe - 4; - - switch (frame_parms->tdd_config) { - case 0: - if (subframe == 0) - pusch_subframe = (3); - else if (subframe == 5) { - pusch_subframe = (8); - } else if (subframe == 6) - pusch_subframe = (2); - else if (subframe == 1) - pusch_subframe = (7); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 1: - if (subframe == 6) - pusch_subframe = (2); - else if (subframe == 9) - pusch_subframe = (3); - else if (subframe == 1) - pusch_subframe = (7); - else if (subframe == 4) - pusch_subframe = (8); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 2: - if (subframe == 8) - pusch_subframe = (2); - else if (subframe == 3) - pusch_subframe = (7); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 3: - if ( (subframe == 8) || (subframe == 9) ) { - pusch_subframe = (subframe-6); - } else if (subframe==0) - pusch_subframe = (4); - else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 4: - if ( (subframe == 8) || (subframe == 9) ) { - pusch_subframe = (subframe-6); - } else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 5: - if (subframe == 8) { - pusch_subframe = (2); - } else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - case 6: - if (subframe == 6) { - pusch_subframe = (2); - } else if (subframe == 9) { - pusch_subframe = (3); - } else if (subframe == 0) { - pusch_subframe = (4); - } else if (subframe == 1) { - pusch_subframe = (7); - } else if (subframe == 5) { - pusch_subframe = (8); - } else { - AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); - pusch_subframe = (0); - } - - break; - - default: - AssertFatal(1==0, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config); - pusch_subframe = (0); - } - - LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", subframe, pusch_subframe); - return pusch_subframe; -} - -int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg) -{ - - if ((reg == frame_parms->pcfich_reg[0]) || - (reg == frame_parms->pcfich_reg[1]) || - (reg == frame_parms->pcfich_reg[2]) || - (reg == frame_parms->pcfich_reg[3])) - return(1); - - return(0); -} - -void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) -{ - - unsigned short n0 = (frame_parms->N_RB_DL * 2) - 4; // 2 REG per RB less the 4 used by PCFICH in first symbol - unsigned short n1 = (frame_parms->N_RB_DL * 3); // 3 REG per RB in second and third symbol - unsigned short n2 = n1; - unsigned short mprime = 0; - unsigned short Ngroup_PHICH; - // uint16_t *phich_reg = frame_parms->phich_reg; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - // 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++; - - // check if Extended prefix - if (frame_parms->Ncp == 1) { - Ngroup_PHICH<<=1; - } - -#ifdef DEBUG_PHICH - LOG_D(PHY,"Ngroup_PHICH %d (phich_config_common.phich_resource %d,phich_config_common.phich_duration %s, NidCell %d,Ncp %d, frame_type %d), smallest pcfich REG %d, n0 %d, n1 %d (first PHICH REG %d)\n", - ((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)), - frame_parms->phich_config_common.phich_resource, - frame_parms->phich_config_common.phich_duration==normal?"normal":"extended", - frame_parms->Nid_cell,frame_parms->Ncp,frame_parms->frame_type, - pcfich_reg[frame_parms->pcfich_first_reg_idx], - n0, - n1, - ((frame_parms->Nid_cell))%n0); -#endif - - // This is the algorithm from Section 6.9.3 in 36-211, it works only for normal PHICH duration for now ... - - for (mprime=0; - mprime<((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)); - mprime++) { - - if (frame_parms->phich_config_common.phich_duration==normal) { // normal PHICH duration - - frame_parms->phich_reg[mprime][0] = (frame_parms->Nid_cell + mprime)%n0; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[frame_parms->pcfich_first_reg_idx]) - frame_parms->phich_reg[mprime][0]++; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3]) - frame_parms->phich_reg[mprime][0]++; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+2)&3]) - frame_parms->phich_reg[mprime][0]++; - - if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3]) - frame_parms->phich_reg[mprime][0]++; - - frame_parms->phich_reg[mprime][1] = (frame_parms->Nid_cell + mprime + (n0/3))%n0; - - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[frame_parms->pcfich_first_reg_idx]) - frame_parms->phich_reg[mprime][1]++; - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3]) - frame_parms->phich_reg[mprime][1]++; - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+2)&3]) - frame_parms->phich_reg[mprime][1]++; - - if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3]) - frame_parms->phich_reg[mprime][1]++; - - - frame_parms->phich_reg[mprime][2] = (frame_parms->Nid_cell + mprime + (2*n0/3))%n0; - - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[frame_parms->pcfich_first_reg_idx]) - frame_parms->phich_reg[mprime][2]++; - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3]) - frame_parms->phich_reg[mprime][2]++; - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+2)&3]) - frame_parms->phich_reg[mprime][2]++; - - if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3]) - frame_parms->phich_reg[mprime][2]++; - -#ifdef DEBUG_PHICH - printf("phich_reg :%d => %d,%d,%d\n",mprime,frame_parms->phich_reg[mprime][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]); -#endif - } else { // extended PHICH duration - frame_parms->phich_reg[mprime<<1][0] = (frame_parms->Nid_cell + mprime)%n0; - frame_parms->phich_reg[1+(mprime<<1)][0] = (frame_parms->Nid_cell + mprime)%n0; - - frame_parms->phich_reg[mprime<<1][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1; - frame_parms->phich_reg[mprime<<1][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2; - - frame_parms->phich_reg[1+(mprime<<1)][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1; - frame_parms->phich_reg[1+(mprime<<1)][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2; - //#ifdef DEBUG_PHICH - printf("phich_reg :%d => %d,%d,%d\n",mprime<<1,frame_parms->phich_reg[mprime<<1][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]); - printf("phich_reg :%d => %d,%d,%d\n",1+(mprime<<1),frame_parms->phich_reg[1+(mprime<<1)][0],frame_parms->phich_reg[1+(mprime<<1)][1],frame_parms->phich_reg[1+(mprime<<1)][2]); - //#endif - } - } // mprime loop -} // 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 @@ -1496,75 +487,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 e756df1fe1a5b4fd4612d0f019bca3bd57c7a64f..d944491b6399ead88d0c3d163f22c2e300787376 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c @@ -19,9 +19,10 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include "PHY/sse_intrin.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" // Mask for identifying subframe for MBMS #define MBSFN_TDD_SF3 0x80// for TDD @@ -30,8 +31,6 @@ #define MBSFN_TDD_SF8 0x10 #define MBSFN_TDD_SF9 0x08 -#include "PHY/defs.h" - #define MBSFN_FDD_SF1 0x80// for FDD #define MBSFN_FDD_SF2 0x40 #define MBSFN_FDD_SF3 0x20 @@ -88,151 +87,6 @@ void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,in ue->frame_parms.samples_per_tti,1,1);*/ } -int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms) -{ - - uint32_t period; - uint8_t i; - - // LOG_D(PHY,"is_pmch_subframe: frame %d, subframe %d, num_MBSFN_config %d\n", - // frame,subframe,frame_parms->num_MBSFN_config); - - for (i=0; i<frame_parms->num_MBSFN_config; i++) { // we have at least one MBSFN configuration - period = 1<<frame_parms->MBSFN_config[i].radioframeAllocationPeriod; - - if ((frame % period) == frame_parms->MBSFN_config[i].radioframeAllocationOffset) { - if (frame_parms->MBSFN_config[i].fourFrames_flag == 0) { - if (frame_parms->frame_type == FDD) { - switch (subframe) { - - case 1: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF1) > 0) - return(1); - - break; - - case 2: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF2) > 0) - return(1); - - break; - - case 3: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF3) > 0) - return(1); - - break; - - case 6: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF6) > 0) - return(1); - - break; - - case 7: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF7) > 0) - return(1); - - break; - - case 8: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF8) > 0) - return(1); - - break; - } - } else { - switch (subframe) { - case 3: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF3) > 0) - return(1); - - break; - - case 4: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF4) > 0) - return(1); - - break; - - case 7: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF7) > 0) - return(1); - - break; - - case 8: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF8) > 0) - return(1); - - break; - - case 9: - if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF9) > 0) - return(1); - - break; - } - } - - } else { // handle 4 frames case - - } - } - } - - 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 +134,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, 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 0000000000000000000000000000000000000000..c9763465cdfbc55c8091289fc2773e2aa8e7a6a1 --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -0,0 +1,534 @@ +/* + * 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_UE.h" +#include "PHY/phy_extern_ue.h" +//#include "prach.h" +#include "PHY/LTE_TRANSPORT/if4_tools.h" + +#include "SCHED_UE/sched_UE.h" +#include "SCHED/sched_common_extern.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +#include "../LTE_TRANSPORT/prach_extern.h" + +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_D(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 0000000000000000000000000000000000000000..c3bbd0fb1caafe229a22a5660e7991385f663515 --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c @@ -0,0 +1,843 @@ +/* + * 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_UE.h" +#include "PHY/phy_extern_ue.h" +#include "PHY/LTE_REFSIG/lte_refsig.h" + +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +#include "T.h" + +#include "../LTE_TRANSPORT/pucch_extern.h" + + + +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 + } + } + +} + + + + +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_UE_TRANSPORT/rar_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c new file mode 100644 index 0000000000000000000000000000000000000000..03df4e7f690e86b00cd8d39e3d58a9ddf1db267c --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c @@ -0,0 +1,207 @@ +/* + * 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_UE_TRANSPORT/rar_tools_ue.c +* \brief Routine for filling the PUSCH/ULSCH data structures based on a random-access response (RAR) SDU from MAC. Note this is for UE +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" +#include "SCHED_UE/sched_UE.h" +#include "LAYER2/MAC/mac.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "transport_proto_ue.h" + +#include "assertions.h" + +extern uint16_t RIV2nb_rb_LUT6[32]; +extern uint16_t RIV2first_rb_LUT6[32]; +extern uint16_t RIV2nb_rb_LUT25[512]; +extern uint16_t RIV2first_rb_LUT25[512]; +extern uint16_t RIV2nb_rb_LUT50[1600]; +extern uint16_t RIV2first_rb_LUT50[1600]; +extern uint16_t RIV2nb_rb_LUT100[6000]; +extern uint16_t RIV2first_rb_LUT100[600]; + +extern uint16_t RIV_max6,RIV_max25,RIV_max50,RIV_max100; + +int8_t delta_PUSCH_msg2[8] = {-6,-4,-2,0,2,4,6,8}; + +int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *ue, + UE_rxtx_proc_t *proc, + unsigned char eNB_id ) +{ + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_IN); + + // RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)rar_pdu; + uint8_t transmission_mode = ue->transmission_mode[eNB_id]; + unsigned char *rar_pdu = ue->dlsch_ra[eNB_id]->harq_processes[0]->b; + unsigned char subframe = ue->ulsch_Msg3_subframe[eNB_id]; + LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id]; + PHY_MEASUREMENTS *meas = &ue->measurements; + + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + // int current_dlsch_cqi = ue->current_dlsch_cqi[eNB_id]; + + uint8_t *rar = (uint8_t *)(rar_pdu+1); + uint8_t harq_pid = subframe2harq_pid(frame_parms,proc->frame_tx,subframe); + uint16_t rballoc; + uint8_t cqireq; + uint16_t *RIV2nb_rb_LUT, *RIV2first_rb_LUT; + uint16_t RIV_max = 0; + + LOG_D(PHY,"[eNB][RAPROC] Frame %d: generate_ue_ulsch_params_from_rar: subframe %d (harq_pid %d)\n",proc->frame_tx,subframe,harq_pid); + + switch (frame_parms->N_RB_DL) { + case 6: + RIV2nb_rb_LUT = &RIV2nb_rb_LUT6[0]; + RIV2first_rb_LUT = &RIV2first_rb_LUT6[0]; + RIV_max = RIV_max6; + break; + + case 25: + RIV2nb_rb_LUT = &RIV2nb_rb_LUT25[0]; + RIV2first_rb_LUT = &RIV2first_rb_LUT25[0]; + RIV_max = RIV_max25; + break; + + case 50: + RIV2nb_rb_LUT = &RIV2nb_rb_LUT50[0]; + RIV2first_rb_LUT = &RIV2first_rb_LUT50[0]; + RIV_max = RIV_max50; + break; + + case 100: + RIV2nb_rb_LUT = &RIV2nb_rb_LUT100[0]; + RIV2first_rb_LUT = &RIV2first_rb_LUT100[0]; + RIV_max = RIV_max100; + break; + + default: + DevParam(frame_parms->N_RB_DL, eNB_id, harq_pid); + break; + } + + + + ulsch->harq_processes[harq_pid]->TPC = (rar[3]>>2)&7;//rar->TPC; + + rballoc = (((uint16_t)(rar[1]&7))<<7)|(rar[2]>>1); + cqireq=rar[3]&1; + + if (rballoc>RIV_max) { + LOG_D(PHY,"rar_tools.c: ERROR: rb_alloc (%x) > RIV_max\n",rballoc); + return(-1); + } + + ulsch->harq_processes[harq_pid]->first_rb = RIV2first_rb_LUT[rballoc]; + ulsch->harq_processes[harq_pid]->nb_rb = RIV2nb_rb_LUT[rballoc]; + + AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb >0, "nb_rb == 0\n"); + + ulsch->power_offset = ue_power_offsets[ulsch->harq_processes[harq_pid]->nb_rb]; + + AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb <= 6,"unlikely rb count for RAR grant : nb_rb > 6\n"); + + // ulsch->harq_processes[harq_pid]->Ndi = 1; + if (ulsch->harq_processes[harq_pid]->round == 0) + ulsch->harq_processes[harq_pid]->status = ACTIVE; + + if (cqireq==1) { + ulsch->O_RI = 1; + + if (meas->rank[eNB_id] == 1) { + ulsch->uci_format = wideband_cqi_rank2_2A; + ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz; + ulsch->o_RI[0] = 1; + } else { + ulsch->uci_format = wideband_cqi_rank1_2A; + ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz; + ulsch->o_RI[0] = 0; + } + + ulsch->uci_format = HLC_subband_cqi_nopmi; + fill_CQI(ulsch,meas,eNB_id,0,ue->frame_parms.N_RB_DL,0, transmission_mode,ue->sinr_eff); + + if (((proc->frame_tx % 100) == 0) || (proc->frame_tx < 10)) + print_CQI(ulsch->o,ulsch->uci_format,eNB_id,ue->frame_parms.N_RB_DL); + } else { + ulsch->O_RI = 0; + ulsch->O = 0; + } + + ulsch->harq_processes[harq_pid]->O_ACK = 0;//2; + + ulsch->beta_offset_cqi_times8 = 18; + ulsch->beta_offset_ri_times8 = 10; + ulsch->beta_offset_harqack_times8 = 16; + + ulsch->Nsymb_pusch = 12-(frame_parms->Ncp<<1); + ulsch->rnti = (((uint16_t)rar[4])<<8)+rar[5]; //rar->t_crnti; + + if (ulsch->harq_processes[harq_pid]->round == 0) { + ulsch->harq_processes[harq_pid]->status = ACTIVE; + ulsch->harq_processes[harq_pid]->rvidx = 0; + ulsch->harq_processes[harq_pid]->mcs = ((rar[2]&1)<<3)|(rar[3]>>5); + ulsch->harq_processes[harq_pid]->TPC = (rar[3]>>2)&7; + //ulsch->harq_processes[harq_pid]->TBS = dlsch_tbs25[ulsch->harq_processes[harq_pid]->mcs][ulsch->harq_processes[harq_pid]->nb_rb-1]; + ulsch->harq_processes[harq_pid]->TBS = TBStable[get_I_TBS_UL(ulsch->harq_processes[harq_pid]->mcs)][ulsch->harq_processes[harq_pid]->nb_rb-1]; + ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch->harq_processes[harq_pid]->nb_rb; + ulsch->harq_processes[harq_pid]->Nsymb_initial = 9; + ulsch->harq_processes[harq_pid]->round = 0; + } else { + ulsch->harq_processes[harq_pid]->rvidx = 0; + ulsch->harq_processes[harq_pid]->round++; + } + + // initialize power control based on PRACH power + ulsch->f_pusch = delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC] + + get_deltaP_rampup(ue->Mod_id,ue->CC_id); + LOG_D(PHY,"[UE %d][PUSCH PC] Initializing f_pusch to %d dB, TPC %d (delta_PUSCH_msg2 %d dB), deltaP_rampup %d dB\n", + ue->Mod_id,ulsch->f_pusch,ulsch->harq_processes[harq_pid]->TPC,delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC], + get_deltaP_rampup(ue->Mod_id,ue->CC_id)); + + + //#ifdef DEBUG_RAR + LOG_D(PHY,"ulsch ra (UE): harq_pid %d\n",harq_pid); + LOG_D(PHY,"ulsch ra (UE): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); + LOG_D(PHY,"ulsch ra (UE): first_rb %x\n",ulsch->harq_processes[harq_pid]->first_rb); + LOG_D(PHY,"ulsch ra (UE): nb_rb %d\n",ulsch->harq_processes[harq_pid]->nb_rb); + LOG_D(PHY,"ulsch ra (UE): round %d\n",ulsch->harq_processes[harq_pid]->round); + LOG_D(PHY,"ulsch ra (UE): TBS %d\n",ulsch->harq_processes[harq_pid]->TBS); + LOG_D(PHY,"ulsch ra (UE): mcs %d\n",ulsch->harq_processes[harq_pid]->mcs); + LOG_D(PHY,"ulsch ra (UE): TPC %d\n",ulsch->harq_processes[harq_pid]->TPC); + LOG_D(PHY,"ulsch ra (UE): O %d\n",ulsch->O); + LOG_D(PHY,"ulsch ra (UE): ORI %d\n",ulsch->O_RI); + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_OUT); + + //#endif + return(0); +} + diff --git a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c similarity index 99% rename from openair1/PHY/LTE_TRANSPORT/srs_modulation.c rename to openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c index c4c02e631279a3833da27c1b2aedceb431e55b7d..45508fcff27eb5ee25e6694b8903f114e2edcb19 100644 --- a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c @@ -29,8 +29,8 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include "UTIL/LOG/log.h" unsigned short msrsb_6_40[8][4] = {{36,12,4,4}, 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 0000000000000000000000000000000000000000..aee5d6bcf91a37fc50710f63c8cfb4d6048a8153 --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c @@ -0,0 +1,421 @@ +/* + * 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_UE.h" +#include "transport_ue.h" +#include "PHY/phy_extern_ue.h" +#include "PHY/MODULATION/modulation_UE.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_TRANSPORT/proto.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h similarity index 74% rename from openair1/PHY/LTE_TRANSPORT/proto.h rename to openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index 0e1a60c0b9ac1bc5105c73ebfe5b253769eb9d94..dfba1f1c58819c6e5b9a8c1824fb032ae3bc8942 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file PHY/LTE_TRANSPORT/proto.h +/*! \file PHY/LTE_UE_TRANSPORT/transport_proto_ue.h * \brief Function prototypes for PHY physical/transport channel processing and generation V8.6 2009-03 * \author R. Knopp, F. Kaltenberger * \date 2011 @@ -29,9 +29,10 @@ * \note * \warning */ -#ifndef __LTE_TRANSPORT_PROTO__H__ -#define __LTE_TRANSPORT_PROTO__H__ -#include "PHY/defs.h" +#ifndef __LTE_TRANSPORT_PROTO_UE__H__ +#define __LTE_TRANSPORT_PROTO_UE__H__ +#include "PHY/defs_UE.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" #include <math.h> #include "nfapi_interface.h" @@ -41,26 +42,6 @@ * @{ */ -/** \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 @@ -68,7 +49,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint 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 + \brief This function allocates structures for a particular DLSCH at UE @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) @@ -79,278 +60,13 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch); 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 -*/ +void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id); -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, @@ -366,66 +82,6 @@ int rx_pmch(PHY_VARS_UE *phy_vars_ue, 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 @@ -1332,6 +988,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, 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, @@ -1371,8 +1028,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue, uint8_t subframe, uint8_t eNB_id, MIMO_mode_t mimo_mode, - uint32_t high_speed_flag, - uint8_t is_secondary_ue); + uint32_t high_speed_flag); /*! \brief Extract PSS and SSS resource elements @param phy_vars_ue Pointer to UE variables @@ -1428,13 +1084,6 @@ 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. @@ -1447,47 +1096,10 @@ void pbch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, 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); +void generate_qpsk_table(void); uint16_t extract_crc(uint8_t *dci,uint8_t DCI_LENGTH); @@ -1640,8 +1252,6 @@ int generate_srs(LTE_DL_FRAME_PARMS *frame_parms, 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. @@ -1694,16 +1304,9 @@ void ulsch_modulation(int32_t **txdataF, 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, @@ -1721,38 +1324,6 @@ int generate_ue_dlsch_params_from_dci(int frame, 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, @@ -1776,44 +1347,20 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, 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, @@ -1836,14 +1383,6 @@ void generate_RIV_tables(void); */ 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. @@ -1864,73 +1403,8 @@ uint32_t ulsch_encoding(uint8_t *a, 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 @@ -1962,8 +1436,6 @@ int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int sub 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); @@ -1980,21 +1452,12 @@ 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 @@ -2029,19 +1492,7 @@ void pdcch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, 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, @@ -2089,33 +1540,6 @@ void generate_pucch3x(int32_t **txdataF, 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); @@ -2140,29 +1564,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t sub */ 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 @@ -2229,16 +1631,6 @@ uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB, // 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, @@ -2262,14 +1654,9 @@ uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, 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_UE_TRANSPORT/transport_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h new file mode 100644 index 0000000000000000000000000000000000000000..e97353a902868b1417240dfc2bc97e168db4e883 --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h @@ -0,0 +1,336 @@ +/* + * 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_UE.h" +#include "PHY/impl_defs_lte.h" +#include "../LTE_TRANSPORT/dci.h" +#include "../LTE_TRANSPORT/mdci.h" +#include "../LTE_TRANSPORT/uci_common.h" +#include "../LTE_TRANSPORT/transport_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 0000000000000000000000000000000000000000..e687ccfd049f2704fd072e5ff0c196be3855f161 --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c @@ -0,0 +1,244 @@ +/* + * 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_UE.h" +#include "PHY/phy_extern_ue.h" +#ifdef DEBUG_UCI_TOOLS +#include "PHY/phy_vars.h" +#endif + +//#define DEBUG_UCI 1 + + +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/LTE_UE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c index 09420f48ab1a7029fdbbb2015fd7f28f47ffcd8c..d913a6f77902bb33f657be1a5ea45cf64ba3b801 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c @@ -30,16 +30,13 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" - -#include "PHY/CODING/defs.h" -#include "PHY/CODING/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" -#include "PHY/LTE_TRANSPORT/defs.h" -#include "defs.h" -#include "extern.h" -#include "SIMULATION/ETH_TRANSPORT/extern.h" +#include "PHY/LTE_UE_TRANSPORT/transport_ue.h" #include "UTIL/LOG/vcd_signal_dumper.h" //#define DEBUG_ULSCH_CODING @@ -107,7 +104,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) case 50: bw_scaling =2; break; - + default: bw_scaling =1; break; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c index d1718f6e90f600927f5d93f3a18e93213bea86f8..92a8d16b44ad59045d890b4ad0e39634f3cfeb8f 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c @@ -29,14 +29,15 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/CODING/defs.h" -#include "PHY/CODING/extern.h" -#include "PHY/LTE_TRANSPORT/defs.h" -#include "defs.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/CODING/coding_extern.h" +#include "PHY/LTE_UE_TRANSPORT/transport_ue.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" #include "UTIL/LOG/vcd_signal_dumper.h" - +#include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_ULSCH_MODULATION @@ -381,7 +382,7 @@ void ulsch_modulation(int32_t **txdataF, DevAssert(frame_parms); - int re_offset,re_offset0,i,Msymb,j,k,nsymb,Msc_PUSCH,l; + int re_offset,re_offset0,i,ulsch_Msymb,j,k,nsymb,Msc_PUSCH,l; // uint8_t harq_pid = (rag_flag == 1) ? 0 : subframe2harq_pid_tdd(frame_parms->tdd_config,subframe); uint8_t harq_pid = subframe2harq_pid(frame_parms,frame,subframe); uint8_t Q_m; @@ -470,12 +471,12 @@ void ulsch_modulation(int32_t **txdataF, // Modulation - Msymb = G/Q_m; + ulsch_Msymb = G/Q_m; if(ulsch->cooperation_flag == 2) // For Distributed Alamouti Scheme in Collabrative Communication { - for (i=0,j=Q_m; i<Msymb; i+=2,j+=2*Q_m) { + for (i=0,j=Q_m; i<ulsch_Msymb; i+=2,j+=2*Q_m) { switch (Q_m) { @@ -609,7 +610,7 @@ void ulsch_modulation(int32_t **txdataF, }//for }//cooperation_flag == 2 else { - for (i=0,j=0; i<Msymb; i++,j+=Q_m) { + for (i=0,j=0; i<ulsch_Msymb; i++,j+=Q_m) { switch (Q_m) { @@ -685,7 +686,7 @@ void ulsch_modulation(int32_t **txdataF, #ifdef OFDMA_ULSCH - for (i=0; i<Msymb; i++) { + for (i=0; i<ulsch_Msymb; i++) { ulsch->z[i] = ulsch->d[i]; } diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 84863c81e89ce8c6742e8ca10896cd81ed3fa92c..e2ab0cd33b827307b8a004956177f5c2545dd19f 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -29,13 +29,14 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "PHY/CODING/defs.h" -#include "PHY/CODING/extern.h" +#include "PHY/defs_common.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" -#include "PHY/LTE_TRANSPORT/defs.h" -#include "defs.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" +#include "modulation_eNB.h" #include "UTIL/LOG/vcd_signal_dumper.h" int beam_precoding(int32_t **txdataF, diff --git a/openair1/PHY/MODULATION/compute_bf_weights.c b/openair1/PHY/MODULATION/compute_bf_weights.c index 4ef8e88ca6652433efbad3ce761463bd41836325..89d76058e6d2b1859124a14408704403fc9f778b 100644 --- a/openair1/PHY/MODULATION/compute_bf_weights.c +++ b/openair1/PHY/MODULATION/compute_bf_weights.c @@ -2,6 +2,7 @@ #include <stdint.h> #include <stdlib.h> #include "PHY/impl_defs_lte.h" +#include "PHY/defs_common.h" int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs){ diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h deleted file mode 100644 index f9bbdcd27156e82cd7e41d010f406a58a905d6ca..0000000000000000000000000000000000000000 --- a/openair1/PHY/MODULATION/defs.h +++ /dev/null @@ -1,134 +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 - */ - -#ifndef __MODULATION_DEFS__H__ -#define __MODULATION_DEFS__H__ -#include "PHY/defs.h" -/** @addtogroup _PHY_MODULATION_ - * @{ -*/ - -/** -\fn void PHY_ofdm_mod(int *input,int *output,int fftsize,unsigned char nb_symbols,unsigned short nb_prefix_samples,Extension_t etype) -This function performs OFDM modulation with cyclic extension or zero-padding. - -@param input The sequence input samples in the frequency-domain. This is a concatenation of the input symbols in SIMD redundant format -@param output The time-domain output signal -@param fftsize size of OFDM symbol size (\f$N_d\f$) -@param nb_symbols The number of OFDM symbols in the block -@param nb_prefix_samples The number of prefix/suffix/zero samples -@param etype Type of extension (CYCLIC_PREFIX,CYCLIC_SUFFIX,ZEROS) - -*/ -void PHY_ofdm_mod(int *input, - int *output, - int fftsize, - unsigned char nb_symbols, - unsigned short nb_prefix_samples, - Extension_t etype - ); - -#ifdef OPENAIR_LTE - -/*! -\brief This function implements the OFDM front end processor on reception (FEP) -\param phy_vars_ue Pointer to PHY variables -\param l symbol within slot (0..6/7) -\param Ns Slot number (0..19) -\param sample_offset offset within rxdata (points to beginning of subframe) -\param no_prefix if 1 prefix is removed by HW -\param reset_freq_est if non-zero it resets the frequency offset estimation loop -*/ - -int slot_fep(PHY_VARS_UE *phy_vars_ue, - unsigned char l, - unsigned char Ns, - int sample_offset, - int no_prefix, - int reset_freq_est); - -int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue, - unsigned char l, - int subframe, - int sample_offset, - int no_prefix); - -int slot_fep_ul(RU_t *ru, - unsigned char l, - unsigned char Ns, - int no_prefix); - -int front_end_fft(PHY_VARS_UE *ue, - unsigned char l, - unsigned char Ns, - int sample_offset, - int no_prefix); - -int front_end_chanEst(PHY_VARS_UE *ue, - unsigned char l, - unsigned char Ns, - int reset_freq_est); - -void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms); - -void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); - -void do_OFDM_mod_symbol(LTE_eNB_COMMON *eNB_common_vars, RU_COMMON *common, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms,int do_precoding); - -void remove_7_5_kHz(RU_t *ru,uint8_t subframe); - -void apply_7_5_kHz(PHY_VARS_UE *phy_vars_ue,int32_t*txdata,uint8_t subframe); - -void init_prach625(LTE_DL_FRAME_PARMS *frame_parms); - -void remove_625_Hz(PHY_VARS_eNB *phy_vars_eNB,int16_t *prach); - -void apply_625_Hz(PHY_VARS_UE *phy_vars_ue,int16_t *prach); - -/** \brief This function performs beamforming precoding for common - * data - @param txdataF Table of pointers for frequency-domain TX signals - @param txdataF_BF Table of pointers for frequency-domain TX signals - @param frame_parms Frame descriptor structure -after beamforming - @param beam_weights Beamforming weights applied on each -antenna element and each carrier - @param slot Slot number - @param symbol Symbol index on which to act - @param aa physical antenna index*/ -int beam_precoding(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t ***beam_weights, - int slot, - int symbol, - int aa); - -int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs); - -int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_estimates, int32_t **tdd_calib_coeffs, int nb_ant, int nb_freq); - -int compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates, PRECODE_TYPE_t precode_type, int nb_ant, int nb_freq); - - -#endif -/** @}*/ -#endif diff --git a/openair1/PHY/MODULATION/modulation_UE.h b/openair1/PHY/MODULATION/modulation_UE.h new file mode 100644 index 0000000000000000000000000000000000000000..7e2a3c8a27778f75b59866ea60392916baf9c684 --- /dev/null +++ b/openair1/PHY/MODULATION/modulation_UE.h @@ -0,0 +1,74 @@ +/* + * 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 + */ + +#ifndef __MODULATION_DEFS__H__ +#define __MODULATION_DEFS__H__ +#include "PHY/defs_common.h" +#include "modulation_common.h" +/** @addtogroup _PHY_MODULATION_ + * @{ +*/ + + + +/*! +\brief This function implements the OFDM front end processor on reception (FEP) +\param phy_vars_ue Pointer to PHY variables +\param l symbol within slot (0..6/7) +\param Ns Slot number (0..19) +\param sample_offset offset within rxdata (points to beginning of subframe) +\param no_prefix if 1 prefix is removed by HW +\param reset_freq_est if non-zero it resets the frequency offset estimation loop +*/ + +int slot_fep(PHY_VARS_UE *phy_vars_ue, + unsigned char l, + unsigned char Ns, + int sample_offset, + int no_prefix, + int reset_freq_est); + +int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue, + unsigned char l, + int subframe, + int sample_offset, + int no_prefix); + +int front_end_fft(PHY_VARS_UE *ue, + unsigned char l, + unsigned char Ns, + int sample_offset, + int no_prefix); + +int front_end_chanEst(PHY_VARS_UE *ue, + unsigned char l, + unsigned char Ns, + int reset_freq_est); + +void apply_7_5_kHz(PHY_VARS_UE *phy_vars_ue,int32_t*txdata,uint8_t subframe); + + +int compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates, PRECODE_TYPE_t precode_type, int nb_ant, int nb_freq); + + + +/** @}*/ +#endif diff --git a/openair1/PHY/MODULATION/modulation_common.h b/openair1/PHY/MODULATION/modulation_common.h new file mode 100644 index 0000000000000000000000000000000000000000..2ac0dc23b3012b5bc76aa8ad7acbdf9f4fedd318 --- /dev/null +++ b/openair1/PHY/MODULATION/modulation_common.h @@ -0,0 +1,56 @@ +/* + * 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 + */ + +#ifndef __MODULATION_COMMON__H__ +#define __MODULATION_COMMON__H__ +#include "PHY/defs_common.h" +/** @addtogroup _PHY_MODULATION_ + * @{ +*/ + +/** +\fn void PHY_ofdm_mod(int *input,int *output,int fftsize,unsigned char nb_symbols,unsigned short nb_prefix_samples,Extension_t etype) +This function performs OFDM modulation with cyclic extension or zero-padding. + +@param input The sequence input samples in the frequency-domain. This is a concatenation of the input symbols in SIMD redundant format +@param output The time-domain output signal +@param fftsize size of OFDM symbol size (\f$N_d\f$) +@param nb_symbols The number of OFDM symbols in the block +@param nb_prefix_samples The number of prefix/suffix/zero samples +@param etype Type of extension (CYCLIC_PREFIX,CYCLIC_SUFFIX,ZEROS) + +*/ +void PHY_ofdm_mod(int *input, + int *output, + int fftsize, + unsigned char nb_symbols, + unsigned short nb_prefix_samples, + Extension_t etype + ); + + +void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms); + +void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); + + +/** @}*/ +#endif diff --git a/openair1/PHY/MODULATION/modulation_eNB.h b/openair1/PHY/MODULATION/modulation_eNB.h new file mode 100644 index 0000000000000000000000000000000000000000..360861088721af9893767520af4af5cbc81a3f88 --- /dev/null +++ b/openair1/PHY/MODULATION/modulation_eNB.h @@ -0,0 +1,66 @@ +/* + * 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 + */ + +#ifndef __MODULATION_ENB__H__ +#define __MODULATION_ENB__H__ +#include "PHY/defs_common.h" +#include "modulation_common.h" + +/** @addtogroup _PHY_MODULATION_ + * @{ +*/ + +int slot_fep_ul(RU_t *ru, + unsigned char l, + unsigned char Ns, + int no_prefix); + +void remove_7_5_kHz(RU_t *ru,uint8_t subframe); + +/** \brief This function performs beamforming precoding for common + * data + @param txdataF Table of pointers for frequency-domain TX signals + @param txdataF_BF Table of pointers for frequency-domain TX signals + @param frame_parms Frame descriptor structure +after beamforming + @param beam_weights Beamforming weights applied on each +antenna element and each carrier + @param slot Slot number + @param symbol Symbol index on which to act + @param aa physical antenna index*/ +int beam_precoding(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***beam_weights, + int slot, + int symbol, + int aa); + +int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs); + +int estimate_DLCSI_from_ULCSI(int32_t **calib_dl_ch_estimates, int32_t **ul_ch_estimates, int32_t **tdd_calib_coeffs, int nb_ant, int nb_freq); + +int compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates, PRECODE_TYPE_t precode_type, int nb_ant, int nb_freq); + + + +/** @}*/ +#endif diff --git a/openair1/PHY/MODULATION/vars.h b/openair1/PHY/MODULATION/modulation_extern.h similarity index 62% rename from openair1/PHY/MODULATION/vars.h rename to openair1/PHY/MODULATION/modulation_extern.h index a05999afe1661142ecb9fbbce6c5f1d46bce0f4b..2834aa00f503113987b5fa27a52f631ff1d235c5 100644 --- a/openair1/PHY/MODULATION/vars.h +++ b/openair1/PHY/MODULATION/modulation_extern.h @@ -10,7 +10,7 @@ * 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, +; * 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. @@ -19,13 +19,20 @@ * contact@openairinterface.org */ -mod_sym_t qpsk_table[4]; -mod_sym_t qam16_table[16]; -mod_sym_t qam64_table[64]; +extern int16_t s6n_kHz_7_5[1920]; +extern int16_t s6e_kHz_7_5[1920]; +extern int16_t s15n_kHz_7_5[3840]; +extern int16_t s15e_kHz_7_5[3840]; +extern int16_t s25n_kHz_7_5[7680]; +extern int16_t s25e_kHz_7_5[7680]; +extern int16_t s50n_kHz_7_5[15360]; +extern int16_t s50e_kHz_7_5[15360]; +extern int16_t s75n_kHz_7_5[23040]; +extern int16_t s75e_kHz_7_5[23040]; +extern int16_t s100n_kHz_7_5[30720]; +extern int16_t s100e_kHz_7_5[30720]; -int16_t kHz75_25PRB[1024] = {}; -int16_t kHz75_6PRB = {}; -int16_t kHz75_15PRB = {}; -int16_t kHz75_50PRB = {}; -int16_t kHz75_75PRB = {}; -int16_t kHz75_100PRB = {}; + +extern short conjugate75[8]; +extern short conjugate75_2[8]; +extern short negate[8]; diff --git a/openair1/SCHED/vars.h b/openair1/PHY/MODULATION/modulation_vars.h similarity index 80% rename from openair1/SCHED/vars.h rename to openair1/PHY/MODULATION/modulation_vars.h index 4dac375f18d0973167228192c7371f75b89d5eea..dbea92ab3f5e3e9998bab0bb417a8e7a11c629eb 100644 --- a/openair1/SCHED/vars.h +++ b/openair1/PHY/MODULATION/modulation_vars.h @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -#include "defs.h" - - - +#include "kHz_7_5.h" +short conjugate75[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ; +short conjugate75_2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; +short negate[8]__attribute__((aligned(16))) = {-1,-1,-1,-1,-1,-1,-1,-1}; diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 3a7cbec79db12352b19780feee2dc7fee3b0ea68..448db6f1f120c584f357e6a64a4074ff132452c5 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -29,10 +29,12 @@ This section deals with basic functions for OFDM Modulation. */ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/impl_defs_top.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" - +#include "modulation_common.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" //#define DEBUG_OFDM_MOD diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index 39ae90217f9b336d2afc397bd60106adc4ecb50f..b01979431dcf88212604aa71cf0d0470eb177d06 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -19,8 +19,10 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "defs.h" +#include "PHY/defs_UE.h" +#include "modulation_UE.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" + //#define DEBUG_FEP #define SOFFSET 0 diff --git a/openair1/PHY/MODULATION/slot_fep_mbsfn.c b/openair1/PHY/MODULATION/slot_fep_mbsfn.c index 7b902bb8f1524199980c08a7b9dc3bf1208ed403..272cbc5d60b0566562fb9d838c54f3396ac37b7e 100644 --- a/openair1/PHY/MODULATION/slot_fep_mbsfn.c +++ b/openair1/PHY/MODULATION/slot_fep_mbsfn.c @@ -19,8 +19,10 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "defs.h" +#include "PHY/defs_UE.h" +#include "modulation_UE.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" + //#define DEBUG_FEP #define SOFFSET 0 diff --git a/openair1/PHY/MODULATION/slot_fep_ul.c b/openair1/PHY/MODULATION/slot_fep_ul.c index 5beb7eccfdc14880ee953d10b198422a8b30a525..fe5488c73c7f29c136bb9730ca10e1f11149521c 100644 --- a/openair1/PHY/MODULATION/slot_fep_ul.c +++ b/openair1/PHY/MODULATION/slot_fep_ul.c @@ -19,9 +19,9 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "modulation_eNB.h" //#define DEBUG_FEP diff --git a/openair1/PHY/MODULATION/ul_7_5_kHz.c b/openair1/PHY/MODULATION/ul_7_5_kHz.c index d92dc1c8b3203bf5c0d103ec3d7fd09ce220f138..3d1d9c2b0470ad2a46c0b6534e4463d558d5d0ae 100644 --- a/openair1/PHY/MODULATION/ul_7_5_kHz.c +++ b/openair1/PHY/MODULATION/ul_7_5_kHz.c @@ -19,121 +19,11 @@ * contact@openairinterface.org */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "extern.h" -#include "kHz_7_5.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" #include <math.h> #include "PHY/sse_intrin.h" - -short conjugate75[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ; -short conjugate75_2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ; -short negate[8]__attribute__((aligned(16))) = {-1,-1,-1,-1,-1,-1,-1,-1}; - -void apply_7_5_kHz(PHY_VARS_UE *ue,int32_t*txdata,uint8_t slot) -{ - - - uint16_t len; - uint32_t *kHz7_5ptr; -#if defined(__x86_64__) || defined(__i386__) - __m128i *txptr128,*kHz7_5ptr128,mmtmp_re,mmtmp_im,mmtmp_re2,mmtmp_im2; -#elif defined(__arm__) - int16x8_t *txptr128,*kHz7_5ptr128; - int32x4_t mmtmp_re,mmtmp_im; - int32x4_t mmtmp0,mmtmp1; -#endif - uint32_t slot_offset; - // uint8_t aa; - uint32_t i; - LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - - switch (frame_parms->N_RB_UL) { - - case 6: - kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s6n_kHz_7_5 : (uint32_t*)s6e_kHz_7_5; - break; - - case 15: - kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s15n_kHz_7_5 : (uint32_t*)s15e_kHz_7_5; - break; - - case 25: - kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s25n_kHz_7_5 : (uint32_t*)s25e_kHz_7_5; - break; - - case 50: - kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s50n_kHz_7_5 : (uint32_t*)s50e_kHz_7_5; - break; - - case 75: - kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s75n_kHz_7_5 : (uint32_t*)s75e_kHz_7_5; - break; - - case 100: - kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s100n_kHz_7_5 : (uint32_t*)s100e_kHz_7_5; - break; - - default: - kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s25n_kHz_7_5 : (uint32_t*)s25e_kHz_7_5; - break; - } - - slot_offset = (uint32_t)slot * frame_parms->samples_per_tti/2; - len = frame_parms->samples_per_tti/2; - -#if defined(__x86_64__) || defined(__i386__) - txptr128 = (__m128i *)&txdata[slot_offset]; - kHz7_5ptr128 = (__m128i *)kHz7_5ptr; -#elif defined(__arm__) - txptr128 = (int16x8_t*)&txdata[slot_offset]; - kHz7_5ptr128 = (int16x8_t*)kHz7_5ptr; -#endif - // apply 7.5 kHz - - for (i=0; i<(len>>2); i++) { -#if defined(__x86_64__) || defined(__i386__) - mmtmp_re = _mm_madd_epi16(*txptr128,*kHz7_5ptr128); - // Real part of complex multiplication (note: 7_5kHz signal is conjugated for this to work) - mmtmp_im = _mm_shufflelo_epi16(*kHz7_5ptr128,_MM_SHUFFLE(2,3,0,1)); - mmtmp_im = _mm_shufflehi_epi16(mmtmp_im,_MM_SHUFFLE(2,3,0,1)); - mmtmp_im = _mm_sign_epi16(mmtmp_im,*(__m128i*)&conjugate75[0]); - mmtmp_im = _mm_madd_epi16(mmtmp_im,txptr128[0]); - mmtmp_re = _mm_srai_epi32(mmtmp_re,15); - mmtmp_im = _mm_srai_epi32(mmtmp_im,15); - mmtmp_re2 = _mm_unpacklo_epi32(mmtmp_re,mmtmp_im); - mmtmp_im2 = _mm_unpackhi_epi32(mmtmp_re,mmtmp_im); - - txptr128[0] = _mm_packs_epi32(mmtmp_re2,mmtmp_im2); - txptr128++; - kHz7_5ptr128++; -#elif defined(__arm__) - - mmtmp0 = vmull_s16(((int16x4_t*)txptr128)[0],((int16x4_t*)kHz7_5ptr128)[0]); - //mmtmp0 = [Re(ch[0])Re(rx[0]) Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1]) Im(ch[1])Im(ch[1])] - mmtmp1 = vmull_s16(((int16x4_t*)txptr128)[1],((int16x4_t*)kHz7_5ptr128)[1]); - //mmtmp1 = [Re(ch[2])Re(rx[2]) Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3]) Im(ch[3])Im(ch[3])] - mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), - vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); - //mmtmp_re = [Re(ch[0])Re(rx[0])+Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1])+Im(ch[1])Im(ch[1]) Re(ch[2])Re(rx[2])+Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3])+Im(ch[3])Im(ch[3])] - - mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)txptr128)[0],*(int16x4_t*)conjugate75_2)),((int16x4_t*)kHz7_5ptr128)[0]); - //mmtmp0 = [-Im(ch[0])Re(rx[0]) Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1]) Re(ch[1])Im(rx[1])] - mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)txptr128)[1],*(int16x4_t*)conjugate75_2)), ((int16x4_t*)kHz7_5ptr128)[1]); - //mmtmp0 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])] - mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), - vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); - //mmtmp_im = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])] - - txptr128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); - txptr128++; - kHz7_5ptr128++; -#endif - } - - //} -} - +#include "modulation_extern.h" void remove_7_5_kHz(RU_t *ru,uint8_t slot) { diff --git a/openair1/PHY/MODULATION/ul_7_5_kHz_ue.c b/openair1/PHY/MODULATION/ul_7_5_kHz_ue.c new file mode 100644 index 0000000000000000000000000000000000000000..3e3a839521b3e5be66c530b0af89172ac0d76ce6 --- /dev/null +++ b/openair1/PHY/MODULATION/ul_7_5_kHz_ue.c @@ -0,0 +1,136 @@ +/* + * 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_UE.h" +#include "PHY/phy_extern_ue.h" +#include "modulation_extern.h" +#include <math.h> +#include "PHY/sse_intrin.h" + +extern short conjugate75[8]; +extern short conjugate75_2[8]; +extern short negate[8]; + +void apply_7_5_kHz(PHY_VARS_UE *ue,int32_t*txdata,uint8_t slot) +{ + + + uint16_t len; + uint32_t *kHz7_5ptr; +#if defined(__x86_64__) || defined(__i386__) + __m128i *txptr128,*kHz7_5ptr128,mmtmp_re,mmtmp_im,mmtmp_re2,mmtmp_im2; +#elif defined(__arm__) + int16x8_t *txptr128,*kHz7_5ptr128; + int32x4_t mmtmp_re,mmtmp_im; + int32x4_t mmtmp0,mmtmp1; +#endif + uint32_t slot_offset; + // uint8_t aa; + uint32_t i; + LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; + + switch (frame_parms->N_RB_UL) { + + case 6: + kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s6n_kHz_7_5 : (uint32_t*)s6e_kHz_7_5; + break; + + case 15: + kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s15n_kHz_7_5 : (uint32_t*)s15e_kHz_7_5; + break; + + case 25: + kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s25n_kHz_7_5 : (uint32_t*)s25e_kHz_7_5; + break; + + case 50: + kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s50n_kHz_7_5 : (uint32_t*)s50e_kHz_7_5; + break; + + case 75: + kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s75n_kHz_7_5 : (uint32_t*)s75e_kHz_7_5; + break; + + case 100: + kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s100n_kHz_7_5 : (uint32_t*)s100e_kHz_7_5; + break; + + default: + kHz7_5ptr = (frame_parms->Ncp==0) ? (uint32_t*)s25n_kHz_7_5 : (uint32_t*)s25e_kHz_7_5; + break; + } + + slot_offset = (uint32_t)slot * frame_parms->samples_per_tti/2; + len = frame_parms->samples_per_tti/2; + +#if defined(__x86_64__) || defined(__i386__) + txptr128 = (__m128i *)&txdata[slot_offset]; + kHz7_5ptr128 = (__m128i *)kHz7_5ptr; +#elif defined(__arm__) + txptr128 = (int16x8_t*)&txdata[slot_offset]; + kHz7_5ptr128 = (int16x8_t*)kHz7_5ptr; +#endif + // apply 7.5 kHz + + for (i=0; i<(len>>2); i++) { +#if defined(__x86_64__) || defined(__i386__) + mmtmp_re = _mm_madd_epi16(*txptr128,*kHz7_5ptr128); + // Real part of complex multiplication (note: 7_5kHz signal is conjugated for this to work) + mmtmp_im = _mm_shufflelo_epi16(*kHz7_5ptr128,_MM_SHUFFLE(2,3,0,1)); + mmtmp_im = _mm_shufflehi_epi16(mmtmp_im,_MM_SHUFFLE(2,3,0,1)); + mmtmp_im = _mm_sign_epi16(mmtmp_im,*(__m128i*)&conjugate75[0]); + mmtmp_im = _mm_madd_epi16(mmtmp_im,txptr128[0]); + mmtmp_re = _mm_srai_epi32(mmtmp_re,15); + mmtmp_im = _mm_srai_epi32(mmtmp_im,15); + mmtmp_re2 = _mm_unpacklo_epi32(mmtmp_re,mmtmp_im); + mmtmp_im2 = _mm_unpackhi_epi32(mmtmp_re,mmtmp_im); + + txptr128[0] = _mm_packs_epi32(mmtmp_re2,mmtmp_im2); + txptr128++; + kHz7_5ptr128++; +#elif defined(__arm__) + + mmtmp0 = vmull_s16(((int16x4_t*)txptr128)[0],((int16x4_t*)kHz7_5ptr128)[0]); + //mmtmp0 = [Re(ch[0])Re(rx[0]) Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1]) Im(ch[1])Im(ch[1])] + mmtmp1 = vmull_s16(((int16x4_t*)txptr128)[1],((int16x4_t*)kHz7_5ptr128)[1]); + //mmtmp1 = [Re(ch[2])Re(rx[2]) Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3]) Im(ch[3])Im(ch[3])] + mmtmp_re = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), + vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); + //mmtmp_re = [Re(ch[0])Re(rx[0])+Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1])+Im(ch[1])Im(ch[1]) Re(ch[2])Re(rx[2])+Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3])+Im(ch[3])Im(ch[3])] + + mmtmp0 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)txptr128)[0],*(int16x4_t*)conjugate75_2)),((int16x4_t*)kHz7_5ptr128)[0]); + //mmtmp0 = [-Im(ch[0])Re(rx[0]) Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1]) Re(ch[1])Im(rx[1])] + mmtmp1 = vmull_s16(vrev32_s16(vmul_s16(((int16x4_t*)txptr128)[1],*(int16x4_t*)conjugate75_2)), ((int16x4_t*)kHz7_5ptr128)[1]); + //mmtmp0 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])] + mmtmp_im = vcombine_s32(vpadd_s32(vget_low_s32(mmtmp0),vget_high_s32(mmtmp0)), + vpadd_s32(vget_low_s32(mmtmp1),vget_high_s32(mmtmp1))); + //mmtmp_im = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])] + + txptr128[0] = vcombine_s16(vmovn_s32(mmtmp_re),vmovn_s32(mmtmp_im)); + txptr128++; + kHz7_5ptr128++; +#endif + } + + //} +} + + diff --git a/openair1/PHY/TOOLS/cadd_vv.c b/openair1/PHY/TOOLS/cadd_vv.c index 34808552fcaab7966d46249853b2ed4a6c9093d8..77346a97f7facdcf1e68a78b7397a709d9af6b12 100644 --- a/openair1/PHY/TOOLS/cadd_vv.c +++ b/openair1/PHY/TOOLS/cadd_vv.c @@ -19,7 +19,8 @@ * contact@openairinterface.org */ -#include "defs.h" +#include "PHY/defs_common.h" +#include "tools_defs.h" int add_vector16(short *x, diff --git a/openair1/PHY/TOOLS/cdot_prod.c b/openair1/PHY/TOOLS/cdot_prod.c index 91ba246bddf51afeb637976ace75c8decec83cae..60bdcf45dd722f98a3eccab80a76963e01f9db1a 100644 --- a/openair1/PHY/TOOLS/cdot_prod.c +++ b/openair1/PHY/TOOLS/cdot_prod.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -#include "defs.h" +#include "tools_defs.h" #include "PHY/sse_intrin.h" // returns the complex dot product of x and y diff --git a/openair1/PHY/TOOLS/cmult_sv.c b/openair1/PHY/TOOLS/cmult_sv.c index 61970ca2b69afa6d8ce38df8fe9d3bf3cc9c9636..013fedc6e9204ed042a7f1025434301532b93656 100644 --- a/openair1/PHY/TOOLS/cmult_sv.c +++ b/openair1/PHY/TOOLS/cmult_sv.c @@ -20,7 +20,7 @@ */ #include "PHY/sse_intrin.h" -#include "defs.h" +#include "tools_defs.h" #if defined(__x86_64__) || defined(__i386__) #define simd_q15_t __m128i diff --git a/openair1/PHY/TOOLS/cmult_vv.c b/openair1/PHY/TOOLS/cmult_vv.c index 13facf69077a165a0f6c05378bb1f847c6c4ab0b..ce3ebec65fe0e29f4bd34e816f484902e7531112 100644 --- a/openair1/PHY/TOOLS/cmult_vv.c +++ b/openair1/PHY/TOOLS/cmult_vv.c @@ -19,7 +19,8 @@ * contact@openairinterface.org */ -#include "defs.h" +#include "PHY/defs_common.h" +#include "tools_defs.h" #include <stdio.h> #if defined(__x86_64__) || defined(__i386__) diff --git a/openair1/PHY/TOOLS/dB_routines.c b/openair1/PHY/TOOLS/dB_routines.c index c99703eaf3c6139682f098aa932691a6522bcfc5..572759a68ca14ed47c4ba785816dc3ddf99f27c2 100644 --- a/openair1/PHY/TOOLS/dB_routines.c +++ b/openair1/PHY/TOOLS/dB_routines.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -#include "defs.h" +#include "tools_defs.h" // Approximate 10*log10(x) in fixed point : x = 0...(2^32)-1 diff --git a/openair1/PHY/TOOLS/lte_dfts.c b/openair1/PHY/TOOLS/lte_dfts.c index 47b39ea7d2666154005d4086e0fdea4c82d8d628..9a5a504ec41eea3d6f69ecf84ed20e5d03c0ed9f 100644 --- a/openair1/PHY/TOOLS/lte_dfts.c +++ b/openair1/PHY/TOOLS/lte_dfts.c @@ -26,9 +26,9 @@ #include <stdint.h> #ifndef MR_MAIN -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "defs.h" +#include "PHY/defs_common.h" +#include "PHY/impl_defs_top.h" +#include "tools_defs.h" #else #include "time_meas.h" #include <math.h> diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index eb86af916597fe0869af11ada340788751f301be..9f2ec54744941e783e0cb27cabeb19b93c95e4d5 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -23,6 +23,8 @@ #include <stdlib.h> #include "lte_phy_scope.h" +#include "PHY/defs_common.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #define TPUT_WINDOW_LENGTH 100 int otg_enabled; diff --git a/openair1/PHY/TOOLS/lte_phy_scope.h b/openair1/PHY/TOOLS/lte_phy_scope.h index 1d2b2ea1ed99c5b579aaa6f77b16bf5485108a7d..af9858ebad97796def7d13b4d007171fd61ca920 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.h +++ b/openair1/PHY/TOOLS/lte_phy_scope.h @@ -25,10 +25,9 @@ #define FD_lte_scope_h_ #include <forms.h> -#include "../impl_defs_lte.h" -#include "../impl_defs_top.h" -#include "../defs.h" -#include "../../SCHED/defs.h" // for OPENAIR_DAQ_VARS +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/impl_defs_top.h" /* Forms and Objects */ diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c index 918d2e3ba0043c636dcd67a2a875f338e7234063..13f37c4c8dbe9de6362a63abe6bd0f174321c9ef 100644 --- a/openair1/PHY/TOOLS/signal_energy.c +++ b/openair1/PHY/TOOLS/signal_energy.c @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -#include "defs.h" +#include "tools_defs.h" #include "PHY/sse_intrin.h" diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index d80832e243c9b0af7cea98e1d3da9fca0ff01b67..cb7775904099a769091795d62d23cc1b1d950b25 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -53,7 +53,7 @@ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){ if (ts->trials>0) { //fprintf(file_name,"Name %25s: Processing %15.3f ms for SF %d, diff_now %15.3f \n", name,(ts->diff_now/(cpu_freq_GHz*1000000.0)),subframe,ts->diff_now); - fprintf(file_name,"%15.3f ms, diff_now %15.3f \n",(ts->diff_now/(cpu_freq_GHz*1000000.0)),(double)ts->diff_now); + fprintf(file_name,"%15.3f us, diff_now %15.3f \n",(ts->diff_now/(cpu_freq_GHz*1000.0)),(double)ts->diff_now); } } diff --git a/openair1/PHY/TOOLS/defs.h b/openair1/PHY/TOOLS/tools_defs.h similarity index 99% rename from openair1/PHY/TOOLS/defs.h rename to openair1/PHY/TOOLS/tools_defs.h index b92c2a42367b59acae680d167af8665f3de7093e..e3b04babdc8f2320f3a319914fbaefbaa20f4a2a 100644 --- a/openair1/PHY/TOOLS/defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -30,7 +30,6 @@ */ #include <stdint.h> - #include "PHY/sse_intrin.h" diff --git a/openair1/PHY/MODULATION/extern.h b/openair1/PHY/TOOLS/tools_extern.h similarity index 100% rename from openair1/PHY/MODULATION/extern.h rename to openair1/PHY/TOOLS/tools_extern.h diff --git a/openair1/PHY/TOOLS/extern.h b/openair1/PHY/TOOLS/tools_vars.h similarity index 100% rename from openair1/PHY/TOOLS/extern.h rename to openair1/PHY/TOOLS/tools_vars.h diff --git a/openair1/PHY/TOOLS/vars.h b/openair1/PHY/TOOLS/vars.h deleted file mode 100644 index 4690bba42e5b91f4721d727b38d41da928e0c55a..0000000000000000000000000000000000000000 --- a/openair1/PHY/TOOLS/vars.h +++ /dev/null @@ -1,21 +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 - */ - diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h index 25ee6465482012c0c42a9457cb6dbac02b075dd3..6eb4ce0e9522f1f8a865cb199f040f22bcee92d2 100644 --- a/openair1/PHY/defs_L1_NB_IoT.h +++ b/openair1/PHY/defs_L1_NB_IoT.h @@ -40,7 +40,7 @@ #include <math.h> #include "common_lib.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" - +#include "defs_eNB.h" //#include <complex.h> #include "assertions.h" #ifdef MEX diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h new file mode 100644 index 0000000000000000000000000000000000000000..f992bb75cf92eab836e7099d1e1843e67452a4e8 --- /dev/null +++ b/openair1/PHY/defs_UE.h @@ -0,0 +1,848 @@ +/* + * 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/defs.h + \brief Top-level defines and structure definitions + \author R. Knopp, F. Kaltenberger + \date 2011 + \version 0.1 + \company Eurecom + \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr + \note + \warning +*/ +#ifndef __PHY_DEFS_UE_H__ +#define __PHY_DEFS_UE_H__ + + +#define _GNU_SOURCE +#include <sched.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/mman.h> +#include <linux/sched.h> +#include <signal.h> +#include <execinfo.h> +#include <getopt.h> +#include <sys/sysinfo.h> + + +#include <stdio.h> +#include <stdlib.h> +#include <malloc.h> +#include <string.h> +#include <math.h> +#include "common_lib.h" +#include "msc.h" + +#include "defs_common.h" +#include "impl_defs_top.h" + +#include "PHY/TOOLS/time_meas.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/TOOLS/tools_defs.h" +#include "platform_types.h" +#include "PHY/LTE_UE_TRANSPORT/transport_ue.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" // for SIC +#include <pthread.h> +#include "assertions.h" + + +/// 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 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 { + + /// \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; + + +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; + + + +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; + +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 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; +}; + + +#endif // __PHY_DEFS__H__ diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index e5be713484b3dca6bb894df66edecb9a5776e4c0..4a8b90b7705e5aa94ef8e98059a9da60ff67f8c9 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -29,11 +29,849 @@ \note \warning */ +<<<<<<< HEAD #ifndef __PHY_DEFS_COMMON__H__ #define __PHY_DEFS_COMMON__H__ #define MAX_NUM_RU_PER_eNB 64 #define MAX_NUM_RU_PER_gNB 64 +======= +#ifndef __PHY_DEFS_COMMON_H__ +#define __PHY_DEFS_COMMON_H__ + + +#define _GNU_SOURCE +#include <sched.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/mman.h> +#include <linux/sched.h> +#include <signal.h> +#include <execinfo.h> +#include <getopt.h> +#include <sys/sysinfo.h> + + +#include <stdio.h> +#include <stdlib.h> +#include <malloc.h> +#include <string.h> +#include <math.h> +#include "common_lib.h" +#include "msc.h" + + +//#include <complex.h> + + + + + + + +#include "PHY/TOOLS/time_meas.h" +#include "platform_types.h" +#define MAX_NUM_RU_PER_eNB 64 + +#include <pthread.h> + +#include "targets/ARCH/COMMON/common_lib.h" +#include "targets/COMMON/openairinterface5g_limits.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 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 { + /// 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; +>>>>>>> develop-uedirectorysplit #define NUMBER_OF_SUBBANDS_MAX 13 #define NUMBER_OF_HARQ_PID_MAX 8 @@ -41,6 +879,10 @@ #define MAX_FRAME_NUMBER 0x400 +<<<<<<< HEAD +======= + +>>>>>>> develop-uedirectorysplit #define NUMBER_OF_RN_MAX 3 typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_relay} relaying_type_t; @@ -97,6 +939,7 @@ typedef enum { } node_timing_t; #endif +<<<<<<< HEAD typedef struct { struct PHY_VARS_eNB_s *eNB; int UE_id; @@ -113,3 +956,138 @@ typedef struct { } te_params; #endif +======= + +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); + + +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); +} + + +#endif // __PHY_DEFS__H__ +>>>>>>> develop-uedirectorysplit diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs_eNB.h similarity index 71% rename from openair1/PHY/defs.h rename to openair1/PHY/defs_eNB.h index 83db0e039c93e778e6cd9295880499dbe8e8b681..ca66df94a50155e5e2b3a883be6834434281abf9 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,84 +57,21 @@ #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 "defs_common.h" #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" +#include "PHY/LTE_TRANSPORT/transport_common.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" +#include <pthread.h> + + +#include "openair2/PHY_INTERFACE/IF_Module.h" + #define MAX_NUM_RU_PER_eNB 64 #include "PHY/LTE_TRANSPORT/defs.h" @@ -331,20 +268,6 @@ typedef struct { 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; typedef struct RU_proc_t_s { /// Pointer to associated RU descriptor @@ -380,6 +303,7 @@ typedef struct RU_proc_t_s { /// \brief Instance count for FH processing thread. /// \internal This variable is protected by \ref mutex_FH. int instance_cnt_FH; + int instance_cnt_FH1; /// \internal This variable is protected by \ref mutex_prach. int instance_cnt_prach; #ifdef Rel14 @@ -396,10 +320,13 @@ typedef struct RU_proc_t_s { int instance_cnt_asynch_rxtx; /// \internal This variable is protected by \ref mutex_fep int instance_cnt_fep; - /// \internal This variable is protected by \ref mutex_fep + /// \internal This variable is protected by \ref mutex_feptx int instance_cnt_feptx; + /// This varible is protected by \ref mutex_emulatedRF + int instance_cnt_emulateRF; /// pthread structure for RU FH processing thread pthread_t pthread_FH; + pthread_t pthread_FH1; /// pthread structure for RU prach processing thread pthread_t pthread_prach; #ifdef Rel14 @@ -410,8 +337,10 @@ typedef struct RU_proc_t_s { pthread_t pthread_synch; /// pthread struct for RU RX FEP worker thread pthread_t pthread_fep; - /// pthread struct for RU RX FEPTX worker thread + /// pthread struct for RU TX FEP worker thread pthread_t pthread_feptx; + /// pthread struct for emulated RF + pthread_t pthread_emulateRF; /// pthread structure for asychronous RX/TX processing thread pthread_t pthread_asynch_rxtx; /// flag to indicate first RX acquisition @@ -420,6 +349,7 @@ typedef struct RU_proc_t_s { int first_tx; /// pthread attributes for RU FH processing thread pthread_attr_t attr_FH; + pthread_attr_t attr_FH1; /// pthread attributes for RU prach pthread_attr_t attr_prach; #ifdef Rel14 @@ -434,8 +364,11 @@ typedef struct RU_proc_t_s { pthread_attr_t attr_fep; /// pthread attributes for worker feptx thread pthread_attr_t attr_feptx; + /// pthread attributes for emulated RF + pthread_attr_t attr_emulateRF; /// scheduling parameters for RU FH thread struct sched_param sched_param_FH; + struct sched_param sched_param_FH1; /// scheduling parameters for RU prach thread struct sched_param sched_param_prach; #ifdef Rel14 @@ -448,6 +381,7 @@ typedef struct RU_proc_t_s { struct sched_param sched_param_asynch_rxtx; /// condition variable for RU FH thread pthread_cond_t cond_FH; + pthread_cond_t cond_FH1; /// condition variable for RU prach thread pthread_cond_t cond_prach; #ifdef Rel14 @@ -458,15 +392,18 @@ typedef struct RU_proc_t_s { pthread_cond_t cond_synch; /// condition variable for asynch RX/TX thread pthread_cond_t cond_asynch_rxtx; - /// condition varaible for RU RX FEP thread + /// condition varible for RU RX FEP thread pthread_cond_t cond_fep; - /// condition varaible for RU RX FEPTX thread + /// condition varible for RU TX FEP thread pthread_cond_t cond_feptx; + /// condition varible for emulated RF + pthread_cond_t cond_emulateRF; /// condition variable for eNB signal pthread_cond_t cond_eNBs; pthread_cond_t cond_gNBs; /// mutex for RU FH pthread_mutex_t mutex_FH; + pthread_mutex_t mutex_FH1; /// mutex for RU prach pthread_mutex_t mutex_prach; #ifdef Rel14 @@ -484,239 +421,21 @@ typedef struct RU_proc_t_s { pthread_mutex_t mutex_fep; /// mutex for fep TX worker thread pthread_mutex_t mutex_feptx; + /// mutex for emulated RF thread + pthread_mutex_t mutex_emulateRF; /// symbol mask for IF4p5 reception per subframe uint32_t symbol_mask[10]; /// number of slave threads int num_slaves; /// array of pointers to slaves struct RU_proc_t_s **slave_proc; + /// pipeline ready state + int ru_rx_ready; + int ru_tx_ready; } 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, @@ -725,6 +444,7 @@ typedef enum { REMOTE_IF4p5 =3, REMOTE_IF1pp =4, MAX_RU_IF_TYPES =5 + //EMULATE_RF =6 } RU_if_south_t; typedef struct RU_t_s{ @@ -818,6 +538,7 @@ typedef struct RU_t_s{ int (*nr_wakeup_rxtx)(struct PHY_VARS_gNB_s *gNB, struct RU_t_s *ru); /// function pointer to wakeup routine in lte-enb/nr-gnb. void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe); +<<<<<<< HEAD:openair1/PHY/defs.h void (*wakeup_prach_gNB)(struct PHY_VARS_gNB_s *gNB,struct RU_t_s *ru,int frame,int subframe); #ifdef Rel14 /// function pointer to wakeup routine in lte-enb. @@ -827,10 +548,29 @@ typedef struct RU_t_s{ /// function pointer to NB entry routine void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string); void (*gNB_top)(struct PHY_VARS_gNB_s *eNB, int frame_rx, int subframe_rx, char *string); +======= +#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); +#endif + /// function pointer to eNB entry routine + void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru); +>>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h /// Timing statistics time_stats_t ofdm_demod_stats; /// Timing statistics (TX) time_stats_t ofdm_mod_stats; +<<<<<<< HEAD:openair1/PHY/defs.h +======= + /// Timing wait statistics + time_stats_t ofdm_demod_wait_stats; + /// Timing wakeup statistics + time_stats_t ofdm_demod_wakeup_stats; + /// Timing wait statistics (TX) + time_stats_t ofdm_mod_wait_stats; + /// Timing wakeup statistics (TX) + time_stats_t ofdm_mod_wakeup_stats; +>>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h /// Timing statistics (RX Fronthaul + Compression) time_stats_t rx_fhaul; /// Timing statistics (TX Fronthaul + Compression) @@ -854,105 +594,445 @@ typedef struct RU_t_s{ openair0_timestamp ts_offset; /// process scheduling variables RU_proc_t proc; +<<<<<<< HEAD:openair1/PHY/defs.h +======= /// stats thread pthread descriptor pthread_t ru_stats_thread; + } RU_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; +#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; - // 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]; +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; - //! 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 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; -typedef struct { +#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; + /// pipeline ready state + int pipe_ready; +} 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; + int total_worker; + int current_worker; + /// \internal This variable is protected by \ref mutex_te. + int instance_cnt_te; + /// pthread attributes for parallel turbo-encoder thread + pthread_attr_t attr_te; + /// scheduling parameters for parallel turbo-encoder thread + struct sched_param sched_param_te; + /// pthread structure for parallel turbo-encoder thread + pthread_t pthread_te; + /// condition variable for parallel turbo-encoder thread + pthread_cond_t cond_te; + /// mutex for parallel turbo-encoder thread + pthread_mutex_t mutex_te; +} 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 + /// 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[3]; + /// set of scheduling variables RXn-TXnp4 threads + eNB_rxtx_proc_t proc_rxtx[2]; +>>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h + /// stats thread pthread descriptor + pthread_t process_stats_thread; + /// for waking up tx procedure + RU_proc_t *ru_proc; +} 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) @@ -1024,7 +1104,7 @@ typedef struct PHY_VARS_eNB_s { eth_params_t eth_params; int rx_total_gain_dB; int (*td)(struct PHY_VARS_eNB_s *eNB,int UE_id,int harq_pid,int llr8_flag); - int (*te)(struct PHY_VARS_eNB_s *,uint8_t *,uint8_t,LTE_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *); + int (*te)(struct PHY_VARS_eNB_s *,uint8_t *,uint8_t,LTE_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *,time_stats_t *); int (*start_if)(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB); uint8_t local_flag; LTE_DL_FRAME_PARMS frame_parms; @@ -1203,7 +1283,14 @@ typedef struct PHY_VARS_eNB_s { time_stats_t dlsch_modulation_stats; time_stats_t dlsch_scrambling_stats; time_stats_t dlsch_rate_matching_stats; + time_stats_t dlsch_turbo_encoding_preperation_stats; + time_stats_t dlsch_turbo_encoding_segmentation_stats; time_stats_t dlsch_turbo_encoding_stats; + time_stats_t dlsch_turbo_encoding_waiting_stats; + time_stats_t dlsch_turbo_encoding_signal_stats; + time_stats_t dlsch_turbo_encoding_main_stats; + time_stats_t dlsch_turbo_encoding_wakeup_stats0; + time_stats_t dlsch_turbo_encoding_wakeup_stats1; time_stats_t dlsch_interleaving_stats; time_stats_t rx_dft_stats; @@ -1224,11 +1311,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]; @@ -1241,433 +1323,11 @@ 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) { +<<<<<<< HEAD:openair1/PHY/defs.h printf( "waiting for sync (%s)\n",thread_name); pthread_mutex_lock( &sync_mutex ); @@ -2157,3 +1817,6 @@ typedef struct PHY_VARS_gNB_s { #include "SIMULATION/ETH_TRANSPORT/defs.h" #endif // __PHY_DEFS__H__ +======= +#endif // __PHY_DEFS_eNB_H__ +>>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 066dc7012c317f08da23c8b5433be624f1937f6a..8ffe1fabf40533f151ade91c194e6b906a2301b4 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 60d3fec5f4da660076ae16cc68fdf8e2c145aff3..d4f23ae763880a452715ddeac3ff269d095560ec 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" @@ -203,6 +203,9 @@ // QAM amplitude definitions +/// Amplitude for QPSK (\f$ 2^15 \times 1/\sqrt{2}\f$) +#define QPSK 23170 + /// First Amplitude for QAM16 (\f$ 2^{15} \times 2/\sqrt{10}\f$) #define QAM16_n1 20724 /// Second Amplitude for QAM16 (\f$ 2^{15} \times 1/\sqrt{10}\f$) @@ -274,8 +277,43 @@ typedef struct { #define MAX_FRAME_NUMBER 0x400 #include "openairinterface5g_limits.h" - - +#include "assertions.h" + +#define cmax(a,b) ((a>b) ? (a) : (b)) +#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c)) +#define cmin(a,b) ((a<b) ? (a) : (b)) +#define max(a,b) cmax(a,b) +#define min(a,b) cmin(a,b) + +#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) +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; +} #endif //__PHY_IMPLEMENTATION_DEFS_H__ /**@} diff --git a/openair1/PHY/extern.h b/openair1/PHY/phy_extern.h similarity index 93% rename from openair1/PHY/extern.h rename to openair1/PHY/phy_extern.h index 3a5389f262e23c6d7cdf0fe3353c3b6d74611748..b19017613ee0af50c26382f914a4a93357f04a14 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 ; @@ -32,23 +32,21 @@ extern char fmageren_name2[512]; extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX]; extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; -#include "PHY/LTE_TRANSPORT/extern.h" -#include "SIMULATION/ETH_TRANSPORT/extern.h" +#include "PHY/LTE_TRANSPORT/transport_extern.h" +//#include "SIMULATION/ETH_TRANSPORT/extern.h" extern unsigned int DAQ_MBOX; extern int number_of_cards; #ifndef OCP_FRAMEWORK -extern PHY_VARS_UE ***PHY_vars_UE_g; //extern PHY_VARS_eNB ***PHY_vars_eNB_g; extern RAN_CONTEXT_t RC; -extern PHY_VARS_RN **PHY_vars_RN_g; extern LTE_DL_FRAME_PARMS *lte_frame_parms_g; #else #define MAX_UE 10 #define MAX_eNB 20 -extern PHY_VARS_UE * PHY_vars_UE_g[MAX_UE][MAX_NUM_CCs]; + extern PHY_VARS_eNB * PHY_vars_eNB_g[MAX_eNB][MAX_NUM_CCs]; #endif @@ -70,7 +68,7 @@ extern int flagMag; extern char mode_string[4][20]; -#include "PHY/LTE_TRANSPORT/extern.h" + extern unsigned char NB_RU; diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h new file mode 100644 index 0000000000000000000000000000000000000000..98dbfb886e858da98de2d418d7afb7a84dd6b859 --- /dev/null +++ b/openair1/PHY/phy_extern_ue.h @@ -0,0 +1,124 @@ +/* + * 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 + */ + +#ifndef __PHY_EXTERN_UE__H__ +#define __PHY_EXTERN_UE__H__ + +#include "PHY/defs_UE.h" +#include "common/ran_context.h" + +extern char* namepointer_chMag ; +extern char* namepointer_log2; +extern char fmageren_name2[512]; + +extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX]; +extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; + +#include "PHY/LTE_TRANSPORT/transport_extern.h" + +extern int number_of_cards; + + +#ifndef OCP_FRAMEWORK +extern PHY_VARS_UE ***PHY_vars_UE_g; +extern LTE_DL_FRAME_PARMS *lte_frame_parms_g; +#else +#define MAX_UE 10 +#define MAX_eNB 20 + +extern PHY_VARS_UE * PHY_vars_UE_g[MAX_UE][MAX_NUM_CCs]; +#endif + +extern short primary_synch0[144]; +extern short primary_synch1[144]; +extern short primary_synch2[144]; +extern unsigned char primary_synch0_tab[72]; +extern unsigned char primary_synch1_tab[72]; +extern unsigned char primary_synch2_tab[72]; +extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ +extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ +extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ +extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ +extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ +extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ + +extern int flagMag; +//extern short **txdataF_rep_tmp; + +extern char mode_string[4][20]; + +extern unsigned char NB_RU; + +#ifndef OPENAIR2 +extern unsigned char NB_eNB_INST; +extern unsigned char NB_UE_INST; +extern unsigned char NB_RN_INST; +#endif + +extern unsigned int ULSCH_max_consecutive_errors; +extern int flag_LA; +extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; +extern double sinr_bler_map_up[MCS_COUNT][2][16]; +extern int table_length[MCS_COUNT]; +extern double sinr_to_cqi[4][16]; +extern int cqi_to_mcs[16]; + +//for MU-MIMO abstraction using MIESM +//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively +extern double MI_map_4qam[3][162]; +extern double MI_map_16qam[3][197]; +extern double MI_map_64qam[3][227]; + +extern double beta1_dlsch_MI[6][MCS_COUNT]; +extern double beta2_dlsch_MI[6][MCS_COUNT]; + +extern double q_qpsk[8]; +extern double q_qam16[8]; +extern double q_qam64[8]; + +extern double p_qpsk[8]; +extern double p_qam16[8]; +extern double p_qam64[8]; + +extern double beta1_dlsch[6][MCS_COUNT]; +extern double beta2_dlsch[6][MCS_COUNT]; + +extern char eNB_functions[6][20]; +extern char eNB_timing[2][20]; +extern char ru_if_types[MAX_RU_IF_TYPES][20]; + +extern int16_t unscrambling_lut[65536*16]; +extern uint8_t scrambling_lut[65536*16]; + +extern unsigned short msrsb_6_40[8][4]; +extern unsigned short msrsb_41_60[8][4]; +extern unsigned short msrsb_61_80[8][4]; +extern unsigned short msrsb_81_110[8][4]; +extern unsigned short Nb_6_40[8][4]; +extern unsigned short Nb_41_60[8][4]; +extern unsigned short Nb_61_80[8][4]; +extern unsigned short Nb_81_110[8][4]; + +extern uint16_t hundred_times_log10_NPRB[100]; +extern uint8_t alpha_lut[8]; +extern uint8_t max_turbo_iterations; +#endif /*__PHY_EXTERN_H__ */ + diff --git a/openair1/PHY/vars.h b/openair1/PHY/phy_vars.h similarity index 98% rename from openair1/PHY/vars.h rename to openair1/PHY/phy_vars.h index 36cf3f31da16d6e225666d736a97630aa4991d3f..29cba545e012a4eff9487088bed41738297ced29 100644 --- a/openair1/PHY/vars.h +++ b/openair1/PHY/phy_vars.h @@ -23,7 +23,8 @@ #define __PHY_VARS_H__ #include "PHY/types.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" #include "common/ran_context.h" char* namepointer_chMag ; @@ -37,7 +38,9 @@ int16_t *primary_synch1_time; int16_t *primary_synch2_time; -#include "PHY/CODING/vars.h" +#include "PHY/CODING/coding_vars.h" +#include "PHY/LTE_TRANSPORT/transport_vars.h" +#include "PHY/MODULATION/modulation_vars.h" //PHY_VARS *PHY_vars; #ifndef OCP_FRAMEWORK @@ -58,7 +61,7 @@ unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048] char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; -#include "PHY/LTE_TRANSPORT/vars.h" + diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h new file mode 100644 index 0000000000000000000000000000000000000000..c323d1eade612f6a3173ba5848322fefa2f5d117 --- /dev/null +++ b/openair1/PHY/phy_vars_ue.h @@ -0,0 +1,150 @@ +/* + * 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 + */ + +#ifndef __PHY_VARS_H__ +#define __PHY_VARS_H__ + +#include "PHY/types.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_vars_ue.h" + +#include "common/ran_context.h" + +char* namepointer_chMag ; +char fmageren_name2[512]; +char* namepointer_log2; + + +#include "PHY/LTE_REFSIG/primary_synch.h" +int16_t *primary_synch0_time; +int16_t *primary_synch1_time; +int16_t *primary_synch2_time; + + +#include "PHY/CODING/coding_vars.h" + +//PHY_VARS *PHY_vars; +#ifndef OCP_FRAMEWORK +PHY_VARS_UE ***PHY_vars_UE_g; +LTE_DL_FRAME_PARMS *lte_frame_parms_g; +#else +PHY_VARS_UE * PHY_vars_UE_g[MAX_UE][MAX_NUM_CCs]={NULL}; + +#endif + + +unsigned short rev[2048],rev_times4[8192],rev_half[1024]; +unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192]; + + +char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; + + + +#include "SIMULATION/ETH_TRANSPORT/vars.h" + +unsigned char NB_RU=0; + +#ifndef OPENAIR2 +unsigned char NB_eNB_INST=0; +unsigned char NB_UE_INST=0; +unsigned char NB_RN_INST=0; +unsigned char NB_INST=0; +#endif + +unsigned int ULSCH_max_consecutive_errors = 20; + +int number_of_cards; + + +int flag_LA=0; +int flagMag; +//extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; +//extern double ABS_SINR_eff_BLER_table[MCS_COUNT][9][9]; +//extern double ABS_beta[MCS_COUNT];odi +double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX]; +int table_length[MCS_COUNT]; +//double sinr_bler_map_up[MCS_COUNT][2][16]; + +//for MU-MIMO abstraction using MIESM +//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively +double MI_map_4qam[3][162]; +double MI_map_16qam[3][197]; +double MI_map_64qam[3][227]; + +// here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs +double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281, 17.2424, 17.2424, 17.2424}, + {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319, 2.9574, 4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572}, + {-1, -1.0000, -0.4198, -0.0140, 1.0362, 2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392}, + { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545} +}; + +//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27}; +int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28}; + +//for SNR to MI conversion 7 th order Polynomial coeff +double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639}; +double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425}; +double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898}; + +//for MI to SNR conversion 7 th order Polynomial coeff +double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965}; +double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089}; +double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343}; + +// ideal CE MIESM + +double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,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.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}}; +double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,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.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}}; + +//real CE MIESM +/* +double beta1_dlsch_MI[6][MCS_COUNT] = { {1.32955, 0.59522, 0.54024, 0.98698, 0.81305, 0.76976, 0.69258, 0.69713, 0.70546, 0.69111, 0.81904, 0.72664, 0.79491, 0.72562, 0.53980, 0.33134, 0.50550, 0.40602,0.40281,0.47012,0.50510,0.23540,0.32045,1}, {0.59632, 1.08475, 1.02431, 1.07020, 0.90170, 0.97719, 0.95464, 0.92764, 0.86721, 0.85986, 0.64558, 0.80631, 0.82673, 0.82888, 0.87122, 0.77245, 0.29771, 0.43477, 0.55321, 0.61027, 0.56111, 0.57292, 0.39737,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.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.77532, 1.07544, 1.10571, 1.04099, 0.91638, 0.88644, 0.96405, 0.86709, 0.94066, 0.84430, 1.24478, 1.09665, 1.42604, 0.79541, 0.71847, 0.71604, 0.74561, 0.36431, 0.41536, 0.52175, 0.47096, 0.49977, 0.59728,1}}; +double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.81637, 0.76847, 0.69842, 0.69885, 0.69967, 0.69826, 0.82660, 0.70559, 0.78404, 0.70670, 0.55393, 0.36893, 0.52225, 0.39752, 0.40494, 0.46239, 0.49247,0.26900,0.34504,1}, {0.43775, 0.78208, 0.72875, 0.77458, 0.64485, 0.69174, 0.66097, 0.63289, 0.59652, 0.61175, 0.44551, 0.56047, 0.57314, 0.57553, 0.58849, 0.52159, 0.21241, 0.30139, 0.37373, 0.32029, 0.37067, 0.36706, 0.27118,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.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.54448, 0.73731, 0.79165, 0.74407, 0.68042, 0.64906, 0.71349, 0.62109, 0.65815, 0.60940, 0.90549, 0.78708, 1.03176, 0.58431, 0.53379, 0.51224, 0.52767, 0.26848, 0.29642, 0.36879, 0.34148, 0.35279,0.40633,1}}; +*/ +//ideal channel estimation values +//double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {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.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; +//double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {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.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; +double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {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.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}}; +double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {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.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}}; + +//real channel estimation valus +/* +double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {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.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}}; +double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {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.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}}; + +*/ + +#ifdef OCP_FRAMEWORK +#include <enums.h> +#else +char eNB_functions[6][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5",}; +char eNB_timing[2][20]={"synch_to_ext_device","synch_to_other"}; +char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"}; +#endif + +/// lookup table for unscrambling in RX +int16_t unscrambling_lut[65536*16] __attribute__((aligned(32))); +/// lookup table for scrambling in TX +uint8_t scrambling_lut[65536*16] __attribute__((aligned(32))); + +uint8_t max_turbo_iterations=4; +#endif /*__PHY_VARS_H__ */ diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index df01fad13622307d0c14c65fbd302744d23453e2..33096c112682d7803e8a4c7d464b5720cab87512 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -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/LTE_TRANSPORT/transport_proto.h" +#include "SCHED/sched_eNB.h" + #include "nfapi_interface.h" #include "fapi_l1.h" diff --git a/openair1/SCHED/fapi_l1.h b/openair1/SCHED/fapi_l1.h index f04e8581dba863b9ede033cae45810df1ede99ea..efb028f46444b73cbed6df710faf6db75bcc4080 100644 --- a/openair1/SCHED/fapi_l1.h +++ b/openair1/SCHED/fapi_l1.h @@ -30,10 +30,11 @@ * \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 "PHY/LTE_TRANSPORT/transport_proto.h" +#include "SCHED/sched_eNB.h" +#include "SCHED/sched_common.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/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c index bbb6986ce9c7c3ac375e79eb170e5c4c77b2ab72..81679f199c64b506de424bfb20bcf03ababa2deb 100644 --- a/openair1/SCHED/phy_procedures_lte_common.c +++ b/openair1/SCHED/phy_procedures_lte_common.c @@ -29,10 +29,10 @@ * \note * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "SCHED/sched_common_extern.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" void get_Msg3_alloc(LTE_DL_FRAME_PARMS *frame_parms, unsigned char current_subframe, @@ -831,12 +831,7 @@ dci_detect_mode_t dci_detect_mode_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t return ret; } -lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe) -{ - - return(subframe_select(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe)); -} uint8_t phich_subframe_to_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe) { @@ -1066,3 +1061,73 @@ void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeri } } + +// uint8_t eNB_id,uint8_t harq_pid, uint8_t UE_id, +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) +{ + + /// The payload + CRC size in bits, "B" + uint32_t B; + /// Number of code segments + uint32_t C; + /// Number of "small" code segments + uint32_t Cminus; + /// Number of "large" code segments + uint32_t Cplus; + /// Number of bits in "small" code segments (<6144) + uint32_t Kminus; + /// Number of bits in "large" code segments (<6144) + uint32_t Kplus; + /// Total number of bits across all segments + uint32_t sumKr; + /// Number of "Filler" bits + uint32_t F; + // num resource elements + uint32_t num_re=0.0; + // num symbols + uint32_t num_symb=0.0; + /// effective spectral efficiency of the PUSCH + uint32_t MPR_x100=0; + /// beta_offset + uint16_t beta_offset_pusch_x8=8; + /// delta mcs + float delta_mcs=0.0; + /// bandwidth factor + float bw_factor=0.0; + + B= tbs+24; + lte_segmentation(NULL, + NULL, + B, + &C, + &Cplus, + &Cminus, + &Kplus, + &Kminus, + &F); + + + sumKr = Cminus*Kminus + Cplus*Kplus; + num_symb = 12-(ncp<<1)-(use_srs==0?0:1); + num_re = num_symb * nb_rb * 12; + + if (num_re == 0) + return(0); + + MPR_x100 = 100*sumKr/num_re; + + if (control_only == 1 ) + beta_offset_pusch_x8=8; // fixme + + //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8; + + // if deltamcs_enabledm + delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0); + bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0); +#ifdef DEBUG_SEGMENTATION + printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n", + (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor); +#endif + return (int16_t)ceil(delta_mcs + bw_factor); + +} diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 6c2e580947da2ebde0616ccd04a83174e2ceefa4..233d4f06ef3d07925f285278f41d463114595b9a 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -30,10 +30,11 @@ * \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_common_extern.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "nfapi_interface.h" #include "fapi_l1.h" #include "UTIL/LOG/log.h" @@ -51,16 +52,94 @@ #endif extern uint8_t nfapi_mode; + + + +int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor) +{ + + uint32_t Nre,sumKr,MPR_x100,Kr,r; + uint16_t beta_offset_pusch; + + DevAssert( UE_id < NUMBER_OF_UE_MAX+1 ); + DevAssert( harq_pid < 8 ); + + Nre = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_initial * + eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12; + + sumKr = 0; + + for (r=0; r<eNB->ulsch[UE_id]->harq_processes[harq_pid]->C; r++) { + if (r<eNB->ulsch[UE_id]->harq_processes[harq_pid]->Cminus) + Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kminus; + else + Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus; + + sumKr += Kr; + } + + if (Nre==0) + return(0); + + MPR_x100 = 100*sumKr/Nre; + // Note: MPR=is the effective spectral efficiency of the PUSCH + // FK 20140908 sumKr is only set after the ulsch_encoding + + beta_offset_pusch = 8; + //(eNB->ulsch[UE_id]->harq_processes[harq_pid]->control_only == 1) ? eNB->ulsch[UE_id]->beta_offset_cqi_times8:8; + + DevAssert( UE_id < NUMBER_OF_UE_MAX ); +//#warning "This condition happens sometimes. Need more investigation" // navid + //DevAssert( MPR_x100/6 < 100 ); + + if (1==1) { //eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) { + // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) + if (bw_factor == 1) { + uint8_t nb_rb = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; + return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB[nb_rb-1]; + } else + return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)); + } else { + return(0); + } +} + + +int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) +{ + + int8_t UE_id; + + if ((RC.eNB == NULL) || (module_idP > RC.nb_inst) || (CC_id > RC.nb_CC[module_idP])) { + LOG_E(PHY,"get_UE_stats: No eNB found (or not allocated) for Mod_id %d,CC_id %d\n",module_idP,CC_id); + return -1; + } + + UE_id = find_ulsch( rnti, RC.eNB[module_idP][CC_id],SEARCH_EXIST); + + if (UE_id == -1) { + // not found + return 0; + } + + return get_hundred_times_delta_IF_eNB( RC.eNB[module_idP][CC_id], UE_id, harq_pid, 0 ); +} + int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); +lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe) +{ + + return(subframe_select(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe)); + +} -void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,PHY_VARS_RN *rn,relaying_type_t r_type) { +void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { #if defined(Rel10) || defined(Rel14) MCH_PDU *mch_pduP=NULL; - MCH_PDU mch_pdu; // uint8_t sync_area=255; #endif @@ -84,50 +163,17 @@ void pmch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,PHY_VARS_RN *rn,rel proc->frame_tx, subframe); */ - switch (r_type) { - case no_relay: - if ((mch_pduP->Pdu_size > 0) && (mch_pduP->sync_area == 0)) // TEST: only transmit mcch for sync area 0 - LOG_D(PHY,"[eNB%"PRIu8"] Frame %d subframe %d : Got MCH pdu for MBSFN (MCS %"PRIu8", TBS %d) \n", - eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->mcs, - eNB->dlsch_MCH->harq_processes[0]->TBS>>3); - else { - LOG_D(PHY,"[DeNB %"PRIu8"] Frame %d subframe %d : Do not transmit MCH pdu for MBSFN sync area %"PRIu8" (%s)\n", - eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->sync_area, - (mch_pduP->Pdu_size == 0)? "Empty MCH PDU":"Let RN transmit for the moment"); - mch_pduP = NULL; - } - - break; - - case multicast_relay: - if ((mch_pduP->Pdu_size > 0) && ((mch_pduP->mcch_active == 1) || mch_pduP->msi_active==1)) { - LOG_D(PHY,"[RN %"PRIu8"] Frame %d subframe %d: Got the MCH PDU for MBSFN sync area %"PRIu8" (MCS %"PRIu8", TBS %"PRIu16")\n", - rn->Mod_id,rn->frame, subframe, - mch_pduP->sync_area,mch_pduP->mcs,mch_pduP->Pdu_size); - } else if (rn->mch_avtive[subframe%5] == 1) { // SF2 -> SF7, SF3 -> SF8 - mch_pduP= &mch_pdu; - memcpy(&mch_pduP->payload, // could be a simple copy - rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->b, - rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->TBS>>3); - mch_pduP->Pdu_size = (uint16_t) (rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->TBS>>3); - mch_pduP->mcs = rn->dlsch_rn_MCH[subframe%5]->harq_processes[0]->mcs; - LOG_D(PHY,"[RN %"PRIu8"] Frame %d subframe %d: Forward the MCH PDU for MBSFN received on SF %d sync area %"PRIu8" (MCS %"PRIu8", TBS %"PRIu16")\n", - rn->Mod_id,rn->frame, subframe,subframe%5, - rn->sync_area[subframe%5],mch_pduP->mcs,mch_pduP->Pdu_size); - } else { - mch_pduP=NULL; - } - - rn->mch_avtive[subframe]=0; - break; + if ((mch_pduP->Pdu_size > 0) && (mch_pduP->sync_area == 0)) // TEST: only transmit mcch for sync area 0 + LOG_D(PHY,"[eNB%"PRIu8"] Frame %d subframe %d : Got MCH pdu for MBSFN (MCS %"PRIu8", TBS %d) \n", + eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->mcs, + eNB->dlsch_MCH->harq_processes[0]->TBS>>3); + else { + LOG_D(PHY,"[DeNB %"PRIu8"] Frame %d subframe %d : Do not transmit MCH pdu for MBSFN sync area %"PRIu8" (%s)\n", + eNB->Mod_id,proc->frame_tx,subframe,mch_pduP->sync_area, + (mch_pduP->Pdu_size == 0)? "Empty MCH PDU":"Let RN transmit for the moment"); + mch_pduP = NULL; + } - default: - LOG_W(PHY,"[eNB %"PRIu8"] Frame %d subframe %d: unknown relaying type %d \n", - eNB->Mod_id,proc->frame_tx,subframe,r_type); - mch_pduP=NULL; - break; - }// switch - if (mch_pduP) { fill_eNB_dlsch_MCH(eNB,mch_pduP->mcs,1,0); // Generate PMCH @@ -346,14 +392,24 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, start_meas(&eNB->dlsch_encoding_stats); eNB->te(eNB, - dlsch_harq->pdu, - dlsch_harq->pdsch_start, - dlsch, - frame,subframe, - &eNB->dlsch_rate_matching_stats, - &eNB->dlsch_turbo_encoding_stats, - &eNB->dlsch_interleaving_stats); + dlsch_harq->pdu, + dlsch_harq->pdsch_start, + dlsch, + frame, + subframe, + &eNB->dlsch_rate_matching_stats, + &eNB->dlsch_turbo_encoding_stats, + &eNB->dlsch_turbo_encoding_waiting_stats, + &eNB->dlsch_turbo_encoding_main_stats, + &eNB->dlsch_turbo_encoding_wakeup_stats0, + &eNB->dlsch_turbo_encoding_wakeup_stats1, + &eNB->dlsch_interleaving_stats); stop_meas(&eNB->dlsch_encoding_stats); + //////////////////////////////////////////////////******************************************* + if(eNB->dlsch_encoding_stats.diff_now>500*3000 && opp_enabled == 1) + { + print_meas_now(&eNB->dlsch_encoding_stats,"total coding",stderr); + } // 36-211 start_meas(&eNB->dlsch_scrambling_stats); dlsch_scrambling(fp, @@ -398,11 +454,8 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, - relaying_type_t r_type, - PHY_VARS_RN *rn, int do_meas) { - UNUSED(rn); int frame=proc->frame_tx; int subframe=proc->subframe_tx; uint32_t i,aa; @@ -433,7 +486,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, if (nfapi_mode == 0 || nfapi_mode == 1) { if (is_pmch_subframe(frame,subframe,fp)) { - pmch_procedures(eNB,proc,rn,r_type); + pmch_procedures(eNB,proc); } else { // this is not a pmch subframe, so generate PSS/SSS/PBCH @@ -546,6 +599,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, else { // generate pdsch + pdsch_procedures(eNB, proc, harq_pid, @@ -1359,37 +1413,63 @@ extern int oai_exit; extern void *td_thread(void*); -void init_td_thread(PHY_VARS_eNB *eNB,pthread_attr_t *attr_td) { +void init_td_thread(PHY_VARS_eNB *eNB) { eNB_proc_t *proc = &eNB->proc; proc->tdp.eNB = eNB; proc->instance_cnt_td = -1; - + + pthread_attr_init( &proc->attr_td); pthread_mutex_init( &proc->mutex_td, NULL); pthread_cond_init( &proc->cond_td, NULL); + + pthread_create(&proc->pthread_td, &proc->attr_td, td_thread, (void*)&proc->tdp); - pthread_create(&proc->pthread_td, attr_td, td_thread, (void*)&proc->tdp); +} +void kill_td_thread(PHY_VARS_eNB *eNB) { + eNB_proc_t *proc = &eNB->proc; + proc->instance_cnt_td = 0; + pthread_cond_signal(&proc->cond_td); + + pthread_join(proc->pthread_td, NULL); + pthread_mutex_destroy( &proc->mutex_td ); + pthread_cond_destroy( &proc->cond_td ); } extern void *te_thread(void*); -void init_te_thread(PHY_VARS_eNB *eNB,pthread_attr_t *attr_te) { +void init_te_thread(PHY_VARS_eNB *eNB) { eNB_proc_t *proc = &eNB->proc; - proc->tep.eNB = eNB; - proc->instance_cnt_te = -1; + for(int i=0; i<3 ;i++){ + proc->tep[i].eNB = eNB; + proc->tep[i].instance_cnt_te = -1; + + pthread_mutex_init( &proc->tep[i].mutex_te, NULL); + pthread_cond_init( &proc->tep[i].cond_te, NULL); + pthread_attr_init( &proc->tep[i].attr_te); - pthread_mutex_init( &proc->mutex_te, NULL); - pthread_cond_init( &proc->cond_te, NULL); + printf("Creating te_thread 0\n"); + pthread_create(&proc->tep[i].pthread_te, &proc->tep[i].attr_te, te_thread, (void*)&proc->tep[i]); + } +} +void kill_te_thread(PHY_VARS_eNB *eNB) { - printf("Creating te_thread\n"); - pthread_create(&proc->pthread_te, attr_te, te_thread, (void*)&proc->tep); + eNB_proc_t *proc = &eNB->proc; + for(int i=0; i<3 ;i++){ + proc->tep[i].instance_cnt_te = 0; + pthread_cond_signal(&proc->tep[i].cond_te); + pthread_join(proc->tep[i].pthread_te, NULL); + pthread_mutex_destroy( &proc->tep[i].mutex_te); + pthread_cond_destroy( &proc->tep[i].cond_te); + } } + void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe) { nfapi_rx_indication_pdu_t *pdu; @@ -1451,7 +1531,9 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe) pthread_mutex_unlock(&eNB->UL_INFO_mutex); } -void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask) { +/* release the harq if its round is >= 'after_rounds' */ +static void do_release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int after_rounds) +{ LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; @@ -1472,11 +1554,13 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf dlsch1_harq = dlsch1->harq_processes[harq_pid]; AssertFatal(dlsch0_harq!=NULL,"dlsch0_harq is null\n"); - dlsch0_harq->status = SCH_IDLE; - /*if ((dlsch1_harq == NULL)|| - ((dlsch1_harq!=NULL)&& - (dlsch1_harq->status == SCH_IDLE)))*/ - dlsch0->harq_mask &= ~(1<<harq_pid); + if (dlsch0_harq->round >= after_rounds) { + dlsch0_harq->status = SCH_IDLE; + /*if ((dlsch1_harq == NULL)|| + ((dlsch1_harq!=NULL)&& + (dlsch1_harq->status == SCH_IDLE)))*/ + dlsch0->harq_mask &= ~(1<<harq_pid); + } LOG_D(PHY,"Frame %d, subframe %d: Releasing harq %d for UE %x\n",frame,subframe,harq_pid,dlsch0->rnti); } @@ -1496,17 +1580,28 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf dlsch1_harq = dlsch1->harq_processes[harq_pid]; AssertFatal(dlsch0_harq!=NULL,"dlsch0_harq is null\n"); - dlsch0_harq->status = SCH_IDLE; - if ((dlsch1_harq == NULL)|| - ((dlsch1_harq!=NULL)&& - (dlsch1_harq->status == SCH_IDLE))) - dlsch0->harq_mask &= ~(1<<harq_pid); + if (dlsch0_harq->round >= after_rounds) { + dlsch0_harq->status = SCH_IDLE; + if ((dlsch1_harq == NULL)|| + ((dlsch1_harq!=NULL)&& + (dlsch1_harq->status == SCH_IDLE))) + dlsch0->harq_mask &= ~(1<<harq_pid); + } } } } } } +static void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int is_ack) +{ + /* Maximum number of DL transmissions = 4. + * TODO: get the value from configuration. + * If is_ack is true then we release immediately. The value -1 can be used for that. + */ + do_release_harq(eNB, UE_id, tb, frame, subframe, mask, is_ack ? -1 : 4); +} + int getM(PHY_VARS_eNB *eNB,int frame,int subframe) { int M,Mtx=0; @@ -1607,7 +1702,8 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq, pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 2-ulsch_harq->o_ACK[i]; // release DLSCH if needed - if (ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff); + release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); + #if T_TRACER /* TODO: get correct harq pid */ @@ -1633,13 +1729,17 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq, pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = 2-ulsch_harq->o_ACK[i]; // release DLSCH if needed - if (ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff); - if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); - else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff); + /* TODO: review this code, it's most certainly wrong. + * We have to release the proper HARQ in case of ACK or NACK if max retransmission reached. + * Basically, call release_harq with 1 as last argument when ACK and 0 when NACK. + */ + release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); + if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); + else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); else if (M>1 && ulsch_harq->o_ACK[i] == 1) { // spatial bundling - release_harq(eNB,UE_id,0,frame,subframe,1<<i); - release_harq(eNB,UE_id,1,frame,subframe,1<<i); + release_harq(eNB,UE_id,0,frame,subframe,1<<i, ulsch_harq->o_ACK[i] == 1); + release_harq(eNB,UE_id,1,frame,subframe,1<<i, ulsch_harq->o_ACK[i] == 1); } } } @@ -1701,7 +1801,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; // release DLSCH if needed - if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + #if T_TRACER if (harq_ack[0] != 1) @@ -1721,8 +1822,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1]; // release DLSCH if needed - if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); - if (harq_ack[1] == 1) release_harq(eNB,UE_id,1,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1); } else AssertFatal(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt); } @@ -1743,7 +1844,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; // release all bundled DLSCH if needed - if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); } else if (uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; @@ -1753,8 +1854,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1]; // release all DLSCH if needed - if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); - if (harq_ack[1] == 1) release_harq(eNB,UE_id,1,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1); } break; case 1: // multiplexing @@ -1766,7 +1867,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; // release all DLSCH if needed - if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); } else if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; @@ -1776,8 +1877,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1]; // release all DLSCH if needed - if (harq_ack[0] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); - if (harq_ack[1] == 1) release_harq(eNB,UE_id,1,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1); } else { // num_pucch_resources (M) > 1 pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; @@ -1788,8 +1889,8 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, if (uci->num_pucch_resources == 3) pdu->harq_indication_tdd_rel13.harq_data[2].multiplex.value_0 = harq_ack[2]; if (uci->num_pucch_resources == 4) pdu->harq_indication_tdd_rel13.harq_data[3].multiplex.value_0 = harq_ack[3]; // spatial-bundling in this case so release both HARQ if necessary - release_harq(eNB,UE_id,0,frame,subframe,tdd_multiplexing_mask); - release_harq(eNB,UE_id,1,frame,subframe,tdd_multiplexing_mask); + release_harq(eNB,UE_id,0,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); + release_harq(eNB,UE_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); } break; case 2: // special bundling (SR collision) @@ -1800,26 +1901,27 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, switch (harq_ack[0]) { case 0: + /* TODO: release_harq here? this whole code looks suspicious */ break; case 1: // check if M=1,4,7 if (uci->num_pucch_resources == 1 || uci->num_pucch_resources == 4 || tdd_config5_sf2scheds == 1 || tdd_config5_sf2scheds == 4 || tdd_config5_sf2scheds == 7) { - release_harq(eNB,UE_id,0,frame,subframe,0xffff); - release_harq(eNB,UE_id,1,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1); + release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1); } break; case 2: // check if M=2,5,8 if (uci->num_pucch_resources == 2 || tdd_config5_sf2scheds == 2 || tdd_config5_sf2scheds == 5 || tdd_config5_sf2scheds == 8) { - release_harq(eNB,UE_id,0,frame,subframe,0xffff); - release_harq(eNB,UE_id,1,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1); + release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1); } break; case 3: // check if M=3,6,9 if (uci->num_pucch_resources == 3 || tdd_config5_sf2scheds == 3 || tdd_config5_sf2scheds == 6 || tdd_config5_sf2scheds == 9) { - release_harq(eNB,UE_id,0,frame,subframe,0xffff); - release_harq(eNB,UE_id,1,frame,subframe,0xffff); + release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1); + release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1); } break; } @@ -1859,7 +1961,7 @@ void fill_crc_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint pthread_mutex_unlock(&eNB->UL_INFO_mutex); } -void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const relaying_type_t r_type) +void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { //RX processing for ue-specific resources (i LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c index 4730eed613198c04a2ced09ae6e6b6d3fc947fcc..772dff3bfdbe1b93fb76247df6bc3095351c01aa 100644 --- a/openair1/SCHED/prach_procedures.c +++ b/openair1/SCHED/prach_procedures.c @@ -30,10 +30,9 @@ * \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 "nfapi_interface.h" #include "fapi_l1.h" #include "nfapi_pnf.h" diff --git a/openair1/SCHED/pusch_pc.c b/openair1/SCHED/pusch_pc.c deleted file mode 100644 index caef13162726849dd38948a8079adaca4982bcc9..0000000000000000000000000000000000000000 --- a/openair1/SCHED/pusch_pc.c +++ /dev/null @@ -1,275 +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 pusch_pc.c - * \brief Implementation of UE PUSCH Power Control procedures from 36.213 LTE specifications (Section - * \author R. Knopp - * \date 2011 - * \version 0.1 - * \company Eurecom - * \email: knopp@eurecom.fr - * \note - * \warning - */ - -#include "defs.h" -#include "PHY/defs.h" -#include "PHY/LTE_TRANSPORT/proto.h" -#include "PHY/extern.h" - -// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25 -int16_t hundred_times_delta_TF[100] = {-32768,-1268,-956,-768,-631,-523,-431,-352,-282,-219,-161,-107,-57,-9,36,79,120,159,197,234,269,304,337,370,402,434,465,495,525,555,583,612,640,668,696,723,750,777,803,829,856,881,907,933,958,983,1008,1033,1058,1083,1108,1132,1157,1181,1205,1229,1254,1278,1302,1325,1349,1373,1397,1421,1444,1468,1491,1515,1538,1562,1585,1609,1632,1655,1679,1702,1725,1748,1772,1795,1818,1841,1864,1887,1910,1933,1956,1980,2003,2026,2049,2072,2095,2118,2141,2164,2186,2209,2232,2255}; -uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000}; - -int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor) -{ - - uint32_t Nre,sumKr,MPR_x100,Kr,r; - uint16_t beta_offset_pusch; - - DevAssert( UE_id < NUMBER_OF_UE_MAX+1 ); - DevAssert( harq_pid < 8 ); - - Nre = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_initial * - eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12; - - sumKr = 0; - - for (r=0; r<eNB->ulsch[UE_id]->harq_processes[harq_pid]->C; r++) { - if (r<eNB->ulsch[UE_id]->harq_processes[harq_pid]->Cminus) - Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kminus; - else - Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus; - - sumKr += Kr; - } - - if (Nre==0) - return(0); - - MPR_x100 = 100*sumKr/Nre; - // Note: MPR=is the effective spectral efficiency of the PUSCH - // FK 20140908 sumKr is only set after the ulsch_encoding - - beta_offset_pusch = 8; - //(eNB->ulsch[UE_id]->harq_processes[harq_pid]->control_only == 1) ? eNB->ulsch[UE_id]->beta_offset_cqi_times8:8; - - DevAssert( UE_id < NUMBER_OF_UE_MAX ); -//#warning "This condition happens sometimes. Need more investigation" // navid - //DevAssert( MPR_x100/6 < 100 ); - - if (1==1) { //eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) { - // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) - if (bw_factor == 1) { - uint8_t nb_rb = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; - return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB[nb_rb-1]; - } else - return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)); - } else { - return(0); - } -} - -int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) -{ - - int8_t UE_id; - - if ((RC.eNB == NULL) || (module_idP > RC.nb_inst) || (CC_id > RC.nb_CC[module_idP])) { - LOG_E(PHY,"get_UE_stats: No eNB found (or not allocated) for Mod_id %d,CC_id %d\n",module_idP,CC_id); - return -1; - } - - UE_id = find_ulsch( rnti, RC.eNB[module_idP][CC_id],SEARCH_EXIST); - - if (UE_id == -1) { - // not found - return 0; - } - - return get_hundred_times_delta_IF_eNB( RC.eNB[module_idP][CC_id], UE_id, harq_pid, 0 ); -} - -int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_pid) -{ - - uint32_t Nre = 2*ue->ulsch[eNB_id]->harq_processes[harq_pid]->Nsymb_initial * - ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb*12; - - if (Nre==0) - return(0); - - uint32_t MPR_x100 = 100*ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS/Nre; - // Note: MPR=is the effective spectral efficiency of the PUSCH - // FK 20140908 sumKr is only set after the ulsch_encoding - - uint16_t beta_offset_pusch = (ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? - ue->ulsch[eNB_id]->beta_offset_cqi_times8:8; - - if (ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled == 1) { - // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) - return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)); - } else { - return(0); - } -} - - - -uint8_t alpha_lut[8] = {0,40,50,60,70,80,90,100}; - -void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag) -{ - - - uint8_t harq_pid = subframe2harq_pid(&ue->frame_parms, - proc->frame_tx, - proc->subframe_tx); - - uint8_t nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb; - int16_t PL; - - - // P_pusch = 10*log10(nb_rb + P_opusch(j)+ alpha(u)*PL + delta_TF(i) + f(i)) - // - // P_opusch(0) = P_oPTR + deltaP_Msg3 if PUSCH is transporting Msg3 - // else - // P_opusch(0) = PO_NOMINAL_PUSCH(j) + P_O_UE_PUSCH(j) - PL = get_PL(ue->Mod_id,ue->CC_id,eNB_id); - - ue->ulsch[eNB_id]->Po_PUSCH = (hundred_times_log10_NPRB[nb_rb-1]+ - get_hundred_times_delta_IF(ue,eNB_id,harq_pid) + - 100*ue->ulsch[eNB_id]->f_pusch)/100; - - if(ue->ulsch_Msg3_active[eNB_id] == 1) { // Msg3 PUSCH - - ue->ulsch[eNB_id]->Po_PUSCH += (get_Po_NOMINAL_PUSCH(ue->Mod_id,0) + PL); - - - LOG_I(PHY,"[UE %d][RAPROC] frame %d, subframe %d: Msg3 Po_PUSCH %d dBm (%d,%d,100*PL=%d,%d,%d)\n", - ue->Mod_id,proc->frame_tx,proc->subframe_tx,ue->ulsch[eNB_id]->Po_PUSCH, - 100*get_Po_NOMINAL_PUSCH(ue->Mod_id,0), - hundred_times_log10_NPRB[nb_rb-1], - 100*PL, - get_hundred_times_delta_IF(ue,eNB_id,harq_pid), - 100*ue->ulsch[eNB_id]->f_pusch); - } else if (j==0) { // SPS PUSCH - } else if (j==1) { // Normal PUSCH - - ue->ulsch[eNB_id]->Po_PUSCH += ((alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]*PL)/100); - ue->ulsch[eNB_id]->Po_PUSCH += ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; - ue->ulsch[eNB_id]->PHR = ue->tx_power_max_dBm-ue->ulsch[eNB_id]->Po_PUSCH; - - if (ue->ulsch[eNB_id]->PHR < -23) - ue->ulsch[eNB_id]->PHR = -23; - else if (ue->ulsch[eNB_id]->PHR > 40) - ue->ulsch[eNB_id]->PHR = 40; - - LOG_D(PHY,"[UE %d][PUSCH %d] AbsSubframe %d.%d: nb_rb: %d, Po_PUSCH %d dBm : tx power %d, Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n", - ue->Mod_id,harq_pid,proc->frame_tx,proc->subframe_tx,nb_rb, - ue->ulsch[eNB_id]->Po_PUSCH, - ue->tx_power_max_dBm, - ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH, - hundred_times_log10_NPRB[nb_rb-1]/100.0, - ue->ulsch[eNB_id]->PHR, - PL, - alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]*PL/100.0, - get_hundred_times_delta_IF(ue,eNB_id,harq_pid)/100.0, - ue->ulsch[eNB_id]->f_pusch); - } - -} - -int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id,uint8_t eNB_index) -{ - - return PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->PHR; -} - -// uint8_t eNB_id,uint8_t harq_pid, uint8_t UE_id, -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) -{ - - /// The payload + CRC size in bits, "B" - uint32_t B; - /// Number of code segments - uint32_t C; - /// Number of "small" code segments - uint32_t Cminus; - /// Number of "large" code segments - uint32_t Cplus; - /// Number of bits in "small" code segments (<6144) - uint32_t Kminus; - /// Number of bits in "large" code segments (<6144) - uint32_t Kplus; - /// Total number of bits across all segments - uint32_t sumKr; - /// Number of "Filler" bits - uint32_t F; - // num resource elements - uint32_t num_re=0.0; - // num symbols - uint32_t num_symb=0.0; - /// effective spectral efficiency of the PUSCH - uint32_t MPR_x100=0; - /// beta_offset - uint16_t beta_offset_pusch_x8=8; - /// delta mcs - float delta_mcs=0.0; - /// bandwidth factor - float bw_factor=0.0; - - B= tbs+24; - lte_segmentation(NULL, - NULL, - B, - &C, - &Cplus, - &Cminus, - &Kplus, - &Kminus, - &F); - - - sumKr = Cminus*Kminus + Cplus*Kplus; - num_symb = 12-(ncp<<1)-(use_srs==0?0:1); - num_re = num_symb * nb_rb * 12; - - if (num_re == 0) - return(0); - - MPR_x100 = 100*sumKr/num_re; - - if (control_only == 1 ) - beta_offset_pusch_x8=8; // fixme - - //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8; - - // if deltamcs_enabledm - delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0); - bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0); -#ifdef DEBUG_SEGMENTATION - printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n", - (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor); -#endif - return (int16_t)ceil(delta_mcs + bw_factor); - -} diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 534023632c2cdc9354efcdaa0f617d9f79bf4fab..d5a78c7f98e05be2c8a72687643f9ba1c3e92313 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -30,16 +30,15 @@ * \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 "PHY/MODULATION/modulation_eNB.h" #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -138,12 +137,22 @@ static void *feptx_thread(void *param) { RU_t *ru = (RU_t *)param; RU_proc_t *proc = &ru->proc; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + + thread_top_init("feptx_thread",1,85000,120000,500000); + pthread_setname_np( pthread_self(),"feptx processing"); + LOG_I(PHY,"thread feptx created id=%ld\n", syscall(__NR_gettid)); + //CPU_SET(6, &cpuset); + //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + //wait_sync("feptx_thread"); - thread_top_init("feptx_thread",0,870000,1000000,1000000); + while (!oai_exit) { if (wait_on_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread")<0) break; + //stop_meas(&ru->ofdm_mod_wakeup_stats); feptx0(ru,1); if (release_thread(&proc->mutex_feptx,&proc->instance_cnt_feptx,"feptx thread")<0) break; @@ -152,6 +161,10 @@ static void *feptx_thread(void *param) { exit_fun( "ERROR pthread_cond_signal" ); return NULL; } + /*if(opp_enabled == 1 && ru->ofdm_mod_wakeup_stats.diff_now>30*3000){ + print_meas_now(&ru->ofdm_mod_wakeup_stats,"fep wakeup",stderr); + printf("delay in fep wakeup in frame_tx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx); + }*/ } @@ -168,7 +181,7 @@ void feptx_ofdm_2thread(RU_t *ru) { wait.tv_sec=0; wait.tv_nsec=5000000L; - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); start_meas(&ru->ofdm_mod_stats); if (subframe_select(fp,subframe) == SF_UL) return; @@ -198,17 +211,25 @@ void feptx_ofdm_2thread(RU_t *ru) { exit_fun( "ERROR pthread_cond_signal" ); return; } + //start_meas(&ru->ofdm_mod_wakeup_stats); pthread_mutex_unlock( &proc->mutex_feptx ); } // call first slot in this thread feptx0(ru,0); + start_meas(&ru->ofdm_mod_wait_stats); wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread"); + stop_meas(&ru->ofdm_mod_wait_stats); + /*if(opp_enabled == 1 && ru->ofdm_mod_wait_stats.diff_now>30*3000){ + print_meas_now(&ru->ofdm_mod_wait_stats,"fep wakeup",stderr); + printf("delay in feptx wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx); + }*/ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); stop_meas(&ru->ofdm_mod_stats); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); } @@ -426,12 +447,23 @@ static void *fep_thread(void *param) { RU_t *ru = (RU_t *)param; RU_proc_t *proc = &ru->proc; - thread_top_init("fep_thread",0,870000,1000000,1000000); + thread_top_init("fep_thread",1,100000,120000,5000000); + pthread_setname_np( pthread_self(),"fep processing"); + LOG_I(PHY,"thread fep created id=%ld\n", syscall(__NR_gettid)); + + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + //CPU_SET(2, &cpuset); + //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + //wait_sync("fep_thread"); while (!oai_exit) { - if (wait_on_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread")<0) break; + if (wait_on_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread")<0) break; + //stop_meas(&ru->ofdm_demod_wakeup_stats); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX1, 1 ); fep0(ru,0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX1, 0 ); if (release_thread(&proc->mutex_fep,&proc->instance_cnt_fep,"fep thread")<0) break; if (pthread_cond_signal(&proc->cond_fep) != 0) { @@ -439,6 +471,10 @@ static void *fep_thread(void *param) { exit_fun( "ERROR pthread_cond_signal" ); return NULL; } + /*if(opp_enabled == 1 && ru->ofdm_demod_wakeup_stats.diff_now>30*3000){ + print_meas_now(&ru->ofdm_demod_wakeup_stats,"fep wakeup",stderr); + printf("delay in fep wakeup in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx); + }*/ } @@ -489,6 +525,7 @@ void ru_fep_full_2thread(RU_t *ru) { wait.tv_sec=0; wait.tv_nsec=5000000L; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); start_meas(&ru->ofdm_demod_stats); if (pthread_mutex_timedlock(&proc->mutex_fep,&wait) != 0) { @@ -512,15 +549,23 @@ void ru_fep_full_2thread(RU_t *ru) { exit_fun( "ERROR pthread_cond_signal" ); return; } + //start_meas(&ru->ofdm_demod_wakeup_stats); pthread_mutex_unlock( &proc->mutex_fep ); // call second slot in this symbol fep0(ru,1); + start_meas(&ru->ofdm_demod_wait_stats); wait_on_busy_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread"); + stop_meas(&ru->ofdm_demod_wait_stats); + if(opp_enabled == 1 && ru->ofdm_demod_wakeup_stats.diff_now>30*3000){ + print_meas_now(&ru->ofdm_demod_wakeup_stats,"fep wakeup",stderr); + printf("delay in fep wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx); + } stop_meas(&ru->ofdm_demod_stats); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 ); } diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/sched_common.h similarity index 97% rename from openair1/SCHED/defs.h rename to openair1/SCHED/sched_common.h index 57943d9bc26d9117c3554251e550d94612e0bc7e..0ff778ca20da2014d3bcaef22f7add50541fa57a 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/sched_common.h @@ -25,8 +25,8 @@ \email knopp@eurecom.fr */ -#ifndef __openair_SCHED_H__ -#define __openair_SCHED_H__ +#ifndef __openair_SCHED_COMMON_H__ +#define __openair_SCHED_COMMON_H__ #include "PHY/defs.h" #include "PHY_INTERFACE/defs.h" @@ -216,6 +216,9 @@ void prach_procedures(PHY_VARS_eNB *eNB, void prach_procedures(PHY_VARS_eNB *eNB); #endif +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" + /*! \brief Function to compute subframe Number(DL and S) as a function of Frame type and TDD Configuration @param frame_parms Pointer to DL frame parameter descriptor @returns Subframe Number (DL,S) @@ -239,13 +242,8 @@ lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) */ dci_detect_mode_t dci_detect_mode_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); -/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index. Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler. - @param Mod_id Index of eNB - @param CC_id Component Carrier Index - @param subframe Subframe index - @returns Subframe type (DL,UL,S) -*/ -lte_subframe_t get_subframe_direction(uint8_t Mod_id, uint8_t CC_id,uint8_t subframe); + + /*! \brief Function to indicate PHICH transmission subframes. Implements Table 9.1.2-1 for TDD. @param frame_parms Pointer to DL frame parameter descriptor diff --git a/openair1/SCHED/extern.h b/openair1/SCHED/sched_common_extern.h similarity index 88% rename from openair1/SCHED/extern.h rename to openair1/SCHED/sched_common_extern.h index b1e8df67ef86a5bb11c9cf9bb2d5dd57374d2eee..b5edc6f38e390dc027a1f3699c2a05c157778092 100644 --- a/openair1/SCHED/extern.h +++ b/openair1/SCHED/sched_common_extern.h @@ -24,16 +24,7 @@ #ifndef __SCHED_EXTERN_H__ #define __SCHED_EXTERN_H__ -#include "defs.h" -//#include "dlc_engine.h" - -extern int openair_sched_status; - -//extern int exit_PHY; -//extern int exit_PHY_ack; - -extern int synch_wait_cnt; - +#include "sched_eNB.h" extern int16_t hundred_times_delta_TF[100]; extern uint16_t hundred_times_log10_NPRB[100]; diff --git a/openair1/SCHED/sched_common_vars.h b/openair1/SCHED/sched_common_vars.h new file mode 100644 index 0000000000000000000000000000000000000000..2cae2aa96f21bc49bc32dc156ac688b8c22f72eb --- /dev/null +++ b/openair1/SCHED/sched_common_vars.h @@ -0,0 +1,28 @@ +/* + * 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 <stdint.h> + + +// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25 +int16_t hundred_times_delta_TF[100] = {-32768,-1268,-956,-768,-631,-523,-431,-352,-282,-219,-161,-107,-57,-9,36,79,120,159,197,234,269,304,337,370,402,434,465,495,525,555,583,612,640,668,696,723,750,777,803,829,856,881,907,933,958,983,1008,1033,1058,1083,1108,1132,1157,1181,1205,1229,1254,1278,1302,1325,1349,1373,1397,1421,1444,1468,1491,1515,1538,1562,1585,1609,1632,1655,1679,1702,1725,1748,1772,1795,1818,1841,1864,1887,1910,1933,1956,1980,2003,2026,2049,2072,2095,2118,2141,2164,2186,2209,2232,2255}; +uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000}; + diff --git a/openair1/SCHED/sched_eNB.h b/openair1/SCHED/sched_eNB.h new file mode 100644 index 0000000000000000000000000000000000000000..e03b7f6b62be7579cdefd02a17b69db3e2809c95 --- /dev/null +++ b/openair1/SCHED/sched_eNB.h @@ -0,0 +1,227 @@ +/* + * 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 + */ + +/* + \author R. Knopp, F. Kaltenberger + \company EURECOM + \email knopp@eurecom.fr +*/ + +#ifndef __openair_SCHED_ENB_H__ +#define __openair_SCHED_ENB_H__ + +#include "PHY/defs_eNB.h" +#include "PHY_INTERFACE/phy_interface.h" +#include "sched_common.h" + +enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0, + TOP_LEVEL_SCHEDULER_THREAD_INDEX, + DLC_SCHED_THREAD_INDEX, + openair_SCHED_NB_THREADS + }; // do not modify this line + + +#define OPENAIR_THREAD_PRIORITY 255 + + +#define OPENAIR_THREAD_STACK_SIZE PTHREAD_STACK_MIN //4096 //RTL_PTHREAD_STACK_MIN*6 +//#define DLC_THREAD_STACK_SIZE 4096 //DLC stack size +//#define UE_SLOT_PARALLELISATION + +enum openair_SCHED_STATUS { + openair_SCHED_STOPPED=1, + openair_SCHED_STARTING, + openair_SCHED_STARTED, + openair_SCHED_STOPPING +}; + +enum openair_ERROR { + // HARDWARE CAUSES + openair_ERROR_HARDWARE_CLOCK_STOPPED= 1, + + // SCHEDULER CAUSE + openair_ERROR_OPENAIR_RUNNING_LATE, + openair_ERROR_OPENAIR_SCHEDULING_FAILED, + + // OTHERS + openair_ERROR_OPENAIR_TIMING_OFFSET_OUT_OF_BOUNDS, +}; + +enum openair_SYNCH_STATUS { + openair_NOT_SYNCHED=1, + openair_SYNCHED, + openair_SCHED_EXIT +}; + +enum openair_HARQ_TYPE { + openair_harq_DL = 0, + openair_harq_UL, + openair_harq_RA +}; + +#define DAQ_AGC_ON 1 +#define DAQ_AGC_OFF 0 + + +/** @addtogroup _PHY_PROCEDURES_ + * @{ + */ + + + +/*! \brief Scheduling for eNB TX procedures in normal subframes. + @param phy_vars_eNB Pointer to eNB variables on which to act + @param abstraction_flag Indicator of PHY abstraction + @param do_meas Do inline timing measurement +*/ +void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,int do_meas); + +/*! \brief Scheduling for eNB RX UE-specific procedures in normal subframes. + @param phy_vars_eNB Pointer to eNB variables on which to act + @param proc Pointer to RXn-TXnp4 proc information +*/ +void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc); + +/*! \brief Scheduling for eNB TX procedures in TDD S-subframes. + @param phy_vars_eNB Pointer to eNB variables on which to act + @param proc Pointer to RXn-TXnp4 proc information + @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying +*/ + +/*! \brief Scheduling for eNB RX common procedures in normal subframes. + @param phy_vars_eNB Pointer to eNB variables on which to act + @param abstraction_flag Indicator of PHY abstraction +*/ +void phy_procedures_eNB_common_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc); + +/*! \brief Scheduling for eNB TX procedures in TDD S-subframes. + @param phy_vars_eNB Pointer to eNB variables on which to act +*/ + +void phy_procedures_eNB_S_TX(PHY_VARS_eNB *phy_vars_eNB); + +/*! \brief Scheduling for eNB RX procedures in TDD S-subframes. + @param phy_vars_eNB Pointer to eNB variables on which to act +*/ +void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc); + +/*! \brief Scheduling for eNB PRACH RX procedures + @param phy_vars_eNB Pointer to eNB variables on which to act + @param br_flag indicator for eMTC PRACH +*/ +#ifdef Rel14 +void prach_procedures(PHY_VARS_eNB *eNB, + int br_flag); +#else +void prach_procedures(PHY_VARS_eNB *eNB); +#endif + +/*! \brief Function to compute timing of Msg3 transmission on UL-SCH (first UE transmission in RA procedure). This implements the timing in paragraph a) from Section 6.1.1 in 36.213 (p. 17 in version 8.6). Used by eNB upon transmission of random-access response (RA_RNTI) to program corresponding ULSCH reception procedure. Used by UE upon reception of random-access response (RA_RNTI) to program corresponding ULSCH transmission procedure. This does not support the UL_delay field in RAR (always assumed to be 0). + @param frame_parms Pointer to DL frame parameter descriptor + @param current_subframe Index of subframe where RA_RNTI was received + @param current_frame Index of frame where RA_RNTI was received + @param frame Frame index where Msg3 is to be transmitted (n+6 mod 10 for FDD, different for TDD) + @param subframe subframe index where Msg3 is to be transmitted (n, n+1 or n+2) +*/ +void get_Msg3_alloc(LTE_DL_FRAME_PARMS *frame_parms, + uint8_t current_subframe, + uint32_t current_frame, + uint32_t *frame, + uint8_t *subframe); + +/*! \brief Function to compute timing of Msg3 retransmission on UL-SCH (first UE transmission in RA procedure). + @param frame_parms Pointer to DL frame parameter descriptor + @param current_subframe Index of subframe where RA_RNTI was received + @param current_frame Index of frame where RA_RNTI was received + @param frame Frame index where Msg3 is to be transmitted (n+6 mod 10 for FDD, different for TDD) + @param subframe subframe index where Msg3 is to be transmitted (n, n+1 or n+2) +*/ +void get_Msg3_alloc_ret(LTE_DL_FRAME_PARMS *frame_parms, + uint8_t current_subframe, + uint32_t current_frame, + uint32_t *frame, + uint8_t *subframe); + +/*! \brief Get ULSCH harq_pid for Msg3 from RAR subframe. This returns n+k mod 10 (k>6) and corresponds to the rule in Section 6.1.1 from 36.213 + @param frame_parms Pointer to DL Frame Parameters + @param frame Frame index + @param current_subframe subframe of RAR transmission + @returns harq_pid (0 ... 7) + */ +uint8_t get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t current_subframe); + +/*! \brief Get ULSCH harq_pid from PHICH subframe + @param frame_parms Pointer to DL Frame Parameters + @param subframe subframe of PHICH + @returns harq_pid (0 ... 7) + */ + +/*! \brief Function to indicate failure of contention resolution or RA procedure. It places the UE back in PRACH mode. + @param Mod_id Instance index of UE + @param CC_id Component Carrier Index + @param eNB_index Index of eNB + */ +void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + +/*! \brief Indicates the SR TXOp in current subframe for eNB and particular UE index. Implements Table 10.1-5 from 36.213. + @param phy_vars_eNB Pointer to eNB variables + @param UE_id ID of UE which may be issuing the SR + @returns 1 if TXOp is active. +*/ +uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id); + +int8_t find_ue_dlsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); +int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); + + + + + +void schedule_response(Sched_Rsp_t *Sched_INFO); + +LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti); + +/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index. Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler. + @param Mod_id Index of eNB + @param CC_id Component Carrier Index + @param subframe Subframe index + @returns Subframe type (DL,UL,S) +*/ +lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe); + + +int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor); + +int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid); + +int16_t get_target_pusch_rx_power(module_id_t module_idP, uint8_t CC_id); +int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id); + +int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); + +void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); + +/*@}*/ + + +#endif + + diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c similarity index 98% rename from openair1/SCHED/phy_procedures_lte_ue.c rename to openair1/SCHED_UE/phy_procedures_lte_ue.c index c73e14b28839d7c4b4bdf26307ee9e10263b2c94..fb493d395ac41017bb921c1b79114dac1b53693e 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -33,22 +33,23 @@ #define _GNU_SOURCE #include "assertions.h" -#include "defs.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern_ue.h" #include <sched.h> #include "targets/RT/USER/lte-softmodem.h" -#define DEBUG_PHY_PROC +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "SCHED_UE/sched_UE.h" +#include "PHY/MODULATION/modulation_UE.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" + +//#define DEBUG_PHY_PROC #ifndef PUCCH #define PUCCH #endif -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -58,13 +59,13 @@ # include "intertask_interface.h" #endif -#include "PHY/defs.h" +#include "PHY/defs_UE.h" -#include "PHY/CODING/extern.h" +#include "PHY/CODING/coding_extern.h" #include "T.h" -#include "PHY/TOOLS/defs.h" +#include "PHY/TOOLS/tools_defs.h" #define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs) #define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs) @@ -81,7 +82,7 @@ extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; #endif -#define UE_DEBUG_TRACE 1 +//#define UE_DEBUG_TRACE 1 void dump_dlsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid) { @@ -1389,7 +1390,6 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin frame_tx, eNB_id, subframe_tx); - LOG_D(PHY,"Got prach_resources for eNB %d address %p, RRCCommon %p\n",eNB_id,ue->prach_resources[eNB_id],UE_mac_inst[ue->Mod_id].radioResourceConfigCommon); LOG_D(PHY,"Prach resources %p\n",ue->prach_resources[eNB_id]); } } @@ -1411,7 +1411,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue->prach_resources[eNB_id]->ra_PreambleIndex = 19; } - LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d,PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n", + LOG_D(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d,PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n", ue->Mod_id, frame_tx, subframe_tx, @@ -2333,7 +2333,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin } -void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) { +void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) { LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; @@ -2452,7 +2452,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui #endif } -void phy_procedures_UE_S_TX(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type) +void phy_procedures_UE_S_TX(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t abstraction_flag) { int aa;//i,aa; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; @@ -2772,15 +2772,17 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint subframe_rx, eNB_id, ue->frame_parms.nb_antenna_ports_eNB==1?SISO:ALAMOUTI, - ue->high_speed_flag, - ue->is_secondary_ue); + ue->high_speed_flag); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_IN); - //printf("Decode SIB frame param agregation + DCI %d %d \n",agregationLevel,dciFormat); - + /*printf("Decode SIB frame param aggregation + DCI %d %d, num_pdcch_symbols %d\n", + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->dciFormat, + ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); + */ //agregation level == FF means no configuration on if(ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->agregationLevel == 0xFF || ue->decode_SIB) { @@ -4140,8 +4142,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { #ifdef UE_SLOT_PARALLELISATION int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, - uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode, - relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn) { + uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { int l,l2; int pmch_flag=0; @@ -4191,8 +4192,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr } #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", - (r_type == multicast_relay) ? "RN/UE" : "UE", + LOG_D(PHY,"[UE %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", ue->Mod_id,frame_rx, subframe_rx); #endif @@ -4657,8 +4657,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, - uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode, - relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn) { + uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { int l,l2; int pilot1; @@ -4707,8 +4706,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, } #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", - (r_type == multicast_relay) ? "RN/UE" : "UE", + LOG_D(PHY,"[UE %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n", ue->Mod_id,frame_rx, subframe_rx); #endif @@ -5133,38 +5131,9 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, return (0); } -#if defined(Rel10) || defined(Rel14) - -int phy_procedures_RN_UE_RX(uint8_t slot_rx, uint8_t next_slot, relaying_type_t r_type) -{ - - int do_proc =0; // do nothing by default - - switch(r_type) { - case no_relay: - do_proc=no_relay; // perform the normal UE operation - break; - - case multicast_relay: - if (slot_rx > 12) - do_proc = 0; // do nothing - else // SF#1, SF#2, SF3, SF#3, SF#4, SF#5, SF#6(do rx slot 12) - do_proc = multicast_relay ; // do PHY procedures UE RX - - break; - - default: // should'not be here - LOG_W(PHY,"Not supported relay type %d, do nothing \n", r_type); - do_proc= 0; - break; - } - return do_proc; -} -#endif -void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode, - relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn) +void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode) { #if defined(ENABLE_ITTI) MessageDef *msg_p; @@ -5226,30 +5195,22 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)|| (ue->frame_parms.frame_type == FDD)) { - phy_procedures_UE_TX(ue,proc,eNB_id,abstraction_flag,mode,r_type); + phy_procedures_UE_TX(ue,proc,eNB_id,abstraction_flag,mode); } if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_DL) || - (ue->frame_parms.frame_type == FDD)) { -#if defined(Rel10) || defined(Rel14) - - if (phy_procedures_RN_UE_RX(subframe_rx, subframe_tx, r_type) != 0 ) -#endif - phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode,r_type,phy_vars_rn); + (ue->frame_parms.frame_type == FDD)) { + phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); } if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_S) && (slot==1)) { - phy_procedures_UE_S_TX(ue,eNB_id,abstraction_flag,r_type); + phy_procedures_UE_S_TX(ue,eNB_id,abstraction_flag); } if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_S) && - (slot==0)) { -#if defined(Rel10) || defined(Rel14) - - if (phy_procedures_RN_UE_RX(subframe_rx, subframe_tx, r_type) != 0 ) -#endif - phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode,r_type,phy_vars_rn); + (slot==0)) { + phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); } if (ue->mac_enabled==1) { diff --git a/openair1/SCHED/pucch_pc.c b/openair1/SCHED_UE/pucch_pc.c similarity index 95% rename from openair1/SCHED/pucch_pc.c rename to openair1/SCHED_UE/pucch_pc.c index f01d0d96dd7df5ddbc65cc8270d0ea4d760e5b43..f03cd93d34995b4313c1104aebd30f439b6afc8f 100644 --- a/openair1/SCHED/pucch_pc.c +++ b/openair1/SCHED_UE/pucch_pc.c @@ -30,10 +30,11 @@ * \warning */ -#include "PHY/defs.h" -#include "SCHED/defs.h" -#include "PHY/LTE_TRANSPORT/proto.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "SCHED_UE/sched_UE.h" +#include "SCHED/sched_common_extern.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" int16_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt) { diff --git a/openair1/SCHED_UE/pusch_pc.c b/openair1/SCHED_UE/pusch_pc.c new file mode 100644 index 0000000000000000000000000000000000000000..588720f18cbeb1eb7e32dd27b1654a4e191e405e --- /dev/null +++ b/openair1/SCHED_UE/pusch_pc.c @@ -0,0 +1,136 @@ +/* + * 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 pusch_pc.c + * \brief Implementation of UE PUSCH Power Control procedures from 36.213 LTE specifications (Section + * \author R. Knopp + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr + * \note + * \warning + */ + +#include "sched_UE.h" +#include "SCHED/sched_common_extern.h" +#include "PHY/defs_UE.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/phy_extern_ue.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" + +int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_pid) +{ + + uint32_t Nre = 2*ue->ulsch[eNB_id]->harq_processes[harq_pid]->Nsymb_initial * + ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb*12; + + if (Nre==0) + return(0); + + uint32_t MPR_x100 = 100*ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS/Nre; + // Note: MPR=is the effective spectral efficiency of the PUSCH + // FK 20140908 sumKr is only set after the ulsch_encoding + + uint16_t beta_offset_pusch = (ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? + ue->ulsch[eNB_id]->beta_offset_cqi_times8:8; + + if (ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled == 1) { + // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) + return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)); + } else { + return(0); + } +} + + + +uint8_t alpha_lut[8] = {0,40,50,60,70,80,90,100}; + +void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag) +{ + + + uint8_t harq_pid = subframe2harq_pid(&ue->frame_parms, + proc->frame_tx, + proc->subframe_tx); + + uint8_t nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb; + int16_t PL; + + + // P_pusch = 10*log10(nb_rb + P_opusch(j)+ alpha(u)*PL + delta_TF(i) + f(i)) + // + // P_opusch(0) = P_oPTR + deltaP_Msg3 if PUSCH is transporting Msg3 + // else + // P_opusch(0) = PO_NOMINAL_PUSCH(j) + P_O_UE_PUSCH(j) + PL = get_PL(ue->Mod_id,ue->CC_id,eNB_id); + + ue->ulsch[eNB_id]->Po_PUSCH = (hundred_times_log10_NPRB[nb_rb-1]+ + get_hundred_times_delta_IF(ue,eNB_id,harq_pid) + + 100*ue->ulsch[eNB_id]->f_pusch)/100; + + if(ue->ulsch_Msg3_active[eNB_id] == 1) { // Msg3 PUSCH + + ue->ulsch[eNB_id]->Po_PUSCH += (get_Po_NOMINAL_PUSCH(ue->Mod_id,0) + PL); + + + LOG_I(PHY,"[UE %d][RAPROC] frame %d, subframe %d: Msg3 Po_PUSCH %d dBm (%d,%d,100*PL=%d,%d,%d)\n", + ue->Mod_id,proc->frame_tx,proc->subframe_tx,ue->ulsch[eNB_id]->Po_PUSCH, + 100*get_Po_NOMINAL_PUSCH(ue->Mod_id,0), + hundred_times_log10_NPRB[nb_rb-1], + 100*PL, + get_hundred_times_delta_IF(ue,eNB_id,harq_pid), + 100*ue->ulsch[eNB_id]->f_pusch); + } else if (j==0) { // SPS PUSCH + } else if (j==1) { // Normal PUSCH + + ue->ulsch[eNB_id]->Po_PUSCH += ((alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]*PL)/100); + ue->ulsch[eNB_id]->Po_PUSCH += ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; + ue->ulsch[eNB_id]->PHR = ue->tx_power_max_dBm-ue->ulsch[eNB_id]->Po_PUSCH; + + if (ue->ulsch[eNB_id]->PHR < -23) + ue->ulsch[eNB_id]->PHR = -23; + else if (ue->ulsch[eNB_id]->PHR > 40) + ue->ulsch[eNB_id]->PHR = 40; + + LOG_D(PHY,"[UE %d][PUSCH %d] AbsSubframe %d.%d: nb_rb: %d, Po_PUSCH %d dBm : tx power %d, Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n", + ue->Mod_id,harq_pid,proc->frame_tx,proc->subframe_tx,nb_rb, + ue->ulsch[eNB_id]->Po_PUSCH, + ue->tx_power_max_dBm, + ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH, + hundred_times_log10_NPRB[nb_rb-1]/100.0, + ue->ulsch[eNB_id]->PHR, + PL, + alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]*PL/100.0, + get_hundred_times_delta_IF(ue,eNB_id,harq_pid)/100.0, + ue->ulsch[eNB_id]->f_pusch); + } + +} + +int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id,uint8_t eNB_index) +{ + + return PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->PHR; +} + + diff --git a/openair1/SCHED_UE/sched_UE.h b/openair1/SCHED_UE/sched_UE.h new file mode 100644 index 0000000000000000000000000000000000000000..244d6789d24b523801a61be02f9e218d19c90630 --- /dev/null +++ b/openair1/SCHED_UE/sched_UE.h @@ -0,0 +1,275 @@ +/* + * 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 + */ + +/* + \author R. Knopp, F. Kaltenberger + \company EURECOM + \email knopp@eurecom.fr +*/ + +#ifndef __openair_SCHED_UE_H__ +#define __openair_SCHED_UE_H__ + +#include "PHY/defs_UE.h" +#include "../SCHED/sched_common.h" + +/*! \brief Scheduling for UE TX procedures in normal subframes. + @param phy_vars_ue Pointer to UE variables on which to act + @param proc Pointer to RXn-TXnp4 proc information + @param eNB_id Local id of eNB on which to act + @param abstraction_flag Indicator of PHY abstraction + @param mode calib/normal mode + @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying +*/ +void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode); +/*! \brief Scheduling for UE RX procedures in normal subframes. + @param last_slot Index of last slot (0-19) + @param phy_vars_ue Pointer to UE variables on which to act + @param proc Pointer to RXn_TXnp4 proc information + @param eNB_id Local id of eNB on which to act + @param abstraction_flag Indicator of PHY abstraction + @param mode calibration/debug mode + @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying + @param phy_vars_rn pointer to RN variables +*/ +int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode); +int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, + uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode); +#ifdef UE_SLOT_PARALLELISATION +void *UE_thread_slot1_dl_processing(void *arg); +#endif + +/*! \brief Scheduling for UE TX procedures in TDD S-subframes. + @param phy_vars_ue Pointer to UE variables on which to act + @param eNB_id Local id of eNB on which to act + @param abstraction_flag Indicator of PHY abstraction + @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying +*/ +void phy_procedures_UE_S_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag); + +/*! \brief Scheduling for UE RX procedures in TDD S-subframes. + @param phy_vars_ue Pointer to UE variables on which to act + @param eNB_id Local id of eNB on which to act + @param abstraction_flag Indicator of PHY abstraction + @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying +*/ +void phy_procedures_UE_S_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag); + +/*! \brief Get ULSCH harq_pid for Msg3 from RAR subframe. This returns n+k mod 10 (k>6) and corresponds to the rule in Section 6.1.1 from 36.213 + @param frame_parms Pointer to DL Frame Parameters + @param frame Frame index + @param current_subframe subframe of RAR transmission + @returns harq_pid (0 ... 7) + */ +uint8_t get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t current_subframe); + +/*! \brief Get ULSCH harq_pid from PHICH subframe + @param frame_parms Pointer to DL Frame Parameters + @param subframe subframe of PHICH + @returns harq_pid (0 ... 7) + */ + +/*! \brief Function to indicate failure of contention resolution or RA procedure. It places the UE back in PRACH mode. + @param Mod_id Instance index of UE + @param CC_id Component Carrier Index + @param eNB_index Index of eNB + */ +void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + +/*! \brief Function to indicate success of contention resolution or RA procedure. + @param Mod_id Instance index of UE + @param CC_id Component Carrier Index + @param eNB_index Index of eNB + */ +void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + +uint8_t phich_subframe_to_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe); + +/*! \brief Get PDSCH subframe (n+k) from PDCCH subframe n using relationship from Table 8-2 from 36.213 + @param frame_parms Pointer to DL Frame Parameters + @param n subframe of PDCCH + @returns PDSCH subframe (0 ... 7) (note: this is n+k from Table 8-2) + */ +uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); + + +/*! \brief Compute ACK/NACK information for PUSCH/PUCCH for UE transmission in subframe n. This function implements table 10.1-1 of 36.213, p. 69. + @param frame_parms Pointer to DL frame parameter descriptor + @param harq_ack Pointer to dlsch_ue harq_ack status descriptor + @param subframe Subframe for UE transmission (n in 36.213) + @param o_ACK Pointer to ACK/NAK payload for PUCCH/PUSCH + @returns status indicator for PUCCH/PUSCH transmission +*/ +uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe_tx,uint8_t subframe_rx,uint8_t *o_ACK, uint8_t cw_idx); + +/*! \brief Reset ACK/NACK information + @param frame_parms Pointer to DL frame parameter descriptor + @param harq_ack Pointer to dlsch_ue harq_ack status descriptor + @param subframe Subframe for UE transmission (n in 36.213) + @param o_ACK Pointer to ACK/NAK payload for PUCCH/PUSCH + @returns status indicator for PUCCH/PUSCH transmission +*/ +uint8_t reset_ack(LTE_DL_FRAME_PARMS *frame_parms, + harq_status_t *harq_ack, + unsigned char subframe_tx, + unsigned char subframe_rx, + unsigned char *o_ACK, + uint8_t *pN_bundled, + uint8_t cw_idx); + +/*! \brief Compute UL ACK subframe from DL subframe. This is used to retrieve corresponding DLSCH HARQ pid at eNB upon reception of ACK/NAK information on PUCCH/PUSCH. Derived from Table 10.1-1 in 36.213 (p. 69 in version 8.6) + @param frame_parms Pointer to DL frame parameter descriptor + @param subframe Subframe for UE transmission (n in 36.213) + @param ACK_index TTI bundling index (0,1) + @returns Subframe index for corresponding DL transmission +*/ +uint8_t ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe,uint8_t ACK_index); + +/*! \brief Computes number of DL subframes represented by a particular ACK received on UL (M from Table 10.1-1 in 36.213, p. 69 in version 8.6) + @param frame_parms Pointer to DL frame parameter descriptor + @param subframe Subframe for UE transmission (n in 36.213) + @returns Number of DL subframes (M) +*/ +uint8_t ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe); + +/*! \brief Indicates the SR TXOp in current subframe. Implements Table 10.1-5 from 36.213. + @param phy_vars_ue Pointer to UE variables + @param proc Pointer to RXn_TXnp4 thread context + @param eNB_id ID of eNB which is to receive the SR + @returns 1 if TXOp is active. +*/ +uint8_t is_SR_TXOp(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id); + +uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); + +/*! \brief Gives the UL frame corresponding to a PDDCH order in subframe n + @param frame_parms Pointer to DL frame parameters + @param frame Frame of received PDCCH + @param n subframe of PDCCH + @returns UL frame corresponding to pdcch order +*/ +uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n); + + +uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1); + + + +void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance); +void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint16_t timing_advance); + +unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb); + +void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + +/*! \brief This function retrives the resource (n1_pucch) corresponding to a PDSCH transmission in +subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch = Ncce + N1_pucch. For +TDD, this routine computes the complex procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2) +@param phy_vars_ue Pointer to UE variables +@param proc Pointer to RXn-TXnp4 proc information +@param harq_ack Pointer to dlsch_ue harq_ack status descriptor +@param eNB_id Index of eNB +@param b Pointer to PUCCH payload (b[0],b[1]) +@param SR 1 means there's a positive SR in parallel to ACK/NAK +@returns n1_pucch +*/ +uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue, + UE_rxtx_proc_t *proc, + harq_status_t *harq_ack, + uint8_t eNB_id, + uint8_t *b, + uint8_t SR); + + + + +/*! \brief This function retrieves the PHY UE mode. It is used as a helper function for the UE MAC. + @param Mod_id Local UE index on which to act + @param CC_id Component Carrier Index + @param eNB_index ID of eNB + @returns UE mode +*/ +UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + +/*! \brief This function implements the power control mechanism for PUCCH from 36.213. + @param phy_vars_ue PHY variables + @param proc Pointer to proc descriptor + @param eNB_id Index of eNB + @param pucch_fmt Format of PUCCH that is being transmitted + @returns Transmit power + */ +int16_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt); + +/*! \brief This function implements the power control mechanism for PUCCH from 36.213. + @param phy_vars_ue PHY variables + @param proc Pointer to proc descriptor + @param eNB_id Index of eNB + @param j index of type of PUSCH (SPS, Normal, Msg3) + @returns Transmit power + */ +void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag); + +/*! \brief This function implements the power control mechanism for SRS from 36.213. + @param phy_vars_ue PHY variables + @param proc Pointer to proc descriptor + @param eNB_id Index of eNB + @param j index of type of PUSCH (SPS, Normal, Msg3) + @returns Transmit power + */ +void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag); + +void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id); + +int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index); + + + +LTE_DL_FRAME_PARMS *get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id); + +MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); + +int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid); + + +int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid); + +int16_t get_target_pusch_rx_power(module_id_t module_idP, uint8_t CC_id); +int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id); + +int get_ue_active_harq_pid(uint8_t Mod_id,uint8_t CC_id,uint16_t rnti,int frame, uint8_t subframe,uint8_t *harq_pid,uint8_t *round,uint8_t ul_flag); + +void dump_dlsch(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid); +void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe); +void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe); + +void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid); + + +int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); + +void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); + +/*@}*/ + + +#endif + + diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED_UE/srs_pc.c similarity index 96% rename from openair1/SCHED/srs_pc.c rename to openair1/SCHED_UE/srs_pc.c index 04dacecc25a5aa59e6feb2ea35811dbe913082fc..9463db2cd62b594db9fad1adeb7514fbcd34516e 100644 --- a/openair1/SCHED/srs_pc.c +++ b/openair1/SCHED_UE/srs_pc.c @@ -30,9 +30,10 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/LTE_TRANSPORT/proto.h" -#include "PHY/extern.h" +#include "PHY/defs_UE.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/phy_extern_ue.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag) { diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c index b578721a1a0ffed4b79f7956551d8ae3fe49c00c..b90961a1c092fa84cdc6ee1fd2e057369fe44060 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -39,6 +39,13 @@ #include <fcntl.h> #include <errno.h> #include "platform_constants.h" +#ifdef UE_NAS_USE_TUN +#include <sys/ioctl.h> +#include <sys/socket.h> +#include <linux/if.h> +#include <linux/if_tun.h> +#include "openairinterface5g_limits.h" +#endif char nl_rx_buf[NL_MAX_PAYLOAD]; @@ -47,12 +54,121 @@ struct nlmsghdr *nas_nlh_tx = NULL; struct nlmsghdr *nas_nlh_rx = NULL; struct iovec nas_iov_tx; struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)}; +#ifdef UE_NAS_USE_TUN +int nas_sock_fd[NUMBER_OF_UE_MAX]; +#else int nas_sock_fd; +#endif struct msghdr nas_msg_tx; struct msghdr nas_msg_rx; #define GRAAL_NETLINK_ID 31 +#ifdef UE_NAS_USE_TUN + +static int tun_alloc(char *dev) +{ + struct ifreq ifr; + int fd, err; + + if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) { + printf("[TUN] failed to open /dev/net/tun\n"); + return -1; + } + + memset(&ifr, 0, sizeof(ifr)); + + /* Flags: IFF_TUN - TUN device (no Ethernet headers) + * IFF_TAP - TAP device + * + * IFF_NO_PI - Do not provide packet information + */ + ifr.ifr_flags = IFF_TUN | IFF_NO_PI; + if( *dev ) + strncpy(ifr.ifr_name, dev, IFNAMSIZ); + + if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){ + close(fd); + return err; + } + strcpy(dev, ifr.ifr_name); + return fd; +} + +int netlink_init(void) +{ + int i; + int ret; + + char ifname[64]; + for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + sprintf(ifname, "oip%d", i+1); + nas_sock_fd[i] = tun_alloc(ifname); + + if (nas_sock_fd[i] == -1) { + printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd[i],errno, strerror(errno)); +#if defined(LINK_ENB_PDCP_TO_IP_DRIVER) + exit(1); +#endif + } + + printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd[i]); + +#if !defined(PDCP_USE_NETLINK_QUEUES) + ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK); + + if (ret == -1) { + printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno)); +#if defined(LINK_ENB_PDCP_TO_IP_DRIVER) + exit(1); +#endif + } + +#endif + + memset(&nas_src_addr, 0, sizeof(nas_src_addr)); + nas_src_addr.nl_family = AF_NETLINK; + nas_src_addr.nl_pid = 1;//getpid(); /* self pid */ + nas_src_addr.nl_groups = 0; /* not in mcast groups */ + ret = bind(nas_sock_fd[i], (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr)); + + + + memset(&nas_dest_addr, 0, sizeof(nas_dest_addr)); + nas_dest_addr.nl_family = AF_NETLINK; + nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ + nas_dest_addr.nl_groups = 0; /* unicast */ + + // TX PART + nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD)); + memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD)); + /* Fill the netlink message header */ + nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD); + nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */ + nas_nlh_tx->nlmsg_flags = 0; + + nas_iov_tx.iov_base = (void *)nas_nlh_tx; + nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len; + memset(&nas_msg_tx,0,sizeof(nas_msg_tx)); + nas_msg_tx.msg_name = (void *)&nas_dest_addr; + nas_msg_tx.msg_namelen = sizeof(nas_dest_addr); + nas_msg_tx.msg_iov = &nas_iov_tx; + nas_msg_tx.msg_iovlen = 1; + + + // RX PART + memset(&nas_msg_rx,0,sizeof(nas_msg_rx)); + nas_msg_rx.msg_name = (void *)&nas_src_addr; + nas_msg_rx.msg_namelen = sizeof(nas_src_addr); + nas_msg_rx.msg_iov = &nas_iov_rx; + nas_msg_rx.msg_iovlen = 1; + } + + return 1; +} + +#else /* UE_NAS_USE_TUN */ + int netlink_init(void) { int ret; @@ -119,3 +235,5 @@ int netlink_init(void) return(nas_sock_fd); } + +#endif /* UE_NAS_USE_TUN */ diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 885d29cc4e1c8caee548a5f376c8f7b4daa8632e..77b8c0e674d3b09cad69be0fcb6048abc7f54f46 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -36,14 +36,15 @@ #include <execinfo.h> #include <signal.h> -#include "SIMULATION/TOOLS/defs.h" +#include "SIMULATION/TOOLS/sim.h" #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/vars.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_vars.h" -#include "SCHED/defs.h" -#include "SCHED/vars.h" -#include "LAYER2/MAC/vars.h" +#include "SCHED/sched_eNB.h" +#include "SCHED/sched_common_vars.h" +#include "LAYER2/MAC/mac_vars.h" #include "OCG_vars.h" #include "UTIL/LOG/log.h" @@ -56,7 +57,18 @@ #include "dummy_functions.c" +#include "PHY/MODULATION/modulation_common.h" +#include "PHY/MODULATION/modulation_eNB.h" +#include "PHY/MODULATION/modulation_UE.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "SCHED/sched_eNB.h" +#include "SCHED_UE/sched_UE.h" +#include "common/config/config_load_configmodule.h" +#include "PHY/INIT/phy_init.h" +void feptx_ofdm(RU_t *ru); +void feptx_prec(RU_t *ru); double cpuf; @@ -69,6 +81,8 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */ int n_tx_dropped = 0; /*!< \brief initial max process time for tx */ int n_rx_dropped = 0; /*!< \brief initial max process time for rx */ +int codingw = 0; + void handler(int sig) { void *array[10]; @@ -538,7 +552,6 @@ int main(int argc, char **argv) DCI_ALLOC_t da; DCI_ALLOC_t *dci_alloc = &da; - unsigned int ret; unsigned int coded_bits_per_codeword=0,nsymb; //,tbs=0; unsigned int tx_lev=0,tx_lev_dB=0,trials; @@ -561,16 +574,6 @@ int main(int argc, char **argv) unsigned char input_trch_file=0; FILE *input_fd=NULL; unsigned char input_file=0; - // char input_val_str[50],input_val_str2[50]; - - char input_trch_val[16]; - - // unsigned char pbch_pdu[6]; - - - - - // FILE *rx_frame_file; int n_frames; int n_ch_rlz = 1; @@ -593,7 +596,7 @@ int main(int argc, char **argv) // void *data; // int ii; // int bler; - double blerr[4],uncoded_ber=0; //,avg_ber; + double blerr[4]; short *uncoded_ber_bit=NULL; uint8_t N_RB_DL=25,osf=1; frame_t frame_type = FDD; @@ -1592,13 +1595,13 @@ int main(int argc, char **argv) eNB->abstraction_flag=0; schedule_response(&sched_resp); - phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,1); + phy_procedures_eNB_TX(eNB,proc_eNB,1); if (uncoded_ber_bit == NULL) { // this is for user 0 only printf("nb_rb %d, rb_alloc %x, mcs %d\n", eNB->dlsch[0][0]->harq_processes[0]->nb_rb, - eNB->dlsch[0][0]->harq_processes[0]->rb_alloc, + eNB->dlsch[0][0]->harq_processes[0]->rb_alloc[0], eNB->dlsch[0][0]->harq_processes[0]->mcs); coded_bits_per_codeword = get_G(&eNB->frame_parms, @@ -1634,7 +1637,7 @@ int main(int argc, char **argv) proc_eNB->subframe_tx = subframe+1; sched_resp.subframe=subframe+1; schedule_response(&sched_resp); - phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,0); + phy_procedures_eNB_TX(eNB,proc_eNB,0); ru->proc.subframe_tx=(subframe+1)%10; @@ -1723,7 +1726,7 @@ int main(int argc, char **argv) dci_received = UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->dci_received; - phy_procedures_UE_RX(UE,proc,0,0,dci_flag,normal_txrx,no_relay,NULL); + phy_procedures_UE_RX(UE,proc,0,0,dci_flag,normal_txrx); dci_received = dci_received - UE->pdcch_vars[UE->current_thread_id[proc->subframe_rx]][eNB_id]->dci_received; diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index fc782be07a05db17d3a78dbe2464bd6a10a3e0b5..22cac3719374c4dcd86a2e71eefc17151dc97d2f 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -33,22 +33,30 @@ #include <string.h> #include <math.h> #include <unistd.h> -#include "SIMULATION/TOOLS/defs.h" +#include "SIMULATION/TOOLS/sim.h" #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/vars.h" +#include "PHY/defs_common.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_vars.h" -#include "SCHED/defs.h" -#include "SCHED/vars.h" -#include "LAYER2/MAC/vars.h" + +#include "SCHED/sched_common_vars.h" +#include "SCHED/sched_eNB.h" +#include "SCHED_UE/sched_UE.h" +#include "LAYER2/MAC/mac_vars.h" #include "OCG_vars.h" -#include "intertask_interface_init.h" + +#include "PHY/LTE_TRANSPORT/transport_proto.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/INIT/phy_init.h" #include "unitary_defs.h" #include "PHY/TOOLS/lte_phy_scope.h" #include "dummy_functions.c" +#include "common/config/config_load_configmodule.h" double cpuf; @@ -89,6 +97,8 @@ nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU]; nfapi_tx_request_t TX_req; Sched_Rsp_t sched_resp; +int codingw = 0; + void fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu, uint8_t cqi_req, @@ -873,6 +883,7 @@ int main(int argc, char **argv) // NN: N_RB_UL has to be defined in ulsim for (int k=0;k<NUMBER_OF_UE_MAX;k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0); UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0); + printf("ULSCH %p\n",UE->ulsch[0]); if (parallel_flag == 1) { extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *); @@ -946,34 +957,6 @@ int main(int argc, char **argv) UE->ulsch_Msg3_active[eNB_id] = 0; UE->ul_power_control_dedicated[eNB_id].accumulationEnabled=1; - /* - generate_ue_ulsch_params_from_dci((void *)&UL_alloc_pdu, - 14, - proc_rxtx->subframe_tx, - format0, - UE, - proc_rxtx_ue, - SI_RNTI, - 0, - P_RNTI, - CBA_RNTI, - 0, - srs_flag); - - // printf("RIV %d\n",UL_alloc_pdu.rballoc); - - generate_eNB_ulsch_params_from_dci(eNB,proc_rxtx, - (void *)&UL_alloc_pdu, - 14, - format0, - 0, - SI_RNTI, - 0, - P_RNTI, - CBA_RNTI, - srs_flag); - */ - coded_bits_per_codeword = nb_rb * (12 * get_Qm_ul(mcs)) * nsymb; if (cqi_flag == 1) coded_bits_per_codeword-=UE->ulsch[0]->O; @@ -1211,7 +1194,7 @@ int main(int argc, char **argv) proc_rxtx_ue->subframe_tx = proc_rxtx->subframe_rx; proc_rxtx_ue->subframe_rx = proc_rxtx->subframe_tx; - phy_procedures_UE_TX(UE,proc_rxtx_ue,0,0,normal_txrx,no_relay); + phy_procedures_UE_TX(UE,proc_rxtx_ue,0,0,normal_txrx); tx_lev = signal_energy(&UE->common_vars.txdata[0][eNB->frame_parms.samples_per_tti*subframe], @@ -1339,7 +1322,7 @@ int main(int argc, char **argv) ru->feprx(ru); - phy_procedures_eNB_uespec_RX(eNB,proc_rxtx,no_relay); + phy_procedures_eNB_uespec_RX(eNB,proc_rxtx); if (cqi_flag > 0) { diff --git a/openair1/SIMULATION/RF/dac.c b/openair1/SIMULATION/RF/dac.c index 8cf6b496231d630df17437b3712fd0f617eb218a..b09bd20374bf7bec5df4143443a841472c3a2876 100644 --- a/openair1/SIMULATION/RF/dac.c +++ b/openair1/SIMULATION/RF/dac.c @@ -22,8 +22,8 @@ //#define DEBUG_DAC 1 #include <math.h> #include <stdio.h> -#include "PHY/TOOLS/defs.h" - +#include "PHY/TOOLS/tools_defs.h" +#include "rf.h" void dac(double *s_re[2], double *s_im[2], uint32_t **input, @@ -91,10 +91,8 @@ double dac_fixed_gain(double *s_re[2], int i; int aa; - double amp,amp1_local,*amp1p; - - amp = //sqrt(NB_RE)*pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna - pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna + double amp1_local,*amp1p; + double amp = pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna if (amp1==NULL) amp1p = &1_local; else amp1p = amp1; @@ -123,7 +121,7 @@ double dac_fixed_gain(double *s_re[2], //printf("DL: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm); */ - + // printf("DAC: amp/amp1p %f amp1 %f dB (%d,%d), tx_power %f\n",amp/(*amp1p),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm); for (i=0; i<length; i++) { for (aa=0; aa<nb_tx_antennas; aa++) { s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(*amp1p); @@ -131,7 +129,7 @@ double dac_fixed_gain(double *s_re[2], } } - // printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length,0)); + // printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0)); return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0)/NB_RE); } diff --git a/openair1/SIMULATION/RF/rf.c b/openair1/SIMULATION/RF/rf.c index 3cf770ac7cf8c1a0f3038626807dedf18fccdef2..51b7e7524d4bb2bc953fc908a4b2fd1a5a0aa5ee 100644 --- a/openair1/SIMULATION/RF/rf.c +++ b/openair1/SIMULATION/RF/rf.c @@ -19,14 +19,13 @@ * contact@openairinterface.org */ -//#include "defs.h" #include <stdio.h> #include <stdlib.h> #include <math.h> //#include "PHY/defs.h" -#include "SIMULATION/TOOLS/defs.h" - +#include "SIMULATION/TOOLS/sim.h" +#include "rf.h" /* extern void randominit(void); extern double gaussdouble(double,double); diff --git a/openair1/SIMULATION/RF/defs.h b/openair1/SIMULATION/RF/rf.h similarity index 98% rename from openair1/SIMULATION/RF/defs.h rename to openair1/SIMULATION/RF/rf.h index 05e74647a06c0f6c4ac17d61369eb76fdb56c841..65055bc71a4257495cec26f333952103b630cd16 100644 --- a/openair1/SIMULATION/RF/defs.h +++ b/openair1/SIMULATION/RF/rf.h @@ -76,7 +76,7 @@ void adc(double *r_re[2], void dac(double *s_re[2], double *s_im[2], - int **input, + unsigned int **input, unsigned int input_offset, unsigned int nb_tx_antennas, unsigned int length, @@ -87,7 +87,7 @@ void dac(double *s_re[2], double dac_fixed_gain(double *s_re[2], double *s_im[2], - int **input, + unsigned int **input, unsigned int input_offset, unsigned int nb_tx_antennas, unsigned int length, diff --git a/openair1/SIMULATION/TOOLS/abstraction.c b/openair1/SIMULATION/TOOLS/abstraction.c index 7e99371c3736dae18f92ac18c2b6536347506087..6b846bb2d5db9e584d54cfd027792506d6363ae8 100644 --- a/openair1/SIMULATION/TOOLS/abstraction.c +++ b/openair1/SIMULATION/TOOLS/abstraction.c @@ -26,8 +26,9 @@ #include <string.h> #include <errno.h> -#include "PHY/TOOLS/defs.h" -#include "defs.h" +#include "SIMULATION/TOOLS/sim.h" +#include "PHY/TOOLS/tools_defs.h" +#include "assertions.h" // NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED) diff --git a/openair1/SIMULATION/TOOLS/multipath_channel.c b/openair1/SIMULATION/TOOLS/multipath_channel.c index 757d5023de214d5ae8a823b3a3dd03e6ca045b9e..02f4abbc7e25285ca3cfa291ffdd52cd275e6126 100644 --- a/openair1/SIMULATION/TOOLS/multipath_channel.c +++ b/openair1/SIMULATION/TOOLS/multipath_channel.c @@ -23,8 +23,9 @@ #include <stdlib.h> #include <math.h> #include <string.h> -#include "defs.h" -#include "SIMULATION/RF/defs.h" +#include "PHY/TOOLS/tools_defs.h" +#include "SIMULATION/RF/rf.h" +#include "sim.h" //#define DEBUG_CH uint8_t multipath_channel_nosigconv(channel_desc_t *desc) diff --git a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c index c2078b91d478763895c25771f24fe109260e4eb6..daa3462b1c85c1f4cf6ec22fcb29cea1e740c6e3 100644 --- a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c +++ b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c @@ -23,8 +23,8 @@ #include <stdlib.h> #include <math.h> #include <string.h> -#include "defs.h" -#include "SIMULATION/RF/defs.h" +#include "sim.h" +#include "SIMULATION/RF/rf.h" #include <complex.h> void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length); diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 222a196e20b9c0e171ecd3ac5c5177a88138e889..dc8df153159c58cd75506054941237c4701439fe 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -26,12 +26,14 @@ #include <string.h> -#include "PHY/TOOLS/defs.h" -#include "defs.h" +#include "PHY/TOOLS/tools_defs.h" +#include "sim.h" #include "scm_corrmat.h" #include "UTIL/LOG/log.h" //#define DEBUG_CH +#include "assertions.h" + extern void print_shorts(char *s,__m128i *x); void fill_channel_desc(channel_desc_t *chan_desc, @@ -1210,10 +1212,8 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { struct complex anew[NB_ANTENNAS_TX*NB_ANTENNAS_RX],acorr[NB_ANTENNAS_TX*NB_ANTENNAS_RX]; struct complex phase, alpha, beta; - if ((desc->nb_tx>NB_ANTENNAS_TX) || (desc->nb_rx > NB_ANTENNAS_RX)) { - LOG_E(PHY,"random_channel.c: Error: temporary buffer for channel not big enough (%d,%d)\n",desc->nb_tx,desc->nb_rx); - return(-1); - } + AssertFatal(desc->nb_tx<=NB_ANTENNAS_TX && desc->nb_rx <= NB_ANTENNAS_RX, + "random_channel.c: Error: temporary buffer for channel not big enough (%d,%d)\n",desc->nb_tx,desc->nb_rx); start_meas(&desc->random_channel); for (i=0;i<(int)desc->nb_taps;i++) { @@ -1372,8 +1372,7 @@ double N_RB2sampling_rate(uint16_t N_RB) break; default: - LOG_E(PHY,"Unknown N_PRB\n"); - return(-1); + AssertFatal(1==0,"Unknown N_PRB %d",N_RB); } return(sampling_rate); diff --git a/openair1/SIMULATION/TOOLS/rangen_double.c b/openair1/SIMULATION/TOOLS/rangen_double.c index 0fc01a8d3132233ff34502b71466e4a3886adb3a..6dcdd9418e2bf703a1d21d2780c184dc5cd2deeb 100644 --- a/openair1/SIMULATION/TOOLS/rangen_double.c +++ b/openair1/SIMULATION/TOOLS/rangen_double.c @@ -24,7 +24,7 @@ #include <math.h> #include <time.h> -#include "defs.h" +#include "sim.h" static unsigned int seed, iy, ir[98]; /* diff --git a/openair1/SIMULATION/TOOLS/defs.h b/openair1/SIMULATION/TOOLS/sim.h similarity index 99% rename from openair1/SIMULATION/TOOLS/defs.h rename to openair1/SIMULATION/TOOLS/sim.h index a958c6b4ebcfb2737c58f30fff63d6475d8446d3..420e5d0072f193a42057902ceae63d2b54cf1a51 100644 --- a/openair1/SIMULATION/TOOLS/defs.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -21,7 +21,7 @@ #ifndef __SIMULATION_TOOLS_DEFS_H__ #define __SIMULATION_TOOLS_DEFS_H__ -#include "PHY/defs.h" +#include "PHY/defs_common.h" /** @defgroup _numerical_ Useful Numerical Functions *@{ diff --git a/openair2/COMMON/phy_messages_types.h b/openair2/COMMON/phy_messages_types.h index c425efa89cb38b88fe08c804ecbcc11bf0e29ecb..1f040a0a773e00163df53a660af70c799629f5d2 100644 --- a/openair2/COMMON/phy_messages_types.h +++ b/openair2/COMMON/phy_messages_types.h @@ -29,10 +29,8 @@ #ifndef PHY_MESSAGES_TYPES_H_ #define PHY_MESSAGES_TYPES_H_ -#include "PHY/impl_defs_lte.h" -#if ENABLE_RAL -#include "ral_messages_types.h" //LG: MIH moved from repository/trunk to repository/extras -#endif +#include "PHY/defs_common.h" + //-------------------------------------------------------------------------------------------// // Defines to access message fields. #define PHY_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.phy_configuration_req diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 4debccc7b05075ce37e830420336551a29c6c323..20a7d5ecd20c52e114546305d77382bed796a3af 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -69,10 +69,12 @@ #ifdef LARGE_SCALE # define MAX_MOBILES_PER_ENB 128 -//# define MAX_RG 2 +# define MAX_MOBILES_PER_ENB_NB_IoT 128 +# define MAX_eNB 2 #else # define MAX_MOBILES_PER_ENB 16 -//# define MAX_RG 2 +# define MAX_MOBILES_PER_ENB_NB_IoT 16 +# define MAX_eNB 2 #endif #define MAX_MANAGED_ENB_PER_MOBILE 2 diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 6cb79efb11ce90b8410bb2d14e7659711b5d0b2f..0545eeb3be11e59522aebcafb3161b4aaa61e60a 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -34,7 +34,7 @@ #include "flexran_agent_timer.h" #include "flexran_agent_ran_api.h" -#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/mac_proto.h" #include "liblfds700.h" @@ -836,7 +836,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle Protocol__FlexHeader *header = NULL; int i, j, UE_id; - int available_harq[NUMBER_OF_UE_MAX]; + int available_harq[MAX_MOBILES_PER_ENB]; const int xid = *((int *)params); @@ -854,7 +854,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle frame_t frame; sub_frame_t subframe; - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { available_harq[i] = -1; } @@ -878,7 +878,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle sf_trigger_msg->n_dl_info = 0; - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { for (j = 0; j < 8; j++) { if (RC.mac && RC.mac[mod_id] && RC.mac[mod_id]->UE_list.eNB_UE_stats[UE_PCCID(mod_id,i)][i].harq_pid == 1) { available_harq[i] = j; @@ -904,7 +904,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle goto error; i = -1; //Fill the status of the current HARQ process for each UE - for(UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { + for(UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { if (available_harq[UE_id] < 0) { continue; } else { @@ -1262,7 +1262,7 @@ void flexran_agent_init_mac_agent(mid_t mod_id) { //Allow RINGBUFFER_SIZE messages to be stored in the ringbuffer at any time dl_mac_config_array[mod_id] = malloc( sizeof(struct lfds700_ringbuffer_element) * num_elements); lfds700_ringbuffer_init_valid_on_current_logical_core( &ringbuffer_state[mod_id], dl_mac_config_array[mod_id], num_elements, &ps[mod_id], NULL ); - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { for (j = 0; j < 8; j++) { if (RC.mac && RC.mac[mod_id]) RC.mac[mod_id]->UE_list.eNB_UE_stats[UE_PCCID(mod_id,i)][i].harq_pid = 0; diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c index 43455fa32a4043edeac6eda7c869b0fe2c783348..b2723f718126973f96d972a3284b995c5e99c3e2 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c @@ -37,7 +37,7 @@ unsigned int pdcp_agent_registered[NUM_MAX_ENB]; /*Array containing the Agent-PDCP interfaces*/ AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB]; -// NUMBER_OF_UE_MAX +// MAX_MOBILES_PER_ENB void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, const mid_t ue_id, diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto index b54fc171c6acb831466726e40ec33ed3e941bb17..9255372340283d8ce89bb0c1c4cfc6c19a2710a9 100644 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -131,7 +131,7 @@ message flex_enb_config_request { message flex_enb_config_reply { optional flex_header header = 1; - optional uint32 eNB_id = 2; // Unique id to distinguish the eNB + optional uint64 eNB_id = 2; // Unique id to distinguish the eNB repeated flex_cell_config cell_config = 3; optional uint32 device_spec = 4; } diff --git a/openair2/ENB_APP/NB_IoT_interface.c b/openair2/ENB_APP/NB_IoT_interface.c index 30ffbb3bb550f6fdcb1cc19075e120df2dac5d9b..c4884453c2e9cc03d62f5c4e454bd3a3dd3f57fb 100644 --- a/openair2/ENB_APP/NB_IoT_interface.c +++ b/openair2/ENB_APP/NB_IoT_interface.c @@ -30,7 +30,7 @@ #include <sys/types.h> -#include "openair1/PHY/extern.h" +#include "openair1/PHY/phy_extern.h" #include "common/utils/load_module_shlib.h" #define NBIOT_INTERFACE_SOURCE #include "NB_IoT_interface.h" diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 481bfaa521e961ce08466ff427be69c58e6a259d..b3471d2637193b5be594ede68816fecf78cb5dc6 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -46,6 +46,7 @@ # include "gtpv1u_eNB_task.h" # endif +#include "openair1/PHY/INIT/phy_init.h" extern unsigned char NB_eNB_INST; #endif diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 5e9c320f57a0caf5caec567b50c4841316517751..f561ceab13b129d23c1dc358989704d0fb10f69d 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -45,9 +45,10 @@ #endif #include "sctp_default_values.h" #include "SystemInformationBlockType2.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/proto.h" -#include "PHY/extern.h" +#include "LAYER2/MAC/mac_extern.h" +#include "LAYER2/MAC/mac_proto.h" +#include "PHY/phy_extern.h" +#include "PHY/INIT/phy_init.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" #include "nfapi_vnf.h" #include "nfapi_pnf.h" @@ -60,37 +61,124 @@ extern uint16_t sf_ahead; - void RCconfig_flexran() { - int i; + uint16_t i; + uint16_t num_enbs; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + /* this will possibly truncate the cell id (RRC assumes int32_t). + * Both Nid_cell and enb_id are signed in RRC case, but we use unsigned for + * the bitshifting to work properly */ + int32_t Nid_cell = 0; + uint16_t Nid_cell_tr = 0; + uint32_t enb_id = 0; + + /* + * the only reason for all these variables is, that they are "hard-encoded" + * into the CCPARAMS_DESC macro and we need it for the Nid_cell variable ... + */ + char *frame_type, *prefix_type, *pbch_repetition, *prach_high_speed, + *pusch_hoppingMode, *pusch_enable64QAM, *pusch_groupHoppingEnabled, + *pusch_sequenceHoppingEnabled, *phich_duration, *phich_resource, + *srs_enable, *srs_ackNackST, *srs_MaxUpPts, *pusch_alpha, + *pucch_deltaF_Format1, *pucch_deltaF_Format1b, *pucch_deltaF_Format2, + *pucch_deltaF_Format2a, *pucch_deltaF_Format2b, + *rach_preamblesGroupAConfig, *rach_messagePowerOffsetGroupB, *pcch_nB; + long long int downlink_frequency; + int32_t tdd_config, tdd_config_s, eutra_band, uplink_frequency_offset, + Nid_cell_mbsfn, N_RB_DL, nb_antenna_ports, prach_root, prach_config_index, + prach_zero_correlation, prach_freq_offset, pucch_delta_shift, + pucch_nRB_CQI, pucch_nCS_AN, pucch_n1_AN, pdsch_referenceSignalPower, + pdsch_p_b, pusch_n_SB, pusch_hoppingOffset, pusch_groupAssignment, + pusch_nDMRS1, srs_BandwidthConfig, srs_SubframeConfig, pusch_p0_Nominal, + pucch_p0_Nominal, msg3_delta_Preamble, rach_numberOfRA_Preambles, + rach_sizeOfRA_PreamblesGroupA, rach_messageSizeGroupA, + rach_powerRampingStep, rach_preambleInitialReceivedTargetPower, + rach_preambleTransMax, rach_raResponseWindowSize, + rach_macContentionResolutionTimer, rach_maxHARQ_Msg3Tx, + pcch_defaultPagingCycle, bcch_modificationPeriodCoeff, + ue_TimersAndConstants_t300, ue_TimersAndConstants_t301, + ue_TimersAndConstants_t310, ue_TimersAndConstants_t311, + ue_TimersAndConstants_n310, ue_TimersAndConstants_n311, + ue_TransmissionMode; + + /* get number of eNBs */ + paramdef_t ENBSParams[] = ENBSPARAMS_DESC; + config_get(ENBSParams, sizeof(ENBSParams)/sizeof(paramdef_t), NULL); + num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; + + /* for eNB ID */ + paramdef_t ENBParams[] = ENBPARAMS_DESC; + paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST, NULL, 0}; + + /* for Nid_cell */ + checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK; + paramdef_t CCsParams[] = CCPARAMS_DESC; + paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0}; + /* map parameter checking array instances to parameter definition array instances */ + for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) { + CCsParams[I].chkPptr = &(config_check_CCparams[I]); + } paramdef_t flexranParams[] = FLEXRANPARAMS_DESC; config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); if (!RC.flexran) { - RC.flexran = calloc(RC.nb_L1_inst, sizeof(flexran_agent_info_t*)); - AssertFatal(RC.flexran != NULL, + RC.flexran = calloc(num_enbs, sizeof(flexran_agent_info_t*)); + AssertFatal(RC.flexran, "can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n", - RC.nb_L1_inst * sizeof(flexran_agent_info_t*), - RC.nb_L1_inst, sizeof(flexran_agent_info_t*)); + num_enbs * sizeof(flexran_agent_info_t*), + num_enbs, sizeof(flexran_agent_info_t*)); } - /* For all agent instance, fill in the same controller configuration. */ - for (i = 0; i < RC.nb_L1_inst; i++) { + for (i = 0; i < num_enbs; i++) { RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t)); - AssertFatal(RC.flexran[i] != NULL, + AssertFatal(RC.flexran[i], "can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n", - sizeof(flexran_agent_info_t), i + 1, RC.nb_L1_inst); + sizeof(flexran_agent_info_t), i + 1, num_enbs); /* if config says "yes", enable Agent, in all other cases it's like "no" */ - RC.flexran[i]->enabled = strcmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0; + RC.flexran[i]->enabled = strcasecmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0; + /* if not enabled, simply skip the rest, it is not needed anyway */ + if (!RC.flexran[i]->enabled) + continue; RC.flexran[i]->interface_name = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr)); //inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN); RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr)); RC.flexran[i]->remote_port = *(flexranParams[FLEXRAN_PORT_IDX].uptr); RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr)); - RC.flexran[i]->node_ctrl_state = strcmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION; - RC.flexran[i]->enb_id = i; + RC.flexran[i]->node_ctrl_state = strcasecmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION; + + config_getlist(&ENBParamList, ENBParams, sizeof(ENBParams)/sizeof(paramdef_t),NULL); + /* eNB ID from configuration, as read in by RCconfig_RRC() */ + if (!ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr) { + // Calculate a default eNB ID +# if defined(ENABLE_USE_MME) + enb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8); +# else + enb_id = i; +# endif + } else { + enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr); + } + + /* cell ID */ + sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i); + config_getlist(&CCsParamList, NULL, 0, aprefix); + if (CCsParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0); + config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix); + Nid_cell_tr = (uint16_t) Nid_cell; + } + + RC.flexran[i]->mod_id = i; + RC.flexran[i]->agent_id = (((uint64_t)i) << 48) | (((uint64_t)enb_id) << 16) | ((uint64_t)Nid_cell_tr); + + /* assume for the moment the monolithic case, i.e. agent can provide + * information for all layers */ + RC.flexran[i]->capability_mask = FLEXRAN_CAP_LOPHY | FLEXRAN_CAP_HIPHY + | FLEXRAN_CAP_LOMAC | FLEXRAN_CAP_HIMAC + | FLEXRAN_CAP_RLC | FLEXRAN_CAP_PDCP + | FLEXRAN_CAP_SDAP | FLEXRAN_CAP_RRC; } } @@ -208,7 +296,12 @@ void RCconfig_macrlc() { RC.nb_macrlc_inst=MacRLC_ParamList.numelt; mac_top_init_eNB(); + RC.nb_mac_CC = (int*)malloc(RC.nb_macrlc_inst*sizeof(int)); + for (j=0;j<RC.nb_macrlc_inst;j++) { + RC.nb_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr); + //RC.mac[j]->phy_test = *(MacRLC_ParamList.paramarray[j][MACRLC_PHY_TEST_IDX].iptr); + //printf("PHY_TEST = %d,%d\n", RC.mac[j]->phy_test, j); if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) { // check number of instances is same as RRC/PDCP diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 42bef9c4e990c0746aeb027c950394d5faee0c0f..0cddad9dcc2d5ef12bbd2afeaae74cfd648f8797 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -38,7 +38,7 @@ #include "platform_types.h" #include "platform_constants.h" #include "PHY/impl_defs_lte.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" #include "s1ap_messages_types.h" #ifdef CMAKER #include "SystemInformationBlockType2.h" @@ -47,7 +47,7 @@ #include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h" #endif #include "intertask_interface_types.h" -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" #define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\ struct in_addr inp;\ diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index a8379c259f948882e6a17c4b98b5daccbfe2067f..fe2b5a8515c164681841375b1b00576255fcc59e 100755 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -687,4 +687,43 @@ typedef enum { #define CONFIG_STRING_MACRLC_CONFIG "macrlc_config" - +/* MACRLC configuration parameters names */ +#define CONFIG_STRING_MACRLC_CC "num_cc" +#define CONFIG_STRING_MACRLC_TRANSPORT_N_PREFERENCE "tr_n_preference" +#define CONFIG_STRING_MACRLC_LOCAL_N_IF_NAME "local_n_if_name" +#define CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS "local_n_address" +#define CONFIG_STRING_MACRLC_REMOTE_N_ADDRESS "remote_n_address" +#define CONFIG_STRING_MACRLC_LOCAL_N_PORTC "local_n_portc" +#define CONFIG_STRING_MACRLC_REMOTE_N_PORTC "remote_n_portc" +#define CONFIG_STRING_MACRLC_LOCAL_N_PORTD "local_n_portd" +#define CONFIG_STRING_MACRLC_REMOTE_N_PORTD "remote_n_portd" +#define CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE "tr_s_preference" +#define CONFIG_STRING_MACRLC_LOCAL_S_IF_NAME "local_s_if_name" +#define CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS "local_s_address" +#define CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS "remote_s_address" +#define CONFIG_STRING_MACRLC_LOCAL_S_PORTC "local_s_portc" +#define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc" +#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd" +#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd" +#define CONFIG_STRING_MACRLC_PHY_TEST_MODE "phy_test_mode" + + +#define MACRLC_CC_IDX 0 +#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1 +#define MACRLC_LOCAL_N_IF_NAME_IDX 2 +#define MACRLC_LOCAL_N_ADDRESS_IDX 3 +#define MACRLC_REMOTE_N_ADDRESS_IDX 4 +#define MACRLC_LOCAL_N_PORTC_IDX 5 +#define MACRLC_REMOTE_N_PORTC_IDX 6 +#define MACRLC_LOCAL_N_PORTD_IDX 7 +#define MACRLC_REMOTE_N_PORTD_IDX 8 +#define MACRLC_TRANSPORT_S_PREFERENCE_IDX 9 +#define MACRLC_LOCAL_S_IF_NAME_IDX 10 +#define MACRLC_LOCAL_S_ADDRESS_IDX 11 +#define MACRLC_REMOTE_S_ADDRESS_IDX 12 +#define MACRLC_LOCAL_S_PORTC_IDX 13 +#define MACRLC_REMOTE_S_PORTC_IDX 14 +#define MACRLC_LOCAL_S_PORTD_IDX 15 +#define MACRLC_REMOTE_S_PORTD_IDX 16 +#define MACRLC_PHY_TEST_IDX 17 +/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index bd46ecc49d246f9e81b7d3d2942f42158d30f0a4..8d5cdbc06bd396b68e1e7c43fa11bfdabcf9476a 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -114,12 +114,12 @@ void *receive_thread(void *args) { while (1) { - while (flexran_agent_msg_recv(d->enb_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) { + while (flexran_agent_msg_recv(d->mod_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) { LOG_D(FLEXRAN_AGENT,"received message with size %d\n", size); // Invoke the message handler - msg=flexran_agent_handle_message(d->enb_id, data, size); + msg=flexran_agent_handle_message(d->mod_id, data, size); free(data); @@ -127,7 +127,7 @@ void *receive_thread(void *args) { if (msg != NULL){ data=flexran_agent_pack_message(msg,&size); - if (flexran_agent_msg_send(d->enb_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { + if (flexran_agent_msg_send(d->mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -190,13 +190,6 @@ int flexran_agent_start(mid_t mod_id) LOG_I(FLEXRAN_AGENT, "FlexRAN Agent for eNB %d is DISABLED\n", mod_id); return 100; } - - flexran->enb_id = mod_id; - /* assume for the moment the monolithic case, i.e. agent can provide - * information for all layers */ - flexran->capability_mask = FLEXRAN_CAP_LOL1 | FLEXRAN_CAP_HIL1 - | FLEXRAN_CAP_LOL2 | FLEXRAN_CAP_HIL2 - | FLEXRAN_CAP_PDCP | FLEXRAN_CAP_RRC; /* * Initialize the channel container diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 6d32aeedbb152facec421b7cfc4d176177320a6e..3bbea167d37dfacf1e8e2ca6cc0c576a2918f18d 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -35,11 +35,11 @@ #include "flexran_agent_extern.h" #include "flexran_agent_net_comm.h" #include "flexran_agent_ran_api.h" -#include "PHY/extern.h" +//#include "PHY/extern.h" #include "log.h" -#include "SCHED/defs.h" -#include "RRC/LITE/extern.h" +//#include "SCHED/defs.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" @@ -804,7 +804,6 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F xid = (enb_config_req_msg->header)->xid; int i, j; - int enb_id = mod_id; Protocol__FlexEnbConfigReply *enb_config_reply_msg; enb_config_reply_msg = malloc(sizeof(Protocol__FlexEnbConfigReply)); @@ -816,10 +815,10 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F goto error; enb_config_reply_msg->header = header; - - enb_config_reply_msg->enb_id = mod_id; - - + + enb_config_reply_msg->enb_id = RC.flexran[mod_id]->agent_id; + enb_config_reply_msg->has_enb_id = 1; + enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; Protocol__FlexCellConfig **cell_conf; @@ -832,61 +831,60 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F protocol__flex_cell_config__init(cell_conf[i]); cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = flexran_get_cell_id(enb_id,i); + cell_conf[i]->has_phy_cell_id = flexran_get_cell_id(mod_id,i); cell_conf[i]->cell_id = i; cell_conf[i]->has_cell_id = 1; - cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(enb_id,i); + cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(mod_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; - if (flexran_get_hopping_mode(enb_id,i) == 0) { + if (flexran_get_hopping_mode(mod_id,i) == 0) { cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; - } else if(flexran_get_hopping_mode(enb_id,i) == 1) { + } else if(flexran_get_hopping_mode(mod_id,i) == 1) { cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; } cell_conf[i]->has_hopping_mode = 1; - cell_conf[i]->n_sb = flexran_get_n_SB(enb_id,i); + cell_conf[i]->n_sb = flexran_get_n_SB(mod_id,i); cell_conf[i]->has_n_sb = 1; - if (flexran_get_phich_resource(enb_id,i) == 0) { + if (flexran_get_phich_resource(mod_id,i) == 0) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 - } else if (flexran_get_phich_resource(enb_id,i) == 1) { + } else if (flexran_get_phich_resource(mod_id,i) == 1) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1 - } else if (flexran_get_phich_resource(enb_id,i) == 2) { + } else if (flexran_get_phich_resource(mod_id,i) == 2) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2 - } else if (flexran_get_phich_resource(enb_id,i) == 3) { + } else if (flexran_get_phich_resource(mod_id,i) == 3) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 } cell_conf[i]->has_phich_resource = 1; - if (flexran_get_phich_duration(enb_id,i) == 0) { + if (flexran_get_phich_duration(mod_id,i) == 0) { cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; - } else if(flexran_get_phich_duration(enb_id,i) == 1) { + } else if(flexran_get_phich_duration(mod_id,i) == 1) { cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; } cell_conf[i]->has_phich_duration = 1; - //TODO: Fill in with actual value, See TS 36.211, section 6.9 - cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(enb_id,i); - cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 0; - //TODO: Fill in with actual value - /* Protocol__FlexSiConfig *si_config; */ - /* si_config = malloc(sizeof(Protocol__FlexSiConfig)); */ - /* if(si_config == NULL) */ - /* goto error; */ - /* protocol__flex_si_config__init(si_config); */ - /* //TODO: Fill in with actual value, Frame number to apply the SI configuration */ - /* si_config->sfn = 1; */ - /* si_config->has_sfn = 1; */ - /* //TODO: Fill in with actual value, the length of SIB1 in bytes */ - /* si_config->sib1_length = get_sib1_length(enb_id,i); */ - /* si_config->has_sib1_length = 1; */ - /* //TODO: Fill in with actual value, Scheduling window for all SIs in SF */ - /* si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); */ - /* si_config->has_si_window_length = 1; */ - /* //TODO: Fill in with actual value, the number of SI messages */ - /* si_config->n_si_message=1; */ + cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(mod_id,i); + cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; + Protocol__FlexSiConfig *si_config; + si_config = malloc(sizeof(Protocol__FlexSiConfig)); + if(si_config == NULL) + goto error; + protocol__flex_si_config__init(si_config); + + si_config->sfn = flexran_get_current_system_frame_num(mod_id); + si_config->has_sfn = 1; + + si_config->sib1_length = flexran_get_sib1_length(mod_id,i); + si_config->has_sib1_length = 1; + + si_config->si_window_length = (uint32_t) flexran_get_si_window_length(mod_id, i); + si_config->has_si_window_length = 1; + + si_config->n_si_message = 0; + /* Protocol__FlexSiMessage **si_message; */ /* si_message = malloc(sizeof(Protocol__FlexSiMessage *) * si_config->n_si_message); */ /* if(si_message == NULL) */ @@ -906,44 +904,42 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F /* if(si_config->n_si_message > 0){ */ /* si_config->si_message = si_message; */ /* } */ - /* cell_conf[i]->si_config = si_config; */ - - cell_conf[i]->dl_bandwidth = flexran_get_N_RB_DL(enb_id,i); + + cell_conf[i]->si_config = si_config; + + cell_conf[i]->dl_bandwidth = flexran_get_N_RB_DL(mod_id,i); cell_conf[i]->has_dl_bandwidth = 1; - cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(enb_id,i); + cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(mod_id,i); cell_conf[i]->has_ul_bandwidth = 1; - if (flexran_get_ul_cyclic_prefix_length(enb_id, i) == 0) { + if (flexran_get_ul_cyclic_prefix_length(mod_id, i) == 0) { cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; - } else if(flexran_get_ul_cyclic_prefix_length(enb_id, i) == 1) { - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; + } else if(flexran_get_ul_cyclic_prefix_length(mod_id, i) == 1) { + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; } cell_conf[i]->has_ul_cyclic_prefix_length = 1; - if (flexran_get_ul_cyclic_prefix_length(enb_id,i) == 0) { + if (flexran_get_ul_cyclic_prefix_length(mod_id,i) == 0) { cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; - } else if (flexran_get_ul_cyclic_prefix_length(enb_id,i) == 1) { + } else if (flexran_get_ul_cyclic_prefix_length(mod_id,i) == 1) { cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; } cell_conf[i]->has_dl_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, number of cell specific antenna ports. Currently single port support - cell_conf[i]->antenna_ports_count = 1; + cell_conf[i]->antenna_ports_count = flexran_get_antenna_ports(mod_id, i); cell_conf[i]->has_antenna_ports_count = 1; - if (flexran_get_duplex_mode(enb_id,i) == 1) { + if (flexran_get_duplex_mode(mod_id,i) == 1) { cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; - } else if(flexran_get_duplex_mode(enb_id,i) == 0) { + } else if(flexran_get_duplex_mode(mod_id,i) == 0) { cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; } cell_conf[i]->has_duplex_mode = 1; - //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only - cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(enb_id, i); - cell_conf[i]->has_subframe_assignment = 0; - //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 - cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(enb_id,i); - cell_conf[i]->has_special_subframe_patterns = 0; + cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(mod_id, i); + cell_conf[i]->has_subframe_assignment = 1; + cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(mod_id,i); + cell_conf[i]->has_special_subframe_patterns = 1; //TODO: Fill in with actual value, The MBSFN radio frame period cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 0; uint32_t *elem_rfperiod; @@ -954,7 +950,7 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F elem_rfperiod[j] = 1; } cell_conf[i]->mbsfn_subframe_config_rfperiod = elem_rfperiod; - + //TODO: Fill in with actual value, The MBSFN radio frame offset cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 0; uint32_t *elem_rfoffset; @@ -965,7 +961,7 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F elem_rfoffset[j] = 1; } cell_conf[i]->mbsfn_subframe_config_rfoffset = elem_rfoffset; - + //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 0; uint32_t *elem_sfalloc; @@ -976,63 +972,62 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F elem_sfalloc[j] = 1; } cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; - - cell_conf[i]->prach_config_index = flexran_get_prach_ConfigIndex(enb_id,i); + + cell_conf[i]->prach_config_index = flexran_get_prach_ConfigIndex(mod_id,i); cell_conf[i]->has_prach_config_index = 1; - cell_conf[i]->prach_freq_offset = flexran_get_prach_FreqOffset(enb_id,i); + cell_conf[i]->prach_freq_offset = flexran_get_prach_FreqOffset(mod_id,i); cell_conf[i]->has_prach_freq_offset = 1; - cell_conf[i]->ra_response_window_size = flexran_get_ra_ResponseWindowSize(enb_id,i); + cell_conf[i]->ra_response_window_size = flexran_get_ra_ResponseWindowSize(mod_id,i); cell_conf[i]->has_ra_response_window_size = 1; - cell_conf[i]->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(enb_id,i); + cell_conf[i]->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(mod_id,i); cell_conf[i]->has_mac_contention_resolution_timer = 1; - cell_conf[i]->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(enb_id,i); + cell_conf[i]->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(mod_id,i); cell_conf[i]->has_max_harq_msg3tx = 1; - cell_conf[i]->n1pucch_an = flexran_get_n1pucch_an(enb_id,i); + cell_conf[i]->n1pucch_an = flexran_get_n1pucch_an(mod_id,i); cell_conf[i]->has_n1pucch_an = 1; - cell_conf[i]->deltapucch_shift = flexran_get_deltaPUCCH_Shift(enb_id,i); + cell_conf[i]->deltapucch_shift = flexran_get_deltaPUCCH_Shift(mod_id,i); cell_conf[i]->has_deltapucch_shift = 1; - cell_conf[i]->nrb_cqi = flexran_get_nRB_CQI(enb_id,i); + cell_conf[i]->nrb_cqi = flexran_get_nRB_CQI(mod_id,i); cell_conf[i]->has_nrb_cqi = 1; - cell_conf[i]->srs_subframe_config = flexran_get_srs_SubframeConfig(enb_id,i); + cell_conf[i]->srs_subframe_config = flexran_get_srs_SubframeConfig(mod_id,i); cell_conf[i]->has_srs_subframe_config = 1; - cell_conf[i]->srs_bw_config = flexran_get_srs_BandwidthConfig(enb_id,i); + cell_conf[i]->srs_bw_config = flexran_get_srs_BandwidthConfig(mod_id,i); cell_conf[i]->has_srs_bw_config = 1; - cell_conf[i]->srs_mac_up_pts = flexran_get_srs_MaxUpPts(enb_id,i); + cell_conf[i]->srs_mac_up_pts = flexran_get_srs_MaxUpPts(mod_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; - cell_conf[i]->dl_freq = flexran_agent_get_operating_dl_freq (enb_id,i); + cell_conf[i]->dl_freq = flexran_agent_get_operating_dl_freq (mod_id,i); cell_conf[i]->has_dl_freq = 1; - cell_conf[i]->ul_freq = flexran_agent_get_operating_ul_freq (enb_id, i); + cell_conf[i]->ul_freq = flexran_agent_get_operating_ul_freq (mod_id, i); cell_conf[i]->has_ul_freq = 1; - cell_conf[i]->eutra_band = flexran_agent_get_operating_eutra_band (enb_id,i); + cell_conf[i]->eutra_band = flexran_agent_get_operating_eutra_band (mod_id,i); cell_conf[i]->has_eutra_band = 1; - cell_conf[i]->dl_pdsch_power = flexran_agent_get_operating_pdsch_refpower(enb_id, i); + cell_conf[i]->dl_pdsch_power = flexran_agent_get_operating_pdsch_refpower(mod_id, i); cell_conf[i]->has_dl_pdsch_power = 1; - cell_conf[i]->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (enb_id,i); + cell_conf[i]->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (mod_id,i); cell_conf[i]->has_ul_pusch_power = 1; - - if (flexran_get_enable64QAM(enb_id,i) == 0) { + if (flexran_get_enable64QAM(mod_id,i) == 0) { cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; - } else if(flexran_get_enable64QAM(enb_id,i) == 1) { + } else if(flexran_get_enable64QAM(mod_id,i) == 1) { cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; } cell_conf[i]->has_enable_64qam = 1; - + cell_conf[i]->carrier_index = i; cell_conf[i]->has_carrier_index = 1; } diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index 242cb55ca86364db4254f250a6a97657ad73e71d..057c5b9489a7332a9cdb8923f3abeb58a44f7d46 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -42,7 +42,6 @@ #include "flexran_agent_defs.h" #include "enb_config.h" -#include "LAYER2/MAC/extern.h" #include "LAYER2/RLC/rlc.h" # include "tree.h" diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 6364bc628191ec7f9c22bdfa98150170b6dbe101..aa71dd33fab750e933a0d86ab1b1ab43f28c5a43 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -138,12 +138,14 @@ typedef enum { FLEXRAN_AGENT_TIMER_STATE_MAX, } flexran_agent_timer_state_t; -#define FLEXRAN_CAP_LOL1 0x1 -#define FLEXRAN_CAP_HIL1 0x2 -#define FLEXRAN_CAP_LOL2 0x4 // is: MAC -#define FLEXRAN_CAP_HIL2 0x8 // is: RLC -#define FLEXRAN_CAP_PDCP 0x16 -#define FLEXRAN_CAP_RRC 0x32 +#define FLEXRAN_CAP_LOPHY 1 +#define FLEXRAN_CAP_HIPHY 2 +#define FLEXRAN_CAP_LOMAC 4 +#define FLEXRAN_CAP_HIMAC 8 +#define FLEXRAN_CAP_RLC 16 +#define FLEXRAN_CAP_PDCP 32 +#define FLEXRAN_CAP_SDAP 64 +#define FLEXRAN_CAP_RRC 128 typedef enum { ENB_NORMAL_OPERATION = 0x0, @@ -159,7 +161,8 @@ typedef struct { uint16_t remote_port; char *cache_name; - int enb_id; + mid_t mod_id; + uint64_t agent_id; uint8_t capability_mask; /* lock for waiting before starting or soft-restart */ diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 3200f55f16fa1100e75140b87c98b6f257786701..d2d8174dd4f7edb9994920ea864f570dd50d747c 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -1207,7 +1207,7 @@ void flexran_set_pdcp_rx_stat_window(const mid_t mod_id, const mid_t ue_id, uint /*PDCP num tx pdu status flexRAN*/ uint32_t flexran_get_pdcp_tx(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid){ - if (mod_id <0 || mod_id> MAX_NUM_CCs || ue_id<0 || ue_id> NUMBER_OF_UE_MAX || lcid<0 || lcid>NB_RB_MAX) + if (mod_id <0 || mod_id> MAX_NUM_CCs || ue_id<0 || ue_id> MAX_MOBILES_PER_ENB || lcid<0 || lcid>NB_RB_MAX) return -1; return Pdcp_stats_tx[mod_id][ue_id][lcid]; } diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 4e5f214af00f133cc2d2485589b17650f7af0712..3354d8ace875da91ed0dc6fc9b53f5fca5225877 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -36,14 +36,13 @@ #include "enb_config.h" -#include "LAYER2/MAC/extern.h" #include "LAYER2/RLC/rlc.h" -#include "SCHED/defs.h" +#include "SCHED/sched_eNB.h" #include "pdcp.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "RRC/LITE/rrc_eNB_UE_context.h" -#include "PHY/extern.h" +#include "RRC/LTE/rrc_eNB_UE_context.h" +#include "PHY/phy_extern.h" #include "log.h" /**************************** diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 42ed105f23b3c507416b0508e292fd6efcb9c8c5..6be1c948c94c1b45629ddf086cf7b3f20ec22882 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -32,7 +32,6 @@ #include "COMMON/platform_types.h" #include "COMMON/platform_constants.h" -#include "SCHED/defs.h" #include "SystemInformationBlockType2.h" //#include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" @@ -43,9 +42,9 @@ #include "MeasObjectToAddModList.h" #include "TDD-Config.h" #include "MAC-MainConfig.h" -#include "defs.h" -#include "proto.h" -#include "extern.h" +#include "mac.h" +#include "mac_proto.h" +#include "mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c index 5ef18f5bdad0c2b4917d943824c9cae3f1c90430..cac3323b0c8fb4d19229df143e5d009156bc0b7e 100644 --- a/openair2/LAYER2/MAC/config_ue.c +++ b/openair2/LAYER2/MAC/config_ue.c @@ -32,7 +32,7 @@ #include "COMMON/platform_types.h" #include "COMMON/platform_constants.h" -#include "SCHED/defs.h" +#include "SCHED_UE/sched_UE.h" #include "SystemInformationBlockType2.h" //#include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" @@ -43,9 +43,9 @@ #include "MeasObjectToAddModList.h" #include "TDD-Config.h" #include "MAC-MainConfig.h" -#include "defs.h" -#include "proto.h" -#include "extern.h" +#include "mac.h" +#include "mac_proto.h" +#include "mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" diff --git a/openair2/LAYER2/MAC/defs_NB_IoT.h b/openair2/LAYER2/MAC/defs_NB_IoT.h index 77c0828b283076bd4edce975379dfe99f4bbd321..02f9c47ea5cdc7d0443cd13c64492460014d4adb 100644 --- a/openair2/LAYER2/MAC/defs_NB_IoT.h +++ b/openair2/LAYER2/MAC/defs_NB_IoT.h @@ -98,7 +98,7 @@ typedef enum{ DL }message_direction_t; -#define MAX_NUMBER_OF_UE_MAX_NB_IoT 20 +#define MAX_MAX_MOBILES_PER_ENB_NB_IoT 20 #define SCH_PAYLOAD_SIZE_MAX_NB_IoT 320 #define MAX_NUMBER_OF_SIBs_NB_IoT 16 @@ -233,17 +233,17 @@ typedef struct{ typedef struct { /// DCI template and MAC connection parameters for UEs - UE_TEMPLATE_NB_IoT UE_template_NB_IoT[MAX_NUMBER_OF_UE_MAX_NB_IoT]; + UE_TEMPLATE_NB_IoT UE_template_NB_IoT[MAX_MAX_MOBILES_PER_ENB_NB_IoT]; /// NPDCCH Period and searching space info NPDCCH_config_dedicated_NB_IoT_t NPDCCH_config_dedicated; - //int next[MAX_NUMBER_OF_UE_MAX_NB_IoT]; + //int next[MAX_MAX_MOBILES_PER_ENB_NB_IoT]; // -1:No UE in list int head; // -1:No UE in list int tail; int num_UEs; - //boolean_t active[MAX_NUMBER_OF_UE_MAX_NB_IoT]; + //boolean_t active[MAX_MAX_MOBILES_PER_ENB_NB_IoT]; } UE_list_NB_IoT_t; @@ -261,7 +261,7 @@ typedef struct{ // flag to indicate scheduling type1 NPDCCH CSS with different CE level uint8_t flag_type1_css[3]; // flag to indicate scheduling NPDCCH USS with UE list - uint8_t flag_uss[MAX_NUMBER_OF_UE_MAX_NB_IoT]; + uint8_t flag_uss[MAX_MAX_MOBILES_PER_ENB_NB_IoT]; // flag to indicate scheduling sib1/MIB uint8_t flag_fix_scheduling; // number of the type2 css to schedule in this period @@ -494,7 +494,7 @@ typedef struct eNB_MAC_INST_NB_IoT_s { RA_template_list_t RA_msg3_list; RA_template_list_t RA_msg4_list; - RA_TEMPLATE_NB_IoT RA_template[MAX_NUMBER_OF_UE_MAX_NB_IoT]; + RA_TEMPLATE_NB_IoT RA_template[MAX_MAX_MOBILES_PER_ENB_NB_IoT]; //int32_t last_tx_subframe; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index a7c79a70d5537d341bfe6d3b82a613e8e7ac6000..f2aed56146e8dcff7b282fe42433a729cacd3aba 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -30,23 +30,18 @@ */ #include "assertions.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" - -#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/mac_proto.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" //#include "LAYER2/MAC/pre_processor.c" @@ -60,10 +55,13 @@ #include "intertask_interface.h" #endif +#include "assertions.h" + #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 extern RAN_CONTEXT_t RC; +extern int phy_test; uint16_t pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; @@ -107,9 +105,8 @@ schedule_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) if ((1 << tmp) & deltaTSFC) { // This is an SRS subframe, loop over UEs - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { - if (RC.mac[module_idP]->UE_list.active[UE_id] != TRUE) - continue; + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { + if (!RC.mac[module_idP]->UE_list.active[UE_id]) continue; ul_req = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body; // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) continue; @@ -169,9 +166,8 @@ schedule_CSI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { cc = &eNB->common_channels[CC_id]; - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { - if (UE_list->active[UE_id] != TRUE) - continue; + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { + if (!UE_list->active[UE_id]) continue; ul_req = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body; @@ -255,8 +251,8 @@ schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { RC.mac[module_idP]->UL_req[CC_id].sfn_sf = (frameP << 4) + subframeP; - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { - if (RC.mac[module_idP]->UE_list.active[UE_id] != TRUE) continue; + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { + if (!RC.mac[module_idP]->UE_list.active[UE_id]) continue; ul_req = &RC.mac[module_idP]->UL_req[CC_id]; ul_req_body = &ul_req->ul_config_request_body; @@ -423,12 +419,15 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id, } } // ul_failure_timer>0 +#if 0 + /* U-plane inactivity timer is disabled. Uncomment to re-enable. */ UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++; if(UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE*subframe_num(&RC.eNB[module_idP][CC_id]->frame_parms))){ LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti); mac_eNB_rrc_uplane_failure(module_idP,CC_id,frameP,subframeP,rnti); UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; }// time > 60s +#endif } void @@ -531,91 +530,91 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, } // refresh UE list based on UEs dropped by PHY in previous subframe - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - if (UE_list->active[i] != TRUE) - continue; + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (UE_list->active[i]) { - rnti = UE_RNTI(module_idP, i); - CC_id = UE_PCCID(module_idP, i); - - if ((frameP == 0) && (subframeP == 0)) { - LOG_I(MAC, - "UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n", - rnti, - UE_list->UE_sched_ctrl[i].ul_out_of_sync == - 0 ? "in synch" : "out of sync", - UE_list->UE_template[CC_id][i].phr_info, - UE_list->UE_sched_ctrl[i].dl_cqi[CC_id], - (UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2, - (UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2); - } - - RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) + - subframeP] = -63; - if (i == UE_list->head) - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME - (VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR, - RC.eNB[module_idP][CC_id]-> - pusch_stats_bsr[i][(frameP * 10) + subframeP]); - // increment this, it is cleared when we receive an sdu - RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++; - - RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++; - LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n", i, rnti, - RC.mac[module_idP]->UE_list.UE_sched_ctrl[i]. - ul_inactivity_timer, - RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer); - check_ul_failure(module_idP, CC_id, i, frameP, subframeP); - - if (RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) { - RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++; - if(RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >= - RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) { - RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0; - for (int ue_id_l = 0; ue_id_l < NUMBER_OF_UE_MAX; ue_id_l++) { - if (reestablish_rnti_map[ue_id_l][0] == rnti) { - // clear currentC-RNTI from map - reestablish_rnti_map[ue_id_l][0] = 0; - reestablish_rnti_map[ue_id_l][1] = 0; - break; + rnti = UE_RNTI(module_idP, i); + CC_id = UE_PCCID(module_idP, i); + + if (((frameP&127) == 0) && (subframeP == 0)) { + LOG_I(MAC, + "UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n", + rnti, + UE_list->UE_sched_ctrl[i].ul_out_of_sync == + 0 ? "in synch" : "out of sync", + UE_list->UE_template[CC_id][i].phr_info, + UE_list->UE_sched_ctrl[i].dl_cqi[CC_id], + (UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2, + (UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2); + } + + RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) + + subframeP] = -63; + if (i == UE_list->head) + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME + (VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR, + RC.eNB[module_idP][CC_id]-> + pusch_stats_bsr[i][(frameP * 10) + subframeP]); + // increment this, it is cleared when we receive an sdu + RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++; + + RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++; + LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n", i, rnti, + RC.mac[module_idP]->UE_list.UE_sched_ctrl[i]. + ul_inactivity_timer, + RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer); + check_ul_failure(module_idP, CC_id, i, frameP, subframeP); + + if (RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) { + RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++; + if(RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >= + RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) { + RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0; + for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_ENB; ue_id_l++) { + if (reestablish_rnti_map[ue_id_l][0] == rnti) { + // clear currentC-RNTI from map + reestablish_rnti_map[ue_id_l][0] = 0; + reestablish_rnti_map[ue_id_l][1] = 0; + break; + } } - } - for (int ii=0; ii<NUMBER_OF_UE_MAX; ii++) { - LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii]; - if((ulsch != NULL) && (ulsch->rnti == rnti)){ - LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti); - clean_eNb_ulsch(ulsch); + // Note: This should not be done in the MAC! + for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) { + LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii]; + if((ulsch != NULL) && (ulsch->rnti == rnti)){ + LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti); + clean_eNb_ulsch(ulsch); + } } - } - for (int ii=0; ii<NUMBER_OF_UE_MAX; ii++) { - LTE_eNB_DLSCH_t *dlsch = RC.eNB[module_idP][CC_id]->dlsch[ii][0]; - if((dlsch != NULL) && (dlsch->rnti == rnti)){ - LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); - clean_eNb_dlsch(dlsch); + for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) { + LTE_eNB_DLSCH_t *dlsch = RC.eNB[module_idP][CC_id]->dlsch[ii][0]; + if((dlsch != NULL) && (dlsch->rnti == rnti)){ + LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); + clean_eNb_dlsch(dlsch); + } } - } - - for(int j = 0; j < 10; j++){ - nfapi_ul_config_request_body_t *ul_req_tmp = NULL; - ul_req_tmp = &RC.mac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body; - if(ul_req_tmp){ - int pdu_number = ul_req_tmp->number_of_pdus; - for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ - if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){ - LOG_I(MAC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number); - if(pdu_index < pdu_number -1){ - memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); + + for(int j = 0; j < 10; j++){ + nfapi_ul_config_request_body_t *ul_req_tmp = NULL; + ul_req_tmp = &RC.mac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body; + if(ul_req_tmp){ + int pdu_number = ul_req_tmp->number_of_pdus; + for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ + if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){ + LOG_I(MAC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number); + if(pdu_index < pdu_number -1){ + memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); + } + ul_req_tmp->number_of_pdus--; } - ul_req_tmp->number_of_pdus--; } } } - } rrc_mac_remove_ue(module_idP,rnti); + } } } } - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, subframeP, module_idP); @@ -637,26 +636,33 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, #endif // This schedules MIB + if ((subframeP == 0) && (frameP & 3) == 0) schedule_mib(module_idP, frameP, subframeP); - // This schedules SI for legacy LTE and eMTC starting in subframeP - schedule_SI(module_idP, frameP, subframeP); - // This schedules Paging in subframeP - schedule_PCH(module_idP,frameP,subframeP); - // This schedules Random-Access for legacy LTE and eMTC starting in subframeP - schedule_RA(module_idP, frameP, subframeP); - // copy previously scheduled UL resources (ULSCH + HARQ) - copy_ulreq(module_idP, frameP, subframeP); - // This schedules SRS in subframeP - schedule_SRS(module_idP, frameP, subframeP); - // This schedules ULSCH in subframeP (dci0) - schedule_ulsch(module_idP, frameP, subframeP); - // This schedules UCI_SR in subframeP - schedule_SR(module_idP, frameP, subframeP); - // This schedules UCI_CSI in subframeP - schedule_CSI(module_idP, frameP, subframeP); - // This schedules DLSCH in subframeP - schedule_dlsch(module_idP, frameP, subframeP, mbsfn_status); + if (phy_test == 0){ + // This schedules SI for legacy LTE and eMTC starting in subframeP + schedule_SI(module_idP, frameP, subframeP); + // This schedules Paging in subframeP + schedule_PCH(module_idP,frameP,subframeP); + // This schedules Random-Access for legacy LTE and eMTC starting in subframeP + schedule_RA(module_idP, frameP, subframeP); + // copy previously scheduled UL resources (ULSCH + HARQ) + copy_ulreq(module_idP, frameP, subframeP); + // This schedules SRS in subframeP + schedule_SRS(module_idP, frameP, subframeP); + // This schedules ULSCH in subframeP (dci0) + schedule_ulsch(module_idP, frameP, subframeP); + // This schedules UCI_SR in subframeP + schedule_SR(module_idP, frameP, subframeP); + // This schedules UCI_CSI in subframeP + schedule_CSI(module_idP, frameP, subframeP); + // This schedules DLSCH in subframeP + schedule_dlsch(module_idP, frameP, subframeP, mbsfn_status); + } + else{ + schedule_ulsch_phy_test(module_idP,frameP,subframeP); + schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status); + } if (RC.flexran[module_idP]->enabled) flexran_agent_send_update_stats(module_idP); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 3005ecf464233f379d856c22441608f6ea1ca182..d9aee92a91437c3a78548728842dd7ca93e6009b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -34,24 +34,19 @@ #include "assertions.h" #include "platform_types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" #include "msc.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" - -#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/mac_proto.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" //#include "LAYER2/MAC/pre_processor.c" @@ -61,10 +56,14 @@ #include "intertask_interface.h" #endif -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus #include "T.h" +#include "common/ran_context.h" + +extern RAN_CONTEXT_t RC; + extern uint8_t nfapi_mode; extern int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req); @@ -1477,18 +1476,18 @@ initiate_ra_proc(module_id_t module_idP, /* TODO: find better procedure to allocate RNTI */ do { #if defined(USRP_REC_PLAY) // deterministic rnti in usrp record/playback mode - static int drnti[NUMBER_OF_UE_MAX] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 }; + static int drnti[MAX_MOBILES_PER_ENB] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 }; int j = 0; int nb_ue = 0; - for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + for (j = 0; j < MAX_MOBILES_PER_ENB; j++) { if (UE_RNTI(module_idP, j) > 0) { nb_ue++; } else { break; } } - if (nb_ue >= NUMBER_OF_UE_MAX) { - printf("No more free RNTI available, increase NUMBER_OF_UE_MAX\n"); + if (nb_ue >= MAX_MOBILES_PER_ENB) { + printf("No more free RNTI available, increase MAX_MOBILES_PER_ENB\n"); abort(); } ra[i].rnti = drnti[nb_ue]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index de4641fac6dc499dd54cf9b77ca8fc121e76a451..8b391a0c1dee4aa7fcdeebd494d9aeec73d49de0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -30,22 +30,16 @@ */ #include "assertions.h" -#include "PHY/defs.h" -#include "PHY/extern.h" - -#include "SCHED/defs.h" -#include "SCHED/extern.h" - -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" //#include "LAYER2/MAC/pre_processor.c" @@ -58,6 +52,9 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 +#include "common/ran_context.h" + +extern RAN_CONTEXT_t RC; // NEED TO ADD schedule_SI_BR for SIB1_BR and SIB23_BR // CCE_allocation_infeasible to be done for EPDCCH/MPDCCH @@ -787,6 +784,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) eNB->eNB_stats[CC_id].bcch_buffer = bcch_sdu_length; eNB->eNB_stats[CC_id].total_bcch_buffer += bcch_sdu_length; eNB->eNB_stats[CC_id].bcch_mcs = mcs; +//printf("SI %d.%d\n", frameP, subframeP);/////////////////////////////////////////****************************** } else { //LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 0729073eba3cc5e6ca1351603329d83c095497bc..ba5d43899c962c327e6f017d6f7ae8e66163574a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -29,29 +29,25 @@ */ -#include "assertions.h" -#include "PHY/defs.h" -#include "PHY/extern.h" - -#include "SCHED/defs.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus + +#include "assertions.h" #if defined(ENABLE_ITTI) #include "intertask_interface.h" @@ -1777,7 +1773,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP) vrb_map = (void*)&cc->vrb_map; n_rb_dl = to_prb(cc->mib->message.dl_Bandwidth); dl_req = &eNB->DL_req[CC_id].dl_config_request_body; - for (uint16_t i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (uint16_t i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (UE_PF_PO[CC_id][i].enable_flag != TRUE) { continue; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index 37b13d2de71936b52dec051274b91e4c73bdd3fe..ccaceba0794f84d2899b21b7f26e2a6683840034 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -29,36 +29,32 @@ */ -#include "assertions.h" -#include "PHY/defs.h" -#include "PHY/extern.h" - -#include "SCHED/defs.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +#include "assertions.h" #if defined(ENABLE_ITTI) #include "intertask_interface.h" #endif -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 +#include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -651,7 +647,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, (char *) &mch_buffer [sdu_length_total]); - //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO, MTCH+(MAX_NUM_RB*(NUMBER_OF_UE_MAX+1)), (char*)&mch_buffer[sdu_length_total]); + //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO, MTCH+(MAX_NUM_RB*(MAX_MOBILES_PER_ENB+1)), (char*)&mch_buffer[sdu_length_total]); LOG_I(MAC, "[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d\n", module_idP, CC_id, sdu_lengths[num_sdus], MTCH); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c new file mode 100644 index 0000000000000000000000000000000000000000..9532222fb8a7359ae988e3cb2ab546f8fb782901 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c @@ -0,0 +1,352 @@ +/* + * 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.0 (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 eNB_scheduler_dlsch.c + * \brief procedures related to eNB for the DLSCH transport channel + * \author Navid Nikaein and Raymond Knopp + * \date 2010 - 2014 + * \email: navid.nikaein@eurecom.fr + * \version 1.0 + * @ingroup _mac + + */ + +#include "assertions.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" + +#include "SCHED/sched_eNB.h" + +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "LAYER2/MAC/mac_extern.h" +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "UTIL/OPT/opt.h" +#include "OCG.h" +#include "OCG_extern.h" + +#include "SIMULATION/TOOLS/sim.h" // for taus + +#include "T.h" + +extern RAN_CONTEXT_t RC; + +//------------------------------------------------------------------------------ +void +schedule_ue_spec_phy_test( + module_id_t module_idP, + frame_t frameP, + sub_frame_t subframeP, + int* mbsfn_flag +) +//------------------------------------------------------------------------------ +{ + uint8_t CC_id; + int UE_id=0; + uint16_t N_RB_DL; + uint16_t TBS; + uint16_t nb_rb; + + unsigned char harq_pid = subframeP%5; + uint16_t rnti = 0x1235; + uint32_t rb_alloc = 0x1FFFFFFF; + int32_t tpc = 1; + int32_t mcs = 28; + int32_t cqi = 15; + int32_t ndi = subframeP/5; + int32_t dai = 0; + + eNB_MAC_INST *eNB = RC.mac[module_idP]; + COMMON_channels_t *cc = eNB->common_channels; + nfapi_dl_config_request_body_t *dl_req; + nfapi_dl_config_request_pdu_t *dl_config_pdu; + + N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); + + for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { + LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",CC_id); + + dl_req = &eNB->DL_req[CC_id].dl_config_request_body; + + if (mbsfn_flag[CC_id]>0) + continue; + + nb_rb = conv_nprb(0,rb_alloc,N_RB_DL); + //printf("////////////////////////////////////*************************nb_rb = %d\n",nb_rb); + TBS = get_TBS_DL(mcs,nb_rb); + + LOG_D(PHY,"schedule_ue_spec_phy_test: subframe %d/%d: nb_rb=%d, TBS=%d, mcs=%d (rb_alloc=%x, N_RB_DL=%d)\n",frameP,subframeP,nb_rb,TBS,mcs,rb_alloc,N_RB_DL); + + dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; + memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); + dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; + dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu)); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP,CC_id),cqi,format1); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = 0; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = rb_alloc; + + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power + + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = tpc; // dont adjust power when retransmitting + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = ndi; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0; + //deactivate second codeword + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1; + + if (cc[CC_id].tdd_Config != NULL) { //TDD + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = dai; + LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, dai %d, mcs %d\n", + module_idP,CC_id,harq_pid,dai,mcs); + } else { + LOG_D(MAC,"[eNB %d] Initial transmission CC_id %d : harq_pid %d, mcs %d\n", + module_idP,CC_id,harq_pid,mcs); + + } + LOG_D(MAC,"Checking feasibility pdu %d (new sdu)\n",dl_req->number_pdu); + if (!CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,rnti)) { + + + //ue_sched_ctl->round[CC_id][harq_pid] = 0; + dl_req->number_dci++; + dl_req->number_pdu++; + + // Toggle NDI for next time + /* + LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + CC_id, frameP,subframeP,UE_id, + rnti,harq_pid,UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid] = mcs; + UE_list->UE_template[CC_id][UE_id].oldmcs2[harq_pid] = 0; + AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated is NULL\n"); + AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated!=NULL,"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n"); + */ + + + + fill_nfapi_dlsch_config(eNB, + dl_req, + TBS, + eNB->pdu_index[CC_id], + rnti, + 0, // type 0 allocation from 7.1.6 in 36.213 + 0, // virtual_resource_block_assignment_flag + rb_alloc, // resource_block_coding + getQm(mcs), + 0, // redundancy version + 1, // transport blocks + 0, // transport block to codeword swap flag + cc[CC_id].p_eNB == 1 ? 0 : 1, // transmission_scheme + 1, // number of layers + 1, // number of subbands + // uint8_t codebook_index, + 4, // UE category capacity + PDSCH_ConfigDedicated__p_a_dB0, + 0, // delta_power_offset for TM5 + 0, // ngap + 0, // nprb + cc[CC_id].p_eNB == 1 ? 1 : 2, // transmission mode + 0, //number of PRBs treated as one subband, not used here + 0 // number of beamforming vectors, not used here + ); + + eNB->TX_req[CC_id].sfn_sf = fill_nfapi_tx_req(&eNB->TX_req[CC_id].tx_request_body, + (frameP*10)+subframeP, + TBS, + eNB->pdu_index[CC_id], + eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0]); + } + else { + LOG_W(MAC,"[eNB_scheduler_phytest] DCI allocation infeasible!\n"); + } + } +} + +void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP) +{ + uint16_t first_rb[MAX_NUM_CCs]; + int UE_id = 0; + uint8_t aggregation = 2; + rnti_t rnti = 0x1235; + uint8_t mcs = 0; + uint8_t harq_pid = 0; + uint32_t cqi_req = 0,cshift,ndi,tpc = 1; + int32_t normalized_rx_power; + int32_t target_rx_power= 178; + int CC_id = 0; + int nb_rb = 96; + eNB_MAC_INST *eNB = RC.mac[module_idP]; + COMMON_channels_t *cc = eNB->common_channels; + UE_list_t *UE_list=&eNB->UE_list; + UE_TEMPLATE *UE_template; + UE_sched_ctrl *UE_sched_ctrl; + int sched_frame=frameP; + int sched_subframe = (subframeP+4)%10; + + if (sched_subframe<subframeP) sched_frame++; + + nfapi_hi_dci0_request_body_t *hi_dci0_req = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body; + nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; + + //nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[0];; + nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req[CC_id].ul_config_request_body; + + + eNB->UL_req[CC_id].sfn_sf = (sched_frame<<4) + sched_subframe; + eNB->HI_DCI0_req[CC_id].sfn_sf = (frameP<<4)+subframeP; + + for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { + //rnti = UE_RNTI(module_idP,UE_id); + //leave out first RB for PUCCH + first_rb[CC_id] = 1; + // loop over all active UEs + + // if (eNB_UE_stats->mode == PUSCH) { // ue has a ulsch channel + + UE_template = &UE_list->UE_template[CC_id][UE_id]; + UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id]; + harq_pid = subframe2harqpid(&cc[CC_id],sched_frame,sched_subframe); + + LOG_D(MAC,"Scheduling for frame %d, subframe %d => harq_pid %d\n",sched_frame,sched_subframe,harq_pid); + + RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->TBS_UL[harq_pid]; + + + + //power control + //compute the expected ULSCH RX power (for the stats) + + // this is the normalized RX power and this should be constant (regardless of mcs + normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id]; + + // new transmission + + ndi = 1-UE_template->oldNDI_UL[harq_pid]; + UE_template->oldNDI_UL[harq_pid]=ndi; + UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1 = mcs; + UE_template->mcs_UL[harq_pid] = mcs;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = mcs; + // buffer_occupancy = UE_template->ul_total_buffer; + + + + UE_template->TBS_UL[harq_pid] = get_TBS_UL(mcs,nb_rb); + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = get_TBS_UL(mcs,nb_rb); + // buffer_occupancy -= TBS; + + + + // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) + //store for possible retransmission + UE_template->nb_rb_ul[harq_pid] = nb_rb; + UE_template->first_rb_ul[harq_pid] = first_rb[CC_id]; + + UE_sched_ctrl->ul_scheduled |= (1<<harq_pid); + + // adjust total UL buffer status by TBS, wait for UL sdus to do final update + //UE_template->ul_total_buffer = UE_template->TBS_UL[harq_pid]; + // Cyclic shift for DM RS + cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1) + // save it for a potential retransmission + UE_template->cshift[harq_pid] = cshift; + + hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci+eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi]; + memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; + hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu); + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = first_rb[CC_id]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = nb_rb; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = mcs; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = ndi; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframe]; + + + eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci++; + + + // Add UL_config PDUs + fill_nfapi_ulsch_config_request_rel8(&ul_req->ul_config_pdu_list[ul_req->number_of_pdus], + cqi_req, + cc, + 0,//UE_template->physicalConfigDedicated, + get_tmode(module_idP,CC_id,UE_id), + eNB->ul_handle, + rnti, + first_rb[CC_id], // resource_block_start + nb_rb, // number_of_resource_blocks + mcs, + cshift, // cyclic_shift_2_for_drms + 0, // frequency_hopping_enabled_flag + 0, // frequency_hopping_bits + ndi, // new_data_indication + 0, // redundancy_version + harq_pid, // harq_process_number + 0, // ul_tx_mode + 0, // current_tx_nb + 0, // n_srs + get_TBS_UL(mcs,nb_rb) + ); +#ifdef Rel14 + if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation + fill_nfapi_ulsch_config_request_emtc(&ul_req->ul_config_pdu_list[ul_req->number_of_pdus], + UE_template->rach_resource_type>2 ? 2 : 1, + 1, //total_number_of_repetitions + 1, //repetition_number + (frameP*10)+subframeP); + } +#endif + ul_req->number_of_pdus = 1; + eNB->ul_handle++; + + + + add_ue_ulsch_info(module_idP, + CC_id, + UE_id, + subframeP, + S_UL_SCHEDULED); + + // increment first rb for next UE allocation + first_rb[CC_id]+= nb_rb; + + + } // loop of CC_id +} diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 341db67934ecfed3ace6cd1ece1b83a0177f0593..ae8524dd5932825e8125d37513783bf88e707887 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -30,23 +30,18 @@ */ #include "assertions.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" - -#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/mac_proto.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" //#include "LAYER2/MAC/pre_processor.c" @@ -61,6 +56,10 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 +#include "common/ran_context.h" + +extern RAN_CONTEXT_t RC; + extern int n_active_slices; int choose(int n, int k) @@ -984,6 +983,8 @@ get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present); } + + void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t aggregation_level, @@ -1666,7 +1667,7 @@ void init_ue_sched_info(void) for (i = 0; i < NUMBER_OF_eNB_MAX; i++) { for (k = 0; k < MAX_NUM_CCs; k++) { - for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + for (j = 0; j < MAX_MOBILES_PER_ENB; j++) { // init DL eNB_dlsch_info[i][k][j].weight = 0; eNB_dlsch_info[i][k][j].subframe = 0; @@ -1697,7 +1698,7 @@ int find_UE_id(module_id_t mod_idP, rnti_t rntiP) int UE_id; UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { if (UE_list->active[UE_id] != TRUE) continue; if (UE_list->UE_template[UE_PCCID(mod_idP, UE_id)][UE_id].rnti == @@ -1838,7 +1839,7 @@ int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP, int harq_pidP mod_idP, cc_idP, rntiP, UE_list->avail, UE_list->num_UEs); dump_ue_list(UE_list, 0); - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (UE_list->active[i] == TRUE) continue; UE_id = i; @@ -2324,9 +2325,7 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id) { int bw_index = 0; - int N_RB_DL = - to_prb(RC.mac[module_id]->common_channels[CC_id].mib-> - message.dl_Bandwidth); + int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth); switch (N_RB_DL) { case 6: // 1.4 MHz @@ -2359,9 +2358,7 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id) int get_min_rb_unit(module_id_t module_id, uint8_t CC_id) { int min_rb_unit = 0; - int N_RB_DL = - to_prb(RC.mac[module_id]->common_channels[CC_id].mib-> - message.dl_Bandwidth); + int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth); switch (N_RB_DL) { case 6: // 1.4 MHz @@ -3268,8 +3265,13 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, if (pdu[0] == 1) { // ACK sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process sched_ctl->tbcnt[CC_idP][harq_pid] = 0; - } else if (pdu[0] == 2 || pdu[0] == 4) // NAK (treat DTX as NAK) + } else if (pdu[0] == 2 || pdu[0] == 4) { // NAK (treat DTX as NAK) sched_ctl->round[CC_idP][harq_pid]++; // increment round + if (sched_ctl->round[CC_idP][harq_pid] == 4) { + sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process + sched_ctl->tbcnt[CC_idP][harq_pid] = 0; + } + } } else { // one or two ACK/NAK bits AssertFatal(num_ack_nak <= 2, @@ -3285,8 +3287,13 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, if ((num_ack_nak == 2) && (sched_ctl->round[CC_idP][harq_pid] < 8) && (sched_ctl->tbcnt[CC_idP][harq_pid] == 1) - && (pdu[0] == 2) && (pdu[1] == 2)) + && (pdu[0] == 2) && (pdu[1] == 2)) { sched_ctl->round[CC_idP][harq_pid]++; + if (sched_ctl->round[CC_idP][harq_pid] == 4) { + sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process + sched_ctl->tbcnt[CC_idP][harq_pid] = 0; + } + } else if (((num_ack_nak == 2) && (sched_ctl->round[CC_idP][harq_pid] < 8) && (sched_ctl->tbcnt[0][harq_pid] == 2) @@ -3297,11 +3304,20 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, && (pdu[0] == 2) && (pdu[1] == 1))) { sched_ctl->round[CC_idP][harq_pid]++; sched_ctl->tbcnt[CC_idP][harq_pid] = 1; + if (sched_ctl->round[CC_idP][harq_pid] == 4) { + sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process + sched_ctl->tbcnt[CC_idP][harq_pid] = 0; /* TODO: do we have to set it to 0? */ + } } else if ((num_ack_nak == 2) && (sched_ctl->round[CC_idP][harq_pid] < 8) && (sched_ctl->tbcnt[CC_idP][harq_pid] == 2) - && (pdu[0] == 2) && (pdu[1] == 2)) + && (pdu[0] == 2) && (pdu[1] == 2)) { sched_ctl->round[CC_idP][harq_pid]++; + if (sched_ctl->round[CC_idP][harq_pid] == 4) { + sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process + sched_ctl->tbcnt[CC_idP][harq_pid] = 0; + } + } else AssertFatal(1 == 0, "Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n", @@ -3327,12 +3343,18 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, pdu[1]); if (pdu[0] == 1) sched_ctl->round[pCCid][harq_pid] = 8; - else + else { sched_ctl->round[pCCid][harq_pid]++; + if (sched_ctl->round[pCCid][harq_pid] == 4) + sched_ctl->round[pCCid][harq_pid] = 8; + } if (pdu[1] == 1) sched_ctl->round[1 - pCCid][harq_pid] = 8; - else + else { sched_ctl->round[1 - pCCid][harq_pid]++; + if (sched_ctl->round[1 - pCCid][harq_pid] == 4) + sched_ctl->round[1 - pCCid][harq_pid] = 8; + } } // A=2 else if ((num_ack_nak == 3) && (sched_ctl->round[pCCid][harq_pid] < 8) @@ -3358,13 +3380,26 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, ((pdu[0] == 1) && (pdu[1] == 2))) { sched_ctl->round[pCCid][harq_pid]++; sched_ctl->tbcnt[pCCid][harq_pid] = 1; - } else + if (sched_ctl->round[pCCid][harq_pid] == 4) { + sched_ctl->round[pCCid][harq_pid] = 8; + sched_ctl->tbcnt[pCCid][harq_pid] = 0; /* TODO: do we have to set it to 0? */ + } + } else { sched_ctl->round[pCCid][harq_pid]++; + if (sched_ctl->round[pCCid][harq_pid] == 4) { + sched_ctl->round[pCCid][harq_pid] = 8; + sched_ctl->tbcnt[pCCid][harq_pid] = 0; + } + } if (pdu[2] == 1) sched_ctl->round[1 - pCCid][harq_pid] = 8; - else + else { sched_ctl->round[1 - pCCid][harq_pid]++; + if (sched_ctl->round[1 - pCCid][harq_pid] == 4) { + sched_ctl->round[1 - pCCid][harq_pid] = 8; + } + } } // A=3 primary cell has 2 TBs else if ((num_ack_nak == 3) && (sched_ctl->round[1 - pCCid][harq_pid] < 8) @@ -3390,13 +3425,26 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, || ((pdu[0] == 1) && (pdu[1] >= 2))) { // one ACK sched_ctl->round[1 - pCCid][harq_pid]++; sched_ctl->tbcnt[1 - pCCid][harq_pid] = 1; - } else // both NAK/DTX + if (sched_ctl->round[1 - pCCid][harq_pid] == 4) { + sched_ctl->round[1 - pCCid][harq_pid] = 8; + sched_ctl->tbcnt[1 - pCCid][harq_pid] = 0; + } + } else { // both NAK/DTX sched_ctl->round[1 - pCCid][harq_pid]++; + if (sched_ctl->round[1 - pCCid][harq_pid] == 4) { + sched_ctl->round[1 - pCCid][harq_pid] = 8; + sched_ctl->tbcnt[1 - pCCid][harq_pid] = 0; + } + } if (pdu[2] == 1) sched_ctl->round[pCCid][harq_pid] = 8; - else + else { sched_ctl->round[pCCid][harq_pid]++; + if (sched_ctl->round[pCCid][harq_pid] == 4) { + sched_ctl->round[pCCid][harq_pid] = 8; + } + } } // A=3 secondary cell has 2 TBs #if MAX_NUM_CCs>1 else if ((num_ack_nak == 4) @@ -3425,8 +3473,17 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, || ((pdu[0] == 1) && (pdu[1] >= 2))) { // one ACK sched_ctl->round[0][harq_pid]++; sched_ctl->tbcnt[0][harq_pid] = 1; - } else // both NAK/DTX + if (sched_ctl->round[0][harq_pid] == 4) { + sched_ctl->round[0][harq_pid] = 8; + sched_ctl->tbcnt[0][harq_pid] = 0; + } + } else { // both NAK/DTX sched_ctl->round[0][harq_pid]++; + if (sched_ctl->round[0][harq_pid] == 4) { + sched_ctl->round[0][harq_pid] = 8; + sched_ctl->tbcnt[0][harq_pid] = 0; + } + } if ((pdu[2] == 1) && (pdu[3] == 1)) { // both ACK sched_ctl->round[1][harq_pid] = 8; @@ -3435,8 +3492,17 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, || ((pdu[2] == 1) && (pdu[3] >= 2))) { // one ACK sched_ctl->round[1][harq_pid]++; sched_ctl->tbcnt[1][harq_pid] = 1; - } else // both NAK/DTX + if (sched_ctl->round[1][harq_pid] == 4) { + sched_ctl->round[1][harq_pid] = 8; + sched_ctl->tbcnt[1][harq_pid] = 0; + } + } else { // both NAK/DTX sched_ctl->round[1][harq_pid]++; + if (sched_ctl->round[1][harq_pid] == 4) { + sched_ctl->round[1][harq_pid] = 8; + sched_ctl->tbcnt[1][harq_pid] = 0; + } + } } // A=4 both serving cells have 2 TBs #endif break; @@ -3451,8 +3517,13 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, if (pdu[j] == 1) { sched_ctl->round[i][harq_pid] = 8; sched_ctl->tbcnt[i][harq_pid] = 0; - } else if (pdu[j] == 2) + } else if (pdu[j] == 2) { sched_ctl->round[i][harq_pid]++; + if (sched_ctl->round[i][harq_pid] == 4) { + sched_ctl->round[i][harq_pid] = 8; + sched_ctl->tbcnt[i][harq_pid] = 0; + } + } else AssertFatal(1 == 0, "Illegal harq_ack value for CC %d harq_pid %d (%d) UE %d/%x\n", @@ -3467,13 +3538,25 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, && (pdu[j] == 1) && (pdu[j + 1] == 2)) { sched_ctl->round[i][harq_pid]++; sched_ctl->tbcnt[i][harq_pid] = 1; + if (sched_ctl->round[i][harq_pid] == 4) { + sched_ctl->round[i][harq_pid] = 8; + sched_ctl->tbcnt[i][harq_pid] = 0; + } } else if ((sched_ctl->tbcnt[i][harq_pid] == 2) && (pdu[j] == 2) && (pdu[j + 1] == 1)) { sched_ctl->round[i][harq_pid]++; sched_ctl->tbcnt[i][harq_pid] = 1; + if (sched_ctl->round[i][harq_pid] == 4) { + sched_ctl->round[i][harq_pid] = 8; + sched_ctl->tbcnt[i][harq_pid] = 0; + } } else if ((sched_ctl->tbcnt[i][harq_pid] == 2) && (pdu[j] == 2) && (pdu[j + 1] == 2)) { sched_ctl->round[i][harq_pid]++; + if (sched_ctl->round[i][harq_pid] == 4) { + sched_ctl->round[i][harq_pid] = 8; + sched_ctl->tbcnt[i][harq_pid] = 0; + } } else AssertFatal(1 == 0, "Illegal combination for CC %d harq_pid %d (%d,%d,%d) UE %d/%x\n", @@ -3487,6 +3570,10 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, sched_ctl->tbcnt[i][harq_pid] = 0; } else if (pdu[j] == 2) { sched_ctl->round[i][harq_pid]++; + if (sched_ctl->round[i][harq_pid] == 4) { + sched_ctl->round[i][harq_pid] = 8; + sched_ctl->tbcnt[i][harq_pid] = 0; + } } else AssertFatal(1 == 0, "Illegal hack_nak value %d for CC %d harq_pid %d UE %d/%x\n", diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index b4fb025ea479c5b5b42291af6f88509daa8be6c5..fd2817e3418b9ae79dca316c06c2a28ae29bb094 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -31,25 +31,21 @@ /* indented with: indent -kr eNB_scheduler_RA.c */ -#include "assertions.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "assertions.h" //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" @@ -144,7 +140,7 @@ rx_sdu(const module_id_t enb_mod_idP, start_meas(&mac->rx_ulsch_sdu); - if ((UE_id > NUMBER_OF_UE_MAX) || (UE_id == -1)) + if ((UE_id > MAX_MOBILES_PER_ENB) || (UE_id == -1)) for (ii = 0; ii < NB_RB_MAX; ii++) { rx_lengths[ii] = 0; } @@ -212,6 +208,30 @@ rx_sdu(const module_id_t enb_mod_idP, UE_list->UE_template[CC_idP][UE_id].scheduled_ul_bytes = 0; } else UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++; + + first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; + + // Program NACK for PHICH + LOG_D(MAC, + "Programming PHICH NACK for rnti %x harq_pid %d (first_rb %d)\n", + current_rnti, harq_pid, first_rb); + nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_idP]; + nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; + nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = + &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; + memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE; + hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu); + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG; + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = first_rb; + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 0; + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0; + hi_dci0_req_body->number_of_hi++; + hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0); + hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; + hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, 4); + hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; + return; } @@ -251,6 +271,9 @@ rx_sdu(const module_id_t enb_mod_idP, ra[RA_id].Msg3_subframe = (ra[RA_id].Msg3_subframe + 8) % 10; add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP); } + + /* TODO: program NACK for PHICH? */ + return; } } else { @@ -1448,6 +1471,10 @@ schedule_ulsch_rnti(module_id_t module_idP, T_INT(first_rb[CC_id]), T_INT(rb_table[rb_table_index]), T_INT(round)); +#if 0 + /* This is done in rx_sdu, as it has to. + * Since the code is a bit different, let's keep this version here for review, in case of problem. + */ // fill in NAK information hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; @@ -1471,6 +1498,7 @@ schedule_ulsch_rnti(module_id_t module_idP, UE_template->first_rb_ul[harq_pid], UE_template->nb_rb_ul[harq_pid], UE_template->TBS_UL[harq_pid], round); +#endif // Add UL_config PDUs LOG_D(MAC, "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", diff --git a/openair2/LAYER2/MAC/l1_helpers.c b/openair2/LAYER2/MAC/l1_helpers.c index 6afd7a26077349fc00004e55c1ac48875df6bd94..0cb5c17f0f6984f22c1ac3cbb77c74b1770aa394 100644 --- a/openair2/LAYER2/MAC/l1_helpers.c +++ b/openair2/LAYER2/MAC/l1_helpers.c @@ -29,10 +29,10 @@ */ -#include "defs.h" -#include "extern.h" +#include "mac.h" +#include "mac_extern.h" #include "UTIL/LOG/log.h" -#include "proto.h" +#include "mac_proto.h" int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id) { diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/mac.h similarity index 90% rename from openair2/LAYER2/MAC/defs.h rename to openair2/LAYER2/MAC/mac.h index e3f5d954f1aacd5d6b958a30c52e55f46092fe29..dfdb4333668493125c6c90d5b04b2fce9ea55a91 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/mac.h @@ -43,11 +43,10 @@ #include <stdlib.h> #include <string.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" @@ -68,6 +67,12 @@ #include "nfapi_interface.h" #include "PHY_INTERFACE/IF_Module.h" +#include "PHY/TOOLS/time_meas.h" + +#include "PHY/defs_common.h" // for PRACH_RESOURCES_t + +#include "targets/ARCH/COMMON/common_lib.h" + /** @defgroup _mac MAC * @ingroup _oai2 * @{ @@ -392,7 +397,6 @@ typedef struct { uint16_t Pdu_size; } __attribute__ ((__packed__)) ULSCH_PDU; -#include "PHY/impl_defs_top.h" /*!\brief RA process state*/ typedef enum { @@ -816,8 +820,8 @@ typedef struct { ///Contention resolution timer used during random access uint8_t mac_ContentionResolutionTimer; - uint16_t max_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES]; - uint16_t max_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES]; + uint16_t max_rbs_allowed_slice[NFAPI_CC_MAX][MAX_NUM_SLICES]; + uint16_t max_rbs_allowed_slice_uplink[NFAPI_CC_MAX][MAX_NUM_SLICES]; uint8_t max_mcs[MAX_NUM_LCID]; @@ -826,14 +830,14 @@ typedef struct { // resource scheduling information /// Current DL harq round per harq_pid on each CC - uint8_t round[MAX_NUM_CCs][10]; + uint8_t round[NFAPI_CC_MAX][10]; /// Current Active TBs per harq_pid on each CC - uint8_t tbcnt[MAX_NUM_CCs][10]; + uint8_t tbcnt[NFAPI_CC_MAX][10]; /// Current UL harq round per harq_pid on each CC - uint8_t round_UL[MAX_NUM_CCs][8]; - uint8_t dl_pow_off[MAX_NUM_CCs]; - uint16_t pre_nb_available_rbs[MAX_NUM_CCs]; - unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX]; + uint8_t round_UL[NFAPI_CC_MAX][8]; + uint8_t dl_pow_off[NFAPI_CC_MAX]; + uint16_t pre_nb_available_rbs[NFAPI_CC_MAX]; + unsigned char rballoc_sub_UE[NFAPI_CC_MAX][N_RBG_MAX]; uint16_t ta_timer; int16_t ta_update; uint16_t ul_consecutive_errors; @@ -938,7 +942,7 @@ typedef struct { /*! \brief subband bitmap confguration (for ALU icic algo purpose), in test phase */ typedef struct { - uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX]; //13 = number of SB MAX for 100 PRB + uint8_t sbmap[13]; //13 = number of SB MAX for 100 PRB uint8_t periodicity; uint8_t first_subframe; uint8_t sb_size; @@ -948,34 +952,34 @@ typedef struct { typedef struct { /// Dedicated information for UEs struct PhysicalConfigDedicated - *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + *physicalConfigDedicated[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; /// DLSCH pdu - DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX]; + DLSCH_PDU DLSCH_pdu[NFAPI_CC_MAX][2][MAX_MOBILES_PER_ENB]; /// DCI template and MAC connection parameters for UEs - UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + UE_TEMPLATE UE_template[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; /// DCI template and MAC connection for RA processes - int pCC_id[NUMBER_OF_UE_MAX]; + int pCC_id[MAX_MOBILES_PER_ENB]; /// sorted downlink component carrier for the scheduler - int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + int ordered_CCids[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; /// number of downlink active component carrier - int numactiveCCs[NUMBER_OF_UE_MAX]; + int numactiveCCs[MAX_MOBILES_PER_ENB]; /// sorted uplink component carrier for the scheduler - int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + int ordered_ULCCids[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; /// number of uplink active component carrier - int numactiveULCCs[NUMBER_OF_UE_MAX]; + int numactiveULCCs[MAX_MOBILES_PER_ENB]; /// number of downlink active component carrier - uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX]; + uint8_t dl_CC_bitmap[MAX_MOBILES_PER_ENB]; /// eNB to UE statistics - eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + eNB_UE_STATS eNB_UE_stats[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; /// scheduling control info - UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX]; - int next[NUMBER_OF_UE_MAX]; + UE_sched_ctrl UE_sched_ctrl[MAX_MOBILES_PER_ENB]; + int next[MAX_MOBILES_PER_ENB]; int head; - int next_ul[NUMBER_OF_UE_MAX]; + int next_ul[MAX_MOBILES_PER_ENB]; int head_ul; int avail; int num_UEs; - boolean_t active[NUMBER_OF_UE_MAX]; + boolean_t active[MAX_MOBILES_PER_ENB]; /// Sorting criteria for the UE list in the MAC preprocessor uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM]; @@ -1056,82 +1060,82 @@ typedef struct { /*! \brief top level eNB MAC structure */ typedef struct eNB_MAC_INST_s { /// Ethernet parameters for northbound midhaul interface - eth_params_t eth_params_n; - /// Ethernet parameters for fronthaul interface - eth_params_t eth_params_s; - /// - module_id_t Mod_id; - /// frame counter - frame_t frame; - /// subframe counter - sub_frame_t subframe; - /// Pointer to IF module instance for PHY - IF_Module_t *if_inst; - /// Common cell resources - COMMON_channels_t common_channels[MAX_NUM_CCs]; - /// current PDU index (BCH,MCH,DLSCH) - uint16_t pdu_index[MAX_NUM_CCs]; - - /// NFAPI Config Request Structure - nfapi_config_request_t config[MAX_NUM_CCs]; - /// Preallocated DL pdu list - nfapi_dl_config_request_pdu_t - dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU]; - /// NFAPI DL Config Request Structure - nfapi_dl_config_request_t DL_req[MAX_NUM_CCs]; - /// Preallocated UL pdu list - nfapi_ul_config_request_pdu_t - ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU]; - /// Preallocated UL pdu list for ULSCH (n+k delay) - nfapi_ul_config_request_pdu_t - ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU]; - /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place - nfapi_ul_config_request_t UL_req[MAX_NUM_CCs]; - /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests - nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10]; - /// Preallocated HI_DCI0 pdu list - nfapi_hi_dci0_request_pdu_t - hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU]; - /// NFAPI HI/DCI0 Config Request Structure - nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs]; - /// Prealocated TX pdu list - nfapi_tx_request_pdu_t - tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU]; - /// NFAPI DL PDU structure - nfapi_tx_request_t TX_req[MAX_NUM_CCs]; - /// UL handle - uint32_t ul_handle; - UE_list_t UE_list; - - ///subband bitmap configuration - SBMAP_CONF sbmap_conf; - /// CCE table used to build DCI scheduling information - int CCE_table[MAX_NUM_CCs][800]; - /// active flag for Other lcid - uint8_t lcid_active[NB_RB_MAX]; - /// eNB stats - eNB_STATS eNB_stats[MAX_NUM_CCs]; - // MAC function execution peformance profiler - /// processing time of eNB scheduler - time_stats_t eNB_scheduler; - /// processing time of eNB scheduler for SI - time_stats_t schedule_si; - /// processing time of eNB scheduler for Random access - time_stats_t schedule_ra; - /// processing time of eNB ULSCH scheduler - time_stats_t schedule_ulsch; - /// processing time of eNB DCI generation - time_stats_t fill_DLSCH_dci; - /// processing time of eNB MAC preprocessor - time_stats_t schedule_dlsch_preprocessor; - /// processing time of eNB DLSCH scheduler - time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor - /// processing time of eNB MCH scheduler - time_stats_t schedule_mch; - /// processing time of eNB ULSCH reception - time_stats_t rx_ulsch_sdu; // include rlc_data_ind - /// processing time of eNB PCH scheduler - time_stats_t schedule_pch; + eth_params_t eth_params_n; + /// Ethernet parameters for fronthaul interface + eth_params_t eth_params_s; + /// + module_id_t Mod_id; + /// frame counter + frame_t frame; + /// subframe counter + sub_frame_t subframe; + /// Pointer to IF module instance for PHY + IF_Module_t *if_inst; + /// Common cell resources + COMMON_channels_t common_channels[NFAPI_CC_MAX]; + /// current PDU index (BCH,MCH,DLSCH) + uint16_t pdu_index[NFAPI_CC_MAX]; + + /// NFAPI Config Request Structure + nfapi_config_request_t config[NFAPI_CC_MAX]; + /// Preallocated DL pdu list + nfapi_dl_config_request_pdu_t + dl_config_pdu_list[NFAPI_CC_MAX][MAX_NUM_DL_PDU]; + /// NFAPI DL Config Request Structure + nfapi_dl_config_request_t DL_req[NFAPI_CC_MAX]; + /// Preallocated UL pdu list + nfapi_ul_config_request_pdu_t + ul_config_pdu_list[NFAPI_CC_MAX][MAX_NUM_UL_PDU]; + /// Preallocated UL pdu list for ULSCH (n+k delay) + nfapi_ul_config_request_pdu_t + ul_config_pdu_list_tmp[NFAPI_CC_MAX][10][MAX_NUM_UL_PDU]; + /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place + nfapi_ul_config_request_t UL_req[NFAPI_CC_MAX]; + /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests + nfapi_ul_config_request_t UL_req_tmp[NFAPI_CC_MAX][10]; + /// Preallocated HI_DCI0 pdu list + nfapi_hi_dci0_request_pdu_t + hi_dci0_pdu_list[NFAPI_CC_MAX][MAX_NUM_HI_DCI0_PDU]; + /// NFAPI HI/DCI0 Config Request Structure + nfapi_hi_dci0_request_t HI_DCI0_req[NFAPI_CC_MAX]; + /// Prealocated TX pdu list + nfapi_tx_request_pdu_t + tx_request_pdu[NFAPI_CC_MAX][MAX_NUM_TX_REQUEST_PDU]; + /// NFAPI DL PDU structure + nfapi_tx_request_t TX_req[NFAPI_CC_MAX]; + /// UL handle + uint32_t ul_handle; + UE_list_t UE_list; + + ///subband bitmap configuration + SBMAP_CONF sbmap_conf; + /// CCE table used to build DCI scheduling information + int CCE_table[NFAPI_CC_MAX][800]; + /// active flag for Other lcid + uint8_t lcid_active[NB_RB_MAX]; + /// eNB stats + eNB_STATS eNB_stats[NFAPI_CC_MAX]; + // MAC function execution peformance profiler + /// processing time of eNB scheduler + time_stats_t eNB_scheduler; + /// processing time of eNB scheduler for SI + time_stats_t schedule_si; + /// processing time of eNB scheduler for Random access + time_stats_t schedule_ra; + /// processing time of eNB ULSCH scheduler + time_stats_t schedule_ulsch; + /// processing time of eNB DCI generation + time_stats_t fill_DLSCH_dci; + /// processing time of eNB MAC preprocessor + time_stats_t schedule_dlsch_preprocessor; + /// processing time of eNB DLSCH scheduler + time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor + /// processing time of eNB MCH scheduler + time_stats_t schedule_mch; + /// processing time of eNB ULSCH reception + time_stats_t rx_ulsch_sdu; // include rlc_data_ind + /// processing time of eNB PCH scheduler + time_stats_t schedule_pch; } eNB_MAC_INST; /* @@ -1263,7 +1267,7 @@ typedef struct { /// Outgoing RAR pdu for PHY RAR_PDU RAR_pdu; /// Incoming DLSCH pdu for PHY - DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2]; + DLSCH_PDU DLSCH_pdu[MAX_MOBILES_PER_ENB][2]; /// number of attempt for rach uint8_t RA_attempt_number; /// Random-access procedure flag @@ -1304,7 +1308,7 @@ typedef struct { /// power backoff due to power management (as allowed by P-MPRc) for this cell uint8_t PHR_reporting_active; /// power backoff due to power management (as allowed by P-MPRc) for this cell - uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; + uint8_t power_backoff_db[MAX_eNB]; /// BSR report falg management uint8_t BSR_reporting_active; /// retxBSR-Timer expires flag @@ -1355,6 +1359,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 73% rename from openair2/LAYER2/MAC/extern.h rename to openair2/LAYER2/MAC/mac_extern.h index e7489ca8e6fffcabb25c34cbb188b1dc7f25dd7c..4ac7cf4d58e79ca0363cd9d813232135b551b9f1 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]; @@ -52,8 +52,8 @@ extern UE_RRC_INST *UE_rrc_inst; extern UE_MAC_INST *UE_mac_inst; -extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 -extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 +extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8 +extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8 @@ -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 98% rename from openair2/LAYER2/MAC/proto.h rename to openair2/LAYER2/MAC/mac_proto.h index 2586c94f432887276f6359e5039b55770dae3bd9..3c4f830bdb323f6be973d848010e38dd2e0f0a65 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/mac_proto.h @@ -29,7 +29,8 @@ #ifndef __LAYER2_MAC_PROTO_H__ #define __LAYER2_MAC_PROTO_H__ -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" +#include "PHY/defs_common.h" // for PRACH_RESOURCES_t and lte_subframe_t /** \addtogroup _mac * @{ @@ -150,6 +151,9 @@ void schedule_dlsch(module_id_t module_idP, frame_t frameP, void schedule_ue_spec(module_id_t module_idP, slice_id_t slice_idP, frame_t frameP,sub_frame_t subframe, int *mbsfn_flag); +void schedule_ue_spec_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag); +void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP); + /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. @param Mod_id Module id of UE @@ -207,13 +211,13 @@ void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id, int subframeP, int N_RBG, uint16_t - nb_rbs_required[MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], + nb_rbs_required[NFAPI_CC_MAX] + [MAX_MOBILES_PER_ENB], unsigned char - rballoc_sub[MAX_NUM_CCs] + rballoc_sub[NFAPI_CC_MAX] [N_RBG_MAX], unsigned char - MIMO_mode_indicator[MAX_NUM_CCs] + MIMO_mode_indicator[NFAPI_CC_MAX] [N_RBG_MAX]); // eNB functions @@ -229,7 +233,7 @@ void dlsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_idP, frame_t frameP, sub_frame_t subframe, - int N_RBG[MAX_NUM_CCs], + int N_RBG[NFAPI_CC_MAX], int *mbsfn_flag); @@ -240,19 +244,10 @@ void dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id, int transmission_mode, int min_rb_unit, uint8_t N_RB_DL, - uint16_t - nb_rbs_required[MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], - uint16_t - nb_rbs_required_remaining - [MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], - unsigned char - rballoc_sub[MAX_NUM_CCs] - [N_RBG_MAX], - unsigned char - MIMO_mode_indicator - [MAX_NUM_CCs][N_RBG_MAX]); + uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], + uint16_t nb_rbs_required_remaining[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], + unsigned char rballoc_sub[NFAPI_CC_MAX][N_RBG_MAX], + unsigned char MIMO_mode_indicator[NFAPI_CC_MAX][N_RBG_MAX]); /* \brief Function to trigger the eNB scheduling procedure. It is called by PHY at the beginning of each subframe, \f$n$\f and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. @@ -638,8 +633,6 @@ uint8_t *parse_ulsch_header(uint8_t * mac_header, int to_prb(int); int to_rbg(int); -int l2_init(LTE_DL_FRAME_PARMS * frame_parms, int eMBMS_active, - char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active); int mac_init(void); int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid #ifdef Rel14 diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/mac_vars.h similarity index 95% rename from openair2/LAYER2/MAC/vars.h rename to openair2/LAYER2/MAC/mac_vars.h index d153c82aeeef2e2ed132cd7c790ffd10150d18d5..f90ba1ec9e1c2e2d86abae45b8173eccc6a779e1 100644 --- a/openair2/LAYER2/MAC/vars.h +++ b/openair2/LAYER2/MAC/mac_vars.h @@ -32,8 +32,8 @@ #ifndef __MAC_VARS_H__ #define __MAC_VARS_H__ -#include "PHY/defs.h" -#include "defs.h" +#include "PHY/defs_common.h" +#include "mac.h" #include "COMMON/mac_rrc_primitives.h" const uint32_t BSR_TABLE[BSR_TABLE_SIZE] = @@ -103,8 +103,8 @@ int pCC_id[NUMBER_OF_eNB_MAX]; -eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 -eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 +eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8 +eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; // eNBxUE = 8x8 #ifdef OPENAIR2 diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index afee1632031a2da102c39c739aa18bc3dd260640..062ead2a206d1e6db672afc02d60785e3b628abd 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -29,21 +29,18 @@ */ -#include "defs.h" -#include "proto.h" -#include "extern.h" +#include "mac.h" +#include "mac_proto.h" +#include "mac_extern.h" #include "assertions.h" -#include "PHY_INTERFACE/extern.h" -#include "PHY/defs.h" -#include "SCHED/defs.h" +//#include "PHY_INTERFACE/phy_extern.h" +//#include "PHY/defs_eNB.h" +//#include "SCHED/sched_eNB.h" #include "LAYER2/PDCP_v10.1.0/pdcp.h" -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" #include "UTIL/LOG/log.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "SCHED/defs.h" - - #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -123,7 +120,7 @@ void mac_top_init_eNB(void) UE_list->head_ul = -1; UE_list->avail = 0; - for (list_el = 0; list_el < NUMBER_OF_UE_MAX - 1; list_el++) { + for (list_el = 0; list_el < MAX_MOBILES_PER_ENB - 1; list_el++) { UE_list->next[list_el] = list_el + 1; UE_list->next_ul[list_el] = list_el + 1; } @@ -147,7 +144,7 @@ void mac_init_cell_params(int Mod_idP, int CC_idP) UE_template = (UE_TEMPLATE *) & RC.mac[Mod_idP]->UE_list.UE_template[CC_idP][0]; - for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + for (j = 0; j < MAX_MOBILES_PER_ENB; j++) { UE_template[j].rnti = 0; // initiallize the eNB to UE statistics memset(&RC.mac[Mod_idP]->UE_list.eNB_UE_stats[CC_idP][j], 0, diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c index 64326dec614dc9ea452c7ce7bebf73692050167b..272ca5cddd7c953ed87bc458f9018451c161d0f1 100644 --- a/openair2/LAYER2/MAC/main_ue.c +++ b/openair2/LAYER2/MAC/main_ue.c @@ -29,20 +29,18 @@ */ -#include "defs.h" -#include "proto.h" -#include "extern.h" +#include "mac.h" +#include "mac_proto.h" +#include "mac_extern.h" #include "assertions.h" -#include "PHY_INTERFACE/extern.h" -#include "PHY/defs.h" -#include "SCHED/defs.h" +#include "PHY_INTERFACE/phy_interface_extern.h" +#include "PHY/defs_UE.h" +#include "SCHED_UE/sched_UE.h" #include "LAYER2/PDCP_v10.1.0/pdcp.h" -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" #include "UTIL/LOG/log.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "SCHED/defs.h" - #include "common/ran_context.h" diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index e7458c347f40932ef248d991bd51b1e3a554e002..0e052a2b62495044c2975186d16453fc7fcda9f5 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -33,24 +33,21 @@ #include <stdlib.h> #include "assertions.h" -#include "PHY/defs.h" -#include "PHY/extern.h" - -#include "SCHED/defs.h" -#include "SCHED/extern.h" - -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rlc.h" +#include "common/ran_context.h" + +extern RAN_CONTEXT_t RC; #define DEBUG_eNB_SCHEDULER 1 #define DEBUG_HEADER_PARSING 1 @@ -107,7 +104,7 @@ store_dlsch_buffer(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP, UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list; UE_TEMPLATE *UE_template; - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { if (UE_list->active[UE_id] != TRUE) continue; @@ -190,8 +187,8 @@ assign_rbs_required(module_id_t Mod_id, frame_t frameP, sub_frame_t subframe, uint16_t - nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX], - int min_rb_unit[MAX_NUM_CCs]) + nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], + int min_rb_unit[NFAPI_CC_MAX]) { uint16_t TBS = 0; @@ -202,7 +199,7 @@ assign_rbs_required(module_id_t Mod_id, int N_RB_DL; // clear rb allocations across all CC_id - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { if (UE_list->active[UE_id] != TRUE) continue; if (!ue_slice_membership(UE_id, slice_id)) @@ -226,7 +223,7 @@ assign_rbs_required(module_id_t Mod_id, &UE_list->eNB_UE_stats[UE_list-> ordered_CCids[i][UE_id]][UE_id]; for (j = i + 1; j < UE_list->numactiveCCs[UE_id]; j++) { - DevAssert(j < MAX_NUM_CCs); + DevAssert(j < NFAPI_CC_MAX); eNB_UE_stats_j = &UE_list-> eNB_UE_stats[UE_list->ordered_CCids[j][UE_id]][UE_id]; @@ -310,7 +307,7 @@ maxround(module_id_t Mod_id, uint16_t rnti, int frame, UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list; COMMON_channels_t *cc; - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; CC_id++) { cc = &RC.mac[Mod_id]->common_channels[CC_id]; @@ -485,14 +482,14 @@ void decode_sorting_policy(module_id_t Mod_idP, slice_id_t slice_id) { void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP) { int i; - int list[NUMBER_OF_UE_MAX]; + int list[MAX_MOBILES_PER_ENB]; int list_size = 0; int rnti; struct sort_ue_dl_params params = { Mod_idP, frameP, subframeP, slice_id }; UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list; - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (UE_list->active[i] == FALSE) continue; @@ -597,11 +594,11 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP, sub_frame_t subframeP, - int N_RBG[MAX_NUM_CCs], - int min_rb_unit[MAX_NUM_CCs], - uint8_t rballoc_sub[MAX_NUM_CCs][N_RBG_MAX], - uint8_t MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX], - uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]) { + int N_RBG[NFAPI_CC_MAX], + int min_rb_unit[NFAPI_CC_MAX], + uint8_t rballoc_sub[NFAPI_CC_MAX][N_RBG_MAX], + uint8_t MIMO_mode_indicator[NFAPI_CC_MAX][N_RBG_MAX], + uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]) { int UE_id, CC_id; @@ -609,22 +606,22 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id, rnti_t rnti; uint8_t harq_pid, round, transmission_mode; - uint8_t total_rbs_used[MAX_NUM_CCs]; - uint8_t total_ue_count[MAX_NUM_CCs]; - uint16_t average_rbs_per_user[MAX_NUM_CCs]; - uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - uint16_t nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint8_t total_rbs_used[NFAPI_CC_MAX]; + uint8_t total_ue_count[NFAPI_CC_MAX]; + uint16_t average_rbs_per_user[NFAPI_CC_MAX]; + uint16_t nb_rbs_required_remaining[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; + uint16_t nb_rbs_required_remaining_1[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; int N_RB_DL; UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list; UE_sched_ctrl *ue_sched_ctl; COMMON_channels_t *cc; - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; CC_id++) { total_ue_count[CC_id] = 0; total_rbs_used[CC_id] = 0; average_rbs_per_user[CC_id] = 0; - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; ++UE_id) { + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; ++UE_id) { nb_rbs_required_remaining[CC_id][UE_id] = 0; } } @@ -734,7 +731,7 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id, // control channel or retransmission /* TODO: do we have to check for retransmission? */ - if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round > 0) { + if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round != 8) { nb_rbs_required_remaining_1[CC_id][UE_id] = nb_rbs_required[CC_id][UE_id]; } else { @@ -815,9 +812,7 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id, transmission_mode, min_rb_unit [CC_id], - to_prb(RC.mac - [Mod_id]->common_channels - [CC_id].mib->message.dl_Bandwidth), + to_prb(RC.mac[Mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth), nb_rbs_required, nb_rbs_required_remaining, rballoc_sub, @@ -997,18 +992,18 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP, sub_frame_t subframeP, - int N_RBG[MAX_NUM_CCs], + int N_RBG[NFAPI_CC_MAX], int *mbsfn_flag) { int UE_id; uint8_t CC_id; uint16_t i, j; - uint8_t rballoc_sub[MAX_NUM_CCs][N_RBG_MAX]; - uint8_t MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]; // If TM5 is revisited, we can move this inside accounting + uint8_t rballoc_sub[NFAPI_CC_MAX][N_RBG_MAX]; + uint8_t MIMO_mode_indicator[NFAPI_CC_MAX][N_RBG_MAX]; // If TM5 is revisited, we can move this inside accounting - int min_rb_unit[MAX_NUM_CCs]; - uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + int min_rb_unit[NFAPI_CC_MAX]; + uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; UE_list_t *UE_list = &RC.mac[Mod_id]->UE_list; UE_sched_ctrl *ue_sched_ctl; @@ -1025,14 +1020,14 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id, UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2; #endif - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; CC_id++) { if (mbsfn_flag[CC_id] > 0) // If this CC is allocated for MBSFN skip it here continue; min_rb_unit[CC_id] = get_min_rb_unit(Mod_id, CC_id); - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; ++UE_id) { + for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; ++UE_id) { if (UE_list->active[UE_id] != TRUE) continue; @@ -1076,7 +1071,7 @@ dlsch_scheduler_pre_processor(module_id_t Mod_id, #ifdef TM5 // This has to be revisited!!!! - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[Mod_id]; CC_id++) { i1 = 0; i2 = 0; i3 = 0; @@ -1150,13 +1145,13 @@ dlsch_scheduler_pre_processor_reset(int module_idP, int frameP, int subframeP, int N_RBG, - uint16_t nb_rbs_required[MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], + uint16_t nb_rbs_required[NFAPI_CC_MAX] + [MAX_MOBILES_PER_ENB], unsigned char - rballoc_sub[MAX_NUM_CCs] + rballoc_sub[NFAPI_CC_MAX] [N_RBG_MAX], unsigned char - MIMO_mode_indicator[MAX_NUM_CCs] + MIMO_mode_indicator[NFAPI_CC_MAX] [N_RBG_MAX]) { int i, j; @@ -1338,17 +1333,10 @@ dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id, int transmission_mode, int min_rb_unit, uint8_t N_RB_DL, - uint16_t - nb_rbs_required[MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], - uint16_t - nb_rbs_required_remaining - [MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], unsigned char - rballoc_sub[MAX_NUM_CCs] - [N_RBG_MAX], unsigned char - MIMO_mode_indicator - [MAX_NUM_CCs][N_RBG_MAX]) + uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], + uint16_t nb_rbs_required_remaining[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], + unsigned char rballoc_sub[NFAPI_CC_MAX][N_RBG_MAX], + unsigned char MIMO_mode_indicator[NFAPI_CC_MAX][N_RBG_MAX]) { int i; @@ -1418,11 +1406,11 @@ ulsch_scheduler_pre_processor(module_id_t module_idP, int16_t i; uint16_t UE_id, n, r; uint8_t CC_id, harq_pid; - uint16_t nb_allocated_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX], - total_allocated_rbs[MAX_NUM_CCs], - average_rbs_per_user[MAX_NUM_CCs]; - int16_t total_remaining_rbs[MAX_NUM_CCs]; - uint16_t total_ue_count[MAX_NUM_CCs]; + uint16_t nb_allocated_rbs[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], + total_allocated_rbs[NFAPI_CC_MAX], + average_rbs_per_user[NFAPI_CC_MAX]; + int16_t total_remaining_rbs[NFAPI_CC_MAX]; + uint16_t total_ue_count[NFAPI_CC_MAX]; rnti_t rnti = -1; UE_list_t *UE_list = &RC.mac[module_idP]->UE_list; UE_TEMPLATE *UE_template = 0; @@ -1440,7 +1428,7 @@ ulsch_scheduler_pre_processor(module_id_t module_idP, // we need to distribute RBs among UEs // step1: reset the vars - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) { total_allocated_rbs[CC_id] = 0; total_remaining_rbs[CC_id] = 0; average_rbs_per_user[CC_id] = 0; @@ -1613,7 +1601,7 @@ ulsch_scheduler_pre_processor(module_id_t module_idP, /* this logging is wrong, ue_sched_ctl may not be valid here * TODO: fix */ - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) { if (total_allocated_rbs[CC_id] > 0) { LOG_D(MAC, "[eNB %d] total RB allocated for all UEs = %d/%d\n", @@ -1644,7 +1632,7 @@ assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP, int Ncp; int N_RB_UL; - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (UE_list->active[i] != TRUE) continue; @@ -1672,14 +1660,11 @@ assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP, // This is the actual CC_id in the list CC_id = UE_list->ordered_ULCCids[n][UE_id]; - if (CC_id >= MAX_NUM_CCs) { - LOG_E(MAC, "CC_id %u should be < %u, loop n=%u < numactiveULCCs[%u]=%u", - CC_id, MAX_NUM_CCs, n, UE_id, UE_list->numactiveULCCs[UE_id]); - } - AssertFatal(CC_id < MAX_NUM_CCs, + + AssertFatal(CC_id < RC.nb_mac_CC[module_idP], "CC_id %u should be < %u, loop n=%u < numactiveULCCs[%u]=%u", - CC_id, MAX_NUM_CCs, n, UE_id, + CC_id, NFAPI_CC_MAX, n, UE_id, UE_list->numactiveULCCs[UE_id]); UE_template = &UE_list->UE_template[CC_id][UE_id]; @@ -1841,14 +1826,14 @@ static int ue_ul_compare(const void *_a, const void *_b, void *_params) void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP) { int i; - int list[NUMBER_OF_UE_MAX]; + int list[MAX_MOBILES_PER_ENB]; int list_size = 0; int rnti; struct sort_ue_ul_params params = { module_idP, frameP, subframeP }; UE_list_t *UE_list = &RC.mac[module_idP]->UE_list; - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (UE_list->active[i] == FALSE) continue; if ((rnti = UE_RNTI(module_idP, i)) == NOT_A_RNTI) diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 4f33089353a582706806e89e3a9896c4405f4ed1..4a2a7d35f08a4c9571ae18a916e1d251a54f50f7 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -30,24 +30,20 @@ * \warning */ -#include "extern.h" -#include "defs.h" -#include "proto.h" +#include "mac_extern.h" +#include "mac.h" +#include "mac_proto.h" #include "UTIL/LOG/vcd_signal_dumper.h" -#include "PHY_INTERFACE/extern.h" -#include "SCHED/defs.h" +#include "PHY_INTERFACE/phy_interface_extern.h" +#include "SCHED_UE/sched_UE.h" #include "COMMON/mac_rrc_primitives.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "UTIL/LOG/log.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" -#ifdef PHY_EMUL -#include "SIMULATION/simulation_defs.h" -#endif - -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus /// This routine implements Section 5.1.2 (UE Random Access Resource Selection) from 36.321 void diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c index 6261eaf35690f672225209e7972aa333d6bd9087..68183f2f89ddcd31a65461b4c65812d6a6b4b20a 100644 --- a/openair2/LAYER2/MAC/rar_tools.c +++ b/openair2/LAYER2/MAC/rar_tools.c @@ -28,10 +28,10 @@ */ -#include "defs.h" -#include "proto.h" -#include "extern.h" -#include "SIMULATION/TOOLS/defs.h" +#include "mac.h" +#include "mac_proto.h" +#include "mac_extern.h" +#include "SIMULATION/TOOLS/sim.h" #include "UTIL/LOG/log.h" #include "OCG.h" #include "OCG_extern.h" diff --git a/openair2/LAYER2/MAC/rar_tools_ue.c b/openair2/LAYER2/MAC/rar_tools_ue.c index ab193c7a66b2422473dd208af125fc815c4a7259..7d24e4c0af31c5fd2a87ea13ec06427f08902d6f 100644 --- a/openair2/LAYER2/MAC/rar_tools_ue.c +++ b/openair2/LAYER2/MAC/rar_tools_ue.c @@ -28,10 +28,10 @@ */ -#include "defs.h" -#include "proto.h" -#include "extern.h" -#include "SIMULATION/TOOLS/defs.h" +#include "mac.h" +#include "mac_proto.h" +#include "mac_extern.h" +#include "SIMULATION/TOOLS/sim.h" #include "UTIL/LOG/log.h" #include "OCG.h" #include "OCG_extern.h" diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 5ca6d10bb530f4ac19246777c488a24d6c8f3b4e..16a7a373c71cc767782b47231cbd44fdd972d965 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -33,29 +33,21 @@ #include <pthread.h> #endif -#include "extern.h" -#include "defs.h" -#include "proto.h" -#ifdef PHY_EMUL -#include "SIMULATION/PHY_EMULATION/impl_defs.h" -#else -#include "SCHED/defs.h" +#include "mac_extern.h" +#include "mac.h" +#include "mac_proto.h" +#include "SCHED_UE/sched_UE.h" #include "PHY/impl_defs_top.h" -#endif -#include "PHY_INTERFACE/extern.h" +#include "PHY_INTERFACE/phy_interface_extern.h" #include "COMMON/mac_rrc_primitives.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" - -#ifdef PHY_EMUL -#include "SIMULATION/simulation_defs.h" -#endif #include "pdcp.h" #if defined(ENABLE_ITTI) @@ -64,7 +56,7 @@ #include "assertions.h" -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus #define DEBUG_HEADER_PARSING 1 #define ENABLE_MAC_PAYLOAD_DEBUG 1 diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 00557ce7e075a04efb439120c2da73c879c8d2b0..67571f873643c361eb0d17cf50eed3494f7d4a8c 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -36,8 +36,8 @@ #include "pdcp_util.h" #include "pdcp_sequence_manager.h" #include "LAYER2/RLC/rlc.h" -#include "LAYER2/MAC/extern.h" -#include "RRC/LITE/proto.h" +#include "LAYER2/MAC/mac_extern.h" +#include "RRC/LTE/rrc_proto.h" #include "pdcp_primitives.h" #include "OCG.h" #include "OCG_extern.h" @@ -393,7 +393,7 @@ boolean_t pdcp_data_req( * so we return TRUE afterwards */ - for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){ + for (pdcp_uid=0; pdcp_uid< MAX_MOBILES_PER_ENB;pdcp_uid++){ if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ) break; } @@ -808,7 +808,7 @@ pdcp_data_ind( * XXX Following two actions are identical, is there a merge error? */ - for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){ + for (pdcp_uid=0; pdcp_uid< MAX_MOBILES_PER_ENB;pdcp_uid++){ if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ){ break; } @@ -856,10 +856,11 @@ void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){ // these stats are measured for both eNB and UE on per seond basis for (rb_id =0; rb_id < NB_RB_MAX; rb_id ++){ - for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){ + for (pdcp_uid=0; pdcp_uid< MAX_MOBILES_PER_ENB;pdcp_uid++){ //printf("frame %d and subframe %d \n", pdcp_enb[ctxt_pP->module_id].frame, pdcp_enb[ctxt_pP->module_id].subframe); // tx stats - if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_tx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){ + if (Pdcp_stats_tx_window_ms[ctxt_pP->module_id][pdcp_uid] > 0 && + pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_tx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){ // unit: bit/s Pdcp_stats_tx_throughput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8; Pdcp_stats_tx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]; @@ -875,7 +876,8 @@ void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){ Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0; } - if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_rx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){ + if (Pdcp_stats_rx_window_ms[ctxt_pP->module_id][pdcp_uid] > 0 && + pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_rx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){ // rx stats Pdcp_stats_rx_goodput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8; Pdcp_stats_rx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]; @@ -1058,14 +1060,14 @@ pdcp_run ( void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP){ int i, ue_flag=1; //, ret=-1; to be decied later - for (i=0; i < NUMBER_OF_UE_MAX; i++){ + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti) { ue_flag=-1; break; } } if (ue_flag == 1 ){ - for (i=0; i < NUMBER_OF_UE_MAX ; i++){ + for (i=0; i < MAX_MOBILES_PER_ENB ; i++){ if (pdcp_enb[ctxt_pP->module_id].rnti[i] == 0 ){ pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti; pdcp_enb[ctxt_pP->module_id].uid[i]=i; @@ -1093,7 +1095,7 @@ pdcp_remove_UE( int i; // check and remove SRBs first - for(int i = 0;i<NUMBER_OF_UE_MAX;i++){ + for(int i = 0;i<MAX_MOBILES_PER_ENB;i++){ if(pdcp_eNB_UE_instance_to_rnti[i] == ctxt_pP->rnti){ pdcp_eNB_UE_instance_to_rnti[i] = NOT_A_RNTI; break; @@ -1114,7 +1116,7 @@ pdcp_remove_UE( (void)h_rc; /* remove gcc warning "set but not used" */ // remove ue for pdcp enb inst - for (i=0; i < NUMBER_OF_UE_MAX; i++) { + for (i=0; i < MAX_MOBILES_PER_ENB; i++) { if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti ) { LOG_I(PDCP, "remove uid is %d/%d %x\n", i, pdcp_enb[ctxt_pP->module_id].uid[i], @@ -1551,16 +1553,16 @@ pdcp_config_req_asn1 ( //pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rnti; // pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti; if( srb_flagP == SRB_FLAG_NO ) { - for(int i = 0;i<NUMBER_OF_UE_MAX;i++){ + for(int i = 0;i<MAX_MOBILES_PER_ENB;i++){ if(pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] == NOT_A_RNTI){ break; } - pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX; + pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % MAX_MOBILES_PER_ENB; } pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti; - pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX; + pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % MAX_MOBILES_PER_ENB; } - //pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX; + //pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % MAX_MOBILES_PER_ENB; } else { pdcp_pP->is_ue = TRUE; pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id] = ctxt_pP->rnti; @@ -2007,7 +2009,7 @@ void pdcp_layer_init(void) pdcp_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, pdcp_free); AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed"); - for (instance = 0; instance < NUMBER_OF_UE_MAX; instance++) { + for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) { #if defined(Rel10) || defined(Rel14) for (service_id = 0; service_id < maxServiceCount; service_id++) { @@ -2045,7 +2047,7 @@ void pdcp_layer_init(void) memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms)); memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms)); for (i =0; i< MAX_NUM_CCs ; i ++){ - for (j=0; j< NUMBER_OF_UE_MAX;j++){ + for (j=0; j< MAX_MOBILES_PER_ENB;j++){ Pdcp_stats_tx_window_ms[i][j]=100; Pdcp_stats_rx_window_ms[i][j]=100; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 7c8f2dd033571f3faac8d484ea99be494b020a81..ed5e1c6b42861fd3d91ffc364a90644281ff6c37 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" @@ -94,34 +94,34 @@ extern int pdcp_instance_cnt; int init_pdcp_thread(void); void cleanup_pdcp_thread(void); -public_pdcp(uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); - -public_pdcp(uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); -public_pdcp(uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]); +public_pdcp(uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); + +public_pdcp(uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]); +public_pdcp(uint32_t Pdcp_stats_rx[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); +public_pdcp(uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][MAX_MOBILES_PER_ENB][NB_RB_MAX]); public_pdcp(void pdcp_update_perioidical_stats(const protocol_ctxt_t* const ctxt_pP)); @@ -131,8 +131,8 @@ public_pdcp(void pdcp_update_perioidical_stats(const protocol_ctxt_t* const ctx //public_pdcp(uint64_t *pdcp_size_packet); typedef struct pdcp_enb_s { // used for eNB stats generation - uint16_t uid[NUMBER_OF_UE_MAX]; - rnti_t rnti[NUMBER_OF_UE_MAX]; + uint16_t uid[MAX_MOBILES_PER_ENB]; + rnti_t rnti[MAX_MOBILES_PER_ENB]; uint16_t num_ues; uint64_t sfn; @@ -482,19 +482,19 @@ typedef struct pdcp_missing_pdu_info_t { protected_pdcp(signed int pdcp_2_nas_irq;) -public_pdcp(pdcp_stats_t UE_pdcp_stats[NUMBER_OF_UE_MAX];) +public_pdcp(pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB];) public_pdcp(pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX];) -//protected_pdcp(pdcp_t pdcp_array_srb_ue[NUMBER_OF_UE_MAX][2];) -//protected_pdcp(pdcp_t pdcp_array_drb_ue[NUMBER_OF_UE_MAX][maxDRB];) -//public_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][2];) -//protected_pdcp(pdcp_t pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][maxDRB];) +//protected_pdcp(pdcp_t pdcp_array_srb_ue[MAX_MOBILES_PER_ENB][2];) +//protected_pdcp(pdcp_t pdcp_array_drb_ue[MAX_MOBILES_PER_ENB][maxDRB];) +//public_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][MAX_MOBILES_PER_ENB][2];) +//protected_pdcp(pdcp_t pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][MAX_MOBILES_PER_ENB][maxDRB];) // for UE code conly -protected_pdcp(rnti_t pdcp_UE_UE_module_id_to_rnti[NUMBER_OF_UE_MAX];) -protected_pdcp(rnti_t pdcp_eNB_UE_instance_to_rnti[NUMBER_OF_UE_MAX];) // for noS1 mode +protected_pdcp(rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB];) +protected_pdcp(rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB];) // for noS1 mode protected_pdcp(unsigned int pdcp_eNB_UE_instance_to_rnti_index;) #if defined(Rel10) || defined(Rel14) -public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h +public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h public_pdcp(pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h #endif protected_pdcp(sdu_size_t pdcp_output_sdu_bytes_to_write;) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 2de1b3fc743a4bd4ca41d9de64866fa0a8c79285..d564b7cad69b071337a9ad30959f4ca82db8d761 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -46,10 +46,10 @@ extern int otg_enabled; #define rtf_put write #define rtf_get read -#include "../MAC/extern.h" +#include "../MAC/mac_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "NETWORK_DRIVER/LITE/constant.h" -#include "SIMULATION/ETH_TRANSPORT/extern.h" +//#include "SIMULATION/ETH_TRANSPORT/extern.h" #include "UTIL/OCG/OCG.h" #include "UTIL/OCG/OCG_extern.h" #include "UTIL/LOG/log.h" @@ -72,7 +72,11 @@ extern struct nlmsghdr *nas_nlh_tx; extern struct nlmsghdr *nas_nlh_rx; extern struct iovec nas_iov_tx; extern struct iovec nas_iov_rx; +#ifdef UE_NAS_USE_TUN +extern int nas_sock_fd[MAX_MOBILES_PER_ENB]; +#else extern int nas_sock_fd; +#endif extern struct msghdr nas_msg_tx; extern struct msghdr nas_msg_rx; @@ -239,7 +243,11 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) nas_nlh_tx->nlmsg_len += pdcp_output_sdu_bytes_to_write; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_SIZE, pdcp_output_sdu_bytes_to_write); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER, 1 ); +#ifdef UE_NAS_USE_TUN + ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); +#else ret = sendmsg(nas_sock_fd,&nas_msg_tx,0); +#endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER, 0 ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_ERR, ret ); @@ -372,6 +380,62 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) //----------------------------------------------------------------------------- int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) { +#ifdef UE_NAS_USE_TUN + protocol_ctxt_t ctxt = *ctxt_pP; + hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; + hashtable_rc_t h_rc; + pdcp_t* pdcp_p = NULL; + int len; + rb_id_t rab_id = DEFAULT_RAB_ID; + + do { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 ); + len = read(nas_sock_fd[ctxt_pP->module_id], &nl_rx_buf, NL_MAX_PAYLOAD); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 ); + + if (len<=0) continue; + LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", + ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); + if (h_rc == HASH_TABLE_OK) { + LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n", + ctxt.frame, ctxt.instance, len, rab_id); + + LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n", + ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, + ctxt.rnti, rab_id); + MSC_LOG_RX_MESSAGE((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, + (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, + NULL, 0, + MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ctxt.instance, rab_id, rab_id, len); + + pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, len, nl_rx_buf, + PDCP_TRANSMISSION_MODE_DATA); + } else { + MSC_LOG_RX_DISCARDED_MESSAGE( + (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, + (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, + NULL, + 0, + MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ctxt.instance, rab_id, rab_id, len); + LOG_D(PDCP, + "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", + ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, + ctxt.rnti, rab_id, key); + } + } while (len > 0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 ); + return len; + +#else /* UE_NAS_USE_TUN */ + #ifdef PDCP_USE_NETLINK protocol_ctxt_t ctxt_cpy = *ctxt_pP; protocol_ctxt_t ctxt; @@ -764,6 +828,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) #else // neither PDCP_USE_NETLINK nor PDCP_USE_RT_FIFO return 0; #endif // PDCP_USE_NETLINK +#endif /* #else UE_NAS_USE_TUN */ } @@ -787,7 +852,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const ctxt_pP) ctxt_pP->subframe, ctxt_pP->module_id); - for (dst_id = 0; dst_id<NUMBER_OF_UE_MAX; dst_id++) { + for (dst_id = 0; dst_id<MAX_MOBILES_PER_ENB; dst_id++) { ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id]; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c index 0df8e59e6d4536bd09654ac739d5651c11fc78d5..f0b15d9888d7d0268be4d43df309f89519e1c5f4 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c @@ -55,7 +55,7 @@ #include "UTIL/LOG/log.h" #include "UTIL/OCG/OCG.h" #include "UTIL/OCG/OCG_extern.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "pdcp.h" #include "pdcp_primitives.h" diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index 2554eb145ab9de975100795e207efe6276e39978..2c29053297d67a5b5daf836a8a99fe60b7bd8b58 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -34,7 +34,7 @@ #include "UTIL/LOG/vcd_signal_dumper.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "pdcp.h" #include "msc.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index 0e21d5cfac8c8d79237b472a1ce691512eede2cb..34c9baf53784b066bd865f88ed9733690c233698 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -37,7 +37,7 @@ #include "mac_primitives.h" #include "rlc_primitives.h" #include "list.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UL-AM-RLC.h" #include "DL-AM-RLC.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h index 5130bde38b9f32f6a8d3b18c6d4d8e139c388c84..040145f7f03c1da8db15b77f979d0c155ef9e1cf 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h @@ -71,6 +71,7 @@ # include "rlc_am_reassembly.h" # include "rlc_am_init.h" # include "RLC-Config.h" +# include "assertions.h" //# include "rlc_am_test.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c index a133ce09920157695402118420de43ab601e610b..996dd96f353f17bf4e11d0f810eef14ce0472930 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c @@ -30,7 +30,7 @@ #define RLC_AM_IN_SDU_C 1 //----------------------------------------------------------------------------- #include "rlc_am.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #define TRACE_RLC_AM_FREE_SDU 0 diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c index 01a635656e24ce819f112c399f70f99ccf7a3e1a..0b0a55bd2b66ee32560704e02ef7b29766e64a47 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c @@ -24,7 +24,7 @@ #include <string.h> //----------------------------------------------------------------------------- #include "rlc_am.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" //----------------------------------------------------------------------------- void 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 2ee7d040ab36b65b0a617dacd8a24e69aa34d996..c69fd3766e4554e043598825f3f61ca68b3de987 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_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c index d0b5b52395417f9e01e6581402111ec51d2c05de..83b0dfd46b86b583eedf242c09fe8671818610ce 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c @@ -30,7 +30,7 @@ #include "rlc.h" #include "rlc_am.h" #include "list.h" -#include "LAYER2/MAC/extern.h" +//#include "LAYER2/MAC/extern.h" #include "UTIL/LOG/log.h" #include "msc.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c index b1facdfb023671b9e948280b6031c1ade079e285..be4b43d1a075db6c89e0dc0dd8b2539fbaae2ba6 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c @@ -28,7 +28,7 @@ #include "rlc.h" #include "rlc_am.h" #include "list.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c index 9e1db8a95bb07d58a4f582c302088156425c8f0e..42e84986238fd9d669e06061222a6492eb74a674 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c @@ -26,7 +26,7 @@ //----------------------------------------------------------------------------- #include "rlc_am.h" #include "rlc.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "msc.h" //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c index dc1ed2116341ed9d395a9546c103b61f022c25e3..c0ce57708b0cf3033f0ced09a5857f8a54e2268a 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c @@ -27,7 +27,7 @@ #include "assertions.h" #include "list.h" #include "rlc_am.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" 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 d2f0740b33de9530a97e531f442f955562ba2d42..9dcc75223dc6d543f1be05dfdfc43af51473760b 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_segment.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c index c16e897bb6f67fdadddb2111694cb95e7ad11097..fe99e137a43bfc413f31b0e93ce5ebf03906f71d 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c @@ -29,7 +29,7 @@ #include "msc.h" #include "list.h" #include "rlc_am.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c index 092c7c65f135f05827e36fcf46bc5c56f4d72a86..3ace3cc51f827022f0ee136092d0568c36385229 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c @@ -32,7 +32,6 @@ #include "assertions.h" #include "list.h" #include "rlc_am.h" -#include "LAYER2/MAC/extern.h" #include "UTIL/LOG/log.h" # if ENABLE_ITTI 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 e09189fcd6060c9b303c59b6b3a6a75cd98df10a..41f214d7c6cc54c87d4fcc6b5aefeece7ebd6efc 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/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c index 0b88e7c650fe4e3d4b9fb23e93eb7fbfb45c9f00..1e3b8b916d5d4b0392fe15282920aeb4360b2b06 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c @@ -27,7 +27,7 @@ #include "platform_constants.h" //----------------------------------------------------------------------------- #include "rlc_am.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "msc.h" //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c index b9383980a4231cd9f84dba7b276bf7c1787dd3be..fd0feceeb0d13181b2545e04e089aafb6daad358 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c @@ -26,7 +26,7 @@ #include "platform_constants.h" //----------------------------------------------------------------------------- #include "rlc_am.h" -# include "LAYER2/MAC/extern.h" +# include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "msc.h" //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c index 13d4205c2800cd1f7de367f46547ce928e9efe53..84c0edbefd52730a8b73d4c36af1611bf8115062 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c @@ -26,7 +26,7 @@ #include "platform_constants.h" //----------------------------------------------------------------------------- #include "rlc_am.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "msc.h" //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c index ee2ff57c1eae1a9a48d9e4013a1abe76907ec9bc..23a4d0eb0478c9aab4e00880f9428d121fafe5e6 100644 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c @@ -29,7 +29,7 @@ #include "mac_primitives.h" #include "rlc_primitives.h" #include "list.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" //----------------------------------------------------------------------------- void rlc_tm_send_sdu ( diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c index 15dc90f175a183dab9d247afeb081aad21db975a..70c1f37221d6d2193e1a29b6f659a5d7976ec51e 100644 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c @@ -23,7 +23,7 @@ #define RLC_TM_INIT_C 1 //----------------------------------------------------------------------------- #include "rlc_tm.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" //----------------------------------------------------------------------------- void config_req_rlc_tm ( const protocol_ctxt_t* const ctxt_pP, diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 7bd0da83a903e40f909f8538a73d5f1c7c192232..0be2ef168644dbf1575a3f29d071d3fbeb5e557b 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -35,7 +35,7 @@ #include "list.h" #include "rlc_primitives.h" #include "mac_primitives.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index 4e2723a8f476489bb16fe1eb677f6e0ed4550ab2..2561ff81be01290b54f6ac29371fae3d6eb535b2 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -28,7 +28,7 @@ #include "rlc_primitives.h" #include "list.h" #include "rrm_config_structs.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "rlc_um_control_primitives.h" diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c index 758630b3cce88476ea49df4a253a60d7d36c9879..bc61ed302ecda6cc92a3502114ff0fbc3e2b5cb3 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c @@ -24,7 +24,7 @@ #include "platform_types.h" //----------------------------------------------------------------------------- #include "rlc_um.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c index 91e1ba66d1bfa662eb29f75cdd286260c48e5147..65aaadb9fa38106defed77ef211b9f497c327e5d 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c @@ -33,7 +33,7 @@ #include "rlc_um.h" #include "rlc_primitives.h" #include "list.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "msc.h" diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 783441bd586928fb2dfe9dfc61dc1e926ca31ada..2db98fc3cac835473a9d7697d8820180860446ed 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -29,7 +29,7 @@ #define RLC_C #include "rlc.h" #include "mem_block.h" -#include "../MAC/extern.h" +#include "../MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/OCG/OCG_vars.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -615,7 +615,7 @@ rlc_module_init (void) rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union); AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed"); - for (module_id1=0; module_id1 < NUMBER_OF_UE_MAX; module_id1++) { + for (module_id1=0; module_id1 < MAX_MOBILES_PER_ENB; module_id1++) { #if defined(Rel10) || defined(Rel14) for (k=0; k < RLC_MAX_MBMS_LC; k++) { diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index ffd963204eeba97839d93bf27cf393dedb9846c5..5ab33d1cd53dd164c7fa03011ba0c26dfb1d631c 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" @@ -174,7 +174,7 @@ typedef struct { //----------------------------------------------------------------------------- #define RLC_MAX_MBMS_LC (maxSessionPerPMCH * maxServiceCount) -#define RLC_MAX_LC ((max_val_DRB_Identity+1)* NUMBER_OF_UE_MAX) +#define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_ENB) protected_rlc(void (*rlc_rrc_data_ind)( const protocol_ctxt_t* const ctxtP, @@ -234,10 +234,10 @@ typedef struct rlc_mbms_id_s { # define maxSessionPerPMCH 1 # endif #endif -//public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h +//public_rlc(rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h //public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h -public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[NUMBER_OF_UE_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h -public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[NUMBER_OF_eNB_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h +public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h +public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h #define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] ; @@ -253,8 +253,8 @@ public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[NUMBER_OF_e rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] = lOG_cH_iD; \ } while (0); -public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_ue [NUMBER_OF_UE_MAX][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ -public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_eNB[NUMBER_OF_eNB_MAX][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ #define RLC_COLL_KEY_VALUE(eNB_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 497937d073841cdb37ce5ddf17b0f8aadee419cf..ded682ee7cb5afc74e576571d5c9e23762d2bab2 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -30,7 +30,7 @@ //----------------------------------------------------------------------------- #define RLC_MAC_C #include "rlc.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/OCG/OCG_vars.h" #include "hashtable.h" diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index dee6ba700017d6dc48151b32ccac8f7a82eead0c..5dd1d82279ec9f8bec2e95c54ae32a624204207c 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -43,7 +43,7 @@ #include "PMCH-InfoList-r9.h" #endif -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "assertions.h" //----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, diff --git a/openair2/LAYER2/openair2_proc.c b/openair2/LAYER2/openair2_proc.c index f66d1142abf5c668f240de1fcda9bc2aa65337ff..0c884a806ce85d35b0d80fe0ee32e8598558de4c 100644 --- a/openair2/LAYER2/openair2_proc.c +++ b/openair2/LAYER2/openair2_proc.c @@ -32,8 +32,8 @@ #include <inttypes.h> #include "LAYER2/RLC/rlc.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" #include "LAYER2/PDCP_v10.1.0/pdcp.h" #include "UTIL/LOG/log.h" #include "common/ran_context.h" diff --git a/openair2/NETWORK_DRIVER/UE_IP/constant.h b/openair2/NETWORK_DRIVER/UE_IP/constant.h index faff970dcdb3cb32e8ade1d2a3e8ee0cae1e3600..0746651d073f8a0b108be6c8f9bfdbfd42e5a76b 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/constant.h +++ b/openair2/NETWORK_DRIVER/UE_IP/constant.h @@ -52,7 +52,7 @@ -#define UE_IP_NB_INSTANCES_MAX NUMBER_OF_UE_MAX +#define UE_IP_NB_INSTANCES_MAX MAX_MOBILES_PER_ENB #endif diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index d0b8e5755858bbaf3ac64711016a8debce09b04c..6d9fe013a5bd6c108671c72e5d3b8e8520b7e18c 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -1,8 +1,8 @@ -#include "openair1/PHY/defs.h" +#include "openair1/PHY/defs_eNB.h" #include "openair2/PHY_INTERFACE/IF_Module.h" -#include "openair1/PHY/extern.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/proto.h" +#include "openair1/PHY/phy_extern.h" +#include "LAYER2/MAC/mac_extern.h" +#include "LAYER2/MAC/mac_proto.h" #include "common/ran_context.h" #define MAX_IF_MODULES 100 diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h index 3b1c88dda03b5857f99c40a3a724b1a072a469e5..ccce490c75584b6f02261844503d9e3cab5db8ed 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/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h deleted file mode 100644 index deb07443f18fcddf3a1555821fece15ca0acd7c4..0000000000000000000000000000000000000000 --- a/openair2/PHY_INTERFACE/defs.h +++ /dev/null @@ -1,373 +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_INTERFACE/defs.h -* \brief mac phy interface primitives -* \author Raymond Knopp and Navid Nikaein -* \date 2011 -* \version 0.5 -* \mail navid.nikaein@eurecom.fr or openair_tech@eurecom.fr -*/ - -#ifndef __MAC_PHY_PRIMITIVES_H__ -# define __MAC_PHY_PRIMITIVES_H__ - -#include "LAYER2/MAC/defs.h" - - -#define MAX_NUMBER_OF_MAC_INSTANCES 16 - -#define NULL_PDU 255 -#define DCI 0 -#define DLSCH 1 -#define ULSCH 2 - -#define mac_exit_wrapper(sTRING) \ -do { \ - char temp[300]; \ - snprintf(temp, sizeof(temp), "%s in file "__FILE__" at line %d\n", sTRING, __LINE__); \ - mac_xface->macphy_exit(temp); \ -} while(0) - -/** @defgroup _phy_if MAC-PHY interface - * @ingroup _oai2 - * @{ - */ -/*! \brief MACPHY Interface */ -/* -typedef struct { - /// Pointer function that initializes L2 - int (*macphy_init)(int eMBMS_active, char *uecap_xer, uint8_t CBA_active,uint8_t HO_active); - - /// Pointer function that stops the low-level scheduler due an exit condition - void (*macphy_exit)(const char *); - - // eNB functions - /// Invoke dlsch/ulsch scheduling procedure for new subframe - void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag); - - /// Fill random access response sdu, passing timing advance - uint16_t (*fill_rar)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t N_RB_UL, uint8_t input_buffer_length); - - /// Initiate the RA procedure upon reception (hypothetical) of a valid preamble - void (*initiate_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble,int16_t timing_offset,uint8_t sect_id,sub_frame_t subframe,uint8_t f_id); - - /// cancel an ongoing RA procedure - void (*cancel_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble); - - /// Inform MAC layer that an uplink is scheduled for Msg3 in given subframe. - /// This is used so that the MAC scheduler marks as busy the RBs used by the Msg3. - void (*set_msg3_subframe)(module_id_t Mod_id, - int CC_id, - int frame, - int subframe, - int rnti, - int Msg3_frame, - int Msg3_subframe); - - /// Get DCI for current subframe from MAC - DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe); - - /// Get DLSCH sdu for particular RNTI and Transport block index - uint8_t* (*get_dlsch_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,uint8_t TB_index); - - /// Send ULSCH sdu to MAC for given rnti - void (*rx_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP, sub_frame_t sub_frameP,rnti_t rnti, uint8_t *sdu,uint16_t sdu_len, int harq_pid,uint8_t *msg3_flag); - - /// Indicate failure to synch to external source - void (*mrbch_phy_sync_failure) (module_id_t Mod_id,frame_t frameP, uint8_t free_eNB_index); - - /// Indicate Scheduling Request from UE - void (*SR_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe); - /// Indicate UL Failure to eNodeB MAC - void (*UL_failure_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe); - - /// Configure Common PHY parameters from SIB1 - void (*phy_config_mib_eNB)(module_id_t Mod_id,int CC_id, - int eutra_band, - int N_RB_DL, - PHICH_Config_t *phich_Config, - int Nid_cell, - int Ncp, - int p_eNB, - uint32_t dl_CarrierFreq, - uint32_t ul_CarrierFreq); - - /// Configure Common PHY parameters from SIB1 - void (*phy_config_sib1_eNB)(module_id_t Mod_id,int CC_id, - TDD_Config_t *tdd_config, - uint8_t SIwindowsize, - uint16_t SIperiod); - - /// Configure Common PHY parameters from SIB2 - void (*phy_config_sib2_eNB)(module_id_t Mod_id, int CC_id, - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, - ARFCN_ValueEUTRA_t *ul_CArrierFreq, - long *ul_Bandwidth, - AdditionalSpectrumEmission_t *additionalSpectrumEmission, - struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); - -#if defined(Rel10) || defined(Rel14) - /// Configure Common PHY parameters from SIB13 - void (*phy_config_sib13_eNB)(module_id_t Mod_id,int CC_id, int mbsfn_Area_idx, - long mbsfn_AreaId_r9); - - void (*phy_config_dedicated_scell_eNB)(uint8_t Mod_id, - uint16_t rnti, - SCellToAddMod_r10_t *sCellToAddMod_r10, - int CC_id); -#endif - - /// PHY-Config-Dedicated eNB - void (*phy_config_dedicated_eNB)(module_id_t Mod_id,int CC_id,rnti_t rnti, - struct PhysicalConfigDedicated *physicalConfigDedicated); - -#if defined(Rel10) || defined(Rel14) - /// Get MCH sdu and corresponding MCS for particular MBSFN subframe - MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id, int CC_id, frame_t frameP,sub_frame_t subframe); -#endif - // configure the cba rnti at the physical layer - void (*phy_config_cba_rnti)(module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, uint16_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups); - /// get delta mcs for fast UL AMC - 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); - - int (*mac_phy_remove_ue)(module_id_t Mod_idP,rnti_t rntiP); - /// UE functions - - /// reset the ue phy - void (*phy_reset_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); - - /// Indicate loss of synchronization of PBCH for this eNB to MAC layer - void (*out_of_sync_ind)(module_id_t Mod_id,frame_t frameP,uint16_t eNB_index); - - /// Send a received SI sdu - void (*ue_decode_si)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len); - - /// Send a received Paging sdu - void (*ue_decode_p)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len); - - /// Send a received DLSCH sdu to MAC - void (*ue_send_sdu)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index); - -#if defined(Rel10) || defined(Rel14) - /// Send a received MCH sdu to MAC - void (*ue_send_mch_sdu)(module_id_t Mod_id,uint8_t CC_id, frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area); - - /// Function to check if UE PHY needs to decode MCH for MAC - /// get the sync area id, and return MCS value if need to decode, otherwise -1 - int (*ue_query_mch)(module_id_t Mod_id, uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active); -#endif - - /// Retrieve ULSCH sdu from MAC - void (*ue_get_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode); - - /// Retrieve RRCConnectionReq from MAC - PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe); - - /// Process Random-Access Response - uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index, uint8_t* selected_rar_buffer); - - /// Get SR payload (0,1) from UE MAC - uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe); - - /// Indicate synchronization with valid PBCH - void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync); - - /// Only calls the PDCP for now - UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, frame_t txFrameP,sub_frame_t txSubframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id); - - /// PHY-Config-Dedicated UE - void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, - struct PhysicalConfigDedicated *physicalConfigDedicated); - - /// PHY-Config-harq UE - void (*phy_config_harq_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, - uint16_t max_harq_tx); - /// Configure Common PHY parameters from SIB1 - void (*phy_config_sib1_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, - TDD_Config_t *tdd_config, - uint8_t SIwindowsize, - uint16_t SIperiod); - - /// Configure Common PHY parameters from SIB2 - void (*phy_config_sib2_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, - ARFCN_ValueEUTRA_t *ul_CArrierFreq, - long *ul_Bandwidth, - AdditionalSpectrumEmission_t *additionalSpectrumEmission, - struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); - -#if defined(Rel10) || defined(Rel14) - /// Configure Common PHY parameters from SIB13 - void (*phy_config_sib13_ue)(uint8_t Mod_id,int CC_id, uint8_t eNB_index,int mbsfn_Area_idx, - long mbsfn_AreaId_r9); - - void (*phy_config_dedicated_scell_ue)(uint8_t Mod_id, - uint8_t eNB_index, - SCellToAddMod_r10_t *sCellToAddMod_r10, - int CC_id); -#endif - /// Configure Common PHY parameters from mobilityControlInfo - void (*phy_config_afterHO_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index, - MobilityControlInfo_t *mobilityControlInfo, - uint8_t ho_failed); - - /// Function to indicate failure of contention resolution or RA procedure - void (*ra_failed)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index); - - /// Function to indicate success of contention resolution or RA procedure - void (*ra_succeeded)(module_id_t Mod_id,uint8_t CC_id, uint8_t eNB_index); - - /// Function to indicate the transmission of msg1/rach to MAC - void (*Msg1_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id); - - /// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer - void (*Msg3_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id); - - /// Function to pass inter-cell measurement parameters to PHY (cell Ids) - void (*phy_config_meas_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,uint32_t *adj_cell_id); - - // PHY Helper Functions - - /// RIV computation from PHY - uint16_t (*computeRIV)(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); - - /// Downlink TBS table lookup from PHY - uint32_t (*get_TBS_DL)(uint8_t mcs, uint16_t nb_rb); - - /// Uplink TBS table lookup from PHY - uint32_t (*get_TBS_UL)(uint8_t mcs, uint16_t nb_rb); - - /// Function to retrieve the HARQ round index for a particular UL/DLSCH and harq_pid - int (*get_ue_active_harq_pid)(module_id_t Mod_id, uint8_t CC_id,rnti_t rnti, int frame, uint8_t subframe, uint8_t *harq_pid, uint8_t *round, uint8_t ul_flag); - - /// Function to retrieve number of CCE - uint16_t (*get_nCCE_max)(module_id_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe); - - - int (*get_nCCE_offset)(int *CCE_table, - const unsigned char L, - const int nCCE, - const int common_dci, - const unsigned short rnti, - const unsigned char subframe); - - /// Function to retrieve number of PRB in an rb_alloc - uint32_t (*get_nb_rb)(uint8_t ra_header, uint32_t rb_alloc, int n_rb_dl); - - /// Function to convert VRB to PRB for distributed allocation - uint32_t (*get_prb)(int N_RB_DL,int odd_slot,int vrb,int Ngap); - - /// Function to retrieve transmission mode for UE - uint8_t (*get_transmission_mode)(module_id_t Mod_id,uint8_t CC_id,rnti_t rnti); - - /// Function to retrieve rb_alloc bitmap from dci rballoc field and VRB type - uint32_t (*get_rballoc)(vrb_t vrb_type, uint16_t rb_alloc_dci); - - /// Function for UE MAC to retrieve current PHY connectivity mode (PRACH,RA_RESPONSE,PUSCH) - UE_MODE_t (*get_ue_mode)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index); - - /// Function for UE MAC to retrieve measured Path Loss - int16_t (*get_PL)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); - - /// Function for UE MAC to retrieve the rssi - uint32_t (*get_RSSI)(uint8_t Mod_id,uint8_t CC_id); - - /// Function for UE MAC to retrieve the total gain - uint32_t (*get_rx_total_gain_dB)(uint8_t Mod_id,uint8_t CC_id); - - /// Function for UE MAC to retrieve the number of adjustent cells - uint8_t (*get_n_adj_cells)(uint8_t Mod_id,uint8_t CC_id); - - /// Function for UE MAC to retrieve RSRP/RSRQ measurements - uint32_t (*get_RSRP)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); - - /// Function for UE MAC to retrieve RSRP/RSRQ measurements - uint32_t (*get_RSRQ)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); - - /// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements - uint8_t (*set_RSRP_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp); - - /// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements - uint8_t (*set_RSRQ_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp); - - /// Function for UE/eNB MAC to retrieve number of PRACH in TDD - uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms); - - /// Function for UE/eNB MAC to retrieve f_id of particular PRACH resource in TDD - uint8_t (*get_fid_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms,uint8_t tdd_map_index); - - /// Function for eNB MAC to retrieve subframe direction - lte_subframe_t (*get_subframe_direction)(module_id_t Mod_id, uint8_t CC_id, uint8_t subframe); - - // MAC Helper functions - /// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (Po_NOMINAL_PUSCH parameter) - int8_t (*get_Po_NOMINAL_PUSCH)(module_id_t Mod_id,uint8_t CC_id); - - /// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (deltaP_rampup parameter) - int8_t (*get_deltaP_rampup)(module_id_t Mod_id,uint8_t CC_id); - - /// Function for UE/PHY to compute PHR - int8_t (*get_PHR)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index); - - /// Function for UE to process the timing advance command - void (*process_timing_advance)(module_id_t Mod_id,uint8_t CC_id, int16_t timing_advance); - - /// Function for MAC to get the UE stats from the PHY - LTE_eNB_UE_stats* (*get_eNB_UE_stats)(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); - - /// get the frame parameters from the PHY - LTE_DL_FRAME_PARMS* (*get_lte_frame_parms)(module_id_t Mod_id, uint8_t CC_id); - - /// get the Multiuser mimo mode - MU_MIMO_mode* (*get_mu_mimo_mode) (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); - - /// get the delta TF for Uplink Power Control Calculation - int16_t (*get_hundred_times_delta_TF) (module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid); - /// get target PUSCH received power - int16_t (*get_target_pusch_rx_power) (module_id_t module_idP, uint8_t CC_id); - /// get target PUSCH received power - int16_t (*get_target_pucch_rx_power) (module_id_t module_idP, uint8_t CC_id); - - unsigned char is_cluster_head; - unsigned char is_primary_cluster_head; - unsigned char is_secondary_cluster_head; - unsigned char cluster_head_index; - - /// PHY Frame Configuration - LTE_DL_FRAME_PARMS *frame_parms; - - uint8_t (*get_prach_prb_offset)(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf); - - int (*is_prach_subframe)(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t subframe); - - /// ICIC algos - uint8_t (*get_SB_size)(uint8_t n_rb_dl); - ///end ALU's algo - -} MAC_xface; - -*/ - -#endif - - -/** @} */ diff --git a/openair2/PHY_INTERFACE/phy_interface.h b/openair2/PHY_INTERFACE/phy_interface.h new file mode 100644 index 0000000000000000000000000000000000000000..f275e91ec1b619059f81be20977c215c6345d922 --- /dev/null +++ b/openair2/PHY_INTERFACE/phy_interface.h @@ -0,0 +1,55 @@ +/* + * 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_INTERFACE/defs.h +* \brief mac phy interface primitives +* \author Raymond Knopp and Navid Nikaein +* \date 2011 +* \version 0.5 +* \mail navid.nikaein@eurecom.fr or openair_tech@eurecom.fr +*/ + +#ifndef __PHY_INTERFACE_H__ +# define __PHY_INTERFACE_H__ + +#include "LAYER2/MAC/mac.h" + + +#define MAX_NUMBER_OF_MAC_INSTANCES 16 + +#define NULL_PDU 255 +#define DCI 0 +#define DLSCH 1 +#define ULSCH 2 + +#define mac_exit_wrapper(sTRING) \ +do { \ + char temp[300]; \ + snprintf(temp, sizeof(temp), "%s in file "__FILE__" at line %d\n", sTRING, __LINE__); \ + mac_xface->macphy_exit(temp); \ +} while(0) + + + +#endif + + +/** @} */ diff --git a/openair2/PHY_INTERFACE/extern.h b/openair2/PHY_INTERFACE/phy_interface_extern.h similarity index 100% rename from openair2/PHY_INTERFACE/extern.h rename to openair2/PHY_INTERFACE/phy_interface_extern.h diff --git a/openair2/PHY_INTERFACE/vars.h b/openair2/PHY_INTERFACE/phy_interface_vars.h similarity index 98% rename from openair2/PHY_INTERFACE/vars.h rename to openair2/PHY_INTERFACE/phy_interface_vars.h index 566f4347b6e5e264ff19a5a28193b1c96258ab97..5f205d302443ddc84274a7cb33e6dc9f8477c197 100644 --- a/openair2/PHY_INTERFACE/vars.h +++ b/openair2/PHY_INTERFACE/phy_interface_vars.h @@ -23,7 +23,7 @@ #define __PHY_INTERFACE_VARS_H__ //#include "SIMULATION/PHY_EMULATION/spec_defs.h" -#include "defs.h" +#include "phy_interface.h" #ifdef PHY_EMUL #include "SIMULATION/PHY_EMULATION/DEVICE_DRIVER/defs.h" diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c similarity index 98% rename from openair2/RRC/LITE/L2_interface.c rename to openair2/RRC/LTE/L2_interface.c index 91834d9c9d64f4742cec1cd2b9d538a8ca9b8065..b21cf77f4df76d15d10938cabeacca0c9ae3924c 100644 --- a/openair2/RRC/LITE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -29,26 +29,14 @@ */ #include "platform_types.h" -//#include "openair_defs.h" -//#include "openair_proto.h" -#include "defs.h" -#include "extern.h" -//#include "mac_lchan_interface.h" -//#include "openair_rrc_utils.h" -//#include "openair_rrc_main.h" +#include "rrc_defs.h" +#include "rrc_extern.h" #include "UTIL/LOG/log.h" #include "rrc_eNB_UE_context.h" #include "pdcp.h" #include "msc.h" #include "common/ran_context.h" -#ifdef PHY_EMUL -#include "SIMULATION/simulation_defs.h" -extern EMULATION_VARS *Emul_vars; -extern eNB_MAC_INST *eNB_mac_inst; -extern UE_MAC_INST *UE_mac_inst; -#endif - #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif diff --git a/openair2/RRC/LITE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c similarity index 94% rename from openair2/RRC/LITE/L2_interface_common.c rename to openair2/RRC/LTE/L2_interface_common.c index 1b832521528ec231b8b8dc9d016e62584ff97191..d72cc2f5bee1aa2d10fbb61838c9fda1eac997c8 100644 --- a/openair2/RRC/LITE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -29,26 +29,14 @@ */ #include "platform_types.h" -//#include "openair_defs.h" -//#include "openair_proto.h" -#include "defs.h" -#include "extern.h" -//#include "mac_lchan_interface.h" -//#include "openair_rrc_utils.h" -//#include "openair_rrc_main.h" +#include "rrc_defs.h" +#include "rrc_extern.h" #include "UTIL/LOG/log.h" #include "rrc_eNB_UE_context.h" #include "pdcp.h" #include "msc.h" #include "common/ran_context.h" -#ifdef PHY_EMUL -#include "SIMULATION/simulation_defs.h" -extern EMULATION_VARS *Emul_vars; -extern eNB_MAC_INST *eNB_mac_inst; -extern UE_MAC_INST *UE_mac_inst; -#endif - #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif diff --git a/openair2/RRC/LITE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c similarity index 98% rename from openair2/RRC/LITE/L2_interface_ue.c rename to openair2/RRC/LTE/L2_interface_ue.c index 244f0d2253bbd6cd78f5724650be5b3dcf7a29d3..856ba96174b48612cc519a74b09d65f08c1333d0 100644 --- a/openair2/RRC/LITE/L2_interface_ue.c +++ b/openair2/RRC/LTE/L2_interface_ue.c @@ -29,13 +29,8 @@ */ #include "platform_types.h" -//#include "openair_defs.h" -//#include "openair_proto.h" -#include "defs.h" -#include "extern.h" -//#include "mac_lchan_interface.h" -//#include "openair_rrc_utils.h" -//#include "openair_rrc_main.h" +#include "rrc_defs.h" +#include "rrc_extern.h" #include "UTIL/LOG/log.h" #include "rrc_eNB_UE_context.h" #include "pdcp.h" 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 99% rename from openair2/RRC/LITE/MESSAGES/asn1_msg.c rename to openair2/RRC/LTE/MESSAGES/asn1_msg.c index 77ba0c4cade0378c36db0cb8807d4f1a23b30ace..6c7e6e4ead7764a610fed45211cb7a252326584e 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -57,8 +57,8 @@ //#define MRB1 1 #endif -#include "RRC/LITE/defs.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_defs.h" +#include "RRC/LTE/rrc_extern.h" #include "RRCConnectionSetupComplete.h" #include "RRCConnectionReconfigurationComplete.h" #include "RRCConnectionReconfiguration.h" @@ -71,7 +71,7 @@ #include "BCCH-DL-SCH-Message.h" -#include "PHY/defs.h" +//#include "PHY/defs.h" #include "MeasObjectToAddModList.h" #include "ReportConfigToAddModList.h" diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h similarity index 99% rename from openair2/RRC/LITE/MESSAGES/asn1_msg.h rename to openair2/RRC/LTE/MESSAGES/asn1_msg.h index 05396bf727961b03a8278f00ddbbf606da6bd629..0dad83f1a6bd7c139a98b0ea7c7b0e9dea050603 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.h @@ -39,7 +39,7 @@ #include <asn_application.h> #include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */ -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" /* * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c similarity index 99% rename from openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c rename to openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c index 43721bbfd55f0ee6d03f2c90e618dcf92571e63d..2d91828861c4e4c07a92f12677abf3c2a9d224ae 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c @@ -53,7 +53,7 @@ #include "RRCConnectionSetup-NB.h" #include "SRB-ToAddModList-NB-r13.h" #include "DRB-ToAddModList-NB-r13.h" -#include "RRC/LITE/defs_NB_IoT.h" +#include "RRC/LTE/defs_NB_IoT.h" #include "RRCConnectionSetupComplete-NB.h" #include "RRCConnectionReconfigurationComplete-NB.h" #include "RRCConnectionReconfiguration-NB.h" 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 98% rename from openair2/RRC/LITE/defs_NB_IoT.h rename to openair2/RRC/LTE/defs_NB_IoT.h index 376b66c79a1e5c61ccedad1aca00806137da49bc..a4e4938814a11a2c4c94eb510f64fe6e613eb1bf 100644 --- a/openair2/RRC/LITE/defs_NB_IoT.h +++ b/openair2/RRC/LTE/defs_NB_IoT.h @@ -35,6 +35,9 @@ #include <stdlib.h> #include <string.h> +#include "COMMON/s1ap_messages_types.h" +#include "COMMON/rrc_messages_types.h" + #include "collection/tree.h" #include "rrc_types_NB_IoT.h" #include "COMMON/platform_constants.h" @@ -85,7 +88,7 @@ /*I will change the name of the structure for compile purposes--> hope not to undo this process*/ typedef unsigned int uid_NB_IoT_t; -#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NB_IoT (((NUMBER_OF_UE_MAX_NB_IoT/8)/sizeof(unsigned int)) + 1) +#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NB_IoT (((MAX_MOBILES_PER_ENB_NB_IoT/8)/sizeof(unsigned int)) + 1) typedef struct uid_linear_allocator_NB_IoT_s { unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NB_IoT]; @@ -147,7 +150,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s { // HO_STATE is not supported by NB-IoT -//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG +//#define MAX_MOBILES_PER_ENB MAX_MOBILES_PER_RG #define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; } #define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n ) #define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n) 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 f5e2f325756006d2841bb81f674d778ea68515f8..f136b57b4787613605ad3f579f779b6005963598 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 b2218517fc8761da2f7311554e25821f02f9f06a..de09d39fab7b100b9335489cae95a513068baea2 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 99% rename from openair2/RRC/LITE/rrc_UE.c rename to openair2/RRC/LTE/rrc_UE.c index 2a12def7523b7697cedc00b228661202ff95d084..a1d0d2f6f72ce7bb2a4cffd3dec0e0fa946f6cb6 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -34,16 +34,16 @@ #include "assertions.h" #include "hashtable.h" #include "asn1_conversions.h" -#include "defs.h" -#include "PHY/TOOLS/dB_routines.h" -#include "extern.h" +#include "rrc_defs.h" +#include "rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "openair1/PHY/LTE_ESTIMATION/lte_estimation.h" #include "LAYER2/RLC/rlc.h" #include "COMMON/mac_rrc_primitives.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" #ifndef CELLULAR -#include "RRC/LITE/MESSAGES/asn1_msg.h" +#include "RRC/LTE/MESSAGES/asn1_msg.h" #endif #include "RRCConnectionRequest.h" #include "RRCConnectionReconfiguration.h" @@ -80,21 +80,14 @@ # include "intertask_interface.h" #endif -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus - -#ifdef PHY_EMUL -extern EMULATION_VARS *Emul_vars; -#endif -extern eNB_MAC_INST *eNB_mac_inst; -extern UE_MAC_INST *UE_mac_inst; -#ifdef BIGPHYSAREA -extern void *bigphys_malloc(int); -#endif +// for malloc_clear +#include "PHY/defs_UE.h" //#define XER_PRINT -//extern int8_t dB_fixed2(uint32_t x,uint32_t y); + extern void pdcp_config_set_security( const protocol_ctxt_t* const ctxt_pP, 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 90% rename from openair2/RRC/LITE/rrc_common.c rename to openair2/RRC/LTE/rrc_common.c index a6a2bbb613b8f2d46a554b422ca2cab4f78bbaac..0acb0d77010a41c8753b3fae87cafa014bf34be2 100644 --- a/openair2/RRC/LITE/rrc_common.c +++ b/openair2/RRC/LTE/rrc_common.c @@ -28,9 +28,9 @@ * \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr */ -#include "defs.h" -#include "extern.h" -#include "LAYER2/MAC/extern.h" +#include "rrc_defs.h" +#include "rrc_extern.h" +#include "LAYER2/MAC/mac_extern.h" #include "COMMON/openair_defs.h" #include "COMMON/platform_types.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" @@ -43,10 +43,6 @@ #include "rrc_eNB_UE_context.h" #include "common/ran_context.h" -#ifdef LOCALIZATION -#include <sys/time.h> -#endif - #define DEBUG_RRC 1 extern RAN_CONTEXT_t RC; extern UE_MAC_INST *UE_mac_inst; @@ -61,33 +57,6 @@ rrc_init_global_param( //----------------------------------------------------------------------------- { - // Rrc_xface = (RRC_XFACE*)malloc16(sizeof(RRC_XFACE)); - - // Rrc_xface->openair_rrc_top_init = openair_rrc_top_init; - // Rrc_xface->openair_rrc_eNB_init = openair_rrc_eNB_init; - // Rrc_xface->openair_rrc_UE_init = openair_rrc_ue_init; - // Rrc_xface->mac_rrc_data_ind = mac_rrc_data_ind; - //Rrc_xface->mac_rrc_data_req = mac_rrc_data_req; - // Rrc_xface->rrc_data_indP = (void *)rlcrrc_data_ind; - // Rrc_xface->rrc_rx_tx = rrc_rx_tx; - // Rrc_xface->mac_rrc_meas_ind = mac_rrc_meas_ind; - // Rrc_xface->get_rrc_status = get_rrc_status; - - //Rrc_xface->rrc_get_status = ... - - // Mac_rlc_xface->mac_out_of_sync_ind=mac_out_of_sync_ind; - -#ifndef NO_RRM - // Rrc_xface->fn_rrc=fn_rrc; -#endif - // LOG_D(RRC, "[RRC]INIT_GLOBAL_PARAM: Mac_rlc_xface %p, rrc_rlc_register %p,rlcrrc_data_ind%p\n",Mac_rlc_xface,Mac_rlc_xface->rrc_rlc_register_rrc,rlcrrc_data_ind); - /* - if((Mac_rlc_xface==NULL) || (Mac_rlc_xface->rrc_rlc_register_rrc==NULL) || - (rlcrrc_data_ind==NULL)) { - LOG_E(RRC,"Data structured is not initialized \n"); - return -1; - } - */ rrc_rlc_register_rrc (rrc_data_ind, NULL); //register with rlc DCCH_LCHAN_DESC.transport_block_size = 4; diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LTE/rrc_defs.h similarity index 98% rename from openair2/RRC/LITE/defs.h rename to openair2/RRC/LTE/rrc_defs.h index 08ac30f8363f9453921c73598a3b8447fc7abc93..616fc8a0140d53465d2ab02fd5026c0d18b14cb8 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" @@ -171,7 +171,7 @@ //-------- typedef unsigned int uid_t; -#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE (((NUMBER_OF_UE_MAX/8)/sizeof(unsigned int)) + 1) +#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE (((MAX_MOBILES_PER_ENB/8)/sizeof(unsigned int)) + 1) typedef struct uid_linear_allocator_s { unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE]; } uid_allocator_t; @@ -219,7 +219,7 @@ typedef enum HO_STATE_e { HO_COMPLETE // initiated by the target eNB } HO_STATE_t; -//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG +//#define MAX_MOBILES_PER_ENB MAX_MOBILES_PER_RG #define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; } #define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n ) #define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n) @@ -521,8 +521,8 @@ typedef struct { #endif SRB_INFO SI; SRB_INFO Srb0; - uint8_t *paging[NUMBER_OF_UE_MAX]; - uint32_t sizeof_paging[NUMBER_OF_UE_MAX]; + uint8_t *paging[MAX_MOBILES_PER_ENB]; + uint32_t sizeof_paging[MAX_MOBILES_PER_ENB]; } rrc_eNB_carrier_data_t; typedef struct eNB_RRC_INST_s { @@ -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 99% rename from openair2/RRC/LITE/rrc_eNB.c rename to openair2/RRC/LTE/rrc_eNB.c index 78d32697f39ca3f7785496438e050a5a2a904355..3db76d3de187caa33af9bfc061a65cbf02788b4c 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -30,17 +30,17 @@ #define RRC_ENB #define RRC_ENB_C -#include "defs.h" -#include "extern.h" +#include "rrc_defs.h" +#include "rrc_extern.h" #include "assertions.h" #include "common/ran_context.h" #include "asn1_conversions.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "LAYER2/RLC/rlc.h" -#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/mac_proto.h" #include "UTIL/LOG/log.h" #include "COMMON/mac_rrc_primitives.h" -#include "RRC/LITE/MESSAGES/asn1_msg.h" +#include "RRC/LTE/MESSAGES/asn1_msg.h" #include "RRCConnectionRequest.h" #include "RRCConnectionReestablishmentRequest.h" //#include "ReestablishmentCause.h" @@ -52,7 +52,6 @@ #include "TDD-Config.h" #include "HandoverCommand.h" #include "rlc.h" -#include "SIMULATION/ETH_TRANSPORT/extern.h" #include "rrc_eNB_UE_context.h" #include "platform_types.h" #include "msc.h" @@ -93,7 +92,7 @@ # include "rrc_eNB_ral.h" #endif -#include "SIMULATION/TOOLS/defs.h" // for taus +#include "SIMULATION/TOOLS/sim.h" // for taus //#define XER_PRINT @@ -516,7 +515,7 @@ rrc_eNB_get_next_transaction_identifier( // // AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST); // -// for (i = 0; i < NUMBER_OF_UE_MAX; i++) { +// for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { // if (RC.rrc[enb_mod_idP]->Info.UE_list[i] == UE_identity) { // // UE_identity already registered // reg = TRUE; @@ -855,14 +854,14 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* #endif for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { eNB_PHY = RC.eNB[enb_mod_idP][CC_id]; - for (i=0; i<NUMBER_OF_UE_MAX; i++) { + for (i=0; i<MAX_MOBILES_PER_ENB; i++) { ulsch = eNB_PHY->ulsch[i]; if((ulsch != NULL) && (ulsch->rnti == rnti)){ LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti); clean_eNb_ulsch(ulsch); } } - for (i=0; i<NUMBER_OF_UE_MAX; i++) { + for (i=0; i<MAX_MOBILES_PER_ENB; i++) { dlsch = eNB_PHY->dlsch[i][0]; if((dlsch != NULL) && (dlsch->rnti == rnti)){ LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti); @@ -1813,7 +1812,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id]; for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id]; - for (int i=0; i<NUMBER_OF_UE_MAX; i++) { + for (int i=0; i<MAX_MOBILES_PER_ENB; i++) { ulsch = eNB_PHY->ulsch[i]; if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){ LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti); @@ -5709,11 +5708,11 @@ openair_rrc_eNB_init( } #endif AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!"); - AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); + AssertFatal(MAX_MOBILES_PER_ENB < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); #ifdef ENABLE_ITTI AssertFatal(configuration!=NULL,"configuration input is null\n"); #endif - // for (j = 0; j < NUMBER_OF_UE_MAX; j++) + // for (j = 0; j < MAX_MOBILES_PER_ENB; j++) // RC.rrc[ctxt.module_id].Info.UE[j].Status = RRC_IDLE; //CH_READY; // //#if defined(ENABLE_USE_MME) @@ -5722,7 +5721,7 @@ openair_rrc_eNB_init( //#endif // { // /* Init security parameters */ - // for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + // for (j = 0; j < MAX_MOBILES_PER_ENB; j++) { // RC.rrc[ctxt.module_id].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea0; // RC.rrc[ctxt.module_id].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; // rrc_eNB_init_security(enb_mod_idP, j); @@ -5736,13 +5735,13 @@ openair_rrc_eNB_init( uid_linear_allocator_init(&RC.rrc[ctxt.module_id]->uid_allocator); RB_INIT(&RC.rrc[ctxt.module_id]->rrc_ue_head); - // for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) { + // for (j = 0; j < (MAX_MOBILES_PER_ENB + 1); j++) { // RC.rrc[enb_mod_idP]->Srb2[j].Active = 0; // } - RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); - RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL); + RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (MAX_MOBILES_PER_ENB * 2, NULL, NULL); memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq)); @@ -5798,7 +5797,7 @@ openair_rrc_eNB_init( , configuration #endif ); - for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++) { + for (int ue_id = 0; ue_id < MAX_MOBILES_PER_ENB; ue_id++) { RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); } @@ -6042,7 +6041,7 @@ rrc_eNB_decode_ccch( ue_context_p->ue_context.ue_release_timer = 0; // insert C-RNTI to map - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (reestablish_rnti_map[i][0] == 0) { reestablish_rnti_map[i][0] = ctxt_pP->rnti; reestablish_rnti_map[i][1] = c_rnti; @@ -6666,7 +6665,7 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; rnti_t reestablish_rnti = 0; // select C-RNTI from map - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { reestablish_rnti = reestablish_rnti_map[i][1]; ue_context_p = rrc_eNB_get_ue_context( diff --git a/openair2/RRC/LITE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c similarity index 97% rename from openair2/RRC/LITE/rrc_eNB_GTPV1U.c rename to openair2/RRC/LTE/rrc_eNB_GTPV1U.c index e5f2c5aaae1c469c4da1ffbcda1a41a0d7c264d4..135c6fea8d82e5279036ad7c11ae08df8d3d8683 100644 --- a/openair2/RRC/LITE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -28,9 +28,9 @@ */ #if defined(ENABLE_USE_MME) -# include "defs.h" -# include "extern.h" -# include "RRC/LITE/MESSAGES/asn1_msg.h" +# include "rrc_defs.h" +# include "rrc_extern.h" +# include "RRC/LTE/MESSAGES/asn1_msg.h" # include "rrc_eNB_GTPV1U.h" # include "rrc_eNB_UE_context.h" # include "msc.h" 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 99% rename from openair2/RRC/LITE/rrc_eNB_S1AP.c rename to openair2/RRC/LTE/rrc_eNB_S1AP.c index 80ae1c9ba57e9e276f5f4581c6dea7c9c7e49bec..153b5d693dfc5da9d574b7023f0915a86c7ef202 100644 --- a/openair2/RRC/LITE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -27,13 +27,11 @@ * \company Eurecom * \email: navid.nikaein@eurecom.fr */ - #if defined(ENABLE_USE_MME) -# include "defs.h" -# include "extern.h" +# include "rrc_defs.h" +# include "rrc_extern.h" # include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -# include "RRC/LITE/MESSAGES/asn1_msg.h" -# include "RRC/LITE/defs.h" +# include "RRC/LTE/MESSAGES/asn1_msg.h" # include "rrc_eNB_UE_context.h" # include "rrc_eNB_S1AP.h" # include "enb_config.h" @@ -57,7 +55,7 @@ #include "UERadioAccessCapabilityInformation.h" #include "gtpv1u_eNB_task.h" -#include "RRC/LITE/rrc_eNB_GTPV1U.h" +#include "RRC/LTE/rrc_eNB_GTPV1U.h" #include "TLVDecoder.h" #include "S1ap-NAS-PDU.h" @@ -1996,7 +1994,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance /* insert data to UE_PF_PO or update data in UE_PF_PO */ pthread_mutex_lock(&ue_pf_po_mutex); uint8_t i = 0; - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value)) || (UE_PF_PO[CC_id][i].enable_flag != TRUE)) { /* set T = min(Tc,Tue) */ 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 98% rename from openair2/RRC/LITE/rrc_eNB_UE_context.h rename to openair2/RRC/LTE/rrc_eNB_UE_context.h index 0e813cdee526819145296ff477ee620f39b00b1d..289b4d69d69275e75659a819a17b57d85fb2861c 100644 --- a/openair2/RRC/LITE/rrc_eNB_UE_context.h +++ b/openair2/RRC/LTE/rrc_eNB_UE_context.h @@ -30,7 +30,7 @@ #ifndef __RRC_ENB_UE_CONTEXT_H__ #include "collection/tree.h" #include "COMMON/platform_types.h" -#include "defs.h" +#include "rrc_defs.h" void 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 91% rename from openair2/RRC/LITE/extern.h rename to openair2/RRC/LTE/rrc_extern.h index b45dbd11e9557db9667b6c2ea24f1906eb67f774..6c19fa9c7076202b934664657e2e9cc3c3c1508a 100644 --- a/openair2/RRC/LITE/extern.h +++ b/openair2/RRC/LTE/rrc_extern.h @@ -30,15 +30,13 @@ #ifndef __OPENAIR_RRC_EXTERN_H__ #define __OPENAIR_RRC_EXTERN_H__ -#include "defs.h" +#include "rrc_defs.h" #include "COMMON/mac_rrc_primitives.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" #include "LAYER2/RLC/rlc.h" extern UE_RRC_INST *UE_rrc_inst; -#include "LAYER2/MAC/extern.h" extern uint8_t DRB2LCHAN[8]; @@ -77,10 +75,10 @@ extern uint32_t timeToTrigger_ms[16]; extern float RSRP_meas_mapping[98]; extern float RSRQ_meas_mapping[35]; -extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; +extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; extern pthread_mutex_t ue_pf_po_mutex; -extern uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2]; +extern uint16_t reestablish_rnti_map[MAX_MOBILES_PER_ENB][2]; #endif 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 b92058741940a5aa8ee91b18b664f2cbd5bb0d46..7216ef65724b0fe3968fe3315106e5c033d0395c 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 95% rename from openair2/RRC/LITE/vars.h rename to openair2/RRC/LTE/rrc_vars.h index e3bab5f5eb48aa577400a62d92d1397ab2ed25cf..dcd608a76a719cda6c2963d5df51d4a018efc6b0 100644 --- a/openair2/RRC/LITE/vars.h +++ b/openair2/RRC/LTE/rrc_vars.h @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file vars.hles +/*! \file rrc_vars.h * \brief rrc variables * \author Raymond Knopp and Navid Nikaein * \date 2013 @@ -31,15 +31,15 @@ #ifndef __OPENAIR_RRC_VARS_H__ #define __OPENAIR_RRC_VARS_H__ -#include "defs.h" +#include "rrc_defs.h" #include "LAYER2/RLC/rlc.h" #include "COMMON/mac_rrc_primitives.h" -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" -UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; +UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][MAX_MOBILES_PER_ENB]; pthread_mutex_t ue_pf_po_mutex; UE_RRC_INST *UE_rrc_inst; -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" #define MAX_U32 0xFFFFFFFF uint8_t DRB2LCHAN[8]; @@ -242,6 +242,6 @@ float RSRQ_meas_mapping[35] = { // [0]: current C-RNTI, [1]: prior C-RNTI // insert one when eNB received RRCConnectionReestablishmentRequest message // delete one when eNB received RRCConnectionReestablishmentComplete message -uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2] = {{0}}; +uint16_t reestablish_rnti_map[MAX_MOBILES_PER_ENB][2] = {{0}}; #endif 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/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index b18d2a25ffd714c778e16a96a971db1e081694d9..a026cfb081a70e1ffd8ab833dd711c329b6ee33e 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -191,6 +191,9 @@ const char* eurecomVariablesNames[] = { "ue0_trx_write_ns", "ue0_trx_read_ns_missing", "ue0_trx_write_ns_missing", + "enb_thread_rxtx_CPUID", + "ru_thread_CPUID", + "ru_thread_tx_CPUID" }; const char* eurecomFunctionsNames[] = { diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index a4c8cd2476e08f0b234e47540b54b89b1d6b52fd..a47cdc059d1a8236b78255b28d457ad8979613e5 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -167,6 +167,9 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS_MISSING, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS_MISSING, + VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX, + VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD, + VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX, VCD_SIGNAL_DUMPER_VARIABLES_END } vcd_signal_dump_variables; diff --git a/openair2/UTIL/MEM/mem_block.c b/openair2/UTIL/MEM/mem_block.c index 9c3a50467a785f4f218d3f2eef034e327d5dde78..39447001fab293832c874cfe2957c30476b7ac26 100644 --- a/openair2/UTIL/MEM/mem_block.c +++ b/openair2/UTIL/MEM/mem_block.c @@ -33,8 +33,8 @@ #include "mem_block.h" #include "mem_pool.h" #include "list.h" -#include "LAYER2/MAC/extern.h" - +#include "LAYER2/MAC/mac_extern.h" +#include "assertions.h" /* all function calls are protected by a mutex * to ensure that many threads calling them at * the same time don't mess up. diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h index 855b7a99fdde30ef25bfb70c7c78c8a523104a2b..0495b139ce363e548346c83d9d22213ea32647e3 100644 --- a/openair2/UTIL/OCG/OCG.h +++ b/openair2/UTIL/OCG/OCG.h @@ -36,7 +36,7 @@ #ifndef __OCG_H__ #define __OCG_H__ -#include "PHY/defs.h" +#include "PHY/defs_common.h" #include "PHY/impl_defs_top.h" #include "platform_types.h" diff --git a/openair2/UTIL/OTG/otg_defs.h b/openair2/UTIL/OTG/otg_defs.h index fad0d9510ece3fc190b76889f819cb71aab4d080..6c9944014fd99f08e01e53f2ef4e4330446bf8e3 100644 --- a/openair2/UTIL/OTG/otg_defs.h +++ b/openair2/UTIL/OTG/otg_defs.h @@ -33,7 +33,7 @@ #ifndef __OTG_DEFS_H__ # define __OTG_DEFS_H__ -/* \brief To define the NUMBER_OF_eNB_MAX and NUMBER_OF_UE_MAX */ +/* \brief To define the NUMBER_OF_eNB_MAX and MAX_MOBILES_PER_ENB */ #if STANDALONE==1 #include "openairinterface5g_limits.h" #else @@ -313,13 +313,13 @@ typedef struct { /*this structure constitutes a whole bg-stream with multiple bg typedef struct { int application_type[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief It identify the application of the simulated traffic, could be cbr, m2m, gaming,etc*/ - int trans_proto[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - int ip_v[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; + int trans_proto[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + int ip_v[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; - int flow_start[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Duration of traffic generation or use the emuulation time instead */ - int flow_duration[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Duration of traffic generation or use the emuulation time instead */ + int flow_start[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief Duration of traffic generation or use the emuulation time instead */ + int flow_duration[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief Duration of traffic generation or use the emuulation time instead */ - int idt_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Inter Departure Time distribution */ + int idt_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief Inter Departure Time distribution */ int idt_min[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief Min Inter Departure Time, for uniform distrib */ int idt_max[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief idt, Max Inter Departure Time, for uniform distrib */ @@ -338,69 +338,69 @@ typedef struct { */ typedef struct { int max_nb_frames; /*!< \brief Max Number of frames*/ - int application_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief It identify the application of the simulated traffic, could be cbr, m2m, gaming,etc*/ + int application_type[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief It identify the application of the simulated traffic, could be cbr, m2m, gaming,etc*/ /*!\header info */ - int trans_proto[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Transport Protocol*/ - int ip_v[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Ip version */ + int trans_proto[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief Transport Protocol*/ + int ip_v[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief Ip version */ //int header_compression; /*!\brief Specify if header compression is used or not */ int num_nodes; /*!\brief Number of used nodes in the simulation */ int packet_gen_type; /*!\brief define how the payload is generated: fixed, predefined, random position, random see ALPHABET_GEN */ - unsigned int background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief enable or disable background traffic */ - unsigned int aggregation_level[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /* define packet aggregation level for the case of gateway*/ + unsigned int background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief enable or disable background traffic */ + unsigned int aggregation_level[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /* define packet aggregation level for the case of gateway*/ // src id , dst id, and state // think to the case of several streams per node !!!!! - int idt_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Inter Departure Time distribution */ - int idt_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Inter Departure Time, for uniform distrib */ - int idt_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Max Inter Departure Time, for uniform distrib */ + int idt_dist[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Inter Departure Time distribution */ + int idt_min[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Inter Departure Time, for uniform distrib */ + int idt_max[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Max Inter Departure Time, for uniform distrib */ - double idt_std_dev[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Standard Deviation, for guassian distrib */ - double idt_lambda[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, lambda, for exponential/poisson distrib */ - double idt_scale[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/ - double idt_shape[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/ + double idt_std_dev[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Standard Deviation, for guassian distrib */ + double idt_lambda[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, lambda, for exponential/poisson distrib */ + double idt_scale[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/ + double idt_shape[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/ - int size_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Paylolad size distribution */ - int size_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Payload size, for uniform distrib */ - int size_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Max Inter Departure Time, for uniform distrib */ - double size_std_dev[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Standard Deviation, for guassian distrib */ - double size_lambda[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, lambda, for exponential/poisson distrib */ + int size_dist[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Paylolad size distribution */ + int size_min[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Payload size, for uniform distrib */ + int size_max[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Max Inter Departure Time, for uniform distrib */ + double size_std_dev[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Standard Deviation, for guassian distrib */ + double size_lambda[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, lambda, for exponential/poisson distrib */ - double size_scale[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution */ - double size_shape[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/ + double size_scale[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution */ + double size_shape[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/ // info for state-based traffic gen - int num_state [NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!\brief Number of states for source node*/ - // int state_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_TRAFFIC_STATE]; /*!\brief States distribution */ - double state_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_TRAFFIC_STATE]; /*!\brief State probablity: prob to move from one state to the other one */ + int num_state [NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!\brief Number of states for source node*/ + // int state_dist[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_TRAFFIC_STATE]; /*!\brief States distribution */ + double state_prob[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_TRAFFIC_STATE]; /*!\brief State probablity: prob to move from one state to the other one */ // num stream for each src - // int stream [NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; // this requires multi thread for parallel stream for a givcen src + // int stream [NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; // this requires multi thread for parallel stream for a givcen src // emu info - int flow_start_flag[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief flow start time flag for traffic generation or use the emuulation time instead */ - int flow_start[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief flow start time of traffic generation or use the emuulation time instead */ - int flow_duration[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief flow duration of traffic generation or use the emuulation time instead */ + int flow_start_flag[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief flow start time flag for traffic generation or use the emuulation time instead */ + int flow_start[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief flow start time of traffic generation or use the emuulation time instead */ + int flow_duration[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!\brief flow duration of traffic generation or use the emuulation time instead */ int seed; /*!\brief The seed used to generate the random positions*/ - int dst_port[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!\brief Destination port number, for the socket mode*/ - char *dst_ip[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!\brief Destination IP address, for the socket mode*/ + int dst_port[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!\brief Destination port number, for the socket mode*/ + char *dst_ip[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!\brief Destination IP address, for the socket mode*/ - int trans_proto_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!\brief define the transport protocol and IP version for background traffic*/ + int trans_proto_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!\brief define the transport protocol and IP version for background traffic*/ - double prob_off_pu[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - double prob_off_ed[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - double prob_off_pe[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - double prob_pu_ed[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - double prob_pu_pe[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - double prob_ed_pe[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - double prob_ed_pu[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int holding_time_off_ed[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int holding_time_off_pu[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int holding_time_off_pe[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int holding_time_pe_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int pu_size_pkts[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int ed_size_pkts[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int m2m[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; + double prob_off_pu[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + double prob_off_ed[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + double prob_off_pe[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + double prob_pu_ed[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + double prob_pu_pe[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + double prob_ed_pe[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + double prob_ed_pu[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int holding_time_off_ed[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int holding_time_off_pu[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int holding_time_off_pe[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int holding_time_pe_off[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int pu_size_pkts[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int ed_size_pkts[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int m2m[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; unsigned int throughput_metric; @@ -409,7 +409,7 @@ typedef struct { unsigned int curve; unsigned int owd_radio_access; unsigned int background_stats; - unsigned int application_idx[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; + unsigned int application_idx[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; } otg_t; @@ -485,8 +485,8 @@ typedef struct { unsigned int rx_total_bytes_dl; /*TARMA parameteres*/ - tarmaStream_t *mtarma_stream[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - tarmaVideo_t *mtarma_video[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; + tarmaStream_t *mtarma_stream[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + tarmaVideo_t *mtarma_video[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; } otg_multicast_info_t; @@ -505,71 +505,71 @@ typedef struct { int ctime; /*!< \brief Simulation time in ms*/ int ptime_background_ul; /*!< \brief time of last sent background UL data (time in ms)*/ int ptime_background_dl; /*!< \brief time of last sent background DL data (time in ms)*/ - int ptime[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief time of last sent data (time in ms)*/ - int seq_num[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the sender */ - int seq_num_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief the sequence number for background traffic of the sender */ - int seq_num_rx[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the receiver */ - int seq_num_rx_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief the sequence number for background traffic of the receiver */ + int ptime[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!< \brief time of last sent data (time in ms)*/ + int seq_num[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the sender */ + int seq_num_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief the sequence number for background traffic of the sender */ + int seq_num_rx[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the receiver */ + int seq_num_rx_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief the sequence number for background traffic of the receiver */ - int idt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Inter Departure Time for background traffic in ms*/ - int size_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief payload size for background traffic*/ - int idt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief Inter Departure Time in ms*/ - int header_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Define the type of header: Transport layer + IP version*/ + int idt_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Inter Departure Time for background traffic in ms*/ + int size_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief payload size for background traffic*/ + int idt[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!< \brief Inter Departure Time in ms*/ + int header_type[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Define the type of header: Transport layer + IP version*/ /*!< \brief Statics part: vars updated at each iteration of otg_tx */ - int tx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the tx*/ - int tx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the tx*/ // get the size and calculate the avg throughput + int tx_num_pkt[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the tx*/ + int tx_num_bytes[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the tx*/ // get the size and calculate the avg throughput // vars updated at each iteration of otg_rx - int rx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the rx */ - int rx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the rx */ - float rx_pkt_owd[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime, */ - float rx_owd_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ - float rx_owd_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ - float rx_pkt_owd_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime, */ - float rx_owd_min_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ - float rx_owd_max_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ - float rx_pkt_owd_history[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */ - float rx_pkt_owd_history_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */ - float rx_pkt_jitter[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */ - float rx_jitter_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ - float rx_jitter_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ - float rx_jitter_avg[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ - float rx_pkt_jitter_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */ - float rx_jitter_min_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ - float rx_jitter_max_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ - float rx_jitter_avg_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ - int rx_jitter_sample[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ - int nb_loss_pkts_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for UL*/ - int nb_loss_pkts_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for DL*/ - float owd_const[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief One way delay constant*/ + int rx_num_pkt[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the rx */ + int rx_num_bytes[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the rx */ + float rx_pkt_owd[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief One way delay: rx_ctime - tx_ctime, */ + float rx_owd_min[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ + float rx_owd_max[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ + float rx_pkt_owd_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief One way delay: rx_ctime - tx_ctime, */ + float rx_owd_min_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ + float rx_owd_max_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ + float rx_pkt_owd_history[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */ + float rx_pkt_owd_history_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */ + float rx_pkt_jitter[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief One way delay: rx_ctime - tx_ctime */ + float rx_jitter_min[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ + float rx_jitter_max[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ + float rx_jitter_avg[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ + float rx_pkt_jitter_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief One way delay: rx_ctime - tx_ctime */ + float rx_jitter_min_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/ + float rx_jitter_max_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ + float rx_jitter_avg_e2e[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ + int rx_jitter_sample[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/ + int nb_loss_pkts_ul[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for UL*/ + int nb_loss_pkts_dl[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for DL*/ + float owd_const[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!< \brief One way delay constant*/ /*!< \brief KPI part: calculate the KPIs, total */ - double tx_throughput[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/ - double rx_goodput[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Rx goodput: (size of received data)/ctime*/ - float rx_loss_rate[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/ - //int rx_latency[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx Latency */ + double tx_throughput[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/ + double rx_goodput[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Rx goodput: (size of received data)/ctime*/ + float rx_loss_rate[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_EMU_TRAFFIC]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/ + //int rx_latency[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Rx Latency */ /*!< \brief Background traffic part: SATS + KPIs */ - int tx_num_pkt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background data packet in the rx */ - int tx_num_bytes_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background bytes in the rx */ - int rx_num_pkt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background data packet in the tx */ - int rx_num_bytes_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background bytes in the tx */ - int nb_loss_pkts_background_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background packets losses for UL*/ - int nb_loss_pkts_background_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background packets losses for DL*/ - double tx_throughput_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/ - double rx_goodput_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx goodput: (size of received data)/ctime*/ - float rx_loss_rate_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/ - - float radio_access_delay[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - int nb_loss_pkts_otg[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - unsigned int aggregation_level[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - - unsigned int state[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief current state of src node */ - float state_transition_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int start_holding_time_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int c_holding_time_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int c_holding_time_pe_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int start_holding_time_pe_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; + int tx_num_pkt_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Number of background data packet in the rx */ + int tx_num_bytes_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Number of background bytes in the rx */ + int rx_num_pkt_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Number of background data packet in the tx */ + int rx_num_bytes_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Number of background bytes in the tx */ + int nb_loss_pkts_background_ul[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Number of background packets losses for UL*/ + int nb_loss_pkts_background_dl[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Number of background packets losses for DL*/ + double tx_throughput_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/ + double rx_goodput_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Rx goodput: (size of received data)/ctime*/ + float rx_loss_rate_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/ + + float radio_access_delay[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + int nb_loss_pkts_otg[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + unsigned int aggregation_level[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + + unsigned int state[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*!< \brief current state of src node */ + float state_transition_prob[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int start_holding_time_off[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int c_holding_time_off[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int c_holding_time_pe_off[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int start_holding_time_pe_off[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; unsigned int tx_total_bytes_dl; unsigned int tx_total_bytes_ul; unsigned int rx_total_bytes_dl; @@ -582,32 +582,32 @@ typedef struct { float average_jitter_ul_e2e; /* VOIP tarffic parameters*/ - float voip_transition_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int voip_state[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int start_voip_silence[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int c_holding_time_silence[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int start_voip_talk[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int c_holding_time_talk[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int silence_time[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int simple_talk_time[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; + float voip_transition_prob[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int voip_state[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int start_voip_silence[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int c_holding_time_silence[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int start_voip_talk[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int c_holding_time_talk[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int silence_time[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int simple_talk_time[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*TARMA parameteres*/ - tarmaStream_t *tarma_stream[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - tarmaVideo_t *tarma_video[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; + tarmaStream_t *tarma_stream[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + tarmaVideo_t *tarma_video[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; /*BACKGROUND_USERS parameters*/ - backgroundStream_t *background_stream[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - - unsigned int header_size_app[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; - unsigned int header_size[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - unsigned int m2m_aggregation[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - unsigned int flow_id[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - unsigned int traffic_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - unsigned int traffic_type_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; + backgroundStream_t *background_stream[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + + unsigned int header_size_app[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; + unsigned int header_size[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + unsigned int m2m_aggregation[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + unsigned int flow_id[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + unsigned int traffic_type[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + unsigned int traffic_type_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; // unsigned int traffic_type_multicast[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX]; - unsigned int hdr_size[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - unsigned int header_type_app[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; ; + unsigned int hdr_size[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + unsigned int header_type_app[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_NUM_APPLICATION]; ; unsigned int gen_pkts; - unsigned int header_size_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; + unsigned int header_size_background[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; } otg_info_t; @@ -640,14 +640,14 @@ typedef struct { int init_forms; int is_data_plot_ul; int is_data_plot_dl; - float data_owd_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES]; - float data_throughput_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES]; - float data_ctime_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES]; - int idx_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; - float data_owd_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES]; - float data_throughput_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES]; - float data_ctime_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES]; - int idx_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; + float data_owd_ul[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_SAMPLES]; + float data_throughput_ul[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_SAMPLES]; + float data_ctime_ul[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_SAMPLES]; + int idx_ul[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; + float data_owd_dl[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_SAMPLES]; + float data_throughput_dl[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_SAMPLES]; + float data_ctime_dl[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][MAX_SAMPLES]; + int idx_dl[NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB][NUMBER_OF_eNB_MAX + MAX_MOBILES_PER_ENB]; } otg_forms_info_t; diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 7f63e8c1ce6fdd179aa6a565bd61ef0dfbdc4ee1..7ba3d88a878e1e294a8d29ca58e7b6d0127b2c38 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -290,6 +290,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; protocol_ctxt_t ctxt; + NwGtpv1uRcT rc; switch(pUlpApi->apiType) { /* Here there are two type of messages handled: @@ -314,6 +315,12 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( gtpv1u_eNB_write_dump_socket(buffer,buffer_len); #endif + rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, + pUlpApi->apiInfo.recvMsgInfo.hMsg); + if (rc != NW_GTPV1U_OK) { + LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); + } + //----------------------- // GTPV1U->PDCP mapping //----------------------- diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c index c0a3e8a7203abecf1aeff6a9a47153304173a465..f4ed215cb96c2bf8871d08f790edc83a48a73399 100644 --- a/targets/ARCH/COMMON/common_lib.c +++ b/targets/ARCH/COMMON/common_lib.c @@ -123,7 +123,7 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf rc=load_lib(device, openair0_cfg, NULL,RAU_LOCAL_RADIO_HEAD ); if ( rc >= 0) { - if ( set_device(device) < 0) { + if ( set_device(device) < 0) { fprintf(stderr, "%s %d:Unsupported radio head\n",__FILE__, __LINE__); return -1; } diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index f77996b2e81bb605e078ad8aeb77788a374b1f0a..a0e8fcff89930c668332a68f38f39cb9a93aa71f 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -982,15 +982,20 @@ extern "C" { // workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); -// args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=4096, recv_frame_size=4096"; - // args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=4096, recv_frame_size=4096"; uhd::device_addrs_t device_adds = uhd::device::find(args); if(device_adds.size() == 0) { - std::cerr<<"No USRP Device Found. " << std::endl; - free(s); - return -1; + args += ",addr=192.168.30.2"; + + uhd::device_addrs_t device_adds = uhd::device::find(args); + + if(device_adds.size() == 0) { + + std::cerr<<"No USRP Device Found. " << std::endl; + free(s); + return -1; + } } LOG_I(PHY,"Found USRP X300\n"); s->usrp = uhd::usrp::multi_usrp::make(args); @@ -1016,18 +1021,20 @@ extern "C" { LOG_I(PHY,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate); switch ((int)openair0_cfg[0].sample_rate) { - case 122880000: + + case 122880000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; - openair0_cfg[0].tx_sample_advance = 15; //to be checked + openair0_cfg[0].tx_sample_advance = 15; //to be checked openair0_cfg[0].tx_bw = 80e6; openair0_cfg[0].rx_bw = 80e6; break; - case 92160000: - openair0_cfg[0].tx_sample_advance = 15; //to be checked + case 92160000: + openair0_cfg[0].tx_sample_advance = 15; //to be checked openair0_cfg[0].tx_bw = 80e6; openair0_cfg[0].rx_bw = 80e6; - break; + break; + case 61440000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1035,11 +1042,13 @@ extern "C" { openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; - case 46080000: + + case 46080000: openair0_cfg[0].tx_sample_advance = 15; openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; + case 30720000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1047,7 +1056,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - case 23040000: + case 23040000: openair0_cfg[0].tx_sample_advance = 15; openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 1efe6f73eb74a8d518a81015f7c1a3ee0decefbf..391e448deb590584e9a4b917edd4a6210b1fa1a5 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -36,10 +36,12 @@ # include "lteRALue.h" # include "lteRALenb.h" # endif -# include "RRC/LITE/defs.h" +# include "RRC/LTE/rrc_defs.h" # endif # include "enb_app.h" +extern int emulate_rf; + int create_tasks(uint32_t enb_nb) { LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb); @@ -69,10 +71,11 @@ int create_tasks(uint32_t enb_nb) LOG_E(S1AP, "Create task for S1AP failed\n"); return -1; } - - if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { - LOG_E(UDP_, "Create task for UDP failed\n"); - return -1; + if(!emulate_rf){ + if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { + LOG_E(UDP_, "Create task for UDP failed\n"); + return -1; + } } if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) { diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c index bd36511b524a093504730643748f55bea95254ff..db531b0e9ddd73294530a337909d04c8878039fd 100644 --- a/targets/COMMON/create_tasks_ue.c +++ b/targets/COMMON/create_tasks_ue.c @@ -36,7 +36,7 @@ # include "lteRALue.h" # include "lteRALenb.h" # endif -# include "RRC/LITE/defs.h" +# include "RRC/LTE/rrc_defs.h" # endif # include "enb_app.h" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.100PRB.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.100PRB.usrpx310.conf new file mode 100644 index 0000000000000000000000000000000000000000..38e471ac545b36c4ee469867efa646d0e3d24780 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.100PRB.usrpx310.conf @@ -0,0 +1,175 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + mobile_network_code = "92"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "TDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 38; + downlink_frequency = 2600000000L; + uplink_frequency_offset = 0; + Nid_cell = 0; + N_RB_DL = 100; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 32; + rx_gain = 116; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -16; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + log_config : + { + global_log_level ="debug"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + + } +); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpx310.conf new file mode 100644 index 0000000000000000000000000000000000000000..2c11ea318701019d3e7a2e81b4889890b4f426a2 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpx310.conf @@ -0,0 +1,175 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + mobile_network_code = "92"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "TDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 38; + downlink_frequency = 2600000000L; + uplink_frequency_offset = 0; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 32; + rx_gain = 116; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -16; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + log_config : + { + global_log_level ="debug"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + + } +); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf new file mode 100644 index 0000000000000000000000000000000000000000..6c7c319a11239189d7c314f3d01c829441301cf2 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf @@ -0,0 +1,209 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "93"; + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2685000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 100; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + ENB_INTERFACE_NAME_FOR_S1_MME = "eth6"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth6"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 116; + eNB_instances = [0]; + + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="medium"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index c4307f8ff2333d9bcbe202e719917912dbb947d9..cfbfa51cab275669015604756f7e00f9436121e1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -151,9 +151,9 @@ eNBs = { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; } @@ -164,6 +164,7 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; + phy_test_mode = 1; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf index aacc87e5b0c49c18d2432224e849121879a48b8a..771bf094997b62110b0394945f74f3acec5c103d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf @@ -73,8 +73,7 @@ eNBs = srs_SubframeConfig =; srs_ackNackST =; srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -96; + pusch_p0_Nominal = -104; pusch_alpha = "AL1"; pucch_p0_Nominal = -104; msg3_delta_Preamble = 6; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf index 24ae36a0a4c7c671f0cc4ad4754f1d6b233397a6..8a0f5feb58687406028e6c81b78a9b4175c3adec 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf @@ -11,7 +11,7 @@ RUs = ( tr_preference = "udp_if4p5"; nb_tx = 1; nb_rx = 1; - max_pdschReferenceSignalPower = -29; + max_pdschReferenceSignalPower = -15; max_rxgain = 120; bands = [7,13]; } diff --git a/targets/RT/USER/eNB_usrp.gtkw b/targets/RT/USER/eNB_usrp.gtkw index 838ec54383f4de0dc6f6165fc374013a3f80e3b8..e50c1831b69ba1e7e49ab33f79f0df523cb15ec0 100644 --- a/targets/RT/USER/eNB_usrp.gtkw +++ b/targets/RT/USER/eNB_usrp.gtkw @@ -1,19 +1,19 @@ [*] [*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI -[*] Tue Jul 25 20:26:12 2017 +[*] Thu Feb 22 14:46:40 2018 [*] [dumpfile] "/tmp/openair_dump_eNB.vcd" -[dumpfile_mtime] "Tue Jul 25 20:11:55 2017" -[dumpfile_size] 19201475 -[savefile] "/home/papillon/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw" -[timestart] 29023604000 -[size] 1236 578 -[pos] 309 0 -*-20.793451 29026062100 -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 +[dumpfile_mtime] "Thu Feb 22 14:44:26 2018" +[dumpfile_size] 3482761 +[savefile] "/homes/wangts/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw" +[timestart] 4525000000 +[size] 1920 1018 +[pos] 0 22 +*-21.506693 4530514310 -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 [sst_width] 386 -[signals_width] 262 +[signals_width] 344 [sst_expanded] 1 -[sst_vpaned_height] 146 +[sst_vpaned_height] 303 @28 functions.trx_read functions.trx_write @@ -25,12 +25,42 @@ functions.eNB_thread_rxtx0 @24 variables.frame_number_RX0_RU[63:0] variables.subframe_number_RX0_RU[63:0] -@25 variables.frame_number_TX0_RU[63:0] -@24 variables.subframe_number_TX0_RU[63:0] @28 +functions.mac_schedule_dlsch +functions.macxface_eNB_dlsch_ulsch_scheduler +functions.macxface_ue_scheduler +functions.phy_eNB_ofdm_mod_l +@24 +variables.frame_number_RX0_eNB[63:0] +@25 +variables.subframe_number_RX0_eNB[63:0] +@24 +variables.frame_number_TX0_eNB[63:0] +variables.subframe_number_TX0_eNB[63:0] +variables.frame_number_RX1_eNB[63:0] +variables.subframe_number_RX1_eNB[63:0] +variables.frame_number_TX1_eNB[63:0] +variables.subframe_number_TX1_eNB[63:0] +@28 +functions.phy_eNB_dlsch_modulation +functions.phy_eNB_dlsch_encoding +functions.phy_eNB_dlsch_scrambling +functions.phy_eNB_beam_precoding +functions.phy_enb_pdcch_tx +functions.phy_enb_prach_rx +functions.phy_procedures_ru_feprx0 +functions.phy_procedures_eNb_rx_uespec0 +functions.phy_procedures_eNb_rx_uespec1 +functions.phy_enb_sfgen functions.phy_procedures_eNb_tx0 +functions.phy_procedures_eNb_tx1 +functions.phy_procedures_ru_feprx1 +functions.phy_procedures_ru_feptx_ofdm0 +functions.phy_procedures_ru_feptx_ofdm1 +functions.phy_procedures_ru_feptx_prec0 +functions.phy_procedures_ru_feptx_prec1 functions.eNB_thread_rxtx1 functions.phy_enb_sfgen functions.phy_enb_prach_rx diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index e1c5d10de561435bae4171bbf1714f6730b63470..d6b92c90414bc94f4c2efac10e7a2da17b280b56 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -44,7 +44,12 @@ #include "PHY/types.h" -#include "PHY/defs.h" +#include "PHY/INIT/phy_init.h" + +#include "PHY/defs_eNB.h" +#include "SCHED/sched_eNB.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" + #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all @@ -55,22 +60,14 @@ #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" -#include "PHY/extern.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/extern.h" - -#include "../../SIMU/USER/init_lte.h" - -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/proto.h" -#include "RRC/LITE/extern.h" -#include "PHY_INTERFACE/extern.h" -#include "PHY_INTERFACE/defs.h" -#ifdef SMBV -#include "PHY/TOOLS/smbv.h" -unsigned short config_frames[4] = {2,9,11,13}; -#endif +#include "PHY/phy_extern.h" + + +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" +#include "LAYER2/MAC/mac_proto.h" +#include "RRC/LTE/rrc_extern.h" +#include "PHY_INTERFACE/phy_interface.h" #include "UTIL/LOG/log_extern.h" #include "UTIL/OTG/otg_tx.h" #include "UTIL/OTG/otg_externs.h" @@ -78,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "enb_config.h" -//#include "PHY/TOOLS/time_meas.h" + #ifndef OPENAIR2 #include "UTIL/OTG/otg_extern.h" @@ -148,11 +145,13 @@ void exit_fun(const char* s); void init_eNB(int,int); void stop_eNB(int nb_inst); - +int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc); +int wakeup_txfh(eNB_rxtx_proc_t *proc,RU_proc_t *ru_proc); void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe); #ifdef Rel14 void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe); #endif +extern int codingw; extern uint8_t nfapi_mode; extern void oai_subframe_ind(uint16_t sfn, uint16_t sf); @@ -218,7 +217,16 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam // UE-specific RX processing for subframe n if (nfapi_mode == 0 || nfapi_mode == 1) { - phy_procedures_eNB_uespec_RX(eNB, proc, no_relay ); + phy_procedures_eNB_uespec_RX(eNB, proc); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 ); + + if(get_nprocs() >= 8){ + if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) { + LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx); + return(-1); + } + if (release_thread(&proc[1].mutex_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) return(-1); } pthread_mutex_lock(&eNB->UL_INFO_mutex); @@ -231,17 +239,12 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam eNB->if_inst->UL_indication(&eNB->UL_INFO); pthread_mutex_unlock(&eNB->UL_INFO_mutex); - - // ***************************************** - // TX processing for subframe n+sf_ahead - // run PHY TX procedures the one after the other for all CCs to avoid race conditions - // (may be relaxed in the future for performance reasons) - // ***************************************** - //if (wait_CCs(proc)<0) return(-1); - - if (oai_exit) return(-1); - phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 0 ); + if(oai_exit) return(-1); + if(get_nprocs() <= 4){ + phy_procedures_eNB_TX(eNB, proc, 1); + } stop_meas( &softmodem_stats_rxtx_sf ); @@ -293,6 +296,50 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam } +static void* tx_thread(void* param) { + + eNB_proc_t *eNB_proc = (eNB_proc_t*)param; + eNB_rxtx_proc_t *proc = &eNB_proc->proc_rxtx[1]; + PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id]; + + char thread_name[100]; + sprintf(thread_name,"TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1); + thread_top_init(thread_name,1,470000,500000,500000); + + //wait_sync("tx_thread"); + + while (!oai_exit) { + + + if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; + if (oai_exit) break; + // ***************************************** + // TX processing for subframe n+4 + // run PHY TX procedures the one after the other for all CCs to avoid race conditions + // (may be relaxed in the future for performance reasons) + // ***************************************** + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_ENB,proc->subframe_tx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_ENB,proc->subframe_rx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,proc->frame_tx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,proc->frame_rx); + + phy_procedures_eNB_TX(eNB, proc, 1); + if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; + + pthread_mutex_lock( &proc->mutex_rxtx ); + proc->pipe_ready++; + // the thread can now be woken up + if (pthread_cond_signal(&proc->cond_rxtx) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + } + pthread_mutex_unlock( &proc->mutex_rxtx ); + wakeup_txfh(proc,eNB_proc->ru_proc); + } + + return 0; +} + /*! * \brief The RX UE-specific and TX thread of eNB. * \param param is a \ref eNB_proc_t structure which contains the info what to process. @@ -302,36 +349,66 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam static void* eNB_thread_rxtx( void* param ) { static int eNB_thread_rxtx_status; - - eNB_rxtx_proc_t *proc = (eNB_rxtx_proc_t*)param; + eNB_proc_t *eNB_proc = (eNB_proc_t*)param; + eNB_rxtx_proc_t *proc = &eNB_proc->proc_rxtx[0]; PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id]; + //RU_proc_t *ru_proc = NULL; char thread_name[100]; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); // set default return value eNB_thread_rxtx_status = 0; - sprintf(thread_name,"RXn_TXnp4_%d",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1); - thread_top_init(thread_name,1,850000L,1000000L,2000000L); + sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1); + thread_top_init(thread_name,1,470000,500000,500000); + pthread_setname_np( pthread_self(),"rxtx processing"); + LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid)); + + while (!oai_exit) { + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); + T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx)); if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu()); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 ); + + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB,proc->subframe_tx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_ENB,proc->subframe_rx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,proc->frame_rx); + if (oai_exit) break; if (eNB->CC_id==0) { if (rxtx(eNB,proc,thread_name) < 0) break; - } if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; + pthread_mutex_lock( &proc->mutex_rxtx ); + proc->pipe_ready++; + // the thread can now be woken up + if (pthread_cond_signal(&proc->cond_rxtx) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + } + pthread_mutex_unlock( &proc->mutex_rxtx ); + if(get_nprocs() >= 8) wakeup_tx(eNB,eNB->proc.ru_proc); + else + { + phy_procedures_eNB_TX(eNB, proc, 1); + wakeup_txfh(proc,eNB->proc.ru_proc); + } } // while !oai_exit @@ -367,10 +444,12 @@ static void wait_system_ready (char *message, volatile int *start_flag) { -void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) +void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t *ru) { eNB_proc_t *proc = &eNB->proc; eNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[0]; + LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; + RU_proc_t *ru_proc=&ru->proc; proc->frame_rx = frame_rx; proc->subframe_rx = subframe_rx; @@ -378,23 +457,113 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) if (!oai_exit) { T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx)); - proc_rxtx->subframe_rx = proc->subframe_rx; - proc_rxtx->frame_rx = proc->frame_rx; - proc_rxtx->subframe_tx = (proc->subframe_rx+sf_ahead)%10; - proc_rxtx->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (1+proc->frame_rx)&1023 : proc->frame_rx; - proc->frame_tx = proc_rxtx->frame_tx; - proc_rxtx->timestamp_tx = proc->timestamp_tx; + proc_rxtx->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); + proc_rxtx->frame_rx = ru_proc->frame_rx; + proc_rxtx->subframe_rx = ru_proc->subframe_rx; + proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > (9-sf_ahead)) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx; + proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + sf_ahead)%10; if (rxtx(eNB,proc_rxtx,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id); + ru_proc->timestamp_tx = proc_rxtx->timestamp_tx; + ru_proc->subframe_tx = proc_rxtx->subframe_tx; + ru_proc->frame_tx = proc_rxtx->frame_tx; + } +} + +int wakeup_txfh(eNB_rxtx_proc_t *proc,RU_proc_t *ru_proc) { + + struct timespec wait; + wait.tv_sec=0; + wait.tv_nsec=5000000L; + + + if(wait_on_condition(&ru_proc->mutex_eNBs,&ru_proc->cond_eNBs,&ru_proc->ru_tx_ready,"wakeup_txfh")<0) { + LOG_E(PHY,"Frame %d, subframe %d: TX FH not ready\n", ru_proc->frame_tx, ru_proc->subframe_tx); + return(-1); + } + if (release_thread(&ru_proc->mutex_eNBs,&ru_proc->ru_tx_ready,"wakeup_txfh")<0) return(-1); + + if (ru_proc->instance_cnt_eNBs == 0) { + LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->subframe_tx, proc->frame_rx, proc->subframe_rx); + return(-1); + } + if (pthread_mutex_timedlock(&ru_proc->mutex_eNBs,&wait) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", ru_proc->subframe_rx&1,ru_proc->instance_cnt_eNBs ); + exit_fun( "error locking mutex_eNB" ); + return(-1); + } + + ++ru_proc->instance_cnt_eNBs; + ru_proc->timestamp_tx = proc->timestamp_tx; + ru_proc->subframe_tx = proc->subframe_tx; + ru_proc->frame_tx = proc->frame_tx; + + // the thread can now be woken up + if (pthread_cond_signal(&ru_proc->cond_eNBs) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + return(-1); } + + pthread_mutex_unlock( &ru_proc->mutex_eNBs ); + + return(0); } +int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) { + + eNB_proc_t *proc=&eNB->proc; + + eNB_rxtx_proc_t *proc_rxtx1=&proc->proc_rxtx[1];//*proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1]; + eNB_rxtx_proc_t *proc_rxtx0=&proc->proc_rxtx[0]; + + + struct timespec wait; + wait.tv_sec=0; + wait.tv_nsec=5000000L; + + + + if (proc_rxtx1->instance_cnt_rxtx == 0) { + LOG_E(PHY,"Frame %d, subframe %d: TX1 thread busy, dropping\n",proc_rxtx1->frame_rx,proc_rxtx1->subframe_rx); + return(-1); + } + + if (pthread_mutex_timedlock(&proc_rxtx1->mutex_rxtx,&wait) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", proc_rxtx1->subframe_rx&1,proc_rxtx1->instance_cnt_rxtx ); + exit_fun( "error locking mutex_tx" ); + return(-1); + } + + ++proc_rxtx1->instance_cnt_rxtx; + + + proc_rxtx1->subframe_rx = proc_rxtx0->subframe_rx; + proc_rxtx1->frame_rx = proc_rxtx0->frame_rx; + proc_rxtx1->subframe_tx = proc_rxtx0->subframe_tx; + proc_rxtx1->frame_tx = proc_rxtx0->frame_tx; + proc_rxtx1->timestamp_tx = proc_rxtx0->timestamp_tx; + + // the thread can now be woken up + if (pthread_cond_signal(&proc_rxtx1->cond_rxtx) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + return(-1); + } + + pthread_mutex_unlock( &proc_rxtx1->mutex_rxtx ); + + return(0); +} int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { eNB_proc_t *proc=&eNB->proc; + RU_proc_t *ru_proc=&ru->proc; - eNB_rxtx_proc_t *proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1]; + eNB_rxtx_proc_t *proc_rxtx0=&proc->proc_rxtx[0];//*proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1]; + //eNB_rxtx_proc_t *proc_rxtx1=&proc->proc_rxtx[1]; + LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; @@ -426,25 +595,28 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { wait.tv_sec=0; wait.tv_nsec=5000000L; - /* accept some delay in processing - up to 5ms */ - for (i = 0; i < 10 && proc_rxtx->instance_cnt_rxtx == 0; i++) { - LOG_W( PHY,"[eNB] Frame %d Subframe %d, eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", proc_rxtx->frame_tx, proc_rxtx->subframe_tx, proc_rxtx->instance_cnt_rxtx); - usleep(500); + + if(wait_on_condition(&proc_rxtx0->mutex_rxtx,&proc_rxtx0->cond_rxtx,&proc_rxtx0->pipe_ready,"wakeup_rxtx")<0) { + LOG_E(PHY,"Frame %d, subframe %d: RXTX0 not ready\n",proc_rxtx0->frame_rx,proc_rxtx0->subframe_rx); + return(-1); } - if (proc_rxtx->instance_cnt_rxtx == 0) { - exit_fun( "TX thread busy" ); + if (release_thread(&proc_rxtx0->mutex_rxtx,&proc_rxtx0->pipe_ready,"wakeup_rxtx")<0) return(-1); + + if (proc_rxtx0->instance_cnt_rxtx == 0) { + LOG_E(PHY,"Frame %d, subframe %d: RXTX0 thread busy, dropping\n",proc_rxtx0->frame_rx,proc_rxtx0->subframe_rx); return(-1); } // wake up TX for subframe n+sf_ahead // lock the TX mutex and make sure the thread is ready - if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) { - LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx ); + if (pthread_mutex_timedlock(&proc_rxtx0->mutex_rxtx,&wait) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx0->subframe_rx&1,proc_rxtx0->instance_cnt_rxtx ); exit_fun( "error locking mutex_rxtx" ); return(-1); } - ++proc_rxtx->instance_cnt_rxtx; + + ++proc_rxtx0->instance_cnt_rxtx; // We have just received and processed the common part of a subframe, say n. // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired @@ -452,20 +624,20 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, // we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti, // and proc->subframe_tx = proc->subframe_rx+sf_ahead - proc_rxtx->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); - proc_rxtx->frame_rx = proc->frame_rx; - proc_rxtx->subframe_rx = proc->subframe_rx; - proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > (9-sf_ahead)) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx; - proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + sf_ahead)%10; + proc_rxtx0->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); + proc_rxtx0->frame_rx = ru_proc->frame_rx; + proc_rxtx0->subframe_rx = ru_proc->subframe_rx; + proc_rxtx0->frame_tx = (proc_rxtx0->subframe_rx > (9-sf_ahead)) ? (proc_rxtx0->frame_rx+1)&1023 : proc_rxtx0->frame_rx; + proc_rxtx0->subframe_tx = (proc_rxtx0->subframe_rx + sf_ahead)%10; // the thread can now be woken up - if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) { + if (pthread_cond_signal(&proc_rxtx0->cond_rxtx) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n"); exit_fun( "ERROR pthread_cond_signal" ); return(-1); } - pthread_mutex_unlock( &proc_rxtx->mutex_rxtx ); + pthread_mutex_unlock( &proc_rxtx0->mutex_rxtx ); return(0); } @@ -605,8 +777,9 @@ static void* eNB_thread_prach( void* param ) { // set default return value eNB_thread_prach_status = 0; - thread_top_init("eNB_thread_prach",1,500000L,1000000L,20000000L); + thread_top_init("eNB_thread_prach",1,500000,1000000,20000000); + //wait_sync("eNB_thread_prach"); while (!oai_exit) { @@ -647,7 +820,7 @@ static void* eNB_thread_prach_br( void* param ) { // set default return value eNB_thread_prach_status = 0; - thread_top_init("eNB_thread_prach_br",1,500000L,1000000L,20000000L); + thread_top_init("eNB_thread_prach_br",1,500000,1000000,20000000); while (!oai_exit) { @@ -671,8 +844,40 @@ static void* eNB_thread_prach_br( void* param ) { #endif -extern void init_td_thread(PHY_VARS_eNB *, pthread_attr_t *); -extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *); + +extern void init_td_thread(PHY_VARS_eNB *); +extern void init_te_thread(PHY_VARS_eNB *); +extern void kill_td_thread(PHY_VARS_eNB *); +extern void kill_te_thread(PHY_VARS_eNB *); +//////////////////////////////////////need to modified////////////////***** + +static void* process_stats_thread(void* param) { + + PHY_VARS_eNB *eNB = (PHY_VARS_eNB*)param; + + wait_sync("process_stats_thread"); + + while (!oai_exit) { + sleep(1); + if (opp_enabled == 1) { + if (eNB->td) print_meas(&eNB->ulsch_decoding_stats,"ulsch_decoding",NULL,NULL); + if (eNB->te) + { + print_meas(&eNB->dlsch_turbo_encoding_preperation_stats,"dlsch_coding_crc",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats,"dlsch_segmentation",NULL,NULL); + print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_signal_stats,"coding_signal",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_main_stats,"coding_main",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_waiting_stats,"coding_wait",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats0,"coding_worker_0",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats1,"coding_worker_1",NULL,NULL); + } + print_meas(&eNB->dlsch_modulation_stats,"dlsch_modulation",NULL,NULL); + } + } + return(NULL); +} + void init_eNB_proc(int inst) { @@ -682,7 +887,6 @@ void init_eNB_proc(int inst) { eNB_proc_t *proc; eNB_rxtx_proc_t *proc_rxtx; pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_prach=NULL; - //*attr_td=NULL,*attr_te=NULL; #ifdef Rel14 pthread_attr_t *attr_prach_br=NULL; #endif @@ -699,8 +903,11 @@ void init_eNB_proc(int inst) { proc_rxtx = proc->proc_rxtx; proc_rxtx[0].instance_cnt_rxtx = -1; proc_rxtx[1].instance_cnt_rxtx = -1; + proc_rxtx[0].pipe_ready = 0; + proc_rxtx[1].pipe_ready = 0; proc->instance_cnt_prach = -1; proc->instance_cnt_asynch_rxtx = -1; + proc->instance_cnt_synch = -1; proc->CC_id = CC_id; proc->first_rx=1; @@ -724,8 +931,6 @@ void init_eNB_proc(int inst) { pthread_attr_init( &proc->attr_prach); pthread_attr_init( &proc->attr_asynch_rxtx); - // pthread_attr_init( &proc->attr_td); - // pthread_attr_init( &proc->attr_te); pthread_attr_init( &proc_rxtx[0].attr_rxtx); pthread_attr_init( &proc_rxtx[1].attr_rxtx); #ifdef Rel14 @@ -747,6 +952,15 @@ void init_eNB_proc(int inst) { // attr_td = &proc->attr_td; // attr_te = &proc->attr_te; #endif + //////////////////////////////////////need to modified////////////////***** + if(get_nprocs() > 2 && codingw) + { + init_te_thread(eNB); + init_td_thread(eNB); + } + //////////////////////////////////////need to modified////////////////***** + pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc ); + pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc); LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag); @@ -767,6 +981,9 @@ void init_eNB_proc(int inst) { } AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach); + + + if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void*)eNB); } @@ -792,6 +1009,8 @@ void init_eNB_proc(int inst) { pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL); pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL); sync_phy_proc.phy_proc_CC_id = 0; + + } @@ -805,21 +1024,22 @@ void kill_eNB_proc(int inst) { PHY_VARS_eNB *eNB; eNB_proc_t *proc; eNB_rxtx_proc_t *proc_rxtx; + int i; for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { eNB=RC.eNB[inst][CC_id]; proc = &eNB->proc; proc_rxtx = &proc->proc_rxtx[0]; + kill_td_thread(eNB); + kill_te_thread(eNB); LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst ); - - if (eNB->single_thread_flag==0) { - pthread_mutex_lock(&proc_rxtx[0].mutex_rxtx); - proc_rxtx[0].instance_cnt_rxtx = 0; - pthread_mutex_unlock(&proc_rxtx[0].mutex_rxtx); - pthread_mutex_lock(&proc_rxtx[1].mutex_rxtx); - proc_rxtx[1].instance_cnt_rxtx = 0; - pthread_mutex_unlock(&proc_rxtx[1].mutex_rxtx); + for (i=0; i<2; i++) { + pthread_mutex_lock(&proc_rxtx[i].mutex_rxtx); + proc_rxtx[i].instance_cnt_rxtx = 0; + proc_rxtx[i].pipe_ready = 0; + pthread_cond_signal(&proc_rxtx[i].cond_rxtx); + pthread_mutex_unlock(&proc_rxtx[i].mutex_rxtx); } proc->instance_cnt_prach = 0; pthread_cond_signal( &proc->cond_prach ); @@ -842,15 +1062,12 @@ void kill_eNB_proc(int inst) { #endif LOG_I(PHY, "Destroying UL_INFO mutex\n"); pthread_mutex_destroy(&eNB->UL_INFO_mutex); - int i; - if (eNB->single_thread_flag==0) { - for (i=0;i<2;i++) { - LOG_I(PHY, "Joining rxtx[%d] mutex/cond\n",i); - pthread_join( proc_rxtx[i].pthread_rxtx, (void**)&status ); - LOG_I(PHY, "Destroying rxtx[%d] mutex/cond\n",i); - pthread_mutex_destroy( &proc_rxtx[i].mutex_rxtx ); - pthread_cond_destroy( &proc_rxtx[i].cond_rxtx ); - } + for (i=0;i<2;i++) { + LOG_I(PHY, "Joining rxtx[%d] mutex/cond\n",i); + pthread_join( proc_rxtx[i].pthread_rxtx, (void**)&status ); + LOG_I(PHY, "Destroying rxtx[%d] mutex/cond\n",i); + pthread_mutex_destroy( &proc_rxtx[i].mutex_rxtx ); + pthread_cond_destroy( &proc_rxtx[i].cond_rxtx ); } } } @@ -1094,8 +1311,8 @@ void init_eNB(int single_thread_flag,int wait_for_sync) { #endif - eNB->td = ulsch_decoding_data;//(single_thread_flag==1) ? ulsch_decoding_data_2thread : ulsch_decoding_data; - eNB->te = dlsch_encoding;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding; + eNB->td = ulsch_decoding_data_all;//(get_nprocs()<=4) ? ulsch_decoding_data : ulsch_decoding_data_2thread; + eNB->te = dlsch_encoding_all;//(get_nprocs()<=4) ? dlsch_encoding : dlsch_encoding_2threads; LOG_I(PHY,"Registering with MAC interface module\n"); diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 60782327ae2128d1a9976457d07a4b3e2749b9d2..dbea0cc80ff36539cf234e299afb610e28ddb8de 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -60,7 +60,7 @@ #include "PHY/types.h" -#include "PHY/defs.h" +#include "PHY/defs_common.h" #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all @@ -70,22 +70,19 @@ #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" -#include "PHY/extern.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/extern.h" +#include "PHY/phy_extern.h" +#include "LAYER2/MAC/mac_extern.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" +#include "SCHED/sched_eNB.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" +#include "PHY/INIT/phy_init.h" -#include "../../SIMU/USER/init_lte.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" +#include "LAYER2/MAC/mac_proto.h" +#include "RRC/LTE/rrc_extern.h" +#include "PHY_INTERFACE/phy_interface.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/proto.h" -#include "RRC/LITE/extern.h" -#include "PHY_INTERFACE/extern.h" - -#ifdef SMBV -#include "PHY/TOOLS/smbv.h" -unsigned short config_frames[4] = {2,9,11,13}; -#endif #include "UTIL/LOG/log_extern.h" #include "UTIL/OTG/otg_tx.h" #include "UTIL/OTG/otg_externs.h" @@ -117,7 +114,11 @@ static int DEFENBS[] = {0}; #include "T.h" + extern volatile int oai_exit; +extern int emulate_rf; +extern int numerology; +extern int fepw; extern void phy_init_RU(RU_t*); @@ -679,6 +680,34 @@ void fh_if4p5_north_out(RU_t *ru) { } +static void* emulatedRF_thread(void* param) { + RU_proc_t *proc = (RU_proc_t *) param; + int microsec = 500; // length of time to sleep, in miliseconds + struct timespec req = {0}; + req.tv_sec = 0; + req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2; + cpu_set_t cpuset; + CPU_SET(1,&cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + + int policy; + struct sched_param sparam; + memset(&sparam, 0, sizeof(sparam)); + sparam.sched_priority = sched_get_priority_max(SCHED_FIFO); + policy = SCHED_FIFO ; + pthread_setschedparam(pthread_self(), policy, &sparam); + + wait_sync("emulatedRF_thread"); + while(!oai_exit){ + nanosleep(&req, (struct timespec *)NULL); + pthread_mutex_lock(&proc->mutex_emulateRF); + ++proc->instance_cnt_emulateRF; + pthread_mutex_unlock(&proc->mutex_emulateRF); + pthread_cond_signal(&proc->cond_emulateRF); + } + return 0; +} + void rx_rf(RU_t *ru,int *frame,int *subframe) { RU_proc_t *proc = &ru->proc; @@ -686,7 +715,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { void *rxp[ru->nb_rx]; unsigned int rxs; int i; - openair0_timestamp ts,old_ts; + openair0_timestamp ts=0,old_ts=0; for (i=0; i<ru->nb_rx; i++) rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_tti]; @@ -694,12 +723,18 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); old_ts = proc->timestamp_rx; - - rxs = ru->rfdevice.trx_read_func(&ru->rfdevice, + if(emulate_rf){ + wait_on_condition(&proc->mutex_emulateRF,&proc->cond_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); + release_thread(&proc->mutex_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); + rxs = fp->samples_per_tti; + } + else{ + rxs = ru->rfdevice.trx_read_func(&ru->rfdevice, &ts, rxp, fp->samples_per_tti, ru->nb_rx); + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); @@ -715,7 +750,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { } else { if (proc->timestamp_rx - old_ts != fp->samples_per_tti) { - LOG_I(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - fp->samples_per_tti,ru->ts_offset); + //LOG_I(PHY,"rx_rf: rfdevice timing drift of %"PRId64" samples (ts_off %"PRId64")\n",proc->timestamp_rx - old_ts - fp->samples_per_tti,ru->ts_offset); ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti); proc->timestamp_rx = ts-ru->ts_offset; } @@ -725,9 +760,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; // synchronize first reception to frame 0 subframe 0 - proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_tti); - proc->subframe_tx = (proc->subframe_rx+sf_ahead)%10; - proc->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx; + //proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_tti); + //proc->subframe_tx = (proc->subframe_rx+sf_ahead)%10; + //proc->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx; LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n", ru->idx, @@ -739,8 +774,6 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { if (ru == RC.ru[0]) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, proc->frame_rx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU, proc->subframe_rx ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU, proc->subframe_tx ); } if (proc->first_rx == 0) { @@ -815,6 +848,8 @@ void tx_rf(RU_t *ru) { for (i=0; i<ru->nb_tx; i++) txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension]; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU, proc->subframe_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); @@ -855,7 +890,7 @@ static void* ru_thread_asynch_rxtx( void* param ) { int subframe=0, frame=0; - thread_top_init("ru_thread_asynch_rxtx",1,870000L,1000000L,1000000L); + thread_top_init("ru_thread_asynch_rxtx",1,870000,1000000,1000000); // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe @@ -881,7 +916,7 @@ static void* ru_thread_asynch_rxtx( void* param ) { subframe++; } LOG_D(PHY,"ru_thread_asynch_rxtx: Waiting on incoming fronthaul\n"); - // asynchronous receive from south (Mobipass) + // asynchronous receive from south (Mobipass) if (ru->fh_south_asynch_in) ru->fh_south_asynch_in(ru,&frame,&subframe); // asynchronous receive from north (RRU IF4/IF5) else if (ru->fh_north_asynch_in) { @@ -907,6 +942,7 @@ void wakeup_slaves(RU_proc_t *proc) { wait.tv_nsec=5000000L; for (i=0;i<proc->num_slaves;i++) { + //printf("////////////////////calling for slave thrads\n");////////////////////////******** RU_proc_t *slave_proc = proc->slave_proc[i]; // wake up slave FH thread // lock the FH mutex and make sure the thread is ready @@ -954,7 +990,8 @@ static void* ru_thread_prach( void* param ) { // set default return value ru_thread_prach_status = 0; - thread_top_init("ru_thread_prach",1,500000L,1000000L,20000000L); + thread_top_init("ru_thread_prach",1,500000,1000000,20000000); + //wait_sync("ru_thread_prach"); while (RC.ru_mask>0) { usleep(1e6); @@ -1009,7 +1046,8 @@ static void* ru_thread_prach_br( void* param ) { // set default return value ru_thread_prach_status = 0; - thread_top_init("ru_thread_prach_br",1,500000L,1000000L,20000000L); + thread_top_init("ru_thread_prach_br",1,500000,1000000,20000000); + //wait_sync("ru_thread_prach_br"); while (!oai_exit) { @@ -1139,13 +1177,14 @@ void wakeup_eNBs(RU_t *ru) { LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru->eNB_top); - if (ru->num_eNB==1 && ru->eNB_top!=0) { - // call eNB function directly + if (ru->num_eNB==1 && ru->eNB_top!=0 && get_nprocs() <= 4) { + // call eNB function directly + char string[20]; sprintf(string,"Incoming RU %d",ru->idx); LOG_D(PHY,"RU %d Call eNB_top\n",ru->idx); - ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string); + ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string,ru); } else { @@ -1154,7 +1193,7 @@ void wakeup_eNBs(RU_t *ru) { for (i=0;i<ru->num_eNB;i++) { LOG_D(PHY,"ru->wakeup_rxtx:%p\n", ru->wakeup_rxtx); - + eNB_list[i]->proc.ru_proc = &ru->proc; if (ru->wakeup_rxtx!=0 && ru->wakeup_rxtx(eNB_list[i],ru) < 0) { LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx); @@ -1185,7 +1224,7 @@ static inline int wakeup_prach_ru(RU_t *ru) { ru->eNB_list[0]->proc.frame_prach = ru->proc.frame_rx; ru->eNB_list[0]->proc.subframe_prach = ru->proc.subframe_rx; } - LOG_I(PHY,"RU %d: waking up PRACH thread\n",ru->idx); + LOG_D(PHY,"RU %d: waking up PRACH thread\n",ru->idx); // the thread can now be woken up AssertFatal(pthread_cond_signal(&ru->proc.cond_prach) == 0, "ERROR pthread_cond_signal for RU prach thread\n"); } @@ -1231,20 +1270,39 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; openair0_config_t *cfg = &ru->openair0_cfg; + //printf("////////////////numerology in config = %d\n",numerology); if(fp->N_RB_DL == 100) { - if (fp->threequarter_fs) { - cfg->sample_rate=23.04e6; - cfg->samples_per_frame = 230400; - cfg->tx_bw = 10e6; - cfg->rx_bw = 10e6; - } - else { - cfg->sample_rate=30.72e6; + if(numerology == 0){ + if (fp->threequarter_fs) { + cfg->sample_rate=23.04e6; + cfg->samples_per_frame = 230400; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + else { + cfg->sample_rate=30.72e6; + cfg->samples_per_frame = 307200; + cfg->tx_bw = 10e6; + cfg->rx_bw = 10e6; + } + }else if(numerology == 1){ + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 307200; + cfg->tx_bw = 20e6; + cfg->rx_bw = 20e6; + }else if(numerology == 2){ + cfg->sample_rate=122.88e6; + cfg->samples_per_frame = 307200; + cfg->tx_bw = 40e6; + cfg->rx_bw = 40e6; + }else{ + printf("Wrong input for numerology %d\n setting to 20MHz normal CP configuration",numerology); + cfg->sample_rate=30.72e6; cfg->samples_per_frame = 307200; cfg->tx_bw = 10e6; cfg->rx_bw = 10e6; - } + } } else if(fp->N_RB_DL == 50) { cfg->sample_rate=15.36e6; cfg->samples_per_frame = 153600; @@ -1363,7 +1421,7 @@ static void* ru_stats_thread(void* param) { while (!oai_exit) { sleep(1); - if (opp_enabled == 1) { + if (opp_enabled == 1 && fepw) { if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL); if (ru->feptx_ofdm) print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL); if (ru->fh_north_asynch_in) print_meas(&ru->rx_fhaul,"rx_fhaul",NULL,NULL); @@ -1377,6 +1435,59 @@ static void* ru_stats_thread(void* param) { return(NULL); } +static void* ru_thread_tx( void* param ) { + RU_t *ru = (RU_t*)param; + RU_proc_t *proc = &ru->proc; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + + + thread_top_init("ru_thread_tx",1,400000,500000,500000); + + //CPU_SET(5, &cpuset); + //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + //wait_sync("ru_thread_tx"); + + wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); + + printf( "ru_thread_tx ready\n"); + while (!oai_exit) { + + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,sched_getcpu()); + if (oai_exit) break; + + + LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n"); + // wait until eNBs are finished subframe RX n and TX n+4 + wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); + if (oai_exit) break; + + // do TX front-end processing if needed (precoding and/or IDFTs) + if (ru->feptx_prec) ru->feptx_prec(ru); + + // do OFDM if needed + if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru); + if(!emulate_rf){ + // do outgoing fronthaul (south) if needed + if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru); + + if (ru->fh_north_out) ru->fh_north_out(ru); + } + release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); + + pthread_mutex_lock( &proc->mutex_eNBs ); + proc->ru_tx_ready++; + // the thread can now be woken up + if (pthread_cond_signal(&proc->cond_eNBs) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); + exit_fun( "ERROR pthread_cond_signal" ); + } + pthread_mutex_unlock( &proc->mutex_eNBs ); + } + release_thread(&proc->mutex_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); + return 0; +} + static void* ru_thread( void* param ) { static int ru_thread_status; @@ -1387,35 +1498,54 @@ static void* ru_thread( void* param ) { int ret; int subframe =9; int frame =1023; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + // set default return value ru_thread_status = 0; // set default return value - thread_top_init("ru_thread",0,870000,1000000,1000000); + thread_top_init("ru_thread",1,400000,500000,500000); LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); + //CPU_SET(1, &cpuset); + //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); + pthread_setname_np( pthread_self(),"ru thread"); + LOG_I(PHY,"thread ru created id=%ld\n", syscall(__NR_gettid)); - // Start IF device if any - if (ru->start_if) { - LOG_I(PHY,"Starting IF interface for RU %d\n",ru->idx); - AssertFatal(ru->start_if(ru,NULL) == 0, "Could not start the IF device\n"); - if (ru->if_south == LOCAL_RF) ret = connect_rau(ru); - else ret = attach_rru(ru); - AssertFatal(ret==0,"Cannot connect to radio\n"); - } - if (ru->if_south == LOCAL_RF) { // configure RF parameters only - fill_rf_config(ru,ru->rf_config_file); - init_frame_parms(&ru->frame_parms,1); - phy_init_RU(ru); - - ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); + if(emulate_rf){ + fill_rf_config(ru,ru->rf_config_file); + init_frame_parms(&ru->frame_parms,1); + phy_init_RU(ru); + if (setup_RU_buffers(ru)!=0) { + printf("Exiting, cannot initialize RU Buffers\n"); + exit(-1); + } } - if (setup_RU_buffers(ru)!=0) { - printf("Exiting, cannot initialize RU Buffers\n"); - exit(-1); + else{ + // Start IF device if any + if (ru->start_if) { + LOG_I(PHY,"Starting IF interface for RU %d\n",ru->idx); + AssertFatal(ru->start_if(ru,NULL) == 0, "Could not start the IF device\n"); + if (ru->if_south == LOCAL_RF) ret = connect_rau(ru); + else ret = attach_rru(ru); + AssertFatal(ret==0,"Cannot connect to radio\n"); + } + if (ru->if_south == LOCAL_RF) { // configure RF parameters only + fill_rf_config(ru,ru->rf_config_file); + init_frame_parms(&ru->frame_parms,1); + phy_init_RU(ru); + + + ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); + } + if (setup_RU_buffers(ru)!=0) { + printf("Exiting, cannot initialize RU Buffers\n"); + exit(-1); + } } LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx); @@ -1424,38 +1554,46 @@ static void* ru_thread( void* param ) { pthread_cond_signal(&RC.ru_cond); pthread_mutex_unlock(&RC.ru_mutex); - wait_sync("ru_thread"); + pthread_mutex_lock(&proc->mutex_FH1); + proc->instance_cnt_FH1 = 0; + pthread_mutex_unlock(&proc->mutex_FH1); + pthread_cond_signal(&proc->cond_FH1); + wait_sync("ru_thread"); - - // Start RF device if any - if (ru->start_rf) { - if (ru->start_rf(ru) != 0) - LOG_E(HW,"Could not start the RF device\n"); - else LOG_I(PHY,"RU %d rf device ready\n",ru->idx); + if(!emulate_rf){ + // Start RF device if any + if (ru->start_rf) { + if (ru->start_rf(ru) != 0) + LOG_E(HW,"Could not start the RF device\n"); + else LOG_I(PHY,"RU %d rf device ready\n",ru->idx); + } + else LOG_I(PHY,"RU %d no rf device\n",ru->idx); + + // if an asnych_rxtx thread exists + // wakeup the thread because the devices are ready at this point + + if ((ru->fh_south_asynch_in)||(ru->fh_north_asynch_in)) { + pthread_mutex_lock(&proc->mutex_asynch_rxtx); + proc->instance_cnt_asynch_rxtx=0; + pthread_mutex_unlock(&proc->mutex_asynch_rxtx); + pthread_cond_signal(&proc->cond_asynch_rxtx); + } + else LOG_I(PHY,"RU %d no asynch_south interface\n",ru->idx); + + // if this is a slave RRU, try to synchronize on the DL frequency + if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru); } - else LOG_I(PHY,"RU %d no rf device\n",ru->idx); - // if an asnych_rxtx thread exists - // wakeup the thread because the devices are ready at this point - - if ((ru->fh_south_asynch_in)||(ru->fh_north_asynch_in)) { - pthread_mutex_lock(&proc->mutex_asynch_rxtx); - proc->instance_cnt_asynch_rxtx=0; - pthread_mutex_unlock(&proc->mutex_asynch_rxtx); - pthread_cond_signal(&proc->cond_asynch_rxtx); - } - else LOG_I(PHY,"RU %d no asynch_south interface\n",ru->idx); - - // if this is a slave RRU, try to synchronize on the DL frequency - if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru); // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices while (!oai_exit) { + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD,sched_getcpu()); + // these are local subframe/frame counters to check that we are in synch with the fronthaul timing. // They are set on the first rx/tx in the underly FH routines. if (subframe==9) { @@ -1505,20 +1643,21 @@ static void* ru_thread( void* param ) { // wakeup all eNB processes waiting for this RU if (ru->num_eNB>0) wakeup_eNBs(ru); + + if(get_nprocs() <= 4){ + // do TX front-end processing if needed (precoding and/or IDFTs) + if (ru->feptx_prec) ru->feptx_prec(ru); + + // do OFDM if needed + if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru); + if(!emulate_rf){ + // do outgoing fronthaul (south) if needed + if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru); + + if (ru->fh_north_out) ru->fh_north_out(ru); + } + } - // wait until eNBs are finished subframe RX n and TX n+sf_ahead - wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread"); - - - // do TX front-end processing if needed (precoding and/or IDFTs) - if (ru->feptx_prec) ru->feptx_prec(ru); - - // do OFDM if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru); - // do outgoing fronthaul (south) if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru); - - if (ru->fh_north_out) ru->fh_north_out(ru); } @@ -1641,7 +1780,7 @@ void init_RU_proc(RU_t *ru) { int i=0; RU_proc_t *proc; - pthread_attr_t *attr_FH=NULL,*attr_prach=NULL,*attr_asynch=NULL,*attr_synch=NULL; + pthread_attr_t *attr_FH=NULL,*attr_FH1=NULL,*attr_prach=NULL,*attr_asynch=NULL,*attr_synch=NULL,*attr_emulateRF=NULL; //pthread_attr_t *attr_fep=NULL; #ifdef Rel14 pthread_attr_t *attr_prach_br=NULL; @@ -1656,14 +1795,19 @@ void init_RU_proc(RU_t *ru) { proc->ru = ru; proc->instance_cnt_prach = -1; - proc->instance_cnt_synch = -1; ; + proc->instance_cnt_synch = -1; proc->instance_cnt_FH = -1; + proc->instance_cnt_FH1 = -1; + proc->instance_cnt_emulateRF = -1; proc->instance_cnt_asynch_rxtx = -1; + proc->instance_cnt_eNBs = -1; proc->first_rx = 1; proc->first_tx = 1; proc->frame_offset = 0; proc->num_slaves = 0; proc->frame_tx_unwrap = 0; + proc->ru_rx_ready = 0; + proc->ru_tx_ready = 0; for (i=0;i<10;i++) proc->symbol_mask[i]=0; @@ -1671,15 +1815,21 @@ void init_RU_proc(RU_t *ru) { pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL); pthread_mutex_init( &proc->mutex_synch,NULL); pthread_mutex_init( &proc->mutex_FH,NULL); + pthread_mutex_init( &proc->mutex_FH1,NULL); + pthread_mutex_init( &proc->mutex_emulateRF,NULL); pthread_mutex_init( &proc->mutex_eNBs, NULL); pthread_cond_init( &proc->cond_prach, NULL); pthread_cond_init( &proc->cond_FH, NULL); + pthread_cond_init( &proc->cond_FH1, NULL); + pthread_cond_init( &proc->cond_emulateRF, NULL); pthread_cond_init( &proc->cond_asynch_rxtx, NULL); pthread_cond_init( &proc->cond_synch,NULL); pthread_cond_init( &proc->cond_eNBs, NULL); pthread_attr_init( &proc->attr_FH); + pthread_attr_init( &proc->attr_FH1); + pthread_attr_init( &proc->attr_emulateRF); pthread_attr_init( &proc->attr_prach); pthread_attr_init( &proc->attr_synch); pthread_attr_init( &proc->attr_asynch_rxtx); @@ -1694,15 +1844,22 @@ void init_RU_proc(RU_t *ru) { #ifndef DEADLINE_SCHEDULER attr_FH = &proc->attr_FH; + attr_FH1 = &proc->attr_FH1; attr_prach = &proc->attr_prach; attr_synch = &proc->attr_synch; attr_asynch = &proc->attr_asynch_rxtx; + attr_emulateRF = &proc->attr_emulateRF; #ifdef Rel14 attr_prach_br = &proc->attr_prach_br; #endif #endif pthread_create( &proc->pthread_FH, attr_FH, ru_thread, (void*)ru ); + if(emulate_rf) + pthread_create( &proc->pthread_emulateRF, attr_emulateRF, emulatedRF_thread, (void*)proc ); + + if (get_nprocs() > 4) + pthread_create( &proc->pthread_FH1, attr_FH1, ru_thread_tx, (void*)ru ); if (ru->function == NGFI_RRU_IF4p5) { pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void*)ru ); @@ -1714,7 +1871,10 @@ void init_RU_proc(RU_t *ru) { if ((ru->if_timing == synch_to_other) || (ru->function == NGFI_RRU_IF5) || - (ru->function == NGFI_RRU_IF4p5)) pthread_create( &proc->pthread_asynch_rxtx, attr_asynch, ru_thread_asynch_rxtx, (void*)ru ); + (ru->function == NGFI_RRU_IF4p5)) + { + pthread_create( &proc->pthread_asynch_rxtx, attr_asynch, ru_thread_asynch_rxtx, (void*)ru ); + } snprintf( name, sizeof(name), "ru_thread_FH %d", ru->idx ); pthread_setname_np( proc->pthread_FH, name ); @@ -1725,7 +1885,7 @@ void init_RU_proc(RU_t *ru) { pthread_create( &proc->pthread_prach, attr_prach, ru_thread_prach, (void*)ru ); } - if (get_nprocs()>=2) { + if (get_nprocs()> 2 && fepw) { if (ru->feprx) init_fep_thread(ru,NULL); if (ru->feptx_ofdm) init_feptx_thread(ru,NULL); } @@ -1740,38 +1900,46 @@ void kill_RU_proc(int inst) pthread_mutex_lock(&proc->mutex_FH); proc->instance_cnt_FH = 0; - pthread_mutex_unlock(&proc->mutex_FH); pthread_cond_signal(&proc->cond_FH); + pthread_mutex_unlock(&proc->mutex_FH); + + pthread_mutex_lock(&proc->mutex_FH1); + proc->instance_cnt_FH1 = 0; + pthread_cond_signal(&proc->cond_FH1); + pthread_mutex_unlock(&proc->mutex_FH1); pthread_mutex_lock(&proc->mutex_prach); proc->instance_cnt_prach = 0; - pthread_mutex_unlock(&proc->mutex_prach); pthread_cond_signal(&proc->cond_prach); + pthread_mutex_unlock(&proc->mutex_prach); #ifdef Rel14 pthread_mutex_lock(&proc->mutex_prach_br); proc->instance_cnt_prach_br = 0; - pthread_mutex_unlock(&proc->mutex_prach_br); pthread_cond_signal(&proc->cond_prach_br); + pthread_mutex_unlock(&proc->mutex_prach_br); #endif pthread_mutex_lock(&proc->mutex_synch); proc->instance_cnt_synch = 0; - pthread_mutex_unlock(&proc->mutex_synch); pthread_cond_signal(&proc->cond_synch); + pthread_mutex_unlock(&proc->mutex_synch); pthread_mutex_lock(&proc->mutex_eNBs); + proc->ru_tx_ready = 0; proc->instance_cnt_eNBs = 0; - pthread_mutex_unlock(&proc->mutex_eNBs); pthread_cond_signal(&proc->cond_eNBs); + pthread_mutex_unlock(&proc->mutex_eNBs); pthread_mutex_lock(&proc->mutex_asynch_rxtx); proc->instance_cnt_asynch_rxtx = 0; - pthread_mutex_unlock(&proc->mutex_asynch_rxtx); pthread_cond_signal(&proc->cond_asynch_rxtx); + pthread_mutex_unlock(&proc->mutex_asynch_rxtx); LOG_D(PHY, "Joining pthread_FH\n"); pthread_join(proc->pthread_FH, NULL); + LOG_D(PHY, "Joining pthread_FHTX\n"); + pthread_join(proc->pthread_FH1, NULL); if (ru->function == NGFI_RRU_IF4p5) { LOG_D(PHY, "Joining pthread_prach\n"); pthread_join(proc->pthread_prach, NULL); @@ -1791,7 +1959,7 @@ void kill_RU_proc(int inst) pthread_join(proc->pthread_asynch_rxtx, NULL); } } - if (get_nprocs() >= 2) { + if (get_nprocs() > 2 && fepw) { if (ru->feprx) { pthread_mutex_lock(&proc->mutex_fep); proc->instance_cnt_fep = 0; @@ -1822,15 +1990,18 @@ void kill_RU_proc(int inst) pthread_mutex_destroy(&proc->mutex_asynch_rxtx); pthread_mutex_destroy(&proc->mutex_synch); pthread_mutex_destroy(&proc->mutex_FH); + pthread_mutex_destroy(&proc->mutex_FH1); pthread_mutex_destroy(&proc->mutex_eNBs); pthread_cond_destroy(&proc->cond_prach); pthread_cond_destroy(&proc->cond_FH); + pthread_cond_destroy(&proc->cond_FH1); pthread_cond_destroy(&proc->cond_asynch_rxtx); pthread_cond_destroy(&proc->cond_synch); pthread_cond_destroy(&proc->cond_eNBs); pthread_attr_destroy(&proc->attr_FH); + pthread_attr_destroy(&proc->attr_FH1); pthread_attr_destroy(&proc->attr_prach); pthread_attr_destroy(&proc->attr_synch); pthread_attr_destroy(&proc->attr_asynch_rxtx); @@ -2061,8 +2232,8 @@ void set_function_spec_param(RU_t *ru) ru->fh_north_out = fh_if4p5_north_out; // send_IF4p5 on reception ru->fh_south_out = tx_rf; // send output to RF ru->fh_north_asynch_in = fh_if4p5_north_asynch_in; // TX packets come asynchronously - ru->feprx = (get_nprocs()<=2) ? fep_full :ru_fep_full_2thread; // RX DFTs - ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft only (no precoding in RRU) + ru->feprx = (get_nprocs()<=2 || !fepw) ? fep_full :ru_fep_full_2thread; // RX DFTs + ru->feptx_ofdm = (get_nprocs()<=2 || !fepw) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft only (no precoding in RRU) ru->feptx_prec = NULL; ru->start_if = start_if; // need to start the if interface for if4p5 ru->ifdevice.host_type = RRU_HOST; @@ -2083,8 +2254,8 @@ void set_function_spec_param(RU_t *ru) } else if (ru->function == eNodeB_3GPP) { ru->do_prach = 0; // no prach processing in RU - ru->feprx = (get_nprocs()<=2) ? fep_full : ru_fep_full_2thread; // RX DFTs - ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft and precoding + ru->feprx = (get_nprocs()<=2 || !fepw) ? fep_full : ru_fep_full_2thread; // RX DFTs + ru->feptx_ofdm = (get_nprocs()<=2 || !fepw) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft and precoding ru->feptx_prec = feptx_prec; // this is fep with idft and precoding ru->fh_north_in = NULL; // no incoming fronthaul from north ru->fh_north_out = NULL; // no outgoing fronthaul to north @@ -2112,9 +2283,9 @@ void set_function_spec_param(RU_t *ru) case REMOTE_IF5: // the remote unit is IF5 RRU ru->do_prach = 0; - ru->feprx = (get_nprocs()<=2) ? fep_full : fep_full; // this is frequency-shift + DFTs + ru->feprx = (get_nprocs()<=2 || !fepw) ? fep_full : fep_full; // this is frequency-shift + DFTs ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs - ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs + ru->feptx_ofdm = (get_nprocs()<=2 || !fepw) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs if (ru->if_timing == synch_to_other) { ru->fh_south_in = fh_slave_south_in; // synchronize to master ru->fh_south_out = fh_if5_mobipass_south_out; // use send_IF5 for mobipass @@ -2245,7 +2416,7 @@ void init_RU(char *rf_config_file) { } } } - // LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function); + LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function); set_function_spec_param(ru); LOG_I(PHY,"Starting ru_thread %d\n",ru_id); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 39f532f222ce54b2a8714cdb8c1bcf0193e43f7f..620ee1904f605dfa612438ebb489f0dc56afce9c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -47,7 +47,7 @@ #include "PHY/types.h" -//#include "PHY/defs.h" +#include "PHY/defs_eNB.h" #include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/load_module_shlib.h" @@ -59,17 +59,14 @@ //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all -#include "PHY/vars.h" -#include "SCHED/vars.h" -#include "LAYER2/MAC/vars.h" +#include "PHY/phy_vars.h" +#include "SCHED/sched_common_vars.h" +#include "LAYER2/MAC/mac_vars.h" -#include "../../SIMU/USER/init_lte.h" - -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/vars.h" -#include "LAYER2/MAC/proto.h" -#include "RRC/LITE/vars.h" -#include "PHY_INTERFACE/vars.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "RRC/LTE/rrc_vars.h" +#include "PHY_INTERFACE/phy_interface_vars.h" #ifdef SMBV #include "PHY/TOOLS/smbv.h" @@ -93,6 +90,8 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "create_tasks.h" #endif +#include "PHY/INIT/phy_init.h" + #include "system.h" #ifdef XFORMS @@ -143,7 +142,8 @@ static int8_t threequarter_fs=0; uint32_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; - +// This is a dummy declaration (dlsch_demodulation.c is no longer compiled for eNodeB) +int16_t dlsch_demod_shift = 0; #if defined(ENABLE_ITTI) static char *itti_dump_file = NULL; @@ -217,6 +217,10 @@ extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, extern void init_eNB_afterRU(void); int transmission_mode=1; +int emulate_rf = 0; +int numerology = 0; +int codingw = 0; +int fepw = 0; @@ -632,6 +636,7 @@ void init_openair0(void) { int card; int i; + for (card=0; card<MAX_CARDS; card++) { @@ -639,6 +644,8 @@ void init_openair0(void) { openair0_cfg[card].configFilename = NULL; if(frame_parms[0]->N_RB_DL == 100) { + if(numerology == 0) + { if (frame_parms[0]->threequarter_fs) { openair0_cfg[card].sample_rate=23.04e6; openair0_cfg[card].samples_per_frame = 230400; @@ -650,6 +657,22 @@ void init_openair0(void) { openair0_cfg[card].tx_bw = 10e6; openair0_cfg[card].rx_bw = 10e6; } + }else if(numerology == 1) + { + openair0_cfg[card].sample_rate=61.44e6; + openair0_cfg[card].samples_per_frame = 307200; + openair0_cfg[card].tx_bw = 20e6; + openair0_cfg[card].rx_bw = 20e6; + }else if(numerology == 2) + { + openair0_cfg[card].sample_rate=122.88e6; + openair0_cfg[card].samples_per_frame = 307200; + openair0_cfg[card].tx_bw = 20e6; + openair0_cfg[card].rx_bw = 20e6; + }else + { + printf("Un supported numerology\n"); + } } else if(frame_parms[0]->N_RB_DL == 50) { openair0_cfg[card].sample_rate=15.36e6; openair0_cfg[card].samples_per_frame = 153600; @@ -904,7 +927,6 @@ int main( int argc, char **argv ) int ret; #endif - start_background_system(); if ( load_configmodule(argc,argv) == NULL) { exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); } @@ -1072,7 +1094,7 @@ int main( int argc, char **argv ) // init UE_PF_PO and mutex lock pthread_mutex_init(&ue_pf_po_mutex, NULL); - memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs); + memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs); mlockall(MCL_CURRENT | MCL_FUTURE); @@ -1209,9 +1231,6 @@ int main( int argc, char **argv ) sync_var=0; pthread_cond_broadcast(&sync_cond); pthread_mutex_unlock(&sync_mutex); - printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); - end_configmodule(); - printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); // wait for end of program printf("TYPE <CTRL-C> TO TERMINATE\n"); @@ -1271,6 +1290,9 @@ int main( int argc, char **argv ) } free_lte_top(); + printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); + end_configmodule(); + printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); pthread_cond_destroy(&sync_cond); pthread_mutex_destroy(&sync_mutex); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 89e9fb025b7f3621ff2a95364ad8fd2e16500211..ac88699b936879b5cdcfa13d57f449eb45353a62 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -28,7 +28,8 @@ #include "assertions.h" #include "msc.h" #include "PHY/types.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" #include "flexran_agent.h" @@ -85,6 +86,12 @@ #define CONFIG_HLP_TPORT "tracer port\n" #define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n" #define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n" + +#define CONFIG_HLP_NUMEROLOGY "adding numerology for 5G\n" +#define CONFIG_HLP_CODINGW "coding worker thread enable(disable by defult)\n" +#define CONFIG_HLP_FEPW "FEP worker thread enabled(disable by defult)\n" +#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n" + #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" /***************************************************************************************************************************************/ @@ -140,35 +147,40 @@ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_PARAMS_DESC { \ -{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)}, \ -{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \ -{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \ -{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \ -{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ -{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \ -{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \ -{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ -{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \ -{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \ -{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \ -{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \ -{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \ -{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \ -{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ -{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:DEFAULT_DLF, TYPE_UINT, 0}, \ -{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \ -{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \ -{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ -{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \ -{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ -{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ -{"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \ -{"P" , CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \ -{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&ouput_vcd, defintval:0, TYPE_INT, 0}, \ -{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ -{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \ -{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ -{"nbiot-disable", CONFIG_HLP_DISABLNBIOT,PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \ +{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)}, \ +{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \ +{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \ +{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \ +{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ +{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \ +{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \ +{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ +{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \ +{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \ +{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \ +{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \ +{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \ +{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \ +{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ +{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ +{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \ +{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \ +{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \ +{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ +{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \ +{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ +{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ +{"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \ +{"P" , CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \ +{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&ouput_vcd, defintval:0, TYPE_INT, 0}, \ +{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ +{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \ +{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ +{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \ +{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \ +{"codingw" , CONFIG_HLP_CODINGW, PARAMFLAG_BOOL, iptr:&codingw, defintval:0, TYPE_INT, 0}, \ +{"fepw" , CONFIG_HLP_FEPW, PARAMFLAG_BOOL, iptr:&fepw, defintval:0, TYPE_INT, 0}, \ +{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \ } #define CONFIG_HLP_FLOG "Enable online log \n" @@ -262,8 +274,10 @@ extern void reset_opp_meas(void); extern void print_opp_meas(void); extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *); -extern void init_td_thread(PHY_VARS_eNB *, pthread_attr_t *); -extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *); +extern void init_td_thread(PHY_VARS_eNB *); +extern void init_te_thread(PHY_VARS_eNB *); +extern void kill_td_thread(PHY_VARS_eNB *); +extern void kill_te_thread(PHY_VARS_eNB *); PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 2c83ea9a04e22671ba45fd6ced7b1ddbbc0656fe..b2ace74474b91ffaf53ed931b74fa158d4eddc46 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -33,19 +33,16 @@ #include "rt_wrapper.h" -#ifdef OPENAIR2 -#include "LAYER2/MAC/defs.h" -#include "RRC/LITE/extern.h" -#endif -#include "PHY_INTERFACE/extern.h" +#include "LAYER2/MAC/mac.h" +#include "RRC/LTE/rrc_extern.h" +#include "PHY_INTERFACE/phy_interface_extern.h" #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all -#include "PHY/extern.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/proto.h" +#include "PHY/phy_extern_ue.h" +#include "LAYER2/MAC/mac_extern.h" +#include "LAYER2/MAC/mac_proto.h" #include "UTIL/LOG/log_extern.h" #include "UTIL/OTG/otg_tx.h" diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 538c74e157b37c827a1e23ecc99ac55ac3a1bce6..c3a5207c2400a21ce90bce2b0f20c8f8b5504971 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -47,7 +47,7 @@ #include "PHY/types.h" -#include "PHY/defs.h" +#include "PHY/defs_UE.h" #include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/load_module_shlib.h" @@ -59,22 +59,18 @@ //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all -#include "PHY/vars.h" -#include "SCHED/vars.h" -#include "LAYER2/MAC/vars.h" - +#include "PHY/phy_vars_ue.h" +#include "PHY/LTE_TRANSPORT/transport_vars.h" +#include "SCHED/sched_common_vars.h" +#include "PHY/MODULATION/modulation_vars.h" #include "../../SIMU/USER/init_lte.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/vars.h" -#include "LAYER2/MAC/proto.h" -#include "RRC/LITE/vars.h" -#include "PHY_INTERFACE/vars.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_vars.h" +#include "LAYER2/MAC/mac_proto.h" +#include "RRC/LTE/rrc_vars.h" +#include "PHY_INTERFACE/phy_interface_vars.h" -#ifdef SMBV -#include "PHY/TOOLS/smbv.h" -unsigned short config_frames[4] = {2,9,11,13}; -#endif #include "UTIL/LOG/log_extern.h" #include "UTIL/OTG/otg_tx.h" #include "UTIL/OTG/otg_externs.h" @@ -101,6 +97,8 @@ unsigned short config_frames[4] = {2,9,11,13}; #endif #include "lte-softmodem.h" +RAN_CONTEXT_t RC; + /* temporary compilation wokaround (UE/eNB split */ uint16_t sf_ahead; #ifdef XFORMS @@ -213,7 +211,10 @@ extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, int transmission_mode=1; - +int emulate_rf = 0; +int numerology = 0; +int codingw = 0; +int fepw = 0; /* struct for ethernet specific parameters given in eNB conf file */ eth_params_t *eth_params; @@ -383,7 +384,7 @@ static void *scope_thread(void *arg) { #endif while (!oai_exit) { - dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm); + // dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm); //fl_set_object_label(form_stats->stats_text, stats_buffer); fl_clear_browser(form_stats->stats_text); fl_add_browser_line(form_stats->stats_text, stats_buffer); diff --git a/targets/RT/USER/rt_wrapper.c b/targets/RT/USER/rt_wrapper.c index c1e5996d44375f4d40f3eeb433ebced1279810f9..443d183068e634ab97e751d7ed5f448edd820732 100644 --- a/targets/RT/USER/rt_wrapper.c +++ b/targets/RT/USER/rt_wrapper.c @@ -43,8 +43,9 @@ #include <getopt.h> #include <sys/sysinfo.h> #include "rt_wrapper.h" +#include <errno.h> -#include "openair1/PHY/defs.h" +#include "openair1/PHY/defs_common.h" static int latency_target_fd = -1; static int32_t latency_target_value = 0; @@ -283,6 +284,7 @@ void thread_top_init(char *thread_name, if (sched_setattr(0, &attr, flags) < 0 ) { perror("[SCHED] eNB tx thread: sched_setattr failed\n"); + fprintf(stderr,"sched_setattr Error = %s",strerror(errno)); exit(1); } diff --git a/targets/SIMU/USER/channel_sim.c b/targets/SIMU/USER/channel_sim.c index 94bd1bbe43d2f3ee8bb02dc1ab18a246dfad9710..3018dbe1fb10e7565303323d9e599daf072b38c5 100644 --- a/targets/SIMU/USER/channel_sim.c +++ b/targets/SIMU/USER/channel_sim.c @@ -26,32 +26,24 @@ #include <stdio.h> #include <time.h> -#include "SIMULATION/TOOLS/defs.h" -#include "SIMULATION/RF/defs.h" +#include "SIMULATION/TOOLS/sim.h" +#include "SIMULATION/RF/rf.h" #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "PHY/phy_extern_ue.h" -#ifdef OPENAIR2 -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log_if.h" #include "UTIL/LOG/log_extern.h" -#include "RRC/LITE/extern.h" -#include "PHY_INTERFACE/extern.h" +#include "RRC/LTE/rrc_extern.h" +#include "PHY_INTERFACE/phy_interface_extern.h" #include "UTIL/OCG/OCG.h" #include "UTIL/OPT/opt.h" // to test OPT -#endif #include "UTIL/FIFO/types.h" -#ifdef IFFT_FPGA -#include "PHY/LTE_REFSIG/mod_table.h" -#endif - -#include "SCHED/defs.h" -#include "SCHED/extern.h" - #ifdef XFORMS #include "forms.h" #include "phy_procedures_sim_form.h" @@ -60,7 +52,11 @@ #include "oaisim.h" #define RF -//#define DEBUG_SIM +#define DEBUG_SIM +/* +#undef LOG_D +#define LOG_D(A,B,C...) printf(B,C) +*/ int number_rb_ul; int first_rbUL ; @@ -232,7 +228,6 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM pthread_mutex_lock(&RU_output_mutex[UE_id]); if (RU_output_mask[UE_id] == 0) { // This is the first eNodeB for this UE, clear the buffer - for (aa=0; aa<nb_antennas_rx; aa++) { memset((void*)r_re_DL[UE_id][aa],0,(RC.ru[0]->frame_parms.samples_per_tti)*sizeof(double)); memset((void*)r_im_DL[UE_id][aa],0,(RC.ru[0]->frame_parms.samples_per_tti)*sizeof(double)); @@ -375,7 +370,8 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM UE_id,ru_id, 10*log10(rx_pwr),subframe); #endif - + + pthread_mutex_lock(&RU_output_mutex[UE_id]); for (i=0; i<frame_parms->samples_per_tti; i++) { for (aa=0; aa<nb_antennas_rx; aa++) { @@ -389,14 +385,14 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM - double *r_re_p[2] = {r_re_DL[ru_id][0],r_re_DL[ru_id][1]}; - double *r_im_p[2] = {r_im_DL[ru_id][0],r_im_DL[ru_id][1]}; + double *r_re_p[2] = {r_re_DL[UE_id][0],r_re_DL[UE_id][1]}; + double *r_im_p[2] = {r_im_DL[UE_id][0],r_im_DL[UE_id][1]}; #ifdef DEBUG_SIM rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,length<length_meas?length:length_meas,0)/(12.0*frame_parms->N_RB_DL); LOG_D(OCM,"[SIM][DL] UE %d : ADC in %f dBm/RE for subframe %d\n",UE_id,10*log10(rx_pwr),subframe); #endif - + rxdata = PHY_vars_UE_g[UE_id][CC_id]->common_vars.rxdata; sf_offset = (subframe*frame_parms->samples_per_tti)+offset; diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c index 0818629727c7e4e2fc6b2c74e7dd0971c4bb4de9..13b9026640786664904fc326bf4bef6968bd3ece 100644 --- a/targets/SIMU/USER/init_lte.c +++ b/targets/SIMU/USER/init_lte.c @@ -29,12 +29,12 @@ #include "init_lte.h" -#include "PHY/extern.h" +#include "PHY/phy_extern.h" -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log_if.h" -#include "PHY_INTERFACE/extern.h" +#include "PHY_INTERFACE/phy_interface.h" /* diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h index 6f0aa0a6eb5ea8840a6b587bd7f18d6563d251b3..fee6c974b84d0e7c2c5761eaae24e7c7a51e1d2d 100644 --- a/targets/SIMU/USER/init_lte.h +++ b/targets/SIMU/USER/init_lte.h @@ -20,7 +20,7 @@ */ #include "PHY/types.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t eNB_id, @@ -32,10 +32,6 @@ PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag); -PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t RN_id, - uint8_t eMBMS_active_state); - void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], uint8_t frame_type, uint8_t tdd_config, diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 0008ba3bbde128740f20be36289ad2b419d018e9..1847db1d7185627b15ca36e9d80385fb5e5961c4 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -41,24 +41,23 @@ #include <execinfo.h> #include "event_handler.h" -#include "SIMULATION/RF/defs.h" +#include "SIMULATION/RF/rf.h" #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/LTE_TRANSPORT/proto.h" -#include "PHY/vars.h" - -#include "SIMULATION/ETH_TRANSPORT/proto.h" - -//#ifdef OPENAIR2 -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/vars.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/LTE_TRANSPORT/transport_proto.h" +#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" +#include "PHY/phy_vars.h" +#include "PHY/phy_vars_ue.h" +#include "SCHED/sched_common_vars.h" + +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_proto.h" +#include "LAYER2/MAC/mac_vars.h" #include "pdcp.h" -#include "RRC/LITE/vars.h" +#include "RRC/LTE/rrc_vars.h" #include "RRC/NAS/nas_config.h" -#include "SCHED/defs.h" -#include "SCHED/vars.h" #include "system.h" @@ -101,6 +100,7 @@ char smbv_ip[16]; #if defined(ENABLE_ITTI) # include "intertask_interface.h" # include "create_tasks.h" +# include "intertask_interface_init.h" #endif #include "T.h" @@ -195,6 +195,11 @@ time_stats_t oaisim_stats_f; time_stats_t dl_chan_stats; time_stats_t ul_chan_stats; +int emulate_rf = 0; +int numerology = 0; +int codingw = 0; +int fepw = 0; + // this should reflect the channel models in openair1/SIMULATION/TOOLS/defs.h mapping small_scale_names[] = { { "custom", custom }, { "SCM_A", SCM_A }, @@ -622,12 +627,8 @@ l2l1_task (void *args_p) } #endif - module_id_t UE_id; + - if (abstraction_flag == 1) { - for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) - dl_phy_sync_success (UE_id, 0, 0,1); //UE_id%NB_eNB_INST); - } start_meas (&oaisim_stats); @@ -696,8 +697,8 @@ l2l1_task (void *args_p) //oai_emulation.info.time_ms += 1; oai_emulation.info.time_s += 0.01; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01) - update_omg (frame); // frequency is defined in the omg_global params configurable by the user - update_omg_ocm (); + //update_omg (frame); // frequency is defined in the omg_global params configurable by the user + //update_omg_ocm (); #ifdef OPENAIR2 @@ -737,19 +738,16 @@ l2l1_task (void *args_p) CC_id=0; int all_done=0; - while (all_done==0) { pthread_mutex_lock(&subframe_mutex); - int subframe_ru_mask_local = subframe_ru_mask; - int subframe_UE_mask_local = subframe_UE_mask; + int subframe_ru_mask_local = (subframe_select(&RC.ru[0]->frame_parms,(sf+4)%10)!=SF_UL) ? subframe_ru_mask : ((1<<NB_RU)-1); + int subframe_UE_mask_local = (RC.ru[0]->frame_parms.frame_type == FDD || subframe_select(&RC.ru[0]->frame_parms,(sf+4)%10)!=SF_DL) ? subframe_UE_mask : ((1<<NB_UE_INST)-1); pthread_mutex_unlock(&subframe_mutex); LOG_D(EMU,"Frame %d, Subframe %d, NB_RU %d, NB_UE %d: Checking masks %x,%x\n",frame,sf,NB_RU,NB_UE_INST,subframe_ru_mask_local,subframe_UE_mask_local); if ((subframe_ru_mask_local == ((1<<NB_RU)-1)) && - (subframe_UE_mask_local == ((1<<NB_UE_INST)-1))) - all_done=1; - else - usleep(1500); + (subframe_UE_mask_local == ((1<<NB_UE_INST)-1))) all_done=1; + else usleep(1500); } @@ -794,15 +792,6 @@ l2l1_task (void *args_p) PHY_vars_eNB_g[eNB_inst][0]->frame_parms.Nid_cell); */ -#ifdef OPENAIR2 - //Application: traffic gen - update_otg_eNB (eNB_inst, oai_emulation.info.time_ms); - - //IP/OTG to PDCP and PDCP to IP operation - // pdcp_run (frame, 1, 0, eNB_inst); //PHY_vars_eNB_g[eNB_id]->Mod_id -#endif - - #ifdef PRINT_STATS if((sf==9) && frame%10==0) @@ -816,18 +805,16 @@ l2l1_task (void *args_p) fwrite (stats_buffer, 1, len, eNB_stats[eNB_inst]); fflush(eNB_stats[eNB_inst]); } - */ #ifdef OPENAIR2 -/* if (eNB_l2_stats) { len = dump_eNB_l2_stats (stats_buffer, 0); rewind (eNB_l2_stats); fwrite (stats_buffer, 1, len, eNB_l2_stats); fflush(eNB_l2_stats); } -*/ #endif +*/ #endif } }// eNB_inst loop @@ -874,7 +861,7 @@ l2l1_task (void *args_p) } - update_ocm (); + //update_ocm (); /* if ((frame >= 10) && (frame <= 11) && (abstraction_flag == 0) #ifdef PROC @@ -1070,6 +1057,7 @@ void set_UE_defaults(int nb_ue) { PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[i][0]->agregationLevel = 0xFF; } PHY_vars_UE_g[UE_id][CC_id]->current_dlsch_cqi[0] = 10; + PHY_vars_UE_g[UE_id][CC_id]->tx_power_max_dBm = 23; } } } @@ -1109,6 +1097,7 @@ int main (int argc, char **argv) oai_emulation.info.n_frames = MAX_FRAME_NUMBER; //1024; //10; oai_emulation.info.n_frames_flag = 0; //fixme snr_dB = 30; + NB_UE_INST = 1; //Default values if not changed by the user in get_simulation_options(); pdcp_period = 1; @@ -1125,7 +1114,7 @@ int main (int argc, char **argv) // start thread for log gen log_thread_init (); - init_oai_emulation (); // to initialize everything !!! + //init_oai_emulation (); // to initialize everything !!! // get command-line options get_simulation_options (argc, argv); //Command-line options @@ -1162,7 +1151,37 @@ int main (int argc, char **argv) #endif // configure oaisim with OCG - oaisim_config (); // config OMG and OCG, OPT, OTG, OLG + //oaisim_config (); // config OMG and OCG, OPT, OTG, OLG + logInit(); + +#if defined(ENABLE_ITTI) + itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, oai_emulation.info.itti_dump_file); + MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); +#endif + + set_glog(LOG_INFO, 0x15); + + + //set_log(OCG, LOG_DEBUG, 1); + //set_log(EMU, LOG_INFO, 20); + set_log(MAC, LOG_DEBUG, 1); + set_log(RLC, LOG_TRACE, 1); + //set_log(PHY, LOG_DEBUG, 1); + set_log(PDCP, LOG_TRACE, 1); + set_log(RRC, LOG_DEBUG, 1); + //set_log(OCM, LOG_INFO, 20); + //set_log(OTG, LOG_INFO, 1); + set_comp_log(OCG, LOG_ERR, 0x15,1); + set_comp_log(EMU, LOG_DEBUG, 0x15,20); + set_comp_log(MAC, LOG_TRACE, 0x15,1); + set_comp_log(RLC, LOG_TRACE, 0x15,1); + set_comp_log(PHY, LOG_TRACE, 0x15, 1); + set_comp_log(PDCP, LOG_DEBUG, 0x15,1); + set_comp_log(RRC, LOG_DEBUG, 0x15,1); + set_comp_log(OCM, LOG_DEBUG, 0x15,20); + set_comp_log(OTG, LOG_DEBUG, 0x15,1); + set_comp_log(OMG, LOG_NOTICE, 0x15,1); + set_comp_log(OPT, LOG_ERR, 0x15,1); if (ue_connection_test == 1) { snr_direction = -snr_step; @@ -1174,15 +1193,11 @@ int main (int argc, char **argv) pthread_mutex_init(&sync_mutex, NULL); pthread_mutex_init(&subframe_mutex, NULL); -#ifdef OPENAIR2 - init_omv (); -#endif //Before this call, NB_UE_INST and NB_eNB_INST are not set correctly check_and_adjust_params (); set_seed = oai_emulation.emulation_config.seed.value; - init_otg_pdcp_buffer (); init_seed (set_seed); @@ -1197,7 +1212,7 @@ int main (int argc, char **argv) - if (create_tasks_ue(oai_emulation.info.nb_ue_local) < 0) + if (create_tasks_ue(NB_UE_INST) < 0) exit(-1); // need a softer mode @@ -1210,6 +1225,7 @@ int main (int argc, char **argv) init_ocm (); + printf("Sending sync to all threads\n"); @@ -1218,12 +1234,6 @@ int main (int argc, char **argv) pthread_cond_broadcast(&sync_cond); pthread_mutex_unlock(&sync_mutex); -#ifdef SMBV - // Rohde&Schwarz SMBV100A vector signal generator - smbv_init_config(smbv_fname, smbv_nframes); - smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->frame_parms); -#endif - /* #if defined (FLEXRAN_AGENT_SB_IF) flexran_agent_start(); #endif */ @@ -1732,11 +1742,6 @@ oai_shutdown (void) #endif - //Perform KPI measurements - if (oai_emulation.info.otg_enabled == 1){ - LOG_N(EMU,"calling OTG kpi gen .... \n"); - kpi_gen (); - } if (oai_emulation.info.opp_enabled == 1) print_opp_meas_oaisim (); @@ -1792,15 +1797,6 @@ oai_shutdown (void) } //End of PHY abstraction changes - // stop OMG - stop_mobility_generator (omg_param_list); //omg_param_list.mobility_type -#ifdef OPENAIR2 - - if (oai_emulation.info.omv_enabled == 1) - omv_end (pfd[1], omv_data); - -#endif - if ((oai_emulation.info.ocm_enabled == 1) && (ethernet_flag == 0) && (ShaF != NULL)) { destroyMat (ShaF, map1, map2); @@ -1810,9 +1806,6 @@ oai_shutdown (void) if (opt_enabled == 1) terminate_opt (); - if (oai_emulation.info.cli_enabled) - cli_server_cleanup (); - for (int i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++) if (oai_emulation.info.oai_ifup[i] == 1) { char interfaceName[8]; diff --git a/targets/SIMU/USER/oaisim.h b/targets/SIMU/USER/oaisim.h index 0fdc4002e47cd053fd8ffe56a4b4d7d5f2bd94d8..1ddc09398322cbb2cd91463e818a5d12ae4efc0f 100644 --- a/targets/SIMU/USER/oaisim.h +++ b/targets/SIMU/USER/oaisim.h @@ -26,15 +26,16 @@ #include <stdio.h> #include <time.h> -#include "SIMULATION/TOOLS/defs.h" -#include "SIMULATION/RF/defs.h" +#include "SIMULATION/TOOLS/sim.h" +#include "SIMULATION/RF/rf.h" #include "PHY/types.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" #include "oaisim_config.h" #include "init_lte.h" #ifdef OPENAIR2 -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" #include "UTIL/OMV/structures.h" #endif diff --git a/targets/SIMU/USER/oaisim_config.h b/targets/SIMU/USER/oaisim_config.h index fe1309b7a48531033474e6bf7413bd54a9b0642c..a403252d06430f214ba3c30e521f1e4652e8f000 100644 --- a/targets/SIMU/USER/oaisim_config.h +++ b/targets/SIMU/USER/oaisim_config.h @@ -49,10 +49,8 @@ The current sturcture of oaisim is shown by the figure. #include "UTIL/OPT/opt.h" // to test OPT #include "UTIL/OMG/omg.h" #include "UTIL/CLI/cli_if.h" -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SIMULATION/ETH_TRANSPORT/defs.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" /** @defgroup _init_oai Initial oaisim * @ingroup _fn diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index c6907e666bc66e9d45bfe4e66d3036a0f9e2610c..9decaed9c3bc8b2a3559bdce806c38ec0e753c02 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -43,29 +43,22 @@ #include "assertions.h" #include "oaisim_functions.h" -#include "PHY/extern.h" -#include "LAYER2/MAC/extern.h" -#ifdef OPENAIR2 -#include "LAYER2/MAC/proto.h" -#endif +#include "PHY/phy_extern.h" +#include "PHY/phy_extern_ue.h" +#include "LAYER2/MAC/mac_extern.h" +#include "LAYER2/MAC/mac_proto.h" #include "LAYER2/PDCP_v10.1.0/pdcp.h" #include "LAYER2/PDCP_v10.1.0/pdcp_primitives.h" -#include "RRC/LITE/extern.h" +#include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "PHY_INTERFACE/extern.h" +#include "PHY_INTERFACE/phy_interface_extern.h" //#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h" -#include "SCHED/extern.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" #include "UTIL/OCG/OCG_extern.h" #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "UTIL/OTG/otg_config.h" #include "UTIL/OTG/otg_tx.h" -#if ENABLE_RAL -#include "lteRALenb.h" -#include "lteRALue.h" -#endif - #include "cor_SF_sim.h" #include "enb_config.h" @@ -83,11 +76,6 @@ #include "ENB_APP/enb_paramdef.h" #include "common/config/config_userapi.h" -#ifdef SMBV -extern uint8_t config_smbv; -extern char smbv_ip[16]; -#endif - //constant for OAISIM soft realtime calibration #define SF_DEVIATION_OFFSET_NS 100000 //= 0.1ms : should be as a number of UE #define SLEEP_STEP_US 100 // = 0.01ms could be adaptive, should be as a number of UE @@ -137,34 +125,14 @@ int sleep_time_us = 0; int phy_test = 0; -#ifdef OPENAIR2 -// omv related info -//pid_t omv_pid; -char full_name[200]; -extern int pfd[2]; // fd for omv : fixme: this could be a local var -char fdstr[10]; -char frames[10]; -char num_enb[10]; -char num_ue[10]; -//area_x, area_y and area_z for omv -char x_area[20]; -char y_area[20]; -char z_area[20]; -char nb_antenna[20]; -char frame_type[10]; -char tdd_config[10]; -#endif - -Packet_OTG_List_t *otg_pdcp_buffer = NULL; - extern node_desc_t *enb_data[NUMBER_OF_RU_MAX]; -extern node_desc_t *ue_data[NUMBER_OF_UE_MAX]; -extern channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs]; -extern channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs]; +extern node_desc_t *ue_data[MAX_MOBILES_PER_ENB]; +extern channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][MAX_MOBILES_PER_ENB][MAX_NUM_CCs]; +extern channel_desc_t *UE2RU[MAX_MOBILES_PER_ENB][NUMBER_OF_RU_MAX][MAX_NUM_CCs]; extern mapping small_scale_names[]; #if defined(Rel10) || defined(Rel14) -extern pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH]; +extern pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; extern pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; #endif @@ -701,7 +669,7 @@ void get_simulation_options(int argc, char *argv[]) break; case 'u': - oai_emulation.info.nb_ue_local = atoi (optarg); + NB_UE_INST = atoi (optarg); break; case 'U': @@ -870,13 +838,13 @@ void check_and_adjust_params(void) int32_t ret; //int i,j; - if (oai_emulation.info.nb_ue_local + oai_emulation.info.nb_rn_local > NUMBER_OF_UE_MAX) { - LOG_E(EMU,"Enter fewer than %d UEs/RNs for the moment or change the NUMBER_OF_UE_MAX\n", NUMBER_OF_UE_MAX); + if (oai_emulation.info.nb_ue_local + oai_emulation.info.nb_rn_local > MAX_MOBILES_PER_ENB) { + LOG_E(EMU,"Enter fewer than %d UEs/RNs for the moment or change the MAX_MOBILES_PER_ENB\n", MAX_MOBILES_PER_ENB); exit(EXIT_FAILURE); } if (oai_emulation.info.nb_enb_local + oai_emulation.info.nb_rn_local > NUMBER_OF_eNB_MAX) { - LOG_E(EMU,"Enter fewer than %d eNBs/RNs for the moment or change the NUMBER_OF_UE_MAX\n", NUMBER_OF_eNB_MAX); + LOG_E(EMU,"Enter fewer than %d eNBs/RNs for the moment or change the MAX_MOBILES_PER_ENB\n", NUMBER_OF_eNB_MAX); exit(EXIT_FAILURE); } @@ -931,80 +899,15 @@ void check_and_adjust_params(void) } // ethernet flag */ // - NB_UE_INST = oai_emulation.info.nb_ue_local + oai_emulation.info.nb_ue_remote; - NB_eNB_INST = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_enb_remote; - NB_RN_INST = oai_emulation.info.nb_rn_local + oai_emulation.info.nb_rn_remote; - NB_RU = oai_emulation.info.nb_ru_local + oai_emulation.info.nb_ru_remote; + + NB_RU = RC.nb_RU; #if defined(PDCP_USE_NETLINK_QUEUES) && defined(OPENAIR2) pdcp_netlink_init(); #endif - if (NB_RN_INST > 0 ) { - LOG_N(EMU,"Total number of RN %d (local %d, remote %d) mobility (the same as eNB) %s \n", NB_RN_INST,oai_emulation.info.nb_rn_local,oai_emulation.info.nb_rn_remote, - oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option); - - LOG_N(EMU,"Adjust the number of eNB inst (%d->%d) and UE inst (%d->%d)\n ", - NB_eNB_INST, NB_eNB_INST+NB_RN_INST, - NB_UE_INST, NB_UE_INST+NB_RN_INST); - NB_eNB_INST+=NB_RN_INST; - NB_UE_INST+=NB_RN_INST; - } - - LOG_I(EMU,"Total number of UE %d (first local %d , num local %d, remote %d, relay %d) mobility %s \n", - NB_UE_INST,oai_emulation.info.first_ue_local, oai_emulation.info.nb_ue_local,oai_emulation.info.nb_ue_remote, - NB_RN_INST, - oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option); - - LOG_I(EMU,"Total number of eNB %d (local %d, remote %d, relay %d) mobility %s \n", - NB_eNB_INST,oai_emulation.info.nb_enb_local,oai_emulation.info.nb_enb_remote, - NB_RN_INST, - oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option); - } -#ifdef OPENAIR2 -void init_omv(void) -{ - if (oai_emulation.info.omv_enabled == 1) { - - if(pipe(pfd) == -1) - perror("pipe error \n"); - - snprintf( full_name, sizeof(full_name), "%s/UTIL/OMV/OMV",getenv("OPENAIR2_DIR") ); - LOG_I(EMU,"Stating the OMV path %s pfd[0] %d pfd[1] %d \n", full_name, pfd[0],pfd[1]); - - switch(fork()) { - case -1 : - perror("fork failed \n"); - break; - - case 0 : // child is going to be the omv, it is the reader - if(close(pfd[1]) == -1 ) // we close the write desc. - perror("close on write\n" ); - - sprintf(fdstr, "%d", pfd[0] ); - sprintf(num_enb, "%d", NB_eNB_INST); - sprintf(num_ue, "%d", NB_UE_INST); - sprintf(x_area, "%f", oai_emulation.topology_config.area.x_m ); - sprintf(y_area, "%f", oai_emulation.topology_config.area.y_m ); - sprintf(z_area, "%f", 200.0 ); - sprintf(frames, "%d", oai_emulation.info.n_frames); - sprintf(nb_antenna, "%d", 4); - sprintf(frame_type, "%s", (oai_emulation.info.frame_type[0] == 0) ? "FDD" : "TDD"); - sprintf(tdd_config, "%d", oai_emulation.info.tdd_config[0]); - // execl is used to launch the visualisor - execl(full_name,"OMV", fdstr, frames, num_enb, num_ue, x_area, y_area, z_area, nb_antenna, frame_type, tdd_config,NULL ); - perror( "error in execl the OMV" ); - } - - //parent - if(close( pfd[0] ) == -1 ) // we close the write desc. - perror("close on read\n" ); - } -} -#endif - void init_seed(uint8_t set_seed) { @@ -1020,9 +923,9 @@ void init_seed(uint8_t set_seed) } openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs]; -openair0_timestamp current_UE_rx_timestamp[NUMBER_OF_UE_MAX][MAX_NUM_CCs]; +openair0_timestamp current_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs]; openair0_timestamp last_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs]; -openair0_timestamp last_UE_rx_timestamp[NUMBER_OF_UE_MAX][MAX_NUM_CCs]; +openair0_timestamp last_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs]; int ru_trx_start(openair0_device *device) { return(0); @@ -1087,20 +990,21 @@ int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void ** subframe = (last_ru_rx_timestamp[ru_id][CC_id]/RC.ru[ru_id]->frame_parms.samples_per_tti)%10; - LOG_D(EMU,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n", - subframe,(unsigned long long)*ptimestamp, - (unsigned long long)current_ru_rx_timestamp[ru_id][CC_id]); - - do_UL_sig(UE2RU, - enb_data, - ue_data, - subframe, - 0, // abstraction_flag - &RC.ru[ru_id]->frame_parms, - 0, // frame is only used for abstraction - ru_id, - CC_id); - + if (subframe_select(&RC.ru[ru_id]->frame_parms,subframe) != SF_DL || RC.ru[ru_id]->frame_parms.frame_type == FDD) { + LOG_D(EMU,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n", + subframe,(unsigned long long)*ptimestamp, + (unsigned long long)current_ru_rx_timestamp[ru_id][CC_id]); + + do_UL_sig(UE2RU, + enb_data, + ue_data, + subframe, + 0, // abstraction_flag + &RC.ru[ru_id]->frame_parms, + 0, // frame is only used for abstraction + ru_id, + CC_id); + } last_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti; sample_count += RC.ru[ru_id]->frame_parms.samples_per_tti; } @@ -1352,9 +1256,6 @@ void init_devices(void){ PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_freq_func = UE_trx_set_freq; PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_gains_func = UE_trx_set_gains; last_UE_rx_timestamp[UE_id][CC_id] = 0; - - - } } } @@ -1371,63 +1272,16 @@ void init_ocm(void) //char* frame_type = "unknown"; LTE_DL_FRAME_PARMS *fp = &RC.ru[0]->frame_parms; -#if 0 - switch (fp->frame_type) { - case FDD: - frame_type = "FDD"; - break; - - case TDD: - frame_type = "TDD"; - break; - } -#endif - - if (abstraction_flag) { - - get_beta_map(); - get_MIESM_param(); - - //load_pbch_desc(); - } - - - for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) { - enb_data[ru_id] = (node_desc_t *)malloc(sizeof(node_desc_t)); - init_enb(enb_data[ru_id],oai_emulation.environment_system_config.antenna.eNB_antenna); - } - - for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) { - ue_data[UE_id] = (node_desc_t *)malloc(sizeof(node_desc_t)); - init_ue(ue_data[UE_id],oai_emulation.environment_system_config.antenna.UE_antenna); - } - - if ((oai_emulation.info.ocm_enabled == 1)&& (ethernet_flag == 0 ) && - (oai_emulation.environment_system_config.fading.shadowing.decorrelation_distance_m>0) && - (oai_emulation.environment_system_config.fading.shadowing.variance_dB>0)) { - - // init SF map here!!! - map1 =(int)oai_emulation.topology_config.area.x_m; - map2 =(int)oai_emulation.topology_config.area.y_m; - ShaF = init_SF(map1,map2,oai_emulation.environment_system_config.fading.shadowing.decorrelation_distance_m,oai_emulation.environment_system_config.fading.shadowing.variance_dB); - - // size of area to generate shadow fading map - LOG_D(EMU,"Simulation area x=%f, y=%f\n", - oai_emulation.topology_config.area.x_m, - oai_emulation.topology_config.area.y_m); - } - - if (abstraction_flag == 0) - init_channel_vars (fp, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0); + init_channel_vars (fp, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0); // initialize channel descriptors + LOG_I(PHY,"Initializing channel descriptors (nb_RU %d, nb_UE %d)\n",RC.nb_RU,NB_UE_INST); for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) { for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - LOG_I(OCM,"Initializing channel (%s, %d) from RU %d to UE %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option, - map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option), ru_id, UE_id); - + LOG_I(PHY,"Initializing channel descriptors (RU %d, UE %d) for N_RB_DL %d\n",ru_id,UE_id, + RC.ru[ru_id]->frame_parms.N_RB_DL); RU2UE[ru_id][UE_id][CC_id] = new_channel_desc_scm(RC.ru[ru_id]->nb_tx, PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_rx, @@ -1456,22 +1310,29 @@ void init_ocm(void) // to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed. //UE2RU[UE_id][ru_id] = RU2UE[ru_id][UE_id]; - } - } - } -} -void init_otg_pdcp_buffer(void) -{ - module_id_t i; - otg_pdcp_buffer = malloc((NB_UE_INST + NB_eNB_INST) * sizeof(Packet_OTG_List_t)); + AssertFatal(RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id); + AssertFatal(UE2RU[UE_id][ru_id][CC_id]!=NULL,"UE2RU[%d][%d][%d] is null\n",UE_id,ru_id,CC_id); + //pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE + if (ru_id == (UE_id % RC.nb_RU)) { + RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower; + UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower; + } else { + RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower; + UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower; + } + + LOG_D(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",ru_id,UE_id,CC_id, + RU2UE[ru_id][UE_id][CC_id]->path_loss_dB, + RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower,snr_dB); + - for (i = 0; i < NB_UE_INST + NB_eNB_INST; i++) { - pkt_list_init(&(otg_pdcp_buffer[i])); - //LOG_I(EMU,"HEAD of otg_pdcp_buffer[%d] is %p\n", i, pkt_list_get_head(&(otg_pdcp_buffer[i]))); + } + } } } +/* void update_omg (frame_t frameP) { module_id_t UE_id, eNB_id; @@ -1517,7 +1378,7 @@ void update_ocm() - /* check if the openair channel model is activated used for PHY abstraction : path loss*/ + // check if the openair channel model is activated used for PHY abstraction : path loss if ((oai_emulation.info.ocm_enabled == 1)&& (ethernet_flag == 0 )) { for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) @@ -1529,15 +1390,12 @@ void update_ocm() //LOG_D(OMG," extracting position of eNb...\n"); //display_node_list(enb_node_list); // display_node_list(ue_node_list); - extract_position(enb_node_list, enb_data, RC.nb_RU); + //extract_position(enb_node_list, enb_data, RC.nb_RU); //extract_position_fixed_enb(enb_data, NB_eNB_INST,frame); //LOG_D(OMG," extracting position of UE...\n"); // if (oai_emulation.info.omg_model_ue == TRACE) - extract_position(ue_node_list, ue_data, NB_UE_INST); + //extract_position(ue_node_list, ue_data, NB_UE_INST); - /* if (frame % 50 == 0) - LOG_N(OCM,"Path loss for TTI %d : \n", frame); - */ for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) { for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) { @@ -1552,10 +1410,10 @@ void update_ocm() //dx = enb_data[ru_id]->x - ue_data[UE_id]->x; //dy = enb_data[ru_id]->y - ue_data[UE_id]->y; //distance = sqrt(dx * dx + dy * dy); - /*LOG_D(LOCALIZE, " OCM distance between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f \n", - ru_id, enb_data[ru_id]->x,enb_data[ru_id]->y, - UE_id, ue_data[UE_id]->x,ue_data[UE_id]->y, - distance);*/ + ///LOG_D(LOCALIZE, " OCM distance between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f \n", + // ru_id, enb_data[ru_id]->x,enb_data[ru_id]->y, + // UE_id, ue_data[UE_id]->x,ue_data[UE_id]->y, + // distance); } } } @@ -1587,6 +1445,7 @@ void update_ocm() } } + #ifdef OPENAIR2 void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) { @@ -1594,13 +1453,12 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) #if defined(USER_MODE) && defined(OAI_EMU) //int rrc_state=0; -/* if (oai_emulation.info.otg_enabled ==1 ) { int dst_id, app_id; Packet_otg_elt_t *otg_pkt; - for (dst_id = 0; dst_id < NUMBER_OF_UE_MAX; dst_id++) { + for (dst_id = 0; dst_id < MAX_MOBILES_PER_ENB; dst_id++) { for_times += 1; // generate traffic if the ue is rrc reconfigured state @@ -1665,9 +1523,9 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) otg_pkt=NULL; } -*/ + // old version - /* // MBSM multicast traffic + // MBSM multicast traffic #if defined(Rel10) || defined(Rel14) if (frame >= 46) {// only generate when UE can receive MTCH (need to control this value) for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount @@ -1690,15 +1548,15 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) } } // end multicast traffic #endif - */ -/* + + } } } } // end multicast traffic -*/ + #endif } @@ -1708,7 +1566,7 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) if (otg_enabled==1) { ctime = frame * 100; - for (dst_id = 0; dst_id < NUMBER_OF_UE_MAX; dst_id++) { + for (dst_id = 0; dst_id < MAX_MOBILES_PER_ENB; dst_id++) { if (mac_get_rrc_status(eNB_index, eNB_flag, dst_id ) > 2) { otg_pkt = malloc (sizeof(Packet_otg_elt_t)); (otg_pkt->otg_pkt).sdu_buffer = packet_gen(module_instP, dst_id, ctime, &pkt_size); @@ -1737,6 +1595,7 @@ void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime) { } #endif +*/ int init_slot_isr(void) { diff --git a/targets/SIMU/USER/sinr_sim.c b/targets/SIMU/USER/sinr_sim.c index 7c752ce432f2b268cc7d11b2efd1f770a2c2482b..2dc86b844301977c9983430ac51e7f89b2725072 100644 --- a/targets/SIMU/USER/sinr_sim.c +++ b/targets/SIMU/USER/sinr_sim.c @@ -27,27 +27,26 @@ #include <time.h> #include <cblas.h> -#include "SIMULATION/TOOLS/defs.h" -#include "SIMULATION/RF/defs.h" +#include "SIMULATION/TOOLS/sim.h" +#include "SIMULATION/RF/rf.h" #include "PHY/types.h" -#include "PHY/defs.h" -#include "PHY/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/defs_UE.h" +#include "PHY/phy_extern.h" #include "oaisim_config.h" #ifdef OPENAIR2 -#include "LAYER2/MAC/defs.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac.h" +#include "LAYER2/MAC/mac_extern.h" #include "UTIL/LOG/log_if.h" #include "UTIL/LOG/log_extern.h" -#include "RRC/LITE/extern.h" -#include "PHY_INTERFACE/extern.h" +#include "RRC/LTE/rrc_extern.h" +#include "PHY_INTERFACE/phy_interface_extern.h" #include "UTIL/OCG/OCG.h" #include "UTIL/OMG/omg.h" #include "UTIL/OPT/opt.h" // to test OPT #endif -#include "SCHED/defs.h" -#include "SCHED/extern.h" #include "oaisim.h"