more splitting eNB/UE files/directories

This commit is contained in:
Raymond Knopp
2018-04-08 13:00:08 -07:00
parent dad93fe297
commit 551f32cc20
123 changed files with 4946 additions and 11577 deletions
+66 -109
View File
@@ -283,13 +283,13 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA")
if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
else()
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION})
@@ -314,8 +314,8 @@ file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
add_library(RRC_LIB ${rrc_h} ${rrc_source}
${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c
${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c)
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c
${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c)
include_directories ("${RRC_FULL_DIR}")
# add the command to generate the source code
@@ -708,7 +708,7 @@ include_directories("${OPENAIR_BIN_DIR}")
# add directories to find all include files
# the internal rule is to use generic names such as defs.h
# but to make it uniq name as adding the relative path in the include directtive
# example: #include "RRC/LITE/defs.h"
# example: #include "RRC/LTE/defs.h"
#find_path (include_dirs_all *.h ${OPENAIR_DIR})
#find_path (include_dirs_all *.h PATHS /usr/include NO_CMAKE_PATH)
#include_directories("${include_dirs_all}")
@@ -740,8 +740,8 @@ include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0")
include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES")
include_directories("${OPENAIR2_DIR}/RRC/LITE")
include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES")
include_directories("${OPENAIR2_DIR}/RRC/LTE")
include_directories("${OPENAIR3_DIR}/RAL-LTE/INTERFACE-802.21/INCLUDE")
include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_ENB/INCLUDE")
include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_UE/INCLUDE")
@@ -781,7 +781,7 @@ include_directories("${OPENAIR2_DIR}/UTIL/OTG")
include_directories("${OPENAIR2_DIR}/UTIL/CLI")
include_directories("${OPENAIR2_DIR}/UTIL/OPT")
include_directories("${OPENAIR2_DIR}/UTIL/OMV")
include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES")
include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES")
include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared")
include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include")
include_directories("${OPENAIR_DIR}")
@@ -893,9 +893,9 @@ endif()
include_directories(${OPENAIR_DIR}/common/utils/msc)
set(UTIL_SRC
${OPENAIR2_DIR}/UTIL/CLI/cli.c
${OPENAIR2_DIR}/UTIL/CLI/cli_cmd.c
${OPENAIR2_DIR}/UTIL/CLI/cli_server.c
# ${OPENAIR2_DIR}/UTIL/CLI/cli.c
# ${OPENAIR2_DIR}/UTIL/CLI/cli_cmd.c
# ${OPENAIR2_DIR}/UTIL/CLI/cli_server.c
${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c
${OPENAIR2_DIR}/UTIL/LISTS/list.c
${OPENAIR2_DIR}/UTIL/LISTS/list2.c
@@ -903,32 +903,32 @@ set(UTIL_SRC
${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
${OPENAIR2_DIR}/UTIL/MATH/oml.c
${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
${OPENAIR2_DIR}/UTIL/OCG/OCG.c
${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c
${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c
${OPENAIR2_DIR}/UTIL/OCG/OCG_generate_report.c
${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_filename.c
${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_XML.c
${OPENAIR2_DIR}/UTIL/OCG/OCG_save_XML.c
${OPENAIR2_DIR}/UTIL/OMG/common.c
${OPENAIR2_DIR}/UTIL/OMG/grid.c
${OPENAIR2_DIR}/UTIL/OMG/job.c
${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c
${OPENAIR2_DIR}/UTIL/OMG/omg.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_generate_report.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_filename.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_XML.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_save_XML.c
# ${OPENAIR2_DIR}/UTIL/OMG/common.c
# ${OPENAIR2_DIR}/UTIL/OMG/grid.c
# ${OPENAIR2_DIR}/UTIL/OMG/job.c
# ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c
# ${OPENAIR2_DIR}/UTIL/OMG/omg.c
#${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c
${OPENAIR2_DIR}/UTIL/OMG/rwalk.c
${OPENAIR2_DIR}/UTIL/OMG/rwp.c
${OPENAIR2_DIR}/UTIL/OMG/static.c
${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c
${OPENAIR2_DIR}/UTIL/OMG/trace.c
${OPENAIR2_DIR}/UTIL/OMG/trace_hashtable.c
# ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c
# ${OPENAIR2_DIR}/UTIL/OMG/rwp.c
# ${OPENAIR2_DIR}/UTIL/OMG/static.c
# ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c
# ${OPENAIR2_DIR}/UTIL/OMG/trace.c
# ${OPENAIR2_DIR}/UTIL/OMG/trace_hashtable.c
${OPENAIR2_DIR}/UTIL/OPT/probe.c
${OPENAIR2_DIR}/UTIL/OTG/otg_tx.c
${OPENAIR2_DIR}/UTIL/OTG/otg.c
${OPENAIR2_DIR}/UTIL/OTG/otg_kpi.c
${OPENAIR2_DIR}/UTIL/OTG/otg_models.c
${OPENAIR2_DIR}/UTIL/OTG/otg_form.c
${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c
# ${OPENAIR2_DIR}/UTIL/OTG/otg_tx.c
# ${OPENAIR2_DIR}/UTIL/OTG/otg.c
# ${OPENAIR2_DIR}/UTIL/OTG/otg_kpi.c
# ${OPENAIR2_DIR}/UTIL/OTG/otg_models.c
# ${OPENAIR2_DIR}/UTIL/OTG/otg_form.c
# ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c
)
add_library(UTIL ${UTIL_SRC})
@@ -967,25 +967,18 @@ add_library(SECU_CN ${SECU_CN_SRC})
set(SCHED_SRC
${OPENAIR1_DIR}/SCHED/fapi_l1.c
${OPENAIR1_DIR}/SCHED/phy_procedures_lte_eNb.c
${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c
${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c
${OPENAIR1_DIR}/SCHED/prach_procedures.c
${OPENAIR1_DIR}/SCHED/ru_procedures.c
# ${OPENAIR1_DIR}/SCHED/phy_mac_stub.c
${OPENAIR1_DIR}/SCHED/pucch_pc.c
${OPENAIR1_DIR}/SCHED/pusch_pc.c
${OPENAIR1_DIR}/SCHED/srs_pc.c
)
add_library(SCHED_LIB ${SCHED_SRC})
set(SCHED_SRC_UE
${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c
${OPENAIR1_DIR}/SCHED_UE/phy_procedures_lte_ue.c
${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c
${OPENAIR1_DIR}/SCHED/ru_procedures.c
${OPENAIR1_DIR}/SCHED/prach_procedures.c
${OPENAIR1_DIR}/SCHED/pucch_pc.c
${OPENAIR1_DIR}/SCHED/pusch_pc.c
${OPENAIR1_DIR}/SCHED/srs_pc.c
${OPENAIR1_DIR}/SCHED_UE/pucch_pc.c
${OPENAIR1_DIR}/SCHED_UE/pusch_pc.c
${OPENAIR1_DIR}/SCHED_UE/srs_pc.c
)
add_library(SCHED_UE_LIB ${SCHED_SRC_UE})
@@ -1066,13 +1059,9 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
@@ -1082,38 +1071,23 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c
${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c
${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c
${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
@@ -1126,11 +1100,9 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
${PHY_TURBOIF}
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/viterbi.c
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/lte_init.c
${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c
${OPENAIR1_DIR}/PHY/INIT/lte_init_ue.c
${OPENAIR1_DIR}/PHY/INIT/init_top.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
@@ -1152,45 +1124,33 @@ set(PHY_SRC_UE
# depend on code generation from asn1c
${RRC_FULL_DIR}/asn1_constants.h
# actual source
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/sss_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/power_control_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/edci.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pbch_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/phich_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pucch_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/prach_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pmch_ue.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pch_ue.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/srs_modulation.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/drs_modulation.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/initial_sync.c
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c
${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c
${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c
${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c
@@ -1201,10 +1161,8 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
@@ -1245,8 +1203,7 @@ if (${SMBV})
endif (${SMBV})
if (${COMPILATION_AVX2} STREQUAL "True")
set(PHY_SRC ${PHY_SRC} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c)
set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c)
set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c)
endif ()
add_library(PHY ${PHY_SRC})
@@ -1260,7 +1217,7 @@ set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC)
set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0)
set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0)
set(RLC_TM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0)
set(RRC_DIR ${OPENAIR2_DIR}/RRC/LITE)
set(RRC_DIR ${OPENAIR2_DIR}/RRC/LTE)
set(PDCP_DIR ${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0)
set(L2_SRC
${OPENAIR2_DIR}/LAYER2/openair2_proc.c
@@ -2241,7 +2198,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
)
target_link_libraries (${myExe}
-Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_UE_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
)
endforeach(myExe)
@@ -2278,7 +2235,7 @@ add_executable(test_epc_play_scenario
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
@@ -2435,7 +2392,7 @@ list(APPEND oai_nw_drv_src device.c common.c ioctl.c classifier.c tool.c)
if(OAI_NW_DRIVER_USE_NETLINK)
list(APPEND oai_nw_drv_src netlink.c)
endif()
make_driver(oai_nw_drv ${OPENAIR2_DIR}/NETWORK_DRIVER/LITE ${oai_nw_drv_src})
make_driver(oai_nw_drv ${OPENAIR2_DIR}/NETWORK_DRIVER/LTE ${oai_nw_drv_src})
# Exmimo board drivers
#########################
+1 -1
View File
@@ -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)
+3 -3
View File
@@ -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;
@@ -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.
+5
View File
@@ -30,6 +30,9 @@
* \warning
*/
#ifndef __DCI__h__
#define __DCI__h__
#include <stdint.h>
/// DCI Format Type 0 (5 MHz,TDD0, 27 bits)
@@ -3014,3 +3017,5 @@ struct DCI_INFO_EXTRACTED {
uint64_t ap_si_nl_id:3;
};
typedef struct DCI_INFO_EXTRACTED DCI_INFO_EXTRACTED_t;
#endif
+4
View File
@@ -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
-121
View File
@@ -96,32 +96,6 @@ void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
}
}
void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
int16_t *d)
{
uint32_t i;
uint8_t reset;
uint32_t x1, x2, s=0;
reset = 1;
// x1 is set in lte_gold_generic
x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1
for (i=0; i<32; i++) {
if ((i&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
//printf("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
if (((s>>(i&0x1f))&1) == 1)
d[i]=-d[i];
}
}
uint8_t pcfich_b[4][32]= {{0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1},
{1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0},
{1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1},
@@ -215,98 +189,3 @@ void generate_pcfich(uint8_t num_pdcch_symbols,
}
uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
LTE_UE_PDCCH *lte_ue_pdcch_vars,
MIMO_mode_t mimo_mode)
{
uint8_t pcfich_quad;
uint8_t i,j;
uint16_t reg_offset;
int32_t **rxdataF_comp = lte_ue_pdcch_vars->rxdataF_comp;
int16_t pcfich_d[32],*pcfich_d_ptr;
int32_t metric,old_metric=-16384;
uint8_t num_pdcch_symbols=3;
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
// demapping
// loop over 4 quadruplets and lookup REGs
// m=0;
pcfich_d_ptr = pcfich_d;
for (pcfich_quad=0; pcfich_quad<4; pcfich_quad++) {
reg_offset = (pcfich_reg[pcfich_quad]*4);
for (i=0; i<4; i++) {
pcfich_d_ptr[0] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[0]; // RE component
pcfich_d_ptr[1] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[1]; // IM component
#ifdef DEBUG_PCFICH
printf("rx_pcfich: quad %d, i %d, offset %d => (%d,%d) => pcfich_d_ptr[0] %d \n",pcfich_quad,i,reg_offset+i,
((int16_t*)&rxdataF_comp[0][reg_offset+i])[0],
((int16_t*)&rxdataF_comp[0][reg_offset+i])[1],
pcfich_d_ptr[0]);
#endif
pcfich_d_ptr+=2;
}
/*
}
else { // ALAMOUTI
for (i=0;i<4;i+=2) {
pcfich_d_ptr[0] = 0;
pcfich_d_ptr[1] = 0;
pcfich_d_ptr[2] = 0;
pcfich_d_ptr[3] = 0;
for (j=0;j<frame_parms->nb_antennas_rx;j++) {
pcfich_d_ptr[0] += (((int16_t*)&rxdataF_comp[j][reg_offset+i])[0]+
((int16_t*)&rxdataF_comp[j+2][reg_offset+i+1])[0]); // RE component
pcfich_d_ptr[1] += (((int16_t*)&rxdataF_comp[j][reg_offset+i])[1] -
((int16_t*)&rxdataF_comp[j+2][reg_offset+i+1])[1]);// IM component
pcfich_d_ptr[2] += (((int16_t*)&rxdataF_comp[j][reg_offset+i+1])[0]-
((int16_t*)&rxdataF_comp[j+2][reg_offset+i])[0]); // RE component
pcfich_d_ptr[3] += (((int16_t*)&rxdataF_comp[j][reg_offset+i+1])[1] +
((int16_t*)&rxdataF_comp[j+2][reg_offset+i])[1]);// IM component
}
pcfich_d_ptr+=4;
}
*/
}
// pcfhich unscrambling
pcfich_unscrambling(frame_parms,subframe,pcfich_d);
// pcfich detection
for (i=0; i<3; i++) {
metric = 0;
for (j=0; j<32; j++) {
// printf("pcfich_b[%d][%d] %d => pcfich_d[%d] %d\n",i,j,pcfich_b[i][j],j,pcfich_d[j]);
metric += (int32_t)(((pcfich_b[i][j]==0) ? (pcfich_d[j]) : (-pcfich_d[j])));
}
#ifdef DEBUG_PCFICH
printf("metric %d : %d\n",i,metric);
#endif
if (metric > old_metric) {
num_pdcch_symbols = 1+i;
old_metric = metric;
}
}
#ifdef DEBUG_PCFICH
printf("[PHY] PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols);
#endif
return(num_pdcch_symbols);
}
-54
View File
@@ -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);
}
+5 -5
View File
@@ -30,13 +30,13 @@
* \warning
*/
#include "PHY/defs.h"
#include "PHY/defs_eNB.h"
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "defs.h"
#include "SCHED/sched_eNB.h"
#include "transport_eNB.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac.h"
#include "T.h"
-209
View File
@@ -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);
}*/
-798
View File
@@ -41,53 +41,6 @@
void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe)
{
unsigned int nsymb_pmch=12;
char fname[32],vname[32];
int N_RB_DL=ue->frame_parms.N_RB_DL;
sprintf(fname,"mch_rxF_ext0.m");
sprintf(vname,"pmch_rxF_ext0");
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb_pmch,1,1);
sprintf(fname,"mch_ch_ext00.m");
sprintf(vname,"pmch_ch_ext00");
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb_pmch,1,1);
/*
write_output("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb_pmch,1,1);
write_output("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb_pmch,1,1);
write_output("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb_pmch,1,1);
write_output("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*nsymb_pmch,1,1);
*/
sprintf(fname,"mch_rxF_comp0.m");
sprintf(vname,"pmch_rxF_comp0");
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb_pmch,1,1);
sprintf(fname,"mch_rxF_llr.m");
sprintf(vname,"pmch_llr");
write_output(fname,vname, ue->pdsch_vars_MCH[eNB_id]->llr[0],coded_bits_per_codeword,1,0);
sprintf(fname,"mch_mag1.m");
sprintf(vname,"pmch_mag1");
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb_pmch,1,1);
sprintf(fname,"mch_mag2.m");
sprintf(vname,"pmch_mag2");
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb_pmch,1,1);
write_output("mch00_ch0.m","pmch00_ch0",
&(ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]),
ue->frame_parms.ofdm_symbol_size*12,1,1);
write_output("rxsig_mch.m","rxs_mch",
&ue->common_vars.rxdata[0][subframe*ue->frame_parms.samples_per_tti],
ue->frame_parms.samples_per_tti,1,1);
/*
if (PHY_vars_eNB_g)
write_output("txsig_mch.m","txs_mch",
&PHY_vars_eNB_g[0][0]->common_vars.txdata[0][0][subframe*ue->frame_parms.samples_per_tti],
ue->frame_parms.samples_per_tti,1,1);*/
}
int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms)
{
@@ -234,51 +187,6 @@ void fill_eNB_dlsch_MCH(PHY_VARS_eNB *eNB,int mcs,int ndi,int rvidx)
}
void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id)
{
LTE_UE_DLSCH_t *dlsch = ue->dlsch_MCH[eNB_id];
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
// dlsch->rnti = M_RNTI;
dlsch->harq_processes[0]->mcs = mcs;
dlsch->harq_processes[0]->rvidx = rvidx;
// dlsch->harq_processes[0]->Ndi = ndi;
dlsch->harq_processes[0]->Nl = 1;
dlsch->harq_processes[0]->TBS = TBStable[get_I_TBS(dlsch->harq_processes[0]->mcs)][frame_parms->N_RB_DL-1];
dlsch->current_harq_pid = 0;
dlsch->harq_processes[0]->nb_rb = frame_parms->N_RB_DL;
switch(frame_parms->N_RB_DL) {
case 6:
dlsch->harq_processes[0]->rb_alloc_even[0] = 0x3f;
dlsch->harq_processes[0]->rb_alloc_odd[0] = 0x3f;
break;
case 25:
dlsch->harq_processes[0]->rb_alloc_even[0] = 0x1ffffff;
dlsch->harq_processes[0]->rb_alloc_odd[0] = 0x1ffffff;
break;
case 50:
dlsch->harq_processes[0]->rb_alloc_even[0] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_odd[0] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_even[1] = 0x3ffff;
dlsch->harq_processes[0]->rb_alloc_odd[1] = 0x3ffff;
break;
case 100:
dlsch->harq_processes[0]->rb_alloc_even[0] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_odd[0] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_even[1] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_odd[1] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_even[2] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_odd[2] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc_even[3] = 0xf;
dlsch->harq_processes[0]->rb_alloc_odd[3] = 0xf;
break;
}
}
void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a)
{
@@ -337,709 +245,3 @@ void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a)
}
void mch_extract_rbs(int **rxdataF,
int **dl_ch_estimates,
int **rxdataF_ext,
int **dl_ch_estimates_ext,
unsigned char symbol,
unsigned char subframe,
LTE_DL_FRAME_PARMS *frame_parms)
{
int pilots=0,i,j,offset,aarx;
// printf("Extracting PMCH: symbol %d\n",symbol);
if ((symbol==2)||
(symbol==10)) {
pilots = 1;
offset = 1;
} else if (symbol==6) {
pilots = 1;
offset = 0;
}
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
if (pilots==1) {
for (i=offset,j=0; i<frame_parms->N_RB_DL*6; i+=2,j++) {
/* printf("MCH with pilots: i %d, j %d => %d,%d\n",i,j,
*(int16_t*)&rxdataF[aarx][i+frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)],
*(int16_t*)(1+&rxdataF[aarx][i+frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)]));
*/
rxdataF_ext[aarx][j+symbol*(frame_parms->N_RB_DL*12)] = rxdataF[aarx][i+frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)];
rxdataF_ext[aarx][(frame_parms->N_RB_DL*3)+j+symbol*(frame_parms->N_RB_DL*12)] = rxdataF[aarx][i+1+ (symbol*frame_parms->ofdm_symbol_size)];
dl_ch_estimates_ext[aarx][j+symbol*(frame_parms->N_RB_DL*12)] = dl_ch_estimates[aarx][i+(symbol*frame_parms->ofdm_symbol_size)];
dl_ch_estimates_ext[aarx][(frame_parms->N_RB_DL*3)+j+symbol*(frame_parms->N_RB_DL*12)] = dl_ch_estimates[aarx][i+(frame_parms->N_RB_DL*6)+(symbol*frame_parms->ofdm_symbol_size)];
}
} else {
memcpy((void*)&rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)],
(void*)&rxdataF[aarx][frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)],
frame_parms->N_RB_DL*24);
memcpy((void*)&rxdataF_ext[aarx][(frame_parms->N_RB_DL*6) + symbol*(frame_parms->N_RB_DL*12)],
(void*)&rxdataF[aarx][1 + (symbol*frame_parms->ofdm_symbol_size)],
frame_parms->N_RB_DL*24);
memcpy((void*)&dl_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)],
(void*)&dl_ch_estimates[aarx][(symbol*frame_parms->ofdm_symbol_size)],
frame_parms->N_RB_DL*48);
}
}
}
void mch_channel_level(int **dl_ch_estimates_ext,
LTE_DL_FRAME_PARMS *frame_parms,
int *avg,
uint8_t symbol,
unsigned short nb_rb)
{
int i,aarx,nre;
#if defined(__x86_64__) || defined(__i386__)
__m128i *dl_ch128,avg128;
#elif defined(__arm__)
int32x4_t avg128;
#endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
#if defined(__x86_64__) || defined(__i386__)
//clear average level
avg128 = _mm_setzero_si128();
// 5 is always a symbol with no pilots for both normal and extended prefix
dl_ch128=(__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12];
#elif defined(__arm__)
#endif
if ((symbol == 2) || (symbol == 6) || (symbol == 10))
nre = (frame_parms->N_RB_DL*6);
else
nre = (frame_parms->N_RB_DL*12);
for (i=0; i<(nre>>2); i++) {
#if defined(__x86_64__) || defined(__i386__)
avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[0],dl_ch128[0]));
#elif defined(__arm__)
#endif
}
avg[aarx] = (((int*)&avg128)[0] +
((int*)&avg128)[1] +
((int*)&avg128)[2] +
((int*)&avg128)[3])/nre;
// printf("Channel level : %d\n",avg[(aatx<<1)+aarx]);
}
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
}
void mch_channel_compensation(int **rxdataF_ext,
int **dl_ch_estimates_ext,
int **dl_ch_mag,
int **dl_ch_magb,
int **rxdataF_comp,
LTE_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
unsigned char mod_order,
unsigned char output_shift)
{
int aarx,nre,i;
#if defined(__x86_64__) || defined(__i386__)
__m128i *dl_ch128,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
#elif defined(__arm__)
#endif
if ((symbol == 2) || (symbol == 6) || (symbol == 10))
nre = frame_parms->N_RB_DL*6;
else
nre = frame_parms->N_RB_DL*12;
#if defined(__x86_64__) || defined(__i386__)
if (mod_order == 4) {
QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10)
QAM_amp128b = _mm_setzero_si128();
} else if (mod_order == 6) {
QAM_amp128 = _mm_set1_epi16(QAM64_n1); //
QAM_amp128b = _mm_set1_epi16(QAM64_n2);
}
#elif defined(__arm__)
#endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
#if defined(__x86_64__) || defined(__i386__)
dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128 = (__m128i *)&dl_ch_mag[aarx][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128b = (__m128i *)&dl_ch_magb[aarx][symbol*frame_parms->N_RB_DL*12];
rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12];
rxdataF_comp128 = (__m128i *)&rxdataF_comp[aarx][symbol*frame_parms->N_RB_DL*12];
#elif defined(__arm__)
#endif
for (i=0; i<(nre>>2); i+=2) {
if (mod_order>2) {
// get channel amplitude if not QPSK
#if defined(__x86_64__) || defined(__i386__)
mmtmpD0 = _mm_madd_epi16(dl_ch128[0],dl_ch128[0]);
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
mmtmpD1 = _mm_madd_epi16(dl_ch128[1],dl_ch128[1]);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
mmtmpD0 = _mm_packs_epi32(mmtmpD0,mmtmpD1);
// store channel magnitude here in a new field of dlsch
dl_ch_mag128[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0);
dl_ch_mag128b[0] = dl_ch_mag128[0];
dl_ch_mag128[0] = _mm_mulhi_epi16(dl_ch_mag128[0],QAM_amp128);
dl_ch_mag128[0] = _mm_slli_epi16(dl_ch_mag128[0],1);
dl_ch_mag128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0);
dl_ch_mag128b[1] = dl_ch_mag128[1];
dl_ch_mag128[1] = _mm_mulhi_epi16(dl_ch_mag128[1],QAM_amp128);
dl_ch_mag128[1] = _mm_slli_epi16(dl_ch_mag128[1],1);
dl_ch_mag128b[0] = _mm_mulhi_epi16(dl_ch_mag128b[0],QAM_amp128b);
dl_ch_mag128b[0] = _mm_slli_epi16(dl_ch_mag128b[0],1);
dl_ch_mag128b[1] = _mm_mulhi_epi16(dl_ch_mag128b[1],QAM_amp128b);
dl_ch_mag128b[1] = _mm_slli_epi16(dl_ch_mag128b[1],1);
#elif defined(__arm__)
#endif
}
#if defined(__x86_64__) || defined(__i386__)
// multiply by conjugated channel
mmtmpD0 = _mm_madd_epi16(dl_ch128[0],rxdataF128[0]);
// print_ints("re",&mmtmpD0);
// mmtmpD0 contains real part of 4 consecutive outputs (32-bit)
mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]);
// print_ints("im",&mmtmpD1);
mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[0]);
// mmtmpD1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
// print_ints("re(shift)",&mmtmpD0);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
// print_ints("im(shift)",&mmtmpD1);
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
// print_ints("c0",&mmtmpD2);
// print_ints("c1",&mmtmpD3);
rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
// print_shorts("rx:",rxdataF128);
// print_shorts("ch:",dl_ch128);
// print_shorts("pack:",rxdataF_comp128);
// multiply by conjugated channel
mmtmpD0 = _mm_madd_epi16(dl_ch128[1],rxdataF128[1]);
// mmtmpD0 contains real part of 4 consecutive outputs (32-bit)
mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate);
mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]);
// mmtmpD1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
// print_shorts("rx:",rxdataF128+1);
// print_shorts("ch:",dl_ch128+1);
// print_shorts("pack:",rxdataF_comp128+1);
dl_ch128+=2;
dl_ch_mag128+=2;
dl_ch_mag128b+=2;
rxdataF128+=2;
rxdataF_comp128+=2;
#elif defined(__arm__)
#endif
}
}
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
}
void mch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
int **dl_ch_mag,
int **dl_ch_magb,
unsigned char symbol)
{
int i;
#if defined(__x86_64__) || defined(__i386__)
__m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b;
#elif defined(__arm__)
int16x8_t *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b;
#endif
if (frame_parms->nb_antennas_rx>1) {
#if defined(__x86_64__) || defined(__i386__)
rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_1 = (__m128i *)&dl_ch_mag[1][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_0b = (__m128i *)&dl_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_1b = (__m128i *)&dl_ch_magb[1][symbol*frame_parms->N_RB_DL*12];
#elif defined(__arm__)
rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_0 = (int16x8_t *)&dl_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_1 = (int16x8_t *)&dl_ch_mag[1][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_0b = (int16x8_t *)&dl_ch_magb[0][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_1b = (int16x8_t *)&dl_ch_magb[1][symbol*frame_parms->N_RB_DL*12];
#endif
// MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
for (i=0; i<frame_parms->N_RB_DL*3; i++) {
#if defined(__x86_64__) || defined(__i386__)
rxdataF_comp128_0[i] = _mm_adds_epi16(_mm_srai_epi16(rxdataF_comp128_0[i],1),_mm_srai_epi16(rxdataF_comp128_1[i],1));
dl_ch_mag128_0[i] = _mm_adds_epi16(_mm_srai_epi16(dl_ch_mag128_0[i],1),_mm_srai_epi16(dl_ch_mag128_1[i],1));
dl_ch_mag128_0b[i] = _mm_adds_epi16(_mm_srai_epi16(dl_ch_mag128_0b[i],1),_mm_srai_epi16(dl_ch_mag128_1b[i],1));
#elif defined(__arm__)
rxdataF_comp128_0[i] = vhaddq_s16(rxdataF_comp128_0[i],rxdataF_comp128_1[i]);
dl_ch_mag128_0[i] = vhaddq_s16(dl_ch_mag128_0[i],dl_ch_mag128_1[i]);
dl_ch_mag128_0b[i] = vhaddq_s16(dl_ch_mag128_0b[i],dl_ch_mag128_1b[i]);
#endif
}
}
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
}
int mch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
short *dlsch_llr,
unsigned char symbol,
short **llr32p)
{
uint32_t *rxF = (uint32_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
uint32_t *llr32;
int i,len;
if (symbol==2) {
llr32 = (uint32_t*)dlsch_llr;
} else {
llr32 = (uint32_t*)(*llr32p);
}
AssertFatal(llr32!=NULL,"dlsch_qpsk_llr: llr is null, symbol %d, llr32=%p\n",symbol, llr32);
if ((symbol==2) || (symbol==6) || (symbol==10)) {
len = frame_parms->N_RB_DL*6;
} else {
len = frame_parms->N_RB_DL*12;
}
// printf("dlsch_qpsk_llr: symbol %d,len %d,pbch_pss_sss_adjust %d\n",symbol,len,pbch_pss_sss_adjust);
for (i=0; i<len; i++) {
*llr32 = *rxF;
rxF++;
llr32++;
}
*llr32p = (short *)llr32;
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
return(0);
}
//----------------------------------------------------------------------------------------------
// 16-QAM
//----------------------------------------------------------------------------------------------
void mch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
short *dlsch_llr,
int **dl_ch_mag,
unsigned char symbol,
int16_t **llr32p)
{
#if defined(__x86_64__) || defined(__i386__)
__m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
__m128i *ch_mag;
__m128i llr128[2],xmm0;
uint32_t *llr32;
#elif defined(__arm__)
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
int16x8_t *ch_mag;
int16x8_t llr128[2],xmm0;
int16_t *llr16;
#endif
int i,len;
unsigned char len_mod4=0;
#if defined(__x86_64__) || defined(__i386__)
if (symbol==2) {
llr32 = (uint32_t*)dlsch_llr;
} else {
llr32 = (uint32_t*)*llr32p;
}
#elif defined(__arm__)
if (symbol==2) {
llr16 = (int16_t*)dlsch_llr;
} else {
llr16 = (int16_t*)*llr32p;
}
#endif
#if defined(__x86_64__) || defined(__i386__)
ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
#elif defined(__arm__)
ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
#endif
if ((symbol==2) || (symbol==6) || (symbol==10)) {
len = frame_parms->N_RB_DL*6;
} else {
len = frame_parms->N_RB_DL*12;
}
// update output pointer according to number of REs in this symbol (<<2 because 4 bits per RE)
if (symbol==2)
*llr32p = dlsch_llr + (len<<2);
else
*llr32p += (len<<2);
len_mod4 = len&3;
len>>=2; // length in quad words (4 REs)
len+=(len_mod4==0 ? 0 : 1);
for (i=0; i<len; i++) {
#if defined(__x86_64__) || defined(__i386__)
xmm0 = _mm_abs_epi16(rxF[i]);
xmm0 = _mm_subs_epi16(ch_mag[i],xmm0);
// lambda_1=y_R, lambda_2=|y_R|-|h|^2, lamda_3=y_I, lambda_4=|y_I|-|h|^2
llr128[0] = _mm_unpacklo_epi32(rxF[i],xmm0);
llr128[1] = _mm_unpackhi_epi32(rxF[i],xmm0);
llr32[0] = ((uint32_t *)&llr128[0])[0];
llr32[1] = ((uint32_t *)&llr128[0])[1];
llr32[2] = ((uint32_t *)&llr128[0])[2];
llr32[3] = ((uint32_t *)&llr128[0])[3];
llr32[4] = ((uint32_t *)&llr128[1])[0];
llr32[5] = ((uint32_t *)&llr128[1])[1];
llr32[6] = ((uint32_t *)&llr128[1])[2];
llr32[7] = ((uint32_t *)&llr128[1])[3];
llr32+=8;
#elif defined(__arm__)
xmm0 = vabsq_s16(rxF[i]);
xmm0 = vsubq_s16(ch_mag[i],xmm0);
// lambda_1=y_R, lambda_2=|y_R|-|h|^2, lamda_3=y_I, lambda_4=|y_I|-|h|^2
llr16[0] = vgetq_lane_s16(rxF[i],0);
llr16[1] = vgetq_lane_s16(xmm0,0);
llr16[2] = vgetq_lane_s16(rxF[i],1);
llr16[3] = vgetq_lane_s16(xmm0,1);
llr16[4] = vgetq_lane_s16(rxF[i],2);
llr16[5] = vgetq_lane_s16(xmm0,2);
llr16[6] = vgetq_lane_s16(rxF[i],2);
llr16[7] = vgetq_lane_s16(xmm0,3);
llr16[8] = vgetq_lane_s16(rxF[i],4);
llr16[9] = vgetq_lane_s16(xmm0,4);
llr16[10] = vgetq_lane_s16(rxF[i],5);
llr16[11] = vgetq_lane_s16(xmm0,5);
llr16[12] = vgetq_lane_s16(rxF[i],6);
llr16[13] = vgetq_lane_s16(xmm0,6);
llr16[14] = vgetq_lane_s16(rxF[i],7);
llr16[15] = vgetq_lane_s16(xmm0,7);
llr16+=16;
#endif
}
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
}
//----------------------------------------------------------------------------------------------
// 64-QAM
//----------------------------------------------------------------------------------------------
void mch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
short *dlsch_llr,
int **dl_ch_mag,
int **dl_ch_magb,
unsigned char symbol,
short **llr_save)
{
#if defined(__x86_64__) || defined(__i386__)
__m128i xmm1,xmm2,*ch_mag,*ch_magb;
__m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
#elif defined(__arm__)
int16x8_t xmm1,xmm2,*ch_mag,*ch_magb;
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
#endif
int i,len,len2;
// int j=0;
unsigned char len_mod4;
short *llr;
int16_t *llr2;
if (symbol==2)
llr = dlsch_llr;
else
llr = *llr_save;
#if defined(__x86_64__) || defined(__i386__)
ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
ch_magb = (__m128i*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)];
#elif defined(__arm__)
ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
ch_magb = (int16x8_t*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)];
#endif
if ((symbol==2) || (symbol==6) || (symbol==10)) {
len = frame_parms->N_RB_DL*6;
} else {
len = frame_parms->N_RB_DL*12;
}
llr2 = llr;
llr += (len*6);
len_mod4 =len&3;
len2=len>>2; // length in quad words (4 REs)
len2+=(len_mod4?0:1);
for (i=0; i<len2; i++) {
#if defined(__x86_64__) || defined(__i386__)
xmm1 = _mm_abs_epi16(rxF[i]);
xmm1 = _mm_subs_epi16(ch_mag[i],xmm1);
xmm2 = _mm_abs_epi16(xmm1);
xmm2 = _mm_subs_epi16(ch_magb[i],xmm2);
#elif defined(__arm__)
xmm1 = vabsq_s16(rxF[i]);
xmm1 = vsubq_s16(ch_mag[i],xmm1);
xmm2 = vabsq_s16(xmm1);
xmm2 = vsubq_s16(ch_magb[i],xmm2);
#endif
/*
printf("pmch i: %d => mag (%d,%d) (%d,%d)\n",i,((short *)&ch_mag[i])[0],((short *)&ch_magb[i])[0],
((short *)&rxF[i])[0],((short *)&rxF[i])[1]);
*/
// loop over all LLRs in quad word (24 coded bits)
/*
for (j=0;j<8;j+=2) {
llr2[0] = ((short *)&rxF[i])[j];
llr2[1] = ((short *)&rxF[i])[j+1];
llr2[2] = _mm_extract_epi16(xmm1,j);
llr2[3] = _mm_extract_epi16(xmm1,j+1);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,j);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,j+1);//((short *)&xmm2)[j+1];
llr2+=6;
}
*/
llr2[0] = ((short *)&rxF[i])[0];
llr2[1] = ((short *)&rxF[i])[1];
#if defined(__x86_64__) || defined(__i386__)
llr2[2] = _mm_extract_epi16(xmm1,0);
llr2[3] = _mm_extract_epi16(xmm1,1);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,0);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,1);//((short *)&xmm2)[j+1];
#elif defined(__arm__)
llr2[2] = vgetq_lane_s16(xmm1,0);
llr2[3] = vgetq_lane_s16(xmm1,1);//((short *)&xmm1)[j+1];
llr2[4] = vgetq_lane_s16(xmm2,0);//((short *)&xmm2)[j];
llr2[5] = vgetq_lane_s16(xmm2,1);//((short *)&xmm2)[j+1];
#endif
llr2+=6;
llr2[0] = ((short *)&rxF[i])[2];
llr2[1] = ((short *)&rxF[i])[3];
#if defined(__x86_64__) || defined(__i386__)
llr2[2] = _mm_extract_epi16(xmm1,2);
llr2[3] = _mm_extract_epi16(xmm1,3);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,2);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,3);//((short *)&xmm2)[j+1];
#elif defined(__arm__)
llr2[2] = vgetq_lane_s16(xmm1,2);
llr2[3] = vgetq_lane_s16(xmm1,3);//((short *)&xmm1)[j+1];
llr2[4] = vgetq_lane_s16(xmm2,2);//((short *)&xmm2)[j];
llr2[5] = vgetq_lane_s16(xmm2,3);//((short *)&xmm2)[j+1];
#endif
llr2+=6;
llr2[0] = ((short *)&rxF[i])[4];
llr2[1] = ((short *)&rxF[i])[5];
#if defined(__x86_64__) || defined(__i386__)
llr2[2] = _mm_extract_epi16(xmm1,4);
llr2[3] = _mm_extract_epi16(xmm1,5);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,4);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,5);//((short *)&xmm2)[j+1];
#elif defined(__arm__)
llr2[2] = vgetq_lane_s16(xmm1,4);
llr2[3] = vgetq_lane_s16(xmm1,5);//((short *)&xmm1)[j+1];
llr2[4] = vgetq_lane_s16(xmm2,4);//((short *)&xmm2)[j];
llr2[5] = vgetq_lane_s16(xmm2,5);//((short *)&xmm2)[j+1];
#endif
llr2+=6;
llr2[0] = ((short *)&rxF[i])[6];
llr2[1] = ((short *)&rxF[i])[7];
#if defined(__x86_64__) || defined(__i386__)
llr2[2] = _mm_extract_epi16(xmm1,6);
llr2[3] = _mm_extract_epi16(xmm1,7);//((short *)&xmm1)[j+1];
llr2[4] = _mm_extract_epi16(xmm2,6);//((short *)&xmm2)[j];
llr2[5] = _mm_extract_epi16(xmm2,7);//((short *)&xmm2)[j+1];
#elif defined(__arm__)
llr2[2] = vgetq_lane_s16(xmm1,6);
llr2[3] = vgetq_lane_s16(xmm1,7);//((short *)&xmm1)[j+1];
llr2[4] = vgetq_lane_s16(xmm2,6);//((short *)&xmm2)[j];
llr2[5] = vgetq_lane_s16(xmm2,7);//((short *)&xmm2)[j+1];
#endif
llr2+=6;
}
*llr_save = llr;
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
#endif
}
int avg_pmch[4];
int rx_pmch(PHY_VARS_UE *ue,
unsigned char eNB_id,
uint8_t subframe,
unsigned char symbol)
{
LTE_UE_COMMON *common_vars = &ue->common_vars;
LTE_UE_PDSCH **pdsch_vars = &ue->pdsch_vars_MCH[eNB_id];
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
LTE_UE_DLSCH_t **dlsch = &ue->dlsch_MCH[eNB_id];
int avgs,aarx;
//printf("*********************mch: symbol %d\n",symbol);
mch_extract_rbs(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF,
common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id],
pdsch_vars[eNB_id]->rxdataF_ext,
pdsch_vars[eNB_id]->dl_ch_estimates_ext,
symbol,
subframe,
frame_parms);
if (symbol == 2) {
mch_channel_level(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
avg_pmch,
symbol,
frame_parms->N_RB_DL);
}
avgs = 0;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
avgs = cmax(avgs,avg_pmch[aarx]);
if (get_Qm(dlsch[0]->harq_processes[0]->mcs)==2)
pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) ;// + 2
else
pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2); // + 5;// + 2
mch_channel_compensation(pdsch_vars[eNB_id]->rxdataF_ext,
pdsch_vars[eNB_id]->dl_ch_estimates_ext,
pdsch_vars[eNB_id]->dl_ch_mag0,
pdsch_vars[eNB_id]->dl_ch_magb0,
pdsch_vars[eNB_id]->rxdataF_comp0,
frame_parms,
symbol,
get_Qm(dlsch[0]->harq_processes[0]->mcs),
pdsch_vars[eNB_id]->log2_maxh);
if (frame_parms->nb_antennas_rx > 1)
mch_detection_mrc(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->dl_ch_mag0,
pdsch_vars[eNB_id]->dl_ch_magb0,
symbol);
switch (get_Qm(dlsch[0]->harq_processes[0]->mcs)) {
case 2 :
mch_qpsk_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
symbol,
pdsch_vars[eNB_id]->llr128);
break;
case 4:
mch_16qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
pdsch_vars[eNB_id]->dl_ch_mag0,
symbol,
pdsch_vars[eNB_id]->llr128);
break;
case 6:
mch_64qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
pdsch_vars[eNB_id]->dl_ch_mag0,
pdsch_vars[eNB_id]->dl_ch_magb0,
symbol,
pdsch_vars[eNB_id]->llr128);
break;
}
return(0);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+749
View File
@@ -0,0 +1,749 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/prach_common.c
* \brief Common routines for UE/eNB PRACH physical channel V8.6 2009-03
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#include "PHY/sse_intrin.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
//#include "prach.h"
#include "PHY/LTE_TRANSPORT/if4_tools.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define PRACH_DEBUG 1
//#define PRACH_WRITE_OUTPUT_DEBUG 1
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
uint16_t NCS_4[7] = {2,4,6,8,10,12,15};
int16_t ru[2*839]; // quantized roots of unity
uint32_t ZC_inv[839]; // multiplicative inverse for roots u
uint16_t du[838];
typedef struct {
uint8_t f_ra;
uint8_t t0_ra;
uint8_t t1_ra;
uint8_t t2_ra;
} PRACH_TDD_PREAMBLE_MAP_elem;
typedef struct {
uint8_t num_prach;
PRACH_TDD_PREAMBLE_MAP_elem map[6];
} PRACH_TDD_PREAMBLE_MAP;
// This is table 5.7.1-4 from 36.211
PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
// TDD Configuration Index 0
{ {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}},
// TDD Configuration Index 1
{ {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}},
// TDD Configuration Index 2
{ {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}},
// TDD Configuration Index 3
{ {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}},
// TDD Configuration Index 4
{ {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}},
// TDD Configuration Index 5
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
// TDD Configuration Index 6
{ {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}},
// TDD Configuration Index 7
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
// TDD Configuration Index 8
{ {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}},
// TDD Configuration Index 9
{ {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}},
// TDD Configuration Index 10
{ {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}},
// TDD Configuration Index 11
{ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}},
// TDD Configuration Index 12
{ {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}},
{4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}},
{4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}},
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
{4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
},
// TDD Configuration Index 13
{ {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}}
},
// TDD Configuration Index 14
{ {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
},
// TDD Configuration Index 15
{ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}},
{5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}},
{5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}},
{5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
},
// TDD Configuration Index 16
{ {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}},
{5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}},
{5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
},
// TDD Configuration Index 17
{ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
},
// TDD Configuration Index 18
{ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}},
{6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}},
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}},
{6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}},
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}}
},
// TDD Configuration Index 19
{ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}
},
// TDD Configuration Index 20
{ {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
// TDD Configuration Index 21
{ {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
// TDD Configuration Index 22
{ {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
// TDD Configuration Index 23
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
// TDD Configuration Index 24
{ {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
// TDD Configuration Index 25
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
// TDD Configuration Index 26
{ {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
// TDD Configuration Index 27
{ {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
},
// TDD Configuration Index 28
{ {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
{5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
},
// TDD Configuration Index 29
{ {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
},
// TDD Configuration Index 30
{ {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
// TDD Configuration Index 31
{ {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
// TDD Configuration Index 32
{ {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
// TDD Configuration Index 33
{ {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
// TDD Configuration Index 34
{ {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
// TDD Configuration Index 35
{ {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
// TDD Configuration Index 36
{ {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
// TDD Configuration Index 37
{ {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
},
// TDD Configuration Index 38
{ {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
{5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
},
// TDD Configuration Index 39
{ {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
{6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
{6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
},
// TDD Configuration Index 40
{ {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}},
// TDD Configuration Index 41
{ {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}},
// TDD Configuration Index 42
{ {1,{{0,1,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
// TDD Configuration Index 43
{ {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}},
// TDD Configuration Index 44
{ {1,{{0,0,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
// TDD Configuration Index 45
{ {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}},
// TDD Configuration Index 46
{ {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}},
// TDD Configuration Index 47
{ {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
{4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}
}
};
uint16_t prach_root_sequence_map0_3[838] = { 129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84, 755, 105, 734, 93, 746, 70, 769, 60, 779,
2, 837, 1, 838,
56, 783, 112, 727, 148, 691,
80, 759, 42, 797, 40, 799,
35, 804, 73, 766, 146, 693,
31, 808, 28, 811, 30, 809, 27, 812, 29, 810,
24, 815, 48, 791, 68, 771, 74, 765, 178, 661, 136, 703,
86, 753, 78, 761, 43, 796, 39, 800, 20, 819, 21, 818,
95, 744, 202, 637, 190, 649, 181, 658, 137, 702, 125, 714, 151, 688,
217, 622, 128, 711, 142, 697, 122, 717, 203, 636, 118, 721, 110, 729, 89, 750, 103, 736, 61,
778, 55, 784, 15, 824, 14, 825,
12, 827, 23, 816, 34, 805, 37, 802, 46, 793, 207, 632, 179, 660, 145, 694, 130, 709, 223, 616,
228, 611, 227, 612, 132, 707, 133, 706, 143, 696, 135, 704, 161, 678, 201, 638, 173, 666, 106,
733, 83, 756, 91, 748, 66, 773, 53, 786, 10, 829, 9, 830,
7, 832, 8, 831, 16, 823, 47, 792, 64, 775, 57, 782, 104, 735, 101, 738, 108, 731, 208, 631, 184,
655, 197, 642, 191, 648, 121, 718, 141, 698, 149, 690, 216, 623, 218, 621,
152, 687, 144, 695, 134, 705, 138, 701, 199, 640, 162, 677, 176, 663, 119, 720, 158, 681, 164,
675, 174, 665, 171, 668, 170, 669, 87, 752, 169, 670, 88, 751, 107, 732, 81, 758, 82, 757, 100,
739, 98, 741, 71, 768, 59, 780, 65, 774, 50, 789, 49, 790, 26, 813, 17, 822, 13, 826, 6, 833,
5, 834, 33, 806, 51, 788, 75, 764, 99, 740, 96, 743, 97, 742, 166, 673, 172, 667, 175, 664, 187,
652, 163, 676, 185, 654, 200, 639, 114, 725, 189, 650, 115, 724, 194, 645, 195, 644, 192, 647,
182, 657, 157, 682, 156, 683, 211, 628, 154, 685, 123, 716, 139, 700, 212, 627, 153, 686, 213,
626, 215, 624, 150, 689,
225, 614, 224, 615, 221, 618, 220, 619, 127, 712, 147, 692, 124, 715, 193, 646, 205, 634, 206,
633, 116, 723, 160, 679, 186, 653, 167, 672, 79, 760, 85, 754, 77, 762, 92, 747, 58, 781, 62,
777, 69, 770, 54, 785, 36, 803, 32, 807, 25, 814, 18, 821, 11, 828, 4, 835,
3, 836, 19, 820, 22, 817, 41, 798, 38, 801, 44, 795, 52, 787, 45, 794, 63, 776, 67, 772, 72,
767, 76, 763, 94, 745, 102, 737, 90, 749, 109, 730, 165, 674, 111, 728, 209, 630, 204, 635, 117,
722, 188, 651, 159, 680, 198, 641, 113, 726, 183, 656, 180, 659, 177, 662, 196, 643, 155, 684,
214, 625, 126, 713, 131, 708, 219, 620, 222, 617, 226, 613,
230, 609, 232, 607, 262, 577, 252, 587, 418, 421, 416, 423, 413, 426, 411, 428, 376, 463, 395,
444, 283, 556, 285, 554, 379, 460, 390, 449, 363, 476, 384, 455, 388, 451, 386, 453, 361, 478,
387, 452, 360, 479, 310, 529, 354, 485, 328, 511, 315, 524, 337, 502, 349, 490, 335, 504, 324,
515,
323, 516, 320, 519, 334, 505, 359, 480, 295, 544, 385, 454, 292, 547, 291, 548, 381, 458, 399,
440, 380, 459, 397, 442, 369, 470, 377, 462, 410, 429, 407, 432, 281, 558, 414, 425, 247, 592,
277, 562, 271, 568, 272, 567, 264, 575, 259, 580,
237, 602, 239, 600, 244, 595, 243, 596, 275, 564, 278, 561, 250, 589, 246, 593, 417, 422, 248,
591, 394, 445, 393, 446, 370, 469, 365, 474, 300, 539, 299, 540, 364, 475, 362, 477, 298, 541,
312, 527, 313, 526, 314, 525, 353, 486, 352, 487, 343, 496, 327, 512, 350, 489, 326, 513, 319,
520, 332, 507, 333, 506, 348, 491, 347, 492, 322, 517,
330, 509, 338, 501, 341, 498, 340, 499, 342, 497, 301, 538, 366, 473, 401, 438, 371, 468, 408,
431, 375, 464, 249, 590, 269, 570, 238, 601, 234, 605,
257, 582, 273, 566, 255, 584, 254, 585, 245, 594, 251, 588, 412, 427, 372, 467, 282, 557, 403,
436, 396, 443, 392, 447, 391, 448, 382, 457, 389, 450, 294, 545, 297, 542, 311, 528, 344, 495,
345, 494, 318, 521, 331, 508, 325, 514, 321, 518,
346, 493, 339, 500, 351, 488, 306, 533, 289, 550, 400, 439, 378, 461, 374, 465, 415, 424, 270,
569, 241, 598,
231, 608, 260, 579, 268, 571, 276, 563, 409, 430, 398, 441, 290, 549, 304, 535, 308, 531, 358,
481, 316, 523,
293, 546, 288, 551, 284, 555, 368, 471, 253, 586, 256, 583, 263, 576,
242, 597, 274, 565, 402, 437, 383, 456, 357, 482, 329, 510,
317, 522, 307, 532, 286, 553, 287, 552, 266, 573, 261, 578,
236, 603, 303, 536, 356, 483,
355, 484, 405, 434, 404, 435, 406, 433,
235, 604, 267, 572, 302, 537,
309, 530, 265, 574, 233, 606,
367, 472, 296, 543,
336, 503, 305, 534, 373, 466, 280, 559, 279, 560, 419, 420, 240, 599, 258, 581, 229, 610
};
uint16_t prach_root_sequence_map4[138] = { 1,138,2,137,3,136,4,135,5,134,6,133,7,132,8,131,9,130,10,129,
11,128,12,127,13,126,14,125,15,124,16,123,17,122,18,121,19,120,20,119,
21,118,22,117,23,116,24,115,25,114,26,113,27,112,28,111,29,110,30,109,
31,108,32,107,33,106,34,105,35,104,36,103,37,102,38,101,39,100,40,99,
41,98,42,97,43,96,44,95,45,94,46,93,47,92,48,91,49,90,50,89,
51,88,52,87,53,86,54,85,55,84,56,83,57,82,58,81,59,80,60,79,
61,78,62,77,63,76,64,75,65,74,66,73,67,72,68,71,69,70
};
void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
{
FILE *fd;
fd = fopen("prach_config.txt","w");
fprintf(fd,"prach_config: subframe = %d\n",subframe);
fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL);
fprintf(fd,"prach_config: frame_type = %s\n",(frame_parms->frame_type==1) ? "TDD":"FDD");
if(frame_parms->frame_type==1) fprintf(fd,"prach_config: tdd_config = %d\n",frame_parms->tdd_config);
fprintf(fd,"prach_config: rootSequenceIndex = %d\n",frame_parms->prach_config_common.rootSequenceIndex);
fprintf(fd,"prach_config: prach_ConfigIndex = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex);
fprintf(fd,"prach_config: Ncs_config = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig);
fprintf(fd,"prach_config: highSpeedFlag = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.highSpeedFlag);
fprintf(fd,"prach_config: n_ra_prboffset = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset);
fclose(fd);
}
// This function computes the du
void fill_du(uint8_t prach_fmt)
{
uint16_t iu,u,p;
uint16_t N_ZC;
uint16_t *prach_root_sequence_map;
if (prach_fmt<4) {
N_ZC = 839;
prach_root_sequence_map = prach_root_sequence_map0_3;
} else {
N_ZC = 139;
prach_root_sequence_map = prach_root_sequence_map4;
}
for (iu=0; iu<(N_ZC-1); iu++) {
u=prach_root_sequence_map[iu];
p=1;
while (((u*p)%N_ZC)!=1)
p++;
du[u] = ((p<(N_ZC>>1)) ? p : (N_ZC-p));
}
}
uint8_t get_num_prach_tdd(module_id_t Mod_id)
{
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][0]->frame_parms;
return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].num_prach);
}
uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index)
{
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][0]->frame_parms;
return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].map[tdd_map_index].f_ra);
}
uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type)
{
if (frame_type == FDD) // FDD
return(prach_ConfigIndex>>4);
else {
if (prach_ConfigIndex < 20)
return (0);
if (prach_ConfigIndex < 30)
return (1);
if (prach_ConfigIndex < 40)
return (2);
if (prach_ConfigIndex < 48)
return (3);
else
return (4);
}
}
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t prach_ConfigIndex,
uint8_t n_ra_prboffset,
uint8_t tdd_mapindex, uint16_t Nf)
{
lte_frame_type_t frame_type = frame_parms->frame_type;
uint8_t tdd_config = frame_parms->tdd_config;
uint8_t n_ra_prb;
uint8_t f_ra,t1_ra;
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
uint8_t Nsp=2;
if (frame_type == TDD) { // TDD
if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
return(-1);
}
// adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
if (prach_fmt < 4) {
if ((f_ra&1) == 0) {
n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
} else {
n_ra_prb = frame_parms->N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
}
} else {
if ((tdd_config >2) && (tdd_config<6))
Nsp = 2;
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
n_ra_prb = 6*f_ra;
} else {
n_ra_prb = frame_parms->N_RB_UL - 6*(f_ra+1);
}
}
}
else { //FDD
n_ra_prb = n_ra_prboffset;
}
return(n_ra_prb);
}
int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe)
{
// uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
uint8_t tdd_config = frame_parms->tdd_config;
uint8_t t0_ra;
uint8_t t1_ra;
uint8_t t2_ra;
int prach_mask = 0;
if (frame_parms->frame_type == FDD) { //FDD
//implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
if ((((frame&1) == 1) && (subframe < 9)) ||
(((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
((prach_ConfigIndex&0x1f)==18) || // 18,50
((prach_ConfigIndex&0xf)==15)) // 15,47
return(0);
switch (prach_ConfigIndex&0x1f) {
case 0:
case 3:
if (subframe==1) prach_mask = 1;
break;
case 1:
case 4:
if (subframe==4) prach_mask = 1;
break;
case 2:
case 5:
if (subframe==7) prach_mask = 1;
break;
case 6:
if ((subframe==1) || (subframe==6)) prach_mask=1;
break;
case 7:
if ((subframe==2) || (subframe==7)) prach_mask=1;
break;
case 8:
if ((subframe==3) || (subframe==8)) prach_mask=1;
break;
case 9:
if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
break;
case 10:
if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
break;
case 11:
if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
break;
case 12:
if ((subframe&1)==0) prach_mask=1;
break;
case 13:
if ((subframe&1)==1) prach_mask=1;
break;
case 14:
prach_mask=1;
break;
case 15:
if (subframe==9) prach_mask=1;
break;
}
} else { // TDD
AssertFatal(prach_ConfigIndex<64,
"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
#ifdef PRACH_DEBUG
LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
prach_ConfigIndex,
subframe,
t0_ra,t1_ra,t2_ra);
#endif
if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
(t0_ra == 0)) && // PRACH is in all frames
(((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
(((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
(((subframe%5)-2)==t2_ra)) prach_mask=1;
else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
}
}
return(prach_mask);
}
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe) {
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe);
#ifdef Rel14
int i;
for (i=0;i<4;i++) {
if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1)
prach_mask|=(is_prach_subframe0(frame_parms,frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],frame,subframe)<<(i+1));
}
#endif
return(prach_mask);
}
void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t prach_ConfigIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
lte_frame_type_t frame_type,
uint32_t X_u[64][839])
{
// Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC)
unsigned int k,inv_u,i,NCS=0,num_preambles;
int N_ZC;
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
uint16_t *prach_root_sequence_map;
uint16_t u, preamble_offset;
uint16_t n_shift_ra,n_shift_ra_bar, d_start,numshift;
uint8_t not_found;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN);
#ifdef PRACH_DEBUG
LOG_I(PHY,"compute_prach_seq: NCS_config %d, prach_fmt %d\n",zeroCorrelationZoneConfig, prach_fmt);
#endif
AssertFatal(prach_fmt<4,
"PRACH sequence is only precomputed for prach_fmt<4 (have %"PRIu8")\n", prach_fmt );
N_ZC = (prach_fmt < 4) ? 839 : 139;
//init_prach_tables(N_ZC); //moved to phy_init_lte_ue/eNB, since it takes to long in real-time
if (prach_fmt < 4) {
prach_root_sequence_map = prach_root_sequence_map0_3;
} else {
// FIXME cannot be reached
prach_root_sequence_map = prach_root_sequence_map4;
}
#ifdef PRACH_DEBUG
LOG_I( PHY, "compute_prach_seq: done init prach_tables\n" );
#endif
if (highSpeedFlag== 0) {
#ifdef PRACH_DEBUG
LOG_I(PHY,"Low speed prach : NCS_config %d\n",zeroCorrelationZoneConfig);
#endif
AssertFatal(zeroCorrelationZoneConfig<=15,
"FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", zeroCorrelationZoneConfig );
NCS = NCS_unrestricted[zeroCorrelationZoneConfig];
num_preambles = (NCS==0) ? 64 : ((64*NCS)/N_ZC);
if (NCS>0) num_preambles++;
preamble_offset = 0;
} else {
#ifdef PRACH_DEBUG
LOG_I( PHY, "high speed prach : NCS_config %"PRIu8"\n", zeroCorrelationZoneConfig );
#endif
AssertFatal(zeroCorrelationZoneConfig<=14,
"FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", zeroCorrelationZoneConfig );
NCS = NCS_restricted[zeroCorrelationZoneConfig];
fill_du(prach_fmt);
num_preambles = 64; // compute ZC sequence for 64 possible roots
// find first non-zero shift root (stored in preamble_offset)
not_found = 1;
preamble_offset = 0;
while (not_found == 1) {
// current root depending on rootSequenceIndex
int index = (rootSequenceIndex + preamble_offset) % N_ZC;
if (prach_fmt<4) {
// prach_root_sequence_map points to prach_root_sequence_map0_3
DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) );
} else {
// prach_root_sequence_map points to prach_root_sequence_map4
DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) );
}
u = prach_root_sequence_map[index];
uint16_t n_group_ra = 0;
if ( (du[u]<(N_ZC/3)) && (du[u]>=NCS) ) {
n_shift_ra = du[u]/NCS;
d_start = (du[u]<<1) + (n_shift_ra * NCS);
n_group_ra = N_ZC/d_start;
n_shift_ra_bar = max(0,(N_ZC-(du[u]<<1)-(n_group_ra*d_start))/N_ZC);
} else if ( (du[u]>=(N_ZC/3)) && (du[u]<=((N_ZC - NCS)>>1)) ) {
n_shift_ra = (N_ZC - (du[u]<<1))/NCS;
d_start = N_ZC - (du[u]<<1) + (n_shift_ra * NCS);
n_group_ra = du[u]/d_start;
n_shift_ra_bar = min(n_shift_ra,max(0,(du[u]- (n_group_ra*d_start))/NCS));
} else {
n_shift_ra = 0;
n_shift_ra_bar = 0;
}
// This is the number of cyclic shifts for the current root u
numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar;
// skip to next root and recompute parameters if numshift==0
if (numshift>0)
not_found = 0;
else
preamble_offset++;
}
}
#ifdef PRACH_DEBUG
if (NCS>0)
LOG_I( PHY, "Initializing %u preambles for PRACH (NCS_config %"PRIu8", NCS %u, N_ZC/NCS %u)\n",
num_preambles, zeroCorrelationZoneConfig, NCS, N_ZC/NCS );
#endif
for (i=0; i<num_preambles; i++) {
int index = (rootSequenceIndex+i+preamble_offset) % N_ZC;
if (prach_fmt<4) {
// prach_root_sequence_map points to prach_root_sequence_map0_3
DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) );
} else {
// prach_root_sequence_map points to prach_root_sequence_map4
DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) );
}
u = prach_root_sequence_map[index];
inv_u = ZC_inv[u]; // multiplicative inverse of u
// X_u[0] stores the first ZC sequence where the root u has a non-zero number of shifts
// for the unrestricted case X_u[0] is the first root indicated by the rootSequenceIndex
for (k=0; k<N_ZC; k++) {
// 420 is the multiplicative inverse of 2 (required since ru is exp[j 2\pi n])
X_u[i][k] = ((uint32_t*)ru)[(((k*(1+(inv_u*k)))%N_ZC)*420)%N_ZC];
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT);
}
-804
View File
@@ -1,804 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/print_stats.c
* \brief PHY statstic logging function
* \author R. Knopp, F. Kaltenberger, navid nikaein
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
* \note
* \warning
*/
#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "SCHED/extern.h"
#ifdef OPENAIR2
#include "../openair2/LAYER2/MAC/proto.h"
#include "../openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#endif
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
#include "common_lib.h"
extern openair0_config_t openair0_cfg[];
#endif
int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length, runmode_t mode, int input_level_dBm)
{
uint8_t eNB=0;
uint32_t RRC_status;
int len=length;
int harq_pid,round;
if (ue==NULL)
return 0;
if ((mode == normal_txrx) || (mode == no_L2_connect)) {
len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",ue->Mod_id, ue->pdcch_vars[0][0]->crnti);
len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE (NF %.1f dB)\n",
10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB,
10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
10*log10(ue->measurements.rsrq[0]),
ue->measurements.n0_power_tot_dBm,
(double)ue->measurements.n0_power_tot_dBm+132.24);
/*
len += sprintf(&buffer[len],
"[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n",
proc->frame_rx,
ue->measurements.rx_rssi_dBm[0],
ue->measurements.rx_power_dB[0][0],
ue->measurements.rx_power_dB[0][1],
ue->measurements.rx_rssi_dBm[1],
ue->measurements.rx_power_dB[1][0],
ue->measurements.rx_power_dB[1][1],
ue->measurements.rx_rssi_dBm[2],
ue->measurements.rx_power_dB[2][0],
ue->measurements.rx_power_dB[2][1],
ue->measurements.n0_power_tot_dBm,
ue->measurements.n0_power_tot_dBm+10*log10(12*ue->frame_parms.N_RB_DL),
ue->frame_parms.N_RB_DL,
ue->measurements.n0_power_dB[0],
ue->measurements.n0_power_dB[1]);
*/
#ifdef EXMIMO
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]);
#endif
#if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",ue->rx_total_gain_dB);
#endif
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz, estimated carrier frequency %f Hz\n",ue->common_vars.freq_offset,openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset);
#endif
len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[ue->UE_mode[0]],ue->UE_mode[0]);
len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",ue->timing_advance);
if (ue->UE_mode[0]==PUSCH) {
len += sprintf(&buffer[len], "[UE PROC] Po_PUSCH = %d dBm (PL %d dB, Po_NOMINAL_PUSCH %d dBm, PHR %d dB)\n",
ue->ulsch[0]->Po_PUSCH,
get_PL(ue->Mod_id,ue->CC_id,0),
ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
ue->ulsch[0]->PHR);
len += sprintf(&buffer[len], "[UE PROC] Po_PUCCH = %d dBm (Po_NOMINAL_PUCCH %d dBm, g_pucch %d dB)\n",
get_PL(ue->Mod_id,ue->CC_id,0)+
ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH+
ue->dlsch[0][0][0]->g_pucch,
ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
ue->dlsch[0][0][0]->g_pucch);
}
//for (eNB=0;eNB<NUMBER_OF_eNB_MAX;eNB++) {
for (eNB=0; eNB<1; eNB++) {
len += sprintf(&buffer[len], "[UE PROC] RX spatial power eNB%d: [%d %d; %d %d] dB\n",
eNB,
ue->measurements.rx_spatial_power_dB[eNB][0][0],
ue->measurements.rx_spatial_power_dB[eNB][0][1],
ue->measurements.rx_spatial_power_dB[eNB][1][0],
ue->measurements.rx_spatial_power_dB[eNB][1][1]);
len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,ue->measurements.rx_power_tot_dB[eNB],ue->measurements.rx_power_avg_dB[eNB]);
len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",ue->measurements.rx_power_tot[eNB],
ue->measurements.rx_power_avg[eNB], ue->measurements.n0_power_tot, ue->measurements.n0_power_avg);
len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",ue->sinr_eff);
len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,ue->measurements.wideband_cqi_tot[eNB],ue->measurements.wideband_cqi_avg[eNB]);
switch (ue->frame_parms.N_RB_DL) {
case 6:
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][0][0],
ue->measurements.subband_cqi_dB[eNB][0][1],
ue->measurements.subband_cqi_dB[eNB][0][2],
ue->measurements.subband_cqi_dB[eNB][0][3],
ue->measurements.subband_cqi_dB[eNB][0][4],
ue->measurements.subband_cqi_dB[eNB][0][5]);
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][1][0],
ue->measurements.subband_cqi_dB[eNB][1][1],
ue->measurements.subband_cqi_dB[eNB][1][2],
ue->measurements.subband_cqi_dB[eNB][1][3],
ue->measurements.subband_cqi_dB[eNB][1][4],
ue->measurements.subband_cqi_dB[eNB][1][5]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][0],
ue->measurements.subband_pmi_im[eNB][0][0],
ue->measurements.subband_pmi_re[eNB][1][0],
ue->measurements.subband_pmi_im[eNB][1][0],
ue->measurements.subband_pmi_re[eNB][2][0],
ue->measurements.subband_pmi_im[eNB][2][0],
ue->measurements.subband_pmi_re[eNB][3][0],
ue->measurements.subband_pmi_im[eNB][3][0],
ue->measurements.subband_pmi_re[eNB][4][0],
ue->measurements.subband_pmi_im[eNB][4][0],
ue->measurements.subband_pmi_re[eNB][5][0],
ue->measurements.subband_pmi_im[eNB][5][0]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][1],
ue->measurements.subband_pmi_im[eNB][0][1],
ue->measurements.subband_pmi_re[eNB][1][1],
ue->measurements.subband_pmi_im[eNB][1][1],
ue->measurements.subband_pmi_re[eNB][2][1],
ue->measurements.subband_pmi_im[eNB][2][1],
ue->measurements.subband_pmi_re[eNB][3][1],
ue->measurements.subband_pmi_im[eNB][3][1],
ue->measurements.subband_pmi_re[eNB][4][1],
ue->measurements.subband_pmi_im[eNB][4][1],
ue->measurements.subband_pmi_re[eNB][5][1],
ue->measurements.subband_pmi_im[eNB][5][1]);
len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d]\n",
eNB,
ue->measurements.selected_rx_antennas[eNB][0],
ue->measurements.selected_rx_antennas[eNB][1],
ue->measurements.selected_rx_antennas[eNB][2],
ue->measurements.selected_rx_antennas[eNB][3],
ue->measurements.selected_rx_antennas[eNB][4],
ue->measurements.selected_rx_antennas[eNB][5]);
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,6)));
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,6)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,6)));
break;
case 25:
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][0][0],
ue->measurements.subband_cqi_dB[eNB][0][1],
ue->measurements.subband_cqi_dB[eNB][0][2],
ue->measurements.subband_cqi_dB[eNB][0][3],
ue->measurements.subband_cqi_dB[eNB][0][4],
ue->measurements.subband_cqi_dB[eNB][0][5],
ue->measurements.subband_cqi_dB[eNB][0][6]);
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][1][0],
ue->measurements.subband_cqi_dB[eNB][1][1],
ue->measurements.subband_cqi_dB[eNB][1][2],
ue->measurements.subband_cqi_dB[eNB][1][3],
ue->measurements.subband_cqi_dB[eNB][1][4],
ue->measurements.subband_cqi_dB[eNB][1][5],
ue->measurements.subband_cqi_dB[eNB][1][6]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][0],
ue->measurements.subband_pmi_im[eNB][0][0],
ue->measurements.subband_pmi_re[eNB][1][0],
ue->measurements.subband_pmi_im[eNB][1][0],
ue->measurements.subband_pmi_re[eNB][2][0],
ue->measurements.subband_pmi_im[eNB][2][0],
ue->measurements.subband_pmi_re[eNB][3][0],
ue->measurements.subband_pmi_im[eNB][3][0],
ue->measurements.subband_pmi_re[eNB][4][0],
ue->measurements.subband_pmi_im[eNB][4][0],
ue->measurements.subband_pmi_re[eNB][5][0],
ue->measurements.subband_pmi_im[eNB][5][0],
ue->measurements.subband_pmi_re[eNB][6][0],
ue->measurements.subband_pmi_im[eNB][6][0]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][1],
ue->measurements.subband_pmi_im[eNB][0][1],
ue->measurements.subband_pmi_re[eNB][1][1],
ue->measurements.subband_pmi_im[eNB][1][1],
ue->measurements.subband_pmi_re[eNB][2][1],
ue->measurements.subband_pmi_im[eNB][2][1],
ue->measurements.subband_pmi_re[eNB][3][1],
ue->measurements.subband_pmi_im[eNB][3][1],
ue->measurements.subband_pmi_re[eNB][4][1],
ue->measurements.subband_pmi_im[eNB][4][1],
ue->measurements.subband_pmi_re[eNB][5][1],
ue->measurements.subband_pmi_im[eNB][5][1],
ue->measurements.subband_pmi_re[eNB][6][1],
ue->measurements.subband_pmi_im[eNB][6][1]);
len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d]\n",
eNB,
ue->measurements.selected_rx_antennas[eNB][0],
ue->measurements.selected_rx_antennas[eNB][1],
ue->measurements.selected_rx_antennas[eNB][2],
ue->measurements.selected_rx_antennas[eNB][3],
ue->measurements.selected_rx_antennas[eNB][4],
ue->measurements.selected_rx_antennas[eNB][5],
ue->measurements.selected_rx_antennas[eNB][6]);
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,7)));
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,7)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,7)));
break;
case 50:
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][0][0],
ue->measurements.subband_cqi_dB[eNB][0][1],
ue->measurements.subband_cqi_dB[eNB][0][2],
ue->measurements.subband_cqi_dB[eNB][0][3],
ue->measurements.subband_cqi_dB[eNB][0][4],
ue->measurements.subband_cqi_dB[eNB][0][5],
ue->measurements.subband_cqi_dB[eNB][0][6],
ue->measurements.subband_cqi_dB[eNB][0][7],
ue->measurements.subband_cqi_dB[eNB][0][8]);
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][1][0],
ue->measurements.subband_cqi_dB[eNB][1][1],
ue->measurements.subband_cqi_dB[eNB][1][2],
ue->measurements.subband_cqi_dB[eNB][1][3],
ue->measurements.subband_cqi_dB[eNB][1][4],
ue->measurements.subband_cqi_dB[eNB][1][5],
ue->measurements.subband_cqi_dB[eNB][1][6],
ue->measurements.subband_cqi_dB[eNB][1][7],
ue->measurements.subband_cqi_dB[eNB][1][8]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][0],
ue->measurements.subband_pmi_im[eNB][0][0],
ue->measurements.subband_pmi_re[eNB][1][0],
ue->measurements.subband_pmi_im[eNB][1][0],
ue->measurements.subband_pmi_re[eNB][2][0],
ue->measurements.subband_pmi_im[eNB][2][0],
ue->measurements.subband_pmi_re[eNB][3][0],
ue->measurements.subband_pmi_im[eNB][3][0],
ue->measurements.subband_pmi_re[eNB][4][0],
ue->measurements.subband_pmi_im[eNB][4][0],
ue->measurements.subband_pmi_re[eNB][5][0],
ue->measurements.subband_pmi_im[eNB][5][0],
ue->measurements.subband_pmi_re[eNB][6][0],
ue->measurements.subband_pmi_im[eNB][6][0],
ue->measurements.subband_pmi_re[eNB][7][0],
ue->measurements.subband_pmi_im[eNB][7][0],
ue->measurements.subband_pmi_re[eNB][8][0],
ue->measurements.subband_pmi_im[eNB][8][0]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][1],
ue->measurements.subband_pmi_im[eNB][0][1],
ue->measurements.subband_pmi_re[eNB][1][1],
ue->measurements.subband_pmi_im[eNB][1][1],
ue->measurements.subband_pmi_re[eNB][2][1],
ue->measurements.subband_pmi_im[eNB][2][1],
ue->measurements.subband_pmi_re[eNB][3][1],
ue->measurements.subband_pmi_im[eNB][3][1],
ue->measurements.subband_pmi_re[eNB][4][1],
ue->measurements.subband_pmi_im[eNB][4][1],
ue->measurements.subband_pmi_re[eNB][5][1],
ue->measurements.subband_pmi_im[eNB][5][1],
ue->measurements.subband_pmi_re[eNB][6][1],
ue->measurements.subband_pmi_im[eNB][6][1],
ue->measurements.subband_pmi_re[eNB][7][1],
ue->measurements.subband_pmi_im[eNB][7][1],
ue->measurements.subband_pmi_re[eNB][8][1],
ue->measurements.subband_pmi_im[eNB][8][1]);
len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d]\n",
eNB,
ue->measurements.selected_rx_antennas[eNB][0],
ue->measurements.selected_rx_antennas[eNB][1],
ue->measurements.selected_rx_antennas[eNB][2],
ue->measurements.selected_rx_antennas[eNB][3],
ue->measurements.selected_rx_antennas[eNB][4],
ue->measurements.selected_rx_antennas[eNB][5],
ue->measurements.selected_rx_antennas[eNB][6],
ue->measurements.selected_rx_antennas[eNB][7],
ue->measurements.selected_rx_antennas[eNB][8]);
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,9)));
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,9)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,9)));
break;
case 100:
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][0][0],
ue->measurements.subband_cqi_dB[eNB][0][1],
ue->measurements.subband_cqi_dB[eNB][0][2],
ue->measurements.subband_cqi_dB[eNB][0][3],
ue->measurements.subband_cqi_dB[eNB][0][4],
ue->measurements.subband_cqi_dB[eNB][0][5],
ue->measurements.subband_cqi_dB[eNB][0][6],
ue->measurements.subband_cqi_dB[eNB][0][7],
ue->measurements.subband_cqi_dB[eNB][0][8],
ue->measurements.subband_cqi_dB[eNB][0][9],
ue->measurements.subband_cqi_dB[eNB][0][10],
ue->measurements.subband_cqi_dB[eNB][0][11],
ue->measurements.subband_cqi_dB[eNB][0][12]);
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n",
eNB,
ue->measurements.subband_cqi_dB[eNB][1][0],
ue->measurements.subband_cqi_dB[eNB][1][1],
ue->measurements.subband_cqi_dB[eNB][1][2],
ue->measurements.subband_cqi_dB[eNB][1][3],
ue->measurements.subband_cqi_dB[eNB][1][4],
ue->measurements.subband_cqi_dB[eNB][1][5],
ue->measurements.subband_cqi_dB[eNB][1][6],
ue->measurements.subband_cqi_dB[eNB][1][7],
ue->measurements.subband_cqi_dB[eNB][1][8],
ue->measurements.subband_cqi_dB[eNB][1][9],
ue->measurements.subband_cqi_dB[eNB][1][10],
ue->measurements.subband_cqi_dB[eNB][1][11],
ue->measurements.subband_cqi_dB[eNB][1][12]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][0],
ue->measurements.subband_pmi_im[eNB][0][0],
ue->measurements.subband_pmi_re[eNB][1][0],
ue->measurements.subband_pmi_im[eNB][1][0],
ue->measurements.subband_pmi_re[eNB][2][0],
ue->measurements.subband_pmi_im[eNB][2][0],
ue->measurements.subband_pmi_re[eNB][3][0],
ue->measurements.subband_pmi_im[eNB][3][0],
ue->measurements.subband_pmi_re[eNB][4][0],
ue->measurements.subband_pmi_im[eNB][4][0],
ue->measurements.subband_pmi_re[eNB][5][0],
ue->measurements.subband_pmi_im[eNB][5][0],
ue->measurements.subband_pmi_re[eNB][6][0],
ue->measurements.subband_pmi_im[eNB][6][0],
ue->measurements.subband_pmi_re[eNB][7][0],
ue->measurements.subband_pmi_im[eNB][7][0],
ue->measurements.subband_pmi_re[eNB][8][0],
ue->measurements.subband_pmi_im[eNB][8][0],
ue->measurements.subband_pmi_re[eNB][9][0],
ue->measurements.subband_pmi_im[eNB][9][0],
ue->measurements.subband_pmi_re[eNB][10][0],
ue->measurements.subband_pmi_im[eNB][10][0],
ue->measurements.subband_pmi_re[eNB][11][0],
ue->measurements.subband_pmi_im[eNB][11][0],
ue->measurements.subband_pmi_re[eNB][12][0],
ue->measurements.subband_pmi_im[eNB][12][0]);
len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
eNB,
ue->measurements.subband_pmi_re[eNB][0][1],
ue->measurements.subband_pmi_im[eNB][0][1],
ue->measurements.subband_pmi_re[eNB][1][1],
ue->measurements.subband_pmi_im[eNB][1][1],
ue->measurements.subband_pmi_re[eNB][2][1],
ue->measurements.subband_pmi_im[eNB][2][1],
ue->measurements.subband_pmi_re[eNB][3][1],
ue->measurements.subband_pmi_im[eNB][3][1],
ue->measurements.subband_pmi_re[eNB][4][1],
ue->measurements.subband_pmi_im[eNB][4][1],
ue->measurements.subband_pmi_re[eNB][5][1],
ue->measurements.subband_pmi_im[eNB][5][1],
ue->measurements.subband_pmi_re[eNB][6][1],
ue->measurements.subband_pmi_im[eNB][6][1],
ue->measurements.subband_pmi_re[eNB][7][1],
ue->measurements.subband_pmi_im[eNB][7][1],
ue->measurements.subband_pmi_re[eNB][8][1],
ue->measurements.subband_pmi_im[eNB][8][1],
ue->measurements.subband_pmi_re[eNB][9][1],
ue->measurements.subband_pmi_im[eNB][9][1],
ue->measurements.subband_pmi_re[eNB][10][1],
ue->measurements.subband_pmi_im[eNB][10][1],
ue->measurements.subband_pmi_re[eNB][11][1],
ue->measurements.subband_pmi_im[eNB][11][1],
ue->measurements.subband_pmi_re[eNB][12][1],
ue->measurements.subband_pmi_im[eNB][12][1]);
len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d %d %d %d %d]\n",
eNB,
ue->measurements.selected_rx_antennas[eNB][0],
ue->measurements.selected_rx_antennas[eNB][1],
ue->measurements.selected_rx_antennas[eNB][2],
ue->measurements.selected_rx_antennas[eNB][3],
ue->measurements.selected_rx_antennas[eNB][4],
ue->measurements.selected_rx_antennas[eNB][5],
ue->measurements.selected_rx_antennas[eNB][6],
ue->measurements.selected_rx_antennas[eNB][7],
ue->measurements.selected_rx_antennas[eNB][8],
ue->measurements.selected_rx_antennas[eNB][9],
ue->measurements.selected_rx_antennas[eNB][10],
ue->measurements.selected_rx_antennas[eNB][11],
ue->measurements.selected_rx_antennas[eNB][12]);
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,13)));
len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,13)),
pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,13)));
break;
}
#ifdef OPENAIR2
RRC_status = mac_UE_get_rrc_status(ue->Mod_id, 0);
len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
#endif
len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d \n",ue->transmission_mode[eNB]);
len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n",
ue->pbch_vars[eNB]->pdu_errors_conseq,
ue->pbch_vars[eNB]->pdu_errors,
ue->pbch_vars[eNB]->pdu_fer);
if (ue->transmission_mode[eNB] == 6)
len += sprintf(&buffer[len], "[UE PROC] Mode 6 Wideband CQI eNB %d : %d dB\n",eNB,ue->measurements.precoded_cqi_dB[eNB][0]);
for (harq_pid=0;harq_pid<8;harq_pid++) {
len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 0 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][0]->harq_processes[harq_pid]->mcs);
for (round=0;round<8;round++)
len+=sprintf(&buffer[len],"%d/%d ",
ue->dlsch[0][0][0]->harq_processes[harq_pid]->errors[round],
ue->dlsch[0][0][0]->harq_processes[harq_pid]->trials[round]);
len+=sprintf(&buffer[len],"\n");
}
if (ue->dlsch[0][0] && ue->dlsch[0][0][0] && ue->dlsch[0][0][1]) {
len += sprintf(&buffer[len], "[UE PROC] Saved PMI for DLSCH eNB %d : %jx (%p)\n",eNB,pmi2hex_2Ar1(ue->dlsch[0][0][0]->pmi_alloc),ue->dlsch[0][0][0]);
len += sprintf(&buffer[len], "[UE PROC] eNB %d: dl_power_off = %d\n",eNB,ue->dlsch[0][0][0]->harq_processes[0]->dl_power_off);
for (harq_pid=0;harq_pid<8;harq_pid++) {
len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 1 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][1]->harq_processes[0]->mcs);
for (round=0;round<8;round++)
len+=sprintf(&buffer[len],"%d/%d ",
ue->dlsch[0][0][1]->harq_processes[harq_pid]->errors[round],
ue->dlsch[0][0][1]->harq_processes[harq_pid]->trials[round]);
len+=sprintf(&buffer[len],"\n");
}
}
len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",ue->dlsch_received[0],ue->dlsch_errors[0],ue->dlsch_fer[0]);
len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",ue->dlsch_SI_received[0],ue->dlsch_SI_errors[0]);
len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",ue->dlsch_ra_received[0],ue->dlsch_ra_errors[0]);
#if defined(Rel10) || defined(Rel14)
int i=0;
//len += sprintf(&buffer[len], "[UE PROC] MCH Total %d\n", ue->dlsch_mch_received[0]);
for(i=0; i <ue->frame_parms.num_MBSFN_config; i++ ) {
len += sprintf(&buffer[len], "[UE PROC] MCH (MCCH MBSFN %d) Total %d, Error %d, Trials %d\n",
i, ue->dlsch_mcch_received[i][0],ue->dlsch_mcch_errors[i][0],ue->dlsch_mcch_trials[i][0]);
len += sprintf(&buffer[len], "[UE PROC] MCH (MTCH MBSFN %d) Total %d, Error %d, Trials %d\n",
i, ue->dlsch_mtch_received[i][0],ue->dlsch_mtch_errors[i][0],ue->dlsch_mtch_trials[i][0]);
}
#endif
len += sprintf(&buffer[len], "[UE PROC] DLSCH Bitrate %dkbps\n",(ue->bitrate[0]/1000));
len += sprintf(&buffer[len], "[UE PROC] Total Received Bits %dkbits\n",(ue->total_received_bits[0]/1000));
len += sprintf(&buffer[len], "[UE PROC] IA receiver %d\n",ue->use_ia_receiver);
}
} else {
len += sprintf(&buffer[len], "[UE PROC] Frame count: %d, RSSI %3.2f dB (%d dB, %d dB), N0 %3.2f dB (%d dB, %d dB)\n",
proc->frame_rx,
10*log10(ue->measurements.rssi),
ue->measurements.rx_power_dB[0][0],
ue->measurements.rx_power_dB[0][1],
10*log10(ue->measurements.n0_power_tot),
ue->measurements.n0_power_dB[0],
ue->measurements.n0_power_dB[1]);
#ifdef EXMIMO
ue->rx_total_gain_dB = ((int)(10*log10(ue->measurements.rssi)))-input_level_dBm;
len += sprintf(&buffer[len], "[UE PROC] rxg_mode %d, input level (set by user) %d dBm, VGA gain %d dB ==> total gain %3.2f dB, noise figure %3.2f dB\n",
openair0_cfg[0].rxg_mode[0],
input_level_dBm,
(int)openair0_cfg[0].rx_gain[0],
10*log10(ue->measurements.rssi)-input_level_dBm,
10*log10(ue->measurements.n0_power_tot)-ue->rx_total_gain_dB+105);
#endif
}
len += sprintf(&buffer[len],"EOF\n");
return len;
} // is_clusterhead
/*
int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
{
unsigned int success=0;
uint8_t eNB_id,UE_id,i,j,number_of_cards_l=1;
uint32_t ulsch_errors=0,dlsch_errors=0;
uint32_t ulsch_round_attempts[4]= {0,0,0,0},ulsch_round_errors[4]= {0,0,0,0};
uint32_t dlsch_round_attempts[4]= {0,0,0,0},dlsch_round_errors[4]= {0,0,0,0};
uint32_t UE_id_mac, RRC_status;
eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
if (eNB==NULL)
return 0;
int len = length;
// if(eNB->frame==0){
eNB->total_dlsch_bitrate = 0;//eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate;
eNB->total_transmitted_bits = 0;// eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_transmitted_bits;
eNB->total_system_throughput = 0;//eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput;
// }
for (eNB_id=0; eNB_id<number_of_cards_l; eNB_id++) {
len += sprintf(&buffer[len],"eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n",
eNB_id,number_of_cards_l,
proc->frame_tx,
eNB->rx_total_gain_dB,
eNB->measurements.n0_power_tot_dBm,
eNB->measurements.n0_power_dB[0],
eNB->measurements.n0_power_dB[1]);
len += sprintf(&buffer[len],"PRB I0 (%X.%X.%X.%X): ",
eNB->rb_mask_ul[0],
eNB->rb_mask_ul[1],eNB->rb_mask_ul[2],eNB->rb_mask_ul[3]);
for (i=0; i<eNB->frame_parms.N_RB_UL; i++) {
len += sprintf(&buffer[len],"%4d ",
eNB->measurements.n0_subband_power_tot_dBm[i]);
if ((i>0) && ((i%25) == 0))
len += sprintf(&buffer[len],"\n");
}
len += sprintf(&buffer[len],"\n");
len += sprintf(&buffer[len],"\nPERFORMANCE PARAMETERS\n");
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
if (eNB &&
(eNB->dlsch!=NULL) &&
(eNB->dlsch[(uint8_t)UE_id]!=NULL) &&
(eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&&
(eNB->UE_stats[UE_id].mode == PUSCH)) {
eNB->total_dlsch_bitrate = eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate;
eNB->total_transmitted_bits = eNB->UE_stats[UE_id].total_TBS + eNB->total_transmitted_bits;
//eNB->total_system_throughput = eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput;
for (i=0; i<8; i++)
success = success + (eNB->UE_stats[UE_id].dlsch_trials[i][0] - eNB->UE_stats[UE_id].dlsch_l2_errors[i]);
len += sprintf(&buffer[len],"Total DLSCH %d kbits / %d frames ",(eNB->total_transmitted_bits/1000),proc->frame_tx+1);
len += sprintf(&buffer[len],"Total DLSCH throughput %d kbps ",(eNB->total_dlsch_bitrate/1000));
len += sprintf(&buffer[len],"Total DLSCH trans %d / %d frames\n",success,proc->frame_tx+1);
//len += sprintf(&buffer[len],"[eNB PROC] FULL MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->FULL_MUMIMO_transmissions,eNB->check_for_total_transmissions);
//len += sprintf(&buffer[len],"[eNB PROC] MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_MUMIMO_transmissions,eNB->check_for_total_transmissions);
//len += sprintf(&buffer[len],"[eNB PROC] SU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_SUMIMO_transmissions,eNB->check_for_total_transmissions);
len += sprintf(&buffer[len],"UE %d (%x) Power: (%d,%d) dB, Po_PUSCH: (%d,%d) dBm, Po_PUCCH (%d/%d) dBm, Po_PUCCH1 (%d,%d) dBm, PUCCH1 Thres %d dBm \n",
UE_id,
eNB->UE_stats[UE_id].crnti,
dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[0]),
dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[1]),
eNB->UE_stats[UE_id].UL_rssi[0],
eNB->UE_stats[UE_id].UL_rssi[1],
dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB,
eNB->frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_below/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB,
dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_above/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB,
PUCCH1_THRES+eNB->measurements.n0_power_tot_dBm-dB_fixed(eNB->frame_parms.N_RB_UL));
len+= sprintf(&buffer[len],"DL mcs %d, UL mcs %d, UL rb %d, delta_TF %d, ",
eNB->dlsch[(uint8_t)UE_id][0]->harq_processes[0]->mcs,
eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->mcs,
eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->nb_rb,
eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->delta_TF);
len += sprintf(&buffer[len],"Wideband CQI: (%d,%d) dB\n",
eNB->measurements.wideband_cqi_dB[UE_id][0],
eNB->measurements.wideband_cqi_dB[UE_id][1]);
len += sprintf(&buffer[len],"DL TM %d, DL_cqi %d, DL_pmi_single %jx ",
eNB->transmission_mode[UE_id],
eNB->UE_stats[UE_id].DL_cqi[0],
pmi2hex_2Ar1(eNB->UE_stats[UE_id].DL_pmi_single));
len += sprintf(&buffer[len],"Timing advance %d samples (%d 16Ts), update %d ",
eNB->UE_stats[UE_id].UE_timing_offset,
eNB->UE_stats[UE_id].UE_timing_offset>>2,
eNB->UE_stats[UE_id].timing_advance_update);
len += sprintf(&buffer[len],"Mode = %s(%d) ",
mode_string[eNB->UE_stats[UE_id].mode],
eNB->UE_stats[UE_id].mode);
UE_id_mac = find_UE_id(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti);
if (UE_id_mac != -1) {
RRC_status = mac_eNB_get_rrc_status(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti);
len += sprintf(&buffer[len],"UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status);
} else
len += sprintf(&buffer[len],"UE_id_mac = -1\n");
len += sprintf(&buffer[len],"SR received/total: %d/%d (diff %d)\n",
eNB->UE_stats[UE_id].sr_received,
eNB->UE_stats[UE_id].sr_total,
eNB->UE_stats[UE_id].sr_total-eNB->UE_stats[UE_id].sr_received);
len += sprintf(&buffer[len],"DL Subband CQI: ");
int nb_sb;
switch (eNB->frame_parms.N_RB_DL) {
case 6:
nb_sb=0;
break;
case 15:
nb_sb = 4;
case 25:
nb_sb = 7;
break;
case 50:
nb_sb = 9;
break;
case 75:
nb_sb = 10;
break;
case 100:
nb_sb = 13;
break;
default:
nb_sb=0;
break;
}
for (i=0; i<nb_sb; i++)
len += sprintf(&buffer[len],"%2d ",
eNB->UE_stats[UE_id].DL_subband_cqi[0][i]);
len += sprintf(&buffer[len],"\n");
ulsch_errors = 0;
for (j=0; j<4; j++) {
ulsch_round_attempts[j]=0;
ulsch_round_errors[j]=0;
}
len += sprintf(&buffer[len],"ULSCH errors/attempts per harq (per round): \n");
for (i=0; i<8; i++) {
len += sprintf(&buffer[len]," harq %d: %d/%d (fer %d) (%d/%d, %d/%d, %d/%d, %d/%d) ",
i,
eNB->UE_stats[UE_id].ulsch_errors[i],
eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0],
eNB->UE_stats[UE_id].ulsch_round_fer[i][0],
eNB->UE_stats[UE_id].ulsch_round_errors[i][0],
eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0],
eNB->UE_stats[UE_id].ulsch_round_errors[i][1],
eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][1],
eNB->UE_stats[UE_id].ulsch_round_errors[i][2],
eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][2],
eNB->UE_stats[UE_id].ulsch_round_errors[i][3],
eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][3]);
if ((i&1) == 1)
len += sprintf(&buffer[len],"\n");
ulsch_errors+=eNB->UE_stats[UE_id].ulsch_errors[i];
for (j=0; j<4; j++) {
ulsch_round_attempts[j]+=eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][j];
ulsch_round_errors[j]+=eNB->UE_stats[UE_id].ulsch_round_errors[i][j];
}
}
len += sprintf(&buffer[len],"ULSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d)\n",
ulsch_errors,ulsch_round_attempts[0],
ulsch_round_errors[0],ulsch_round_attempts[0],
ulsch_round_errors[1],ulsch_round_attempts[1],
ulsch_round_errors[2],ulsch_round_attempts[2],
ulsch_round_errors[3],ulsch_round_attempts[3]);
dlsch_errors = 0;
for (j=0; j<4; j++) {
dlsch_round_attempts[j]=0;
dlsch_round_errors[j]=0;
}
len += sprintf(&buffer[len],"DLSCH errors/attempts per harq (per round): \n");
for (i=0; i<8; i++) {
len += sprintf(&buffer[len]," harq %d: %d/%d (%d/%d/%d, %d/%d/%d, %d/%d/%d, %d/%d/%d) ",
i,
eNB->UE_stats[UE_id].dlsch_l2_errors[i],
eNB->UE_stats[UE_id].dlsch_trials[i][0],
eNB->UE_stats[UE_id].dlsch_ACK[i][0],
eNB->UE_stats[UE_id].dlsch_NAK[i][0],
eNB->UE_stats[UE_id].dlsch_trials[i][0],
eNB->UE_stats[UE_id].dlsch_ACK[i][1],
eNB->UE_stats[UE_id].dlsch_NAK[i][1],
eNB->UE_stats[UE_id].dlsch_trials[i][1],
eNB->UE_stats[UE_id].dlsch_ACK[i][2],
eNB->UE_stats[UE_id].dlsch_NAK[i][2],
eNB->UE_stats[UE_id].dlsch_trials[i][2],
eNB->UE_stats[UE_id].dlsch_ACK[i][3],
eNB->UE_stats[UE_id].dlsch_NAK[i][3],
eNB->UE_stats[UE_id].dlsch_trials[i][3]);
if ((i&1) == 1)
len += sprintf(&buffer[len],"\n");
dlsch_errors+=eNB->UE_stats[UE_id].dlsch_l2_errors[i];
for (j=0; j<4; j++) {
dlsch_round_attempts[j]+=eNB->UE_stats[UE_id].dlsch_trials[i][j];
dlsch_round_errors[j]+=eNB->UE_stats[UE_id].dlsch_NAK[i][j];
}
}
len += sprintf(&buffer[len],"DLSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n",
dlsch_errors,dlsch_round_attempts[0],
dlsch_round_errors[0],dlsch_round_attempts[0],
dlsch_round_errors[1],dlsch_round_attempts[1],
dlsch_round_errors[2],dlsch_round_attempts[2],
dlsch_round_errors[3],dlsch_round_attempts[3]);
len += sprintf(&buffer[len],"DLSCH total bits from MAC: %dkbit ",(eNB->UE_stats[UE_id].total_TBS_MAC)/1000);
len += sprintf(&buffer[len],"DLSCH total bits ack'ed: %dkbit ",(eNB->UE_stats[UE_id].total_TBS)/1000);
len += sprintf(&buffer[len],"DLSCH Average throughput (100 frames): %dkbps\n",(eNB->UE_stats[UE_id].dlsch_bitrate/1000));
// len += sprintf(&buffer[len],"[eNB PROC] Transmission Mode %d\n",eNB->transmission_mode[UE_id]);
}
}
len += sprintf(&buffer[len],"\n");
}
len += sprintf(&buffer[len],"EOF\n");
return len;
}
*/
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+276
View File
@@ -0,0 +1,276 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/pucch_common.c
* \brief Top-level routines common to eNB/UE for the PUCCH physical channel V8.6 2009-03
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "T.h"
void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7])
{
uint8_t ns,l,reset=1,i,N_UL_symb;
uint32_t x1,x2,j=0,s=0;
N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6;
x2 = frame_parms->Nid_cell;
for (ns=0; ns<20; ns++) {
for (l=0; l<N_UL_symb; l++) {
ncs_cell[ns][l]=0;
for (i=0; i<8; i++) {
if ((j%32) == 0) {
s = lte_gold_generic(&x1,&x2,reset);
// printf("s %x\n",s);
reset=0;
}
if (((s>>(j%32))&1)==1)
ncs_cell[ns][l] += (1<<i);
j++;
}
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH ncs_cell init (j %d): Ns %d, l %d => ncs_cell %d\n",j,ns,l,ncs_cell[ns][l]);
#endif
}
}
}
int16_t W4[3][4] = {{32767, 32767, 32767, 32767},
{32767,-32768, 32767,-32768},
{32767,-32768,-32768, 32767}
};
int16_t W3_re[3][6] = {{32767, 32767, 32767},
{32767,-16384,-16384},
{32767,-16384,-16384}
};
int16_t W3_im[3][6] = {{0 ,0 ,0 },
{0 , 28377,-28378},
{0 ,-28378, 28377}
};
char *pucch_format_string[] = {
"format 1",
"format 1a",
"format 1b",
"pucch_format1b_csA2",
"pucch_format1b_csA3",
"pucch_format1b_csA4",
"format 2",
"format 2a",
"format 2b",
"pucch_format3"
};
/* PUCCH format3 >> */
#define D_I 0
#define D_Q 1
#define D_IQDATA 2
#define D_NSLT1SF 2
#define D_NSYM1SLT 7
#define D_NSYM1SF 2*7
#define D_NSC1RB 12
#define D_NRB1PUCCH 2
#define D_NPUCCH_SF5 5
#define D_NPUCCH_SF4 4
uint8_t chcod_tbl[128][48] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1},
{0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1},
{1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1},
{0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0},
{0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0},
{1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1},
{1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1},
{0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0},
{0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0},
{1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1},
{1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1},
{0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1},
{1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0},
{1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0},
{0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1},
{0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1},
{1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0},
{1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0},
{0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1},
{0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1},
{1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0},
{0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1},
{0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1},
{1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
{1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0},
{0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1},
{0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1},
{1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0},
{1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0},
{0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1},
{0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1},
{1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0},
{1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1},
{0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1},
{1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0},
{1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0},
{0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1},
{0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
{1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1},
{0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0},
{0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0},
{1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1},
{1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1},
{0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0},
{1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1},
{1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1},
{0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0},
{0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1},
{1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1},
{0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0},
{0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1},
{1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0},
{1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1},
{0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0},
{0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1},
{1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0},
{1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1},
{0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1},
{1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0},
{1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0},
{0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1},
{0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0},
{1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1},
{1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1},
{0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0},
{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1},
{1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1},
{0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1},
{1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1},
{0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0},
{0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0},
{1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1},
{1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1},
{0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0},
{1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1},
{1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1},
{0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0},
{1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1},
{1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1},
{0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0},
{1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1},
{1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1},
{0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0},
{1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1},
{1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1},
{0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1},
{1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0},
{1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1},
{0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1},
{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
{1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1},
{0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
{1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0},
{1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1},
{0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1},
{1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0},
{1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0},
{0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1} };
// W5_TBL
int16_t W5_fmt3_re[5][5] = { {32767, 32767, 32767, 32767, 32767},
{32767, 10125, -26509, -26509, 10125},
{32767, -26509, 10125, 10125, -26509},
{32767, -26509, 10125, 10125, -26509},
{32767, 10125, -26509, -26509, 10125} };
int16_t W5_fmt3_im[5][5] = { {0, 0, 0, 0, 0},
{0, 31163, 19259, -19259, -31163},
{0, 19259, -31163, 31163, -19259},
{0, -19259, 31163, -31163, 19259},
{0, -31163, -19259, 19259, 31163} };
int16_t W4_fmt3[4][4] = { {32767, 32767, 32767, 32767},
{32767, -32767, 32767, -32767},
{32767, 32767, -32767, -32767},
{32767, -32767, -32767, 32767} };
// W2 TBL
int16_t W2[2] = {32767, 32767};
// e^j*pai*floor (ncs_cell(ns,l)/64)/2
int16_t RotTBL_re[4] = {32767, 0, -32767, 0};
int16_t RotTBL_im[4] = {0, 32767, 0, -32767};
//np4_tbl, np5_tbl
uint8_t Np5_TBL[5] = {0, 3, 6, 8, 10};
uint8_t Np4_TBL[4] = {0, 3, 6, 9};
// alpha_TBL
int16_t alphaTBL_re[12] = {32767, 28377, 16383, 0, -16383, -28377, -32767, -28377, -16383, 0, 16383, 28377};
int16_t alphaTBL_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0, -16383, -28377, -32767, -28377, -16383};
-380
View File
@@ -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);
}
@@ -0,0 +1,177 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/transport_commont.h
* \brief data structures for PDSCH/DLSCH/PUSCH/ULSCH physical and transport channel descriptors (TX/RX) common to both eNB/UE
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
* \note
* \warning
*/
#ifndef __TRANSPORT_COMMON__H__
#define __TRANSPORT_COMMON__H__
#include "PHY/defs_common.h"
#include "PHY/impl_defs_lte.h"
#include "dci.h"
#include "mdci.h"
//#include "uci.h"
#ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h"
#endif
#define MOD_TABLE_QPSK_OFFSET 1
#define MOD_TABLE_16QAM_OFFSET 5
#define MOD_TABLE_64QAM_OFFSET 21
#define MOD_TABLE_PSS_OFFSET 85
// structures below implement 36-211 and 36-212
/** @addtogroup _PHY_TRANSPORT_
* @{
*/
#define NSOFT 1827072
#define LTE_NULL 2
// maximum of 3 segments before each coding block if data length exceeds 6144 bits.
#define MAX_NUM_DLSCH_SEGMENTS 16
#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS
#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768)
#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768)
#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
#define MAX_NUM_RE (14*1200)
#if !defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xffff
#endif
#if !defined(M_RNTI)
#define M_RNTI (rnti_t)0xfffd
#endif
#if !defined(P_RNTI)
#define P_RNTI (rnti_t)0xfffe
#endif
#if !defined(CBA_RNTI)
#define CBA_RNTI (rnti_t)0xfff4
#endif
#if !defined(C_RNTI)
#define C_RNTI (rnti_t)0x1234
#endif
// These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211
//1 layer
#define PMI_2A_11 0
#define PMI_2A_1m1 1
#define PMI_2A_1j 2
#define PMI_2A_1mj 3
//2 layers
#define PMI_2A_R1_10 0
#define PMI_2A_R1_11 1
#define PMI_2A_R1_1j 2
typedef enum { SEARCH_EXIST=0,
SEARCH_EXIST_OR_FREE} find_type_t;
typedef enum {
SCH_IDLE=0,
ACTIVE,
CBA_ACTIVE,
DISABLED
} SCH_status_t;
#ifdef Rel14
typedef enum {
CEmodeA = 0,
CEmodeB = 1
} CEmode_t;
#endif
#define PUSCH_x 2
#define PUSCH_y 3
typedef enum {
pucch_format1=0,
pucch_format1a,
pucch_format1b,
pucch_format1b_csA2,
pucch_format1b_csA3,
pucch_format1b_csA4,
pucch_format2,
pucch_format2a,
pucch_format2b,
pucch_format3 // PUCCH format3
} PUCCH_FMT_t;
typedef enum {
SR,
HARQ,
CQI,
HARQ_SR,
HARQ_CQI,
SR_CQI,
HARQ_SR_CQI
} UCI_type_t;
#ifdef Rel14
typedef enum {
NOCE,
CEMODEA,
CEMODEB
} UE_type_t;
#endif
typedef enum {
SI_PDSCH=0,
RA_PDSCH,
P_PDSCH,
PDSCH,
PDSCH1,
PMCH
} PDSCH_t;
typedef enum {
rx_standard=0,
rx_IC_single_stream,
rx_IC_dual_stream,
rx_SIC_dual_stream
} RX_type_t;
typedef enum {
DCI_COMMON_SPACE,
DCI_UE_SPACE
} dci_space_t;
/**@}*/
#endif
@@ -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,93 +425,41 @@ 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;
/// 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 {
SI_PDSCH=0,
RA_PDSCH,
P_PDSCH,
PDSCH,
PDSCH1,
PMCH
} PDSCH_t;
typedef enum {
rx_standard=0,
rx_IC_single_stream,
rx_IC_dual_stream,
rx_SIC_dual_stream
} RX_type_t;
typedef enum {
DCI_COMMON_SPACE,
DCI_UE_SPACE
} dci_space_t;
/**@}*/
#endif
@@ -0,0 +1,601 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/transport_proto.h
* \brief Function prototypes for eNB PHY physical/transport channel processing and generation V8.6 2009-03
* \author R. Knopp, F. Kaltenberger
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __LTE_TRANSPORT_PROTO__H__
#define __LTE_TRANSPORT_PROTO__H__
#include "PHY/defs.h"
#include <math.h>
#include "nfapi_interface.h"
// Functions below implement 36-211 and 36-212
/** @addtogroup _PHY_TRANSPORT_
* @{
*/
/** \fn free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch,unsigned char N_RB_DL)
\brief This function frees memory allocated for a particular DLSCH at eNB
@param dlsch Pointer to DLSCH to be removed
*/
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch);
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
/** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms)
\brief This function allocates structures for a particular DLSCH at eNB
@returns Pointer to DLSCH to be removed
@param Kmimo Kmimo factor from 36-212/36-213
@param Mdlharq Maximum number of HARQ rounds (36-212/36-213)
@param Nsoft Soft-LLR buffer size from UE-Category
@params N_RB_DL total number of resource blocks (determine the operating BW)
@param abstraction_flag Flag to indicate abstracted interface
@param frame_parms Pointer to frame descriptor structure
*/
LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms);
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
/** \fn free_eNB_ulsch(LTE_eNB_DLSCH_t *dlsch)
\brief This function frees memory allocated for a particular ULSCH at eNB
@param ulsch Pointer to ULSCH to be removed
*/
void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch);
LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
/** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t *input_buffer,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe)
\brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are:
- CRC computation and addition
- Code block segmentation and sub-block CRC addition
- Channel coding (Turbo coding)
- Rate matching (sub-block interleaving, bit collection, selection and transmission
- Code block concatenation
@param eNB Pointer to eNB PHY context
@param input_buffer Pointer to input buffer for sub-frame
@param frame_parms Pointer to frame descriptor structure
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch Pointer to dlsch to be encoded
@param frame Frame number
@param subframe Subframe number
@param rm_stats Time statistics for rate-matching
@param te_stats Time statistics for turbo-encoding
@param i_stats Time statistics for interleaving
@returns status
*/
int32_t dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats);
int32_t dlsch_encoding_SIC(PHY_VARS_UE *ue,
uint8_t *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats);
/** \fn dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
uint8_t *input_buffer,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe)
\brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). This version spawns 1 worker thread. The implemented functions are:
- CRC computation and addition
- Code block segmentation and sub-block CRC addition
- Channel coding (Turbo coding)
- Rate matching (sub-block interleaving, bit collection, selection and transmission
- Code block concatenation
@param eNB Pointer to eNB PHY context
@param input_buffer Pointer to input buffer for sub-frame
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch Pointer to dlsch to be encoded
@param frame Frame number
@param subframe Subframe number
@param rm_stats Time statistics for rate-matching
@param te_stats Time statistics for turbo-encoding
@param i_stats Time statistics for interleaving
@returns status
*/
int32_t dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
uint8_t *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats);
// Functions below implement 36-211
/** \fn allocate_REs_in_RB(int32_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
int16_t *qam_table_s,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t use2ndpilots,
LTE_DL_FRAME_PARMS *frame_parms);
\brief Fills RB with data
\param txdataF pointer to output data (frequency domain signal)
\param jj index to output (from CW 1)
\param jj index to output (from CW 2)
\param re_offset index of the first RE of the RB
\param symbol_offset index to the OFDM symbol
\param dlsch0_harq Pointer to Transport block 0 HARQ structure
\param dlsch0_harq Pointer to Transport block 1 HARQ structure
\param pilots =1 if symbol_offset is an OFDM symbol that contains pilots, 0 otherwise
\param amp Amplitude for symbols
\param qam_table_s0 pointer to scaled QAM table for Transport Block 0 (by rho_a or rho_b)
\param qam_table_s1 pointer to scaled QAM table for Transport Block 1 (by rho_a or rho_b)
\param re_allocated pointer to allocation counter
\param skip_dc offset for positive RBs
\param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS
\param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH
\param frame_parms Frame parameter descriptor
*/
int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
int32_t **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t lprime,
uint8_t mprime,
uint8_t Ns,
int *P1_SHIFT,
int *P2_SHIFT);
/** \fn int32_t dlsch_modulation(int32_t **txdataF,
int16_t amp,
uint32_t sub_frame_offset,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch);
\brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for DLSCH.
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param sub_frame_offset Offset of this subframe in units of subframes (usually 0)
@param frame_parms Pointer to frame descriptor
@param num_pdcch_symbols Number of PDCCH symbols in this subframe
@param dlsch0 Pointer to Transport Block 0 DLSCH descriptor for this allocation
@param dlsch1 Pointer to Transport Block 0 DLSCH descriptor for this allocation
*/
int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint32_t sub_frame_offset,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch0,
LTE_eNB_DLSCH_t *dlsch1);
int32_t dlsch_modulation_SIC(int32_t **sic_buffer,
uint32_t sub_frame_offset,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch0,
int G);
/*
\brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH.
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param subframe_offset Offset of this subframe in units of subframes (usually 0)
@param frame_parms Pointer to frame descriptor
@param dlsch Pointer to DLSCH descriptor for this allocation
*/
int mch_modulation(int32_t **txdataF,
int16_t amp,
uint32_t subframe_offset,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_eNB_DLSCH_t *dlsch);
/** \brief Top-level generation function for eNB TX of MBSFN
@param phy_vars_eNB Pointer to eNB variables
@param a Pointer to transport block
@param abstraction_flag
*/
void generate_mch(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t *a);
/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals)
@param phy_vars_eNB Pointer to eNB variables
@param proc Pointer to RXn-TXnp4 proc information
@param mcs MCS for MBSFN
@param ndi new data indicator
@param rdvix
*/
void fill_eNB_dlsch_MCH(PHY_VARS_eNB *phy_vars_eNB,int mcs,int ndi,int rvidx);
/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals)
@param phy_vars_ue Pointer to UE variables
@param mcs MCS for MBSFN
@param eNB_id index of eNB in ue variables
*/
/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals)
for N subframes.
@param phy_vars_eNB Pointer to eNB variables
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param N Number of sub-frames to generate
*/
void generate_pilots(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t N);
/**
\brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) for one slot only
@param phy_vars_eNB Pointer to eNB variables
@param txdataF Table of pointers for frequency-domain TX signals
@param amp Amplitude of signal
@param slot index (0..19)
@param first_pilot_only (0 no)
*/
int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t slot,
int first_pilot_only);
int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
int32_t **txdataF,
int16_t amp);
void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB,
uint8_t UE_id,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti,
uint8_t beamforming_mode);
int32_t generate_pss(int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint16_t l,
uint16_t Ns);
int32_t generate_sss(int32_t **txdataF,
short amp,
LTE_DL_FRAME_PARMS *frame_parms,
unsigned short symbol,
unsigned short slot_offset);
int32_t generate_pbch(LTE_eNB_PBCH *eNB_pbch,
int32_t **txdataF,
int32_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *pbch_pdu,
uint8_t frame_mod4);
/*! \brief DCI Encoding. This routine codes an arbitrary DCI PDU after appending the 8-bit 3GPP CRC. It then applied sub-block interleaving and rate matching.
\param a Pointer to DCI PDU (coded in bytes)
\param A Length of DCI PDU in bits
\param E Length of DCI PDU in coded bits
\param e Pointer to sequence
\param rnti RNTI for CRC scrambling*/
void dci_encoding(uint8_t *a,
uint8_t A,
uint16_t E,
uint8_t *e,
uint16_t rnti);
/*! \brief Top-level DCI entry point. This routine codes an set of DCI PDUs and performs PDCCH modulation, interleaving and mapping.
\param num_dci Number of pdcch symbols
\param num_dci Number of DCI pdus to encode
\param dci_alloc Allocation vectors for each DCI pdu
\param n_rnti n_RNTI (see )
\param amp Amplitude of QPSK symbols
\param frame_parms Pointer to DL Frame parameter structure
\param txdataF Pointer to tx signal buffers
\param sub_frame_offset subframe offset in frame
@returns Number of PDCCH symbols
*/
uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
uint8_t num_dci,
DCI_ALLOC_t *dci_alloc,
uint32_t n_rnti,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint32_t sub_frame_offset);
void generate_64qam_table(void);
void generate_16qam_table(void);
void ulsch_extract_rbs_single(int32_t **rxdataF,
int32_t **rxdataF_ext,
uint32_t first_rb,
uint32_t nb_rb,
uint8_t l,
uint8_t Ns,
LTE_DL_FRAME_PARMS *frame_parms);
void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
int frame,
int subframe,
eNB_rxtx_proc_t *proc,
DCI_ALLOC_t *dci_alloc,
nfapi_dl_config_dci_dl_pdu *pdu);
void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *dci_alloc,nfapi_dl_config_mpdcch_pdu *pdu);
void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,
nfapi_hi_dci0_dci_pdu *pdu);
void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe);
int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB,
unsigned char *rar_pdu,
uint32_t frame,
unsigned char subframe);
int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
eNB_rxtx_proc_t *proc,
void *dci_pdu,
rnti_t rnti,
DCI_format_t dci_format,
uint8_t UE_id,
uint16_t si_rnti,
uint16_t ra_rnti,
uint16_t p_rnti,
uint16_t cba_rnti,
uint8_t use_srs);
void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id,int round);
void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
uint8_t *b,
uint8_t *bt);
void generate_pcfich(uint8_t num_pdcch_symbols,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint8_t subframe);
void init_transport_channels(uint8_t);
void rx_ulsch(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id);
/*!
\brief Decoding of PUSCH/ACK/RI/ACK from 36-212.
@param phy_vars_eNB Pointer to eNB top-level descriptor
@param proc Pointer to RXTX proc variables
@param UE_id ID of UE transmitting this PUSCH
@param subframe Index of subframe for PUSCH
@param control_only_flag Receive PUSCH with control information only
@param Nbundled Nbundled parameter for ACK/NAK scrambling from 36-212/36-213
@param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
@returns 0 on success
*/
unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id,
uint8_t control_only_flag,
uint8_t Nbundled,
uint8_t llr8_flag);
/*!
\brief Decoding of ULSCH data component from 36-212. This one spawns 1 worker thread in parallel,half of the segments in each thread.
@param phy_vars_eNB Pointer to eNB top-level descriptor
@param UE_id ID of UE transmitting this PUSCH
@param harq_pid HARQ process ID
@param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
@returns 0 on success
*/
int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,
int UE_id,
int harq_pid,
int llr8_flag);
/*!
\brief Decoding of ULSCH data component from 36-212. This one is single thread.
@param phy_vars_eNB Pointer to eNB top-level descriptor
@param UE_id ID of UE transmitting this PUSCH
@param harq_pid HARQ process ID
@param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
@returns 0 on success
*/
int ulsch_decoding_data(PHY_VARS_eNB *eNB,
int UE_id,
int harq_pid,
int llr8_flag);
void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
int16_t amp);
void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi);
void pdcch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
int8_t* llr,
uint32_t length);
void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
int mbsfn_flag,
LTE_eNB_DLSCH_t *dlsch,
int hard_pid,
int G,
uint8_t q,
uint16_t frame,
uint8_t Ns);
uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB,
PUCCH_FMT_t fmt,
uint8_t UE_id,
uint16_t n1_pucch,
uint16_t n2_pucch,
uint8_t shortened_format,
uint8_t *payload,
int frame,
uint8_t subframe,
uint8_t pucch1_thres);
/*!
\brief Process PRACH waveform
@param phy_vars_eNB Pointer to eNB top-level descriptor. If NULL, then this is an RRU
@param ru Pointer to RU top-level descriptor. If NULL, then this is an eNB and we make use of the RU_list
@param max_preamble most likely preamble
@param max_preamble_energy Estimated Energy of most likely preamble
@param max_preamble_delay Estimated Delay of most likely preamble
@param Nf System frame number
@param tdd_mapindex Index of PRACH resource in Table 5.7.1-4 (TDD)
@param br_flag indicator to act on eMTC PRACH
@returns 0 on success
*/
void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t Nf, uint8_t tdd_mapindex
#ifdef Rel14
,
uint8_t br_flag
#endif
);
void init_unscrambling_lut(void);
uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2ndpilots);
uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode);
double computeRhoA_eNB(uint8_t pa,
LTE_eNB_DLSCH_t *dlsch_eNB,
int dl_power_off,
uint8_t n_antenna_port);
double computeRhoB_eNB(uint8_t pa,
uint8_t pb,
uint8_t n_antenna_port,
LTE_eNB_DLSCH_t *dlsch_eNB,
int dl_power_off);
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
/**@}*/
#endif
-751
View File
@@ -37,757 +37,6 @@
//#define DEBUG_UCI 1
uint64_t pmi2hex_2Ar1(uint32_t pmi)
{
uint64_t pmil = (uint64_t)pmi;
return ((pmil&3) + (((pmil>>2)&3)<<4) + (((pmil>>4)&3)<<8) + (((pmil>>6)&3)<<12) +
(((pmil>>8)&3)<<16) + (((pmil>>10)&3)<<20) + (((pmil>>12)&3)<<24) +
(((pmil>>14)&3)<<28) + (((pmil>>16)&3)<<32) + (((pmil>>18)&3)<<36) +
(((pmil>>20)&3)<<40) + (((pmil>>22)&3)<<44) + (((pmil>>24)&3)<<48));
}
uint64_t pmi2hex_2Ar2(uint32_t pmi)
{
uint64_t pmil = (uint64_t)pmi;
return ((pmil&1) + (((pmil>>1)&1)<<4) + (((pmil>>2)&1)<<8) + (((pmil>>3)&1)<<12) +
(((pmil>>4)&1)<<16) + (((pmil>>5)&1)<<20) + (((pmil>>6)&1)<<24) +
(((pmil>>7)&1)<<28) + (((pmil>>8)&1)<<32) + (((pmil>>9)&1)<<36) +
(((pmil>>10)&1)<<40) + (((pmil>>11)&1)<<44) + (((pmil>>12)&1)<<48));
}
uint64_t cqi2hex(uint32_t cqi)
{
uint64_t cqil = (uint64_t)cqi;
return ((cqil&3) + (((cqil>>2)&3)<<4) + (((cqil>>4)&3)<<8) + (((cqil>>6)&3)<<12) +
(((cqil>>8)&3)<<16) + (((cqil>>10)&3)<<20) + (((cqil>>12)&3)<<24) +
(((cqil>>14)&3)<<28) + (((cqil>>16)&3)<<32) + (((cqil>>18)&3)<<36) +
(((cqil>>20)&3)<<40) + (((cqil>>22)&3)<<44) + (((cqil>>24)&3)<<48));
}
//void do_diff_cqi(uint8_t N_RB_DL,
// uint8_t *DL_subband_cqi,
// uint8_t DL_cqi,
// uint32_t diffcqi1) {
//
// uint8_t nb_sb,i,offset;
//
// // This is table 7.2.1-3 from 36.213 (with k replaced by the number of subbands, nb_sb)
// switch (N_RB_DL) {
// case 6:
// nb_sb=0;
// break;
// case 15:
// nb_sb = 4;
// case 25:
// nb_sb = 7;
// break;
// case 50:
// nb_sb = 9;
// break;
// case 75:
// nb_sb = 10;
// break;
// case 100:
// nb_sb = 13;
// break;
// default:
// nb_sb=0;
// break;
// }
//
// memset(DL_subband_cqi,0,13);
//
// for (i=0;i<nb_sb;i++) {
// offset = (DL_cqi>>(2*i))&3;
// if (offset == 3)
// DL_subband_cqi[i] = DL_cqi - 1;
// else
// DL_subband_cqi[i] = DL_cqi + offset;
// }
//}
void do_diff_cqi(uint8_t N_RB_DL,
uint8_t *DL_subband_cqi,
uint8_t DL_cqi,
uint32_t diffcqi1)
{
uint8_t nb_sb,i,offset;
// This is table 7.2.1-3 from 36.213 (with k replaced by the number of subbands, nb_sb)
switch (N_RB_DL) {
case 6:
nb_sb=1;
break;
case 15:
nb_sb = 4;
break;
case 25:
nb_sb = 7;
break;
case 50:
nb_sb = 9;
break;
case 75:
nb_sb = 10;
break;
case 100:
nb_sb = 13;
break;
default:
nb_sb=0;
break;
}
memset(DL_subband_cqi,0,13);
for (i=0; i<nb_sb; i++) {
offset = (diffcqi1>>(2*i))&3;
if (offset == 3)
DL_subband_cqi[i] = DL_cqi - 1;
else
DL_subband_cqi[i] = DL_cqi + offset;
}
}
void extract_CQI(void *o,UCI_format_t uci_format,LTE_eNB_UE_stats *stats, uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode)
{
//unsigned char rank;
//UCI_format fmt;
//uint8_t N_RB_DL = 25;
uint8_t i;
LOG_D(PHY,"[eNB][UCI] N_RB_DL %d uci format %d\n", N_RB_DL,uci_format);
switch(N_RB_DL) {
case 6:
switch(uci_format) {
case wideband_cqi_rank1_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi;
break;
case wideband_cqi_rank2_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi;
break;
case HLC_subband_cqi_nopmi:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_1_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_1_5MHz *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1));
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi;
break;
case unknown_cqi:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL);
break;
}
break;
case 25:
switch(uci_format) {
case wideband_cqi_rank1_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz *)o)->pmi;
break;
case wideband_cqi_rank2_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi;
//this translates the 2-layer PMI into a single layer PMI for the first codeword
//the PMI for the second codeword will be stats->DL_pmi_single^0x1555
stats->DL_pmi_single = 0;
for (i=0;i<7;i++)
stats->DL_pmi_single = stats->DL_pmi_single | (((stats->DL_pmi_dual&(1<i))>>i)*2)<<2*i;
break;
case HLC_subband_cqi_nopmi:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi;
break;
case unknown_cqi:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL);
break;
}
break;
case 50:
switch(uci_format) {
case wideband_cqi_rank1_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_10MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_10MHz *)o)->pmi;
break;
case wideband_cqi_rank2_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_10MHz *)o)->pmi;
break;
case HLC_subband_cqi_nopmi:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_10MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_10MHz *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_10MHz *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1));
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi;
break;
case unknown_cqi:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
break;
}
break;
case 100:
switch(uci_format) {
case wideband_cqi_rank1_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_20MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_20MHz *)o)->pmi;
break;
case wideband_cqi_rank2_2A:
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_20MHz *)o)->pmi;
break;
case HLC_subband_cqi_nopmi:
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_20MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_20MHz *)o)->diffcqi1);
break;
case HLC_subband_cqi_rank1_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_20MHz *)o)->pmi;
break;
case HLC_subband_cqi_rank2_2A:
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 24)
stats->DL_cqi[0] = 24;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 24)
stats->DL_cqi[1] = 24;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1));
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi;
break;
case unknown_cqi:
default:
LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL);
break;
}
break;
default:
LOG_N(PHY,"[eNB][UCI] unknown RB %d\n",N_RB_DL);
break;
}
/*
switch (tmode) {
case 1:
case 2:
case 3:
case 5:
case 6:
case 7:
default:
fmt = hlc_cqi;
break;
case 4:
fmt = wideband_cqi;
break;
}
rank = o_RI[0];
//printf("extract_CQI: rank = %d\n",rank);
switch (fmt) {
case wideband_cqi: //and subband pmi
if (rank == 0) {
stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 15)
stats->DL_cqi[0] = 15;
stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz *)o)->pmi;
}
else {
stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 15)
stats->DL_cqi[0] = 15;
stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 15)
stats->DL_cqi[1] = 15;
stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi;
}
break;
case hlc_cqi:
if (tmode > 2) {
if (rank == 0) {
stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 15)
stats->DL_cqi[0] = 15;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi;
}
else {
stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 15)
stats->DL_cqi[0] = 15;
stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
if (stats->DL_cqi[1] > 15)
stats->DL_cqi[1] = 15;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi;
}
}
else {
stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1);
if (stats->DL_cqi[0] > 15)
stats->DL_cqi[0] = 15;
do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1);
}
break;
default:
break;
}
*/
}
void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
{
switch(uci_format) {
case wideband_cqi_rank1_2A:
#ifdef DEBUG_UCI
LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA);
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi));
break;
case 25:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_5MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi));
break;
case 50:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_10MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_10MHz *)o)->pmi));
break;
case 100:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_20MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_20MHz *)o)->pmi));
break;
}
#endif //DEBUG_UCI
break;
case wideband_cqi_rank2_2A:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi));
break;
case 25:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi));
break;
case 50:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_10MHz *)o)->pmi));
break;
case 100:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_20MHz *)o)->pmi));
break;
}
#endif //DEBUG_UCI
break;
case HLC_subband_cqi_nopmi:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1));
break;
case 25:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
break;
case 50:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1));
break;
case 100:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1));
break;
}
#endif //DEBUG_UCI
break;
case HLC_subband_cqi_rank1_2A:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
case 25:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
case 50:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
case 100:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
}
#endif //DEBUG_UCI
break;
case HLC_subband_cqi_rank2_2A:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi);
break;
case 25:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi);
break;
case 50:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi);
break;
case 100:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi);
break;
}
#endif //DEBUG_UCI
break;
case ue_selected:
#ifdef DEBUG_UCI
LOG_W(PHY,"[PRINT CQI] ue_selected CQI not supported yet!!!\n");
#endif //DEBUG_UCI
break;
default:
#ifdef DEBUG_UCI
LOG_E(PHY,"[PRINT CQI] unsupported CQI mode (%d)!!!\n",uci_format);
#endif //DEBUG_UCI
break;
}
/*
switch (tmode) {
case 1:
case 2:
case 3:
case 5:
case 6:
case 7:
default:
fmt = hlc_cqi;
break;
case 4:
fmt = wideband_cqi;
break;
}
switch (fmt) {
case wideband_cqi:
if (rank == 0) {
#ifdef DEBUG_UCI
msg("[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
msg("[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,((wideband_cqi_rank1_2A_5MHz *)o)->pmi,pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi));
#endif //DEBUG_UCI
}
else {
#ifdef DEBUG_UCI
msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi));
#endif //DEBUG_UCI
}
break;
case hlc_cqi:
if (tmode > 2) {
if (rank == 0) {
#ifdef DEBUG_UCI
msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
#endif //DEBUG_UCI
}
else {
#ifdef DEBUG_UCI
msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi);
#endif //DEBUG_UCI
}
}
else {
#ifdef DEBUG_UCI
msg("[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
msg("[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
#endif //DEBUG_UCI
}
break;
case ue_selected:
#ifdef DEBUG_UCI
msg("dci_tools.c: print_CQI ue_selected CQI not supported yet!!!\n");
#endif //DEBUG_UCI
break;
}
*/
}
int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
uint8_t i;
-115
View File
@@ -72,29 +72,7 @@ void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
//#endif
}
void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
uint8_t *b,
uint8_t *bt)
{
uint32_t i;
uint8_t reset;
uint32_t x1, x2, s=0;
reset = 1;
// x1 is set in lte_gold_generic
x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1
for (i=0; i<32; i++) {
if ((i&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
//printf("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
bt[i] = (b[i]&1) ^ ((s>>(i&0x1f))&1);
}
}
void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
@@ -122,99 +100,6 @@ void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
}
}
uint8_t pcfich_b[4][32]= {{0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1},
{1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0},
{1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
void generate_pcfich(uint8_t num_pdcch_symbols,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **txdataF,
uint8_t subframe)
{
uint8_t pcfich_bt[32],nsymb,pcfich_quad;
int32_t pcfich_d[2][16];
uint8_t i;
uint32_t symbol_offset,m,re_offset,reg_offset;
int16_t gain_lin_QPSK;
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
int nushiftmod3 = frame_parms->nushift%3;
#ifdef DEBUG_PCFICH
LOG_D(PHY,"Generating PCFICH in subfrmae %d for %d PDCCH symbols, AMP %d, p %d, Ncp %d\n",
subframe,num_pdcch_symbols,amp,frame_parms->nb_antenna_ports_eNB,frame_parms->Ncp);
#endif
// scrambling
if ((num_pdcch_symbols>0) && (num_pdcch_symbols<4))
pcfich_scrambling(frame_parms,subframe,pcfich_b[num_pdcch_symbols-1],pcfich_bt);
// modulation
if (frame_parms->nb_antenna_ports_eNB==1)
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
else
gain_lin_QPSK = amp/2;
if (frame_parms->nb_antenna_ports_eNB==1) { // SISO
for (i=0; i<16; i++) {
((int16_t*)(&(pcfich_d[0][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
((int16_t*)(&(pcfich_d[1][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
((int16_t*)(&(pcfich_d[0][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
((int16_t*)(&(pcfich_d[1][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
}
} else { // ALAMOUTI
for (i=0; i<16; i+=2) {
// first antenna position n -> x0
((int16_t*)(&(pcfich_d[0][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
((int16_t*)(&(pcfich_d[0][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
// second antenna position n -> -x1*
((int16_t*)(&(pcfich_d[1][i])))[0] = ((pcfich_bt[2*i+2] == 1) ? gain_lin_QPSK : -gain_lin_QPSK);
((int16_t*)(&(pcfich_d[1][i])))[1] = ((pcfich_bt[2*i+3] == 1) ? -gain_lin_QPSK : gain_lin_QPSK);
// fill in the rest of the ALAMOUTI precoding
((int16_t*)&pcfich_d[0][i+1])[0] = -((int16_t*)&pcfich_d[1][i])[0];
((int16_t*)&pcfich_d[0][i+1])[1] = ((int16_t*)&pcfich_d[1][i])[1];
((int16_t*)&pcfich_d[1][i+1])[0] = ((int16_t*)&pcfich_d[0][i])[0];
((int16_t*)&pcfich_d[1][i+1])[1] = -((int16_t*)&pcfich_d[0][i])[1];
}
}
// mapping
nsymb = (frame_parms->Ncp==0) ? 14:12;
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(subframe*nsymb);
re_offset = frame_parms->first_carrier_offset;
// loop over 4 quadruplets and lookup REGs
m=0;
for (pcfich_quad=0; pcfich_quad<4; pcfich_quad++) {
reg_offset = re_offset+((uint16_t)pcfich_reg[pcfich_quad]*6);
if (reg_offset>=frame_parms->ofdm_symbol_size)
reg_offset=1 + reg_offset-frame_parms->ofdm_symbol_size;
for (i=0; i<6; i++) {
if ((i!=nushiftmod3)&&(i!=(nushiftmod3+3))) {
txdataF[0][symbol_offset+reg_offset+i] = pcfich_d[0][m];
if (frame_parms->nb_antenna_ports_eNB>1)
txdataF[1][symbol_offset+reg_offset+i] = pcfich_d[1][m];
m++;
}
}
}
}
uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t subframe,
LTE_UE_PDCCH *lte_ue_pdcch_vars,
-737
View File
@@ -400,671 +400,6 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
} // num_pdcch_symbols loop
void generate_phich_emul(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t HI,
uint8_t subframe)
{
}
int32_t alam_bpsk_perm1[4] = {2,1,4,3}; // -conj(x) 1 (-1-j) -> 2 (1-j), 2->1, 3 (-1+j) -> (4) 1+j, 4->3
int32_t alam_bpsk_perm2[4] = {3,4,2,1}; // conj(x) 1 (-1-j) -> 3 (-1+j), 3->1, 2 (1-j) -> 4 (1+j), 4->2
// This routine generates the PHICH
void generate_phich(LTE_DL_FRAME_PARMS *frame_parms,
int16_t amp,
uint8_t nseq_PHICH,
uint8_t ngroup_PHICH,
uint8_t HI,
uint8_t subframe,
int32_t **y)
{
int16_t d[24],*dp;
// unsigned int i,aa;
unsigned int re_offset;
int16_t y0_16[8],y1_16[8];
int16_t *y0,*y1;
// scrambling
uint32_t x1, x2, s=0;
uint8_t reset = 1;
int16_t cs[12];
uint32_t i,i2,i3,m,j;
int16_t gain_lin_QPSK;
uint32_t subframe_offset=((frame_parms->Ncp==0)?14:12)*frame_parms->ofdm_symbol_size*subframe;
memset(d,0,24*sizeof(int16_t));
if (frame_parms->nb_antenna_ports_eNB==1)
gain_lin_QPSK = (int16_t)(((int32_t)amp*ONE_OVER_SQRT2_Q15)>>15);
else
gain_lin_QPSK = amp/2;
//printf("PHICH : gain_lin_QPSK %d\n",gain_lin_QPSK);
// BPSK modulation of HI input (to be repeated 3 times, 36-212 Section 5.3.5, p. 56 in v8.6)
if (HI>0)
HI=1;
// c = (1-(2*HI))*SSS_AMP;
// x1 is set in lte_gold_generic
x2 = (((subframe+1)*((frame_parms->Nid_cell<<1)+1))<<9) + frame_parms->Nid_cell;
s = lte_gold_generic(&x1, &x2, reset);
// compute scrambling sequence
for (i=0; i<12; i++) {
cs[i] = (uint8_t)((s>>(i&0x1f))&1);
cs[i] = (cs[i] == 0) ? (1-(HI<<1)) : ((HI<<1)-1);
}
if (frame_parms->Ncp == 0) { // Normal Cyclic Prefix
// printf("Doing PHICH : Normal CP, subframe %d\n",subframe);
// 12 output symbols (Msymb)
for (i=0,i2=0,i3=0; i<3; i++,i2+=4,i3+=8) {
switch (nseq_PHICH) {
case 0: // +1 +1 +1 +1
d[i3] = cs[i2];
d[1+i3] = cs[i2];
d[2+i3] = cs[1+i2];
d[3+i3] = cs[1+i2];
d[4+i3] = cs[2+i2];
d[5+i3] = cs[2+i2];
d[6+i3] = cs[3+i2];
d[7+i3] = cs[3+i2];
break;
case 1: // +1 -1 +1 -1
d[i3] = cs[i2];
d[1+i3] = cs[i2];
d[2+i3] = -cs[1+i2];
d[3+i3] = -cs[1+i2];
d[4+i3] = cs[2+i2];
d[5+i3] = cs[2+i2];
d[6+i3] = -cs[3+i2];
d[7+i3] = -cs[3+i2];
break;
case 2: // +1 +1 -1 -1
d[i3] = cs[i2];
d[1+i3] = cs[i2];
d[2+i3] = cs[1+i2];
d[3+i3] = cs[1+i2];
d[4+i3] = -cs[2+i2];
d[5+i3] = -cs[2+i2];
d[6+i3] = -cs[3+i2];
d[7+i3] = -cs[3+i2];
break;
case 3: // +1 -1 -1 +1
d[i3] = cs[i2];
d[1+i3] = cs[i2];
d[2+i3] = -cs[1+i2];
d[3+i3] = -cs[1+i2];
d[4+i3] = -cs[2+i2];
d[5+i3] = -cs[2+i2];
d[6+i3] = cs[3+i2];
d[7+i3] = cs[3+i2];
break;
case 4: // +j +j +j +j
d[i3] = -cs[i2];
d[1+i3] = cs[i2];
d[2+i3] = -cs[1+i2];
d[3+i3] = cs[1+i2];
d[4+i3] = -cs[2+i2];
d[5+i3] = cs[2+i2];
d[6+i3] = -cs[3+i2];
d[7+i3] = cs[3+i2];
break;
case 5: // +j -j +j -j
d[1+i3] = cs[i2];
d[3+i3] = -cs[1+i2];
d[5+i3] = cs[2+i2];
d[7+i3] = -cs[3+i2];
d[i3] = -cs[i2];
d[2+i3] = cs[1+i2];
d[4+i3] = -cs[2+i2];
d[6+i3] = cs[3+i2];
break;
case 6: // +j +j -j -j
d[1+i3] = cs[i2];
d[3+i3] = cs[1+i2];
d[5+i3] = -cs[2+i2];
d[7+i3] = -cs[3+i2];
d[i3] = -cs[i2];
d[2+i3] = -cs[1+i2];
d[4+i3] = cs[2+i2];
d[6+i3] = cs[3+i2];
break;
case 7: // +j -j -j +j
d[1+i3] = cs[i2];
d[3+i3] = -cs[1+i2];
d[5+i3] = -cs[2+i2];
d[7+i3] = cs[3+i2];
d[i3] = -cs[i2];
d[2+i3] = cs[1+i2];
d[4+i3] = cs[2+i2];
d[6+i3] = -cs[3+i2];
break;
default:
AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n");
} // nseq_PHICH
}
#ifdef DEBUG_PHICH
LOG_D(PHY,"[PUSCH 0]PHICH d = ");
for (i=0; i<24; i+=2)
LOG_D(PHY,"(%d,%d)",d[i],d[i+1]);
LOG_D(PHY,"\n");
#endif
// modulation here
if (frame_parms->nb_antenna_ports_eNB != 1) {
// do Alamouti precoding here
// Symbol 0
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y1 = (int16_t*)&y[1][re_offset+subframe_offset];
// first antenna position n -> x0
y0_16[0] = d[0]*gain_lin_QPSK;
y0_16[1] = d[1]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[0] = -d[2]*gain_lin_QPSK;
y1_16[1] = d[3]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[2] = -y1_16[0];
y0_16[3] = y1_16[1];
y1_16[2] = y0_16[0];
y1_16[3] = -y0_16[1];
// first antenna position n -> x0
y0_16[4] = d[4]*gain_lin_QPSK;
y0_16[5] = d[5]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[4] = -d[6]*gain_lin_QPSK;
y1_16[5] = d[7]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[6] = -y1_16[4];
y0_16[7] = y1_16[5];
y1_16[6] = y0_16[4];
y1_16[7] = -y0_16[5];
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m];
y1[j] += y1_16[m++];
y0[j+1] += y0_16[m];
y1[j+1] += y1_16[m++];
}
}
// Symbol 1
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]*6);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y1 = (int16_t*)&y[1][re_offset+subframe_offset];
// first antenna position n -> x0
y0_16[0] = d[8]*gain_lin_QPSK;
y0_16[1] = d[9]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[0] = -d[10]*gain_lin_QPSK;
y1_16[1] = d[11]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[2] = -y1_16[0];
y0_16[3] = y1_16[1];
y1_16[2] = y0_16[0];
y1_16[3] = -y0_16[1];
// first antenna position n -> x0
y0_16[4] = d[12]*gain_lin_QPSK;
y0_16[5] = d[13]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[4] = -d[14]*gain_lin_QPSK;
y1_16[5] = d[15]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[6] = -y1_16[4];
y0_16[7] = y1_16[5];
y1_16[6] = y0_16[4];
y1_16[7] = -y0_16[5];
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m];
y1[j] += y1_16[m++];
y0[j+1] += y0_16[m];
y1[j+1] += y1_16[m++];
}
}
// Symbol 2
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]*6);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y1 = (int16_t*)&y[1][re_offset+subframe_offset];
// first antenna position n -> x0
y0_16[0] = d[16]*gain_lin_QPSK;
y0_16[1] = d[17]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[0] = -d[18]*gain_lin_QPSK;
y1_16[1] = d[19]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[2] = -y1_16[0];
y0_16[3] = y1_16[1];
y1_16[2] = y0_16[0];
y1_16[3] = -y0_16[1];
// first antenna position n -> x0
y0_16[4] = d[20]*gain_lin_QPSK;
y0_16[5] = d[21]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[4] = -d[22]*gain_lin_QPSK;
y1_16[5] = d[23]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[6] = -y1_16[4];
y0_16[7] = y1_16[5];
y1_16[6] = y0_16[4];
y1_16[7] = -y0_16[5];
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m];
y1[j] += y1_16[m++];
y0[j+1] += y0_16[m];
y1[j+1] += y1_16[m++];
}
}
} // nb_antenna_ports_eNB
else {
// Symbol 0
// printf("[PUSCH 0]PHICH REG %d\n",frame_parms->phich_reg[ngroup_PHICH][0]);
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
// printf("y0 %p\n",y0);
y0_16[0] = d[0]*gain_lin_QPSK;
y0_16[1] = d[1]*gain_lin_QPSK;
y0_16[2] = d[2]*gain_lin_QPSK;
y0_16[3] = d[3]*gain_lin_QPSK;
y0_16[4] = d[4]*gain_lin_QPSK;
y0_16[5] = d[5]*gain_lin_QPSK;
y0_16[6] = d[6]*gain_lin_QPSK;
y0_16[7] = d[7]*gain_lin_QPSK;
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m++];
y0[j+1] += y0_16[m++];
}
}
// Symbol 1
// printf("[PUSCH 0]PHICH REG %d\n",frame_parms->phich_reg[ngroup_PHICH][1]);
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]*6);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y0_16[0] = d[8]*gain_lin_QPSK;
y0_16[1] = d[9]*gain_lin_QPSK;
y0_16[2] = d[10]*gain_lin_QPSK;
y0_16[3] = d[11]*gain_lin_QPSK;
y0_16[4] = d[12]*gain_lin_QPSK;
y0_16[5] = d[13]*gain_lin_QPSK;
y0_16[6] = d[14]*gain_lin_QPSK;
y0_16[7] = d[15]*gain_lin_QPSK;
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m++];
y0[j+1] += y0_16[m++];
}
}
// Symbol 2
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]*6);
// printf("[PUSCH 0]PHICH REG %d\n",frame_parms->phich_reg[ngroup_PHICH][2]);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y0_16[0] = d[16]*gain_lin_QPSK;
y0_16[1] = d[17]*gain_lin_QPSK;
y0_16[2] = d[18]*gain_lin_QPSK;
y0_16[3] = d[19]*gain_lin_QPSK;
y0_16[4] = d[20]*gain_lin_QPSK;
y0_16[5] = d[21]*gain_lin_QPSK;
y0_16[6] = d[22]*gain_lin_QPSK;
y0_16[7] = d[23]*gain_lin_QPSK;
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m++];
y0[j+1] += y0_16[m++];
}
}
/*
for (i=0;i<512;i++)
printf("re %d (%d): %d,%d\n",i,subframe_offset+i,((int16_t*)&y[0][subframe_offset+i])[0],((int16_t*)&y[0][subframe_offset+i])[1]);
*/
} // nb_antenna_ports_eNB
} else { // extended prefix
// 6 output symbols
if ((ngroup_PHICH & 1) == 1)
dp = &d[4];
else
dp = d;
switch (nseq_PHICH) {
case 0: // +1 +1
dp[0] = cs[0];
dp[2] = cs[1];
dp[8] = cs[2];
dp[10] = cs[3];
dp[16] = cs[4];
dp[18] = cs[5];
dp[1] = cs[0];
dp[3] = cs[1];
dp[9] = cs[2];
dp[11] = cs[3];
dp[17] = cs[4];
dp[19] = cs[5];
break;
case 1: // +1 -1
dp[0] = cs[0];
dp[2] = -cs[1];
dp[8] = cs[2];
dp[10] = -cs[3];
dp[16] = cs[4];
dp[18] = -cs[5];
dp[1] = cs[0];
dp[3] = -cs[1];
dp[9] = cs[2];
dp[11] = -cs[3];
dp[17] = cs[4];
dp[19] = -cs[5];
break;
case 2: // +j +j
dp[1] = cs[0];
dp[3] = cs[1];
dp[9] = cs[2];
dp[11] = cs[3];
dp[17] = cs[4];
dp[19] = cs[5];
dp[0] = -cs[0];
dp[2] = -cs[1];
dp[8] = -cs[2];
dp[10] = -cs[3];
dp[16] = -cs[4];
dp[18] = -cs[5];
break;
case 3: // +j -j
dp[1] = cs[0];
dp[3] = -cs[1];
dp[9] = cs[2];
dp[11] = -cs[3];
dp[17] = cs[4];
dp[19] = -cs[5];
dp[0] = -cs[0];
dp[2] = cs[1];
dp[8] = -cs[2];
dp[10] = cs[3];
dp[16] = -cs[4];
dp[18] = cs[5];
break;
default:
AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n");
}
if (frame_parms->nb_antenna_ports_eNB != 1) {
// do Alamouti precoding here
// Symbol 0
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y1 = (int16_t*)&y[1][re_offset+subframe_offset];
// first antenna position n -> x0
y0_16[0] = d[0]*gain_lin_QPSK;
y0_16[1] = d[1]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[0] = -d[2]*gain_lin_QPSK;
y1_16[1] = d[3]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[2] = -y1_16[0];
y0_16[3] = y1_16[1];
y1_16[2] = y0_16[0];
y1_16[3] = -y0_16[1];
// first antenna position n -> x0
y0_16[4] = d[4]*gain_lin_QPSK;
y0_16[5] = d[5]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[4] = -d[6]*gain_lin_QPSK;
y1_16[5] = d[7]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[6] = -y1_16[4];
y0_16[7] = y1_16[5];
y1_16[6] = y0_16[4];
y1_16[7] = -y0_16[5];
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m];
y1[j] += y1_16[m++];
y0[j+1] += y0_16[m];
y1[j+1] += y1_16[m++];
}
}
// Symbol 1
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]<<2);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
re_offset += (frame_parms->ofdm_symbol_size);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y1 = (int16_t*)&y[1][re_offset+subframe_offset];
// first antenna position n -> x0
y0_16[0] = d[8]*gain_lin_QPSK;
y0_16[1] = d[9]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[0] = -d[10]*gain_lin_QPSK;
y1_16[1] = d[11]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[2] = -y1_16[0];
y0_16[3] = y1_16[1];
y1_16[2] = y0_16[0];
y1_16[3] = -y0_16[1];
// first antenna position n -> x0
y0_16[4] = d[12]*gain_lin_QPSK;
y0_16[5] = d[13]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[4] = -d[14]*gain_lin_QPSK;
y1_16[5] = d[15]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[6] = -y1_16[4];
y0_16[7] = y1_16[5];
y1_16[6] = y0_16[4];
y1_16[7] = -y0_16[5];
for (i=0,j=0,m=0; i<4; i++,j+=2) {
y0[j] += y0_16[m];
y1[j] += y1_16[m++];
y0[j+1] += y0_16[m];
y1[j+1] += y1_16[m++];
}
// Symbol 2
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]<<2);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
re_offset += (frame_parms->ofdm_symbol_size<<1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y1 = (int16_t*)&y[1][re_offset+subframe_offset];
// first antenna position n -> x0
y0_16[0] = d[16]*gain_lin_QPSK;
y0_16[1] = d[17]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[0] = -d[18]*gain_lin_QPSK;
y1_16[1] = d[19]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[2] = -y1_16[0];
y0_16[3] = y1_16[1];
y1_16[2] = y0_16[0];
y1_16[3] = -y0_16[1];
// first antenna position n -> x0
y0_16[4] = d[20]*gain_lin_QPSK;
y0_16[5] = d[21]*gain_lin_QPSK;
// second antenna position n -> -x1*
y1_16[4] = -d[22]*gain_lin_QPSK;
y1_16[5] = d[23]*gain_lin_QPSK;
// fill in the rest of the ALAMOUTI precoding
y0_16[6] = -y1_16[4];
y0_16[7] = y1_16[5];
y1_16[6] = y0_16[4];
y1_16[7] = -y0_16[5];
for (i=0,j=0,m=0; i<4; i++,j+=2) {
y0[j] += y0_16[m];
y1[j] += y1_16[m++];
y0[j+1] += y0_16[m];
y1[j+1] += y1_16[m++];
}
} else {
// Symbol 0
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y0_16[0] = d[0]*gain_lin_QPSK;
y0_16[1] = d[1]*gain_lin_QPSK;
y0_16[2] = d[2]*gain_lin_QPSK;
y0_16[3] = d[3]*gain_lin_QPSK;
y0_16[4] = d[4]*gain_lin_QPSK;
y0_16[5] = d[5]*gain_lin_QPSK;
y0_16[6] = d[6]*gain_lin_QPSK;
y0_16[7] = d[7]*gain_lin_QPSK;
for (i=0,j=0,m=0; i<6; i++,j+=2) {
if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) {
y0[j] += y0_16[m++];
y0[j+1] += y0_16[m++];
}
}
// Symbol 1
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]<<2);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
re_offset += (frame_parms->ofdm_symbol_size);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y0_16[0] = d[8]*gain_lin_QPSK;
y0_16[1] = d[9]*gain_lin_QPSK;
y0_16[2] = d[10]*gain_lin_QPSK;
y0_16[3] = d[11]*gain_lin_QPSK;
y0_16[4] = d[12]*gain_lin_QPSK;
y0_16[5] = d[13]*gain_lin_QPSK;
y0_16[6] = d[14]*gain_lin_QPSK;
y0_16[7] = d[15]*gain_lin_QPSK;
for (i=0,j=0,m=0; i<4; i++,j+=2) {
y0[j] += y0_16[m++];
y0[j+1] += y0_16[m++];
}
// Symbol 2
re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]<<2);
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size-1);
re_offset += (frame_parms->ofdm_symbol_size<<1);
y0 = (int16_t*)&y[0][re_offset+subframe_offset];
y0_16[0] = d[16]*gain_lin_QPSK;
y0_16[1] = d[17]*gain_lin_QPSK;
y0_16[2] = d[18]*gain_lin_QPSK;
y0_16[3] = d[19]*gain_lin_QPSK;
y0_16[4] = d[20]*gain_lin_QPSK;
y0_16[5] = d[21]*gain_lin_QPSK;
y0_16[6] = d[22]*gain_lin_QPSK;
y0_16[7] = d[23]*gain_lin_QPSK;
for (i=0,j=0,m=0; i<4; i++) {
y0[j] += y0_16[m++];
y0[j+1] += y0_16[m++];
}
} // nb_antenna_ports_eNB
} // normal/extended prefix
}
// This routine demodulates the PHICH and updates PUSCH/ULSCH parameters
void rx_phich(PHY_VARS_UE *ue,
@@ -1496,75 +831,3 @@ void rx_phich(PHY_VARS_UE *ue,
}
void generate_phich_top(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
int16_t amp)
{
LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms;
int32_t **txdataF = eNB->common_vars.txdataF;
uint8_t harq_pid;
uint8_t Ngroup_PHICH,ngroup_PHICH,nseq_PHICH;
uint8_t NSF_PHICH = 4;
uint8_t pusch_subframe;
uint8_t i;
uint32_t pusch_frame;
int subframe = proc->subframe_tx;
phich_config_t *phich;
// compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211
Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48;
if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0)
Ngroup_PHICH++;
if (frame_parms->Ncp == 1)
NSF_PHICH = 2;
if (eNB->phich_vars[subframe&1].num_hi > 0) {
pusch_frame = phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe);
pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe);
}
for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) {
phich = &eNB->phich_vars[subframe&1].config[i];
ngroup_PHICH = (phich->first_rb +
phich->n_DMRS)%Ngroup_PHICH;
if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == TDD) ) {
if ((pusch_subframe == 4) || (pusch_subframe == 9))
ngroup_PHICH += Ngroup_PHICH;
}
nseq_PHICH = ((phich->first_rb/Ngroup_PHICH) +
phich->n_DMRS)%(2*NSF_PHICH);
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, AMP %d ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d)\n",
eNB->Mod_id,harq_pid,proc->frame_tx,
subframe,amp,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
phich->hi,
phich->first_rb);
T(T_ENB_PHY_PHICH, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(subframe),
T_INT(-1 /* TODO: rnti */), T_INT(harq_pid),
T_INT(Ngroup_PHICH), T_INT(NSF_PHICH),
T_INT(ngroup_PHICH), T_INT(nseq_PHICH),
T_INT(phich->hi),
T_INT(phich->first_rb),
T_INT(phich->n_DMRS));
generate_phich(frame_parms,
amp,//amp*2,
nseq_PHICH,
ngroup_PHICH,
phich->hi,
subframe,
txdataF);
}// for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) {
eNB->phich_vars[subframe&1].num_hi=0;
}
+1 -106
View File
@@ -184,56 +184,6 @@ int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_par
return(0);
}
void fill_eNB_dlsch_MCH(PHY_VARS_eNB *eNB,int mcs,int ndi,int rvidx)
{
LTE_eNB_DLSCH_t *dlsch = eNB->dlsch_MCH;
LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms;
// dlsch->rnti = M_RNTI;
dlsch->harq_processes[0]->mcs = mcs;
// dlsch->harq_processes[0]->Ndi = ndi;
dlsch->harq_processes[0]->rvidx = rvidx;
dlsch->harq_processes[0]->Nl = 1;
dlsch->harq_processes[0]->TBS = TBStable[get_I_TBS(dlsch->harq_processes[0]->mcs)][frame_parms->N_RB_DL-1];
// dlsch->harq_ids[subframe] = 0;
dlsch->harq_processes[0]->nb_rb = frame_parms->N_RB_DL;
switch(frame_parms->N_RB_DL) {
case 6:
dlsch->harq_processes[0]->rb_alloc[0] = 0x3f;
break;
case 25:
dlsch->harq_processes[0]->rb_alloc[0] = 0x1ffffff;
break;
case 50:
dlsch->harq_processes[0]->rb_alloc[0] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc[1] = 0x3ffff;
break;
case 100:
dlsch->harq_processes[0]->rb_alloc[0] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc[1] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc[2] = 0xffffffff;
dlsch->harq_processes[0]->rb_alloc[3] = 0xf;
break;
}
if (eNB->abstraction_flag) {
eNB_transport_info[eNB->Mod_id][eNB->CC_id].cntl.pmch_flag=1;
eNB_transport_info[eNB->Mod_id][eNB->CC_id].num_pmch=1; // assumption: there is always one pmch in each SF
eNB_transport_info[eNB->Mod_id][eNB->CC_id].num_common_dci=0;
eNB_transport_info[eNB->Mod_id][eNB->CC_id].num_ue_spec_dci=0;
eNB_transport_info[eNB->Mod_id][eNB->CC_id].dlsch_type[0]=5;// put at the reserved position for PMCH
eNB_transport_info[eNB->Mod_id][eNB->CC_id].harq_pid[0]=0;
eNB_transport_info[eNB->Mod_id][eNB->CC_id].ue_id[0]=255;//broadcast
eNB_transport_info[eNB->Mod_id][eNB->CC_id].tbs[0]=dlsch->harq_processes[0]->TBS>>3;
}
}
void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id)
{
@@ -280,62 +230,7 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id)
}
}
void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a)
{
int G;
int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
if (eNB->abstraction_flag != 0) {
if (eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]!=0)
printf("[PHY][EMU] PMCH transport block position is different than zero %d \n", eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]);
memcpy(eNB->dlsch_MCH->harq_processes[0]->b,
a,
eNB->dlsch_MCH->harq_processes[0]->TBS>>3);
LOG_D(PHY, "[eNB %d] dlsch_encoding_emul pmch , tbs is %d \n",
eNB->Mod_id,
eNB->dlsch_MCH->harq_processes[0]->TBS>>3);
memcpy(&eNB_transport_info[eNB->Mod_id][eNB->CC_id].transport_blocks[eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]],
a,
eNB->dlsch_MCH->harq_processes[0]->TBS>>3);
eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]+= eNB->dlsch_MCH->harq_processes[0]->TBS>>3;//=eNB_transport_info[eNB->Mod_id].tbs[0];
} else {
G = get_G(&eNB->frame_parms,
eNB->frame_parms.N_RB_DL,
eNB->dlsch_MCH->harq_processes[0]->rb_alloc,
get_Qm(eNB->dlsch_MCH->harq_processes[0]->mcs),1,
2,proc->frame_tx,subframe,0);
generate_mbsfn_pilot(eNB,proc,
eNB->common_vars.txdataF,
AMP);
AssertFatal(dlsch_encoding(eNB,
a,
1,
eNB->dlsch_MCH,
proc->frame_tx,
subframe,
&eNB->dlsch_rate_matching_stats,
&eNB->dlsch_turbo_encoding_stats,
&eNB->dlsch_interleaving_stats)==0,
"problem in dlsch_encoding");
dlsch_scrambling(&eNB->frame_parms,1,eNB->dlsch_MCH,0,G,0,frame,subframe<<1);
mch_modulation(eNB->common_vars.txdataF,
AMP,
subframe,
&eNB->frame_parms,
eNB->dlsch_MCH);
}
}
void mch_extract_rbs(int **rxdataF,
int **dl_ch_estimates,
@@ -563,7 +458,7 @@ void mch_channel_compensation(int **rxdataF_ext,
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate);
mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]);
// mmtmpD1 contains imag part of 4 consecutive outputs (32-bit)
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
mmtmpD0 = _mpm_srai_epi32(mmtmpD0,output_shift);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift);
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
@@ -0,0 +1,152 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "PHY/defs.h"
#include "PHY/impl_defs_lte.h"
//#define DEBUG_PC 0
/*
double ratioPB[2][4]={{ 1.0,4.0/5.0,3.0/5.0,2.0/5.0},
{ 5.0/4.0,1.0,3.0/4.0,1.0/2.0}};
*/
double ratioPB[2][4]={{ 0.00000, -0.96910, -2.21849, -3.97940}, //in db
{ 0.96910, 0.00000, -1.24939, -3.01030}};
double pa_values[8]={-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0}; //reported by higher layers
double get_pa_dB(uint8_t pa)
{
AssertFatal(pa<8,"pa %d is not in (0...7)\n",pa);
return(pa_values[pa]);
}
double computeRhoA_eNB(uint8_t pa,
LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port){
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = get_pa_dB(pa);
if(!dl_power_off) //if dl_power_offset is 0, this is for MU-interference, TM5
rho_a_dB-=10*log10(2);
if(n_antenna_port==4) // see TS 36.213 Section 5.2
rho_a_dB+=10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#if DEBUG_PC
printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n",p_a,pa_values[ pdsch_config_dedicated->p_a],dlsch_eNB->sqrt_rho_a);
#endif
return(rho_a_dB);
}
double computeRhoB_eNB(uint8_t pa,
uint8_t pb,
uint8_t n_antenna_port,
LTE_eNB_DLSCH_t *dlsch_eNB,
int dl_power_off)
{
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
AssertFatal(pa<8,"pa %d is not in (0...7)\n",pa);
AssertFatal(pb<4,"pb %d is not in (0...3)\n",pb);
rho_a_dB= computeRhoA_eNB(pa,dlsch_eNB,dl_power_off, n_antenna_port);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pb] + rho_a_dB;
else
rho_b_dB= ratioPB[0][pb] + rho_a_dB;
sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
dlsch_eNB->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
#ifdef DEBUG_PC
printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n",n_antenna_port,pb,ratioPB[1][pb],dlsch_eNB->sqrt_rho_b);
#endif
return(rho_b_dB);
}
double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue,
unsigned char dl_power_off,
uint8_t n_antenna_port
){
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = get_pa_dB(pdsch_config_dedicated->p_a);
if(!dl_power_off)
rho_a_dB-=10*log10(2);
//if dl_power_offset is 0, this is for MU-interference, TM5. But in practice UE may assume 16 or 64QAM TM4 as multiuser
if(n_antenna_port==4) // see TS 36.213 Section 5.2
rho_a_dB=+10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_ue->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#ifdef DEBUG_PC
printf("UE: p_a=%d, value=%f, dl_power_off=%d, sqrt_rho_a=%d\n",pdsch_config_dedicated->p_a,pa_values[ pdsch_config_dedicated->p_a],dl_power_off,dlsch_ue->sqrt_rho_a);
#endif
return(rho_a_dB);
}
double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
PDSCH_CONFIG_COMMON *pdsch_config_common,
uint8_t n_antenna_port,
LTE_UE_DLSCH_t *dlsch_ue,
unsigned char dl_power_off)
{
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_UE(pdsch_config_dedicated,dlsch_ue,dl_power_off, n_antenna_port);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else
rho_b_dB= ratioPB[0][pdsch_config_common->p_b] + rho_a_dB;
sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB));
dlsch_ue->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13));
#ifdef DEBUG_PC
printf("UE: p_b=%d, n_ant=%d -> ratio=%f -> sqrt_rho_b=%d\n",pdsch_config_common->p_b, n_antenna_port,ratioPB[1][pdsch_config_common->p_b],dlsch_ue->sqrt_rho_b);
#endif
return(rho_b_dB);
}
+533
View File
@@ -0,0 +1,533 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/prach_ue.c
* \brief Top-level routines for decoding the PRACH physical channel V8.6 2009-03
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#include "PHY/sse_intrin.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
//#include "prach.h"
#include "PHY/LTE_TRANSPORT/if4_tools.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "../LTE_TRANSPORT/prach_common.c"
int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf )
{
lte_frame_type_t frame_type = ue->frame_parms.frame_type;
//uint8_t tdd_config = ue->frame_parms.tdd_config;
uint16_t rootSequenceIndex = ue->frame_parms.prach_config_common.rootSequenceIndex;
uint8_t prach_ConfigIndex = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
uint8_t Ncs_config = ue->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
uint8_t restricted_set = ue->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag;
//uint8_t n_ra_prboffset = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex;
uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index;
int16_t *prachF = ue->prach_vars[eNB_id]->prachF;
static int16_t prach_tmp[45600*2] __attribute__((aligned(32)));
int16_t *prach = prach_tmp;
int16_t *prach2;
int16_t amp = ue->prach_vars[eNB_id]->amp;
int16_t Ncp;
uint8_t n_ra_prb;
uint16_t NCS;
uint16_t *prach_root_sequence_map;
uint16_t preamble_offset,preamble_shift;
uint16_t preamble_index0,n_shift_ra,n_shift_ra_bar;
uint16_t d_start,numshift;
uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
//uint8_t Nsp=2;
//uint8_t f_ra,t1_ra;
uint16_t N_ZC = (prach_fmt<4)?839:139;
uint8_t not_found;
int k;
int16_t *Xu;
uint16_t u;
int32_t Xu_re,Xu_im;
uint16_t offset,offset2;
int prach_start;
int i, prach_len;
uint16_t first_nonzero_root_idx=0;
#if defined(EXMIMO) || defined(OAI_USRP)
prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset);
#ifdef PRACH_DEBUG
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start,
ue->rx_offset,
ue->hw_timing_advance,
ue->N_TA_offset);
#endif
if (prach_start<0)
prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
#else //normal case (simulation)
prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset;
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start,
ue->rx_offset,
ue->hw_timing_advance,
ue->N_TA_offset);
#endif
// First compute physical root sequence
if (restricted_set == 0) {
AssertFatal(Ncs_config <= 15,
"[PHY] FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", Ncs_config );
NCS = NCS_unrestricted[Ncs_config];
} else {
AssertFatal(Ncs_config <= 14,
"[PHY] FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", Ncs_config );
NCS = NCS_restricted[Ncs_config];
}
n_ra_prb = get_prach_prb_offset(&(ue->frame_parms),
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset,
tdd_mapindex, Nf);
prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
/*
// this code is not part of get_prach_prb_offset
if (frame_type == TDD) { // TDD
if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
LOG_E( PHY, "[PHY][UE %"PRIu8"] Illegal prach_ConfigIndex %"PRIu8" for ", ue->Mod_id, prach_ConfigIndex );
}
// adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
if (prach_fmt < 4) {
if ((f_ra&1) == 0) {
n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
} else {
n_ra_prb = ue->frame_parms.N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
}
} else {
if ((tdd_config >2) && (tdd_config<6))
Nsp = 2;
t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
n_ra_prb = 6*f_ra;
} else {
n_ra_prb = ue->frame_parms.N_RB_UL - 6*(f_ra+1);
}
}
}
*/
// This is the relative offset (for unrestricted case) in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS)));
if (restricted_set == 0) {
// This is the \nu corresponding to the preamble index
preamble_shift = (NCS==0)? 0 : (preamble_index % (N_ZC/NCS));
preamble_shift *= NCS;
} else { // This is the high-speed case
#ifdef PRACH_DEBUG
LOG_I(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config);
#endif
not_found = 1;
preamble_index0 = preamble_index;
// set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this
// preamble index and find the corresponding cyclic shift
preamble_offset = 0; // relative rootSequenceIndex;
while (not_found == 1) {
// current root depending on rootSequenceIndex and preamble_offset
int index = (rootSequenceIndex + preamble_offset) % N_ZC;
if (prach_fmt<4) {
// prach_root_sequence_map points to prach_root_sequence_map0_3
DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) );
} else {
// prach_root_sequence_map points to prach_root_sequence_map4
DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) );
}
u = prach_root_sequence_map[index];
uint16_t n_group_ra = 0;
if ( (du[u]<(N_ZC/3)) && (du[u]>=NCS) ) {
n_shift_ra = du[u]/NCS;
d_start = (du[u]<<1) + (n_shift_ra * NCS);
n_group_ra = N_ZC/d_start;
n_shift_ra_bar = max(0,(N_ZC-(du[u]<<1)-(n_group_ra*d_start))/N_ZC);
} else if ( (du[u]>=(N_ZC/3)) && (du[u]<=((N_ZC - NCS)>>1)) ) {
n_shift_ra = (N_ZC - (du[u]<<1))/NCS;
d_start = N_ZC - (du[u]<<1) + (n_shift_ra * NCS);
n_group_ra = du[u]/d_start;
n_shift_ra_bar = min(n_shift_ra,max(0,(du[u]- (n_group_ra*d_start))/NCS));
} else {
n_shift_ra = 0;
n_shift_ra_bar = 0;
}
// This is the number of cyclic shifts for the current root u
numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar;
if (numshift>0 && preamble_index0==preamble_index)
first_nonzero_root_idx = preamble_offset;
if (preamble_index0 < numshift) {
not_found = 0;
preamble_shift = (d_start * (preamble_index0/n_shift_ra)) + ((preamble_index0%n_shift_ra)*NCS);
} else { // skip to next rootSequenceIndex and recompute parameters
preamble_offset++;
preamble_index0 -= numshift;
}
}
}
// now generate PRACH signal
#ifdef PRACH_DEBUG
if (NCS>0)
LOG_I(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n",
rootSequenceIndex,preamble_index,NCS,Ncs_config,N_ZC/NCS,n_ra_prb,
preamble_offset,preamble_shift);
#endif
// nsymb = (frame_parms->Ncp==0) ? 14:12;
// subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb;
k = (12*n_ra_prb) - 6*ue->frame_parms.N_RB_UL;
if (k<0)
k+=ue->frame_parms.ofdm_symbol_size;
k*=12;
k+=13;
Xu = (int16_t*)ue->X_u[preamble_offset-first_nonzero_root_idx];
/*
k+=(12*ue->frame_parms.first_carrier_offset);
if (k>(12*ue->frame_parms.ofdm_symbol_size))
k-=(12*ue->frame_parms.ofdm_symbol_size);
*/
k*=2;
switch (ue->frame_parms.N_RB_UL) {
case 6:
memset((void*)prachF,0,4*1536);
break;
case 15:
memset((void*)prachF,0,4*3072);
break;
case 25:
memset((void*)prachF,0,4*6144);
break;
case 50:
memset((void*)prachF,0,4*12288);
break;
case 75:
memset((void*)prachF,0,4*18432);
break;
case 100:
if (ue->frame_parms.threequarter_fs == 0)
memset((void*)prachF,0,4*24576);
else
memset((void*)prachF,0,4*18432);
break;
}
for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) {
if (offset2 >= N_ZC)
offset2 -= N_ZC;
Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15);
Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15);
prachF[k++]= ((Xu_re*ru[offset2<<1]) - (Xu_im*ru[1+(offset2<<1)]))>>15;
prachF[k++]= ((Xu_im*ru[offset2<<1]) + (Xu_re*ru[1+(offset2<<1)]))>>15;
if (k==(12*2*ue->frame_parms.ofdm_symbol_size))
k=0;
}
switch (prach_fmt) {
case 0:
Ncp = 3168;
break;
case 1:
case 3:
Ncp = 21024;
break;
case 2:
Ncp = 6240;
break;
case 4:
Ncp = 448;
break;
default:
Ncp = 3168;
break;
}
switch (ue->frame_parms.N_RB_UL) {
case 6:
Ncp>>=4;
prach+=4; // makes prach2 aligned to 128-bit
break;
case 15:
Ncp>>=3;
break;
case 25:
Ncp>>=2;
break;
case 50:
Ncp>>=1;
break;
case 75:
Ncp=(Ncp*3)>>2;
break;
}
if (ue->frame_parms.threequarter_fs == 1)
Ncp=(Ncp*3)>>2;
prach2 = prach+(Ncp<<1);
// do IDFT
switch (ue->frame_parms.N_RB_UL) {
case 6:
if (prach_fmt == 4) {
idft256(prachF,prach2,1);
memmove( prach, prach+512, Ncp<<2 );
prach_len = 256+Ncp;
} else {
idft1536(prachF,prach2,1);
memmove( prach, prach+3072, Ncp<<2 );
prach_len = 1536+Ncp;
if (prach_fmt>1) {
memmove( prach2+3072, prach2, 6144 );
prach_len = 2*1536+Ncp;
}
}
break;
case 15:
if (prach_fmt == 4) {
idft512(prachF,prach2,1);
//TODO: account for repeated format in dft output
memmove( prach, prach+1024, Ncp<<2 );
prach_len = 512+Ncp;
} else {
idft3072(prachF,prach2);
memmove( prach, prach+6144, Ncp<<2 );
prach_len = 3072+Ncp;
if (prach_fmt>1) {
memmove( prach2+6144, prach2, 12288 );
prach_len = 2*3072+Ncp;
}
}
break;
case 25:
default:
if (prach_fmt == 4) {
idft1024(prachF,prach2,1);
memmove( prach, prach+2048, Ncp<<2 );
prach_len = 1024+Ncp;
} else {
idft6144(prachF,prach2);
/*for (i=0;i<6144*2;i++)
prach2[i]<<=1;*/
memmove( prach, prach+12288, Ncp<<2 );
prach_len = 6144+Ncp;
if (prach_fmt>1) {
memmove( prach2+12288, prach2, 24576 );
prach_len = 2*6144+Ncp;
}
}
break;
case 50:
if (prach_fmt == 4) {
idft2048(prachF,prach2,1);
memmove( prach, prach+4096, Ncp<<2 );
prach_len = 2048+Ncp;
} else {
idft12288(prachF,prach2);
memmove( prach, prach+24576, Ncp<<2 );
prach_len = 12288+Ncp;
if (prach_fmt>1) {
memmove( prach2+24576, prach2, 49152 );
prach_len = 2*12288+Ncp;
}
}
break;
case 75:
if (prach_fmt == 4) {
idft3072(prachF,prach2);
//TODO: account for repeated format in dft output
memmove( prach, prach+6144, Ncp<<2 );
prach_len = 3072+Ncp;
} else {
idft18432(prachF,prach2);
memmove( prach, prach+36864, Ncp<<2 );
prach_len = 18432+Ncp;
if (prach_fmt>1) {
memmove( prach2+36834, prach2, 73728 );
prach_len = 2*18432+Ncp;
}
}
break;
case 100:
if (ue->frame_parms.threequarter_fs == 0) {
if (prach_fmt == 4) {
idft4096(prachF,prach2,1);
memmove( prach, prach+8192, Ncp<<2 );
prach_len = 4096+Ncp;
} else {
idft24576(prachF,prach2);
memmove( prach, prach+49152, Ncp<<2 );
prach_len = 24576+Ncp;
if (prach_fmt>1) {
memmove( prach2+49152, prach2, 98304 );
prach_len = 2* 24576+Ncp;
}
}
}
else {
if (prach_fmt == 4) {
idft3072(prachF,prach2);
//TODO: account for repeated format in dft output
memmove( prach, prach+6144, Ncp<<2 );
prach_len = 3072+Ncp;
} else {
idft18432(prachF,prach2);
memmove( prach, prach+36864, Ncp<<2 );
prach_len = 18432+Ncp;
printf("Generated prach for 100 PRB, 3/4 sampling\n");
if (prach_fmt>1) {
memmove( prach2+36834, prach2, 73728 );
prach_len = 2*18432+Ncp;
}
}
}
break;
}
//LOG_I(PHY,"prach_len=%d\n",prach_len);
AssertFatal(prach_fmt<4,
"prach_fmt4 not fully implemented" );
#if defined(EXMIMO) || defined(OAI_USRP)
int j;
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti;
LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4;
}
for (i=0; i<overflow; i++,j++) {
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4;
}
#if defined(EXMIMO)
// handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on
for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; k<prach_start ; k++) {
if (k<0)
ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
else
ue->common_vars.txdata[0][k] &= 0xFFFEFFFE;
}
#endif
#else
for (i=0; i<prach_len; i++) {
((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i];
((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1];
}
#endif
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
exit(-1);
#endif
return signal_energy( (int*)prach, 256 );
}
+877
View File
@@ -0,0 +1,877 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/pucch.c
* \brief Top-level routines for generating and decoding the PUCCH physical channel V8.6 2009-03
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "T.h"
#include "pucch_common.c"
void generate_pucch1x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n1_pucch,
uint8_t shortened_format,
uint8_t *payload,
int16_t amp,
uint8_t subframe)
{
uint32_t u,v,n;
uint32_t z[12*14],*zptr;
int16_t d0;
uint8_t ns,N_UL_symb,nsymb,n_oc,n_oc0,n_oc1;
uint8_t c = (frame_parms->Ncp==0) ? 3 : 2;
uint16_t nprime,nprime0,nprime1;
uint16_t i,j,re_offset,thres,h;
uint8_t Nprime_div_deltaPUCCH_Shift,Nprime,d;
uint8_t m,l,refs;
uint8_t n_cs,S,alpha_ind,rem;
int16_t tmp_re,tmp_im,ref_re,ref_im,W_re=0,W_im=0;
int32_t *txptr;
uint32_t symbol_offset;
uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift;
uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI;
uint8_t Ncs1 = frame_parms->pucch_config_common.nCS_AN;
uint8_t Ncs1_div_deltaPUCCH_Shift = Ncs1/deltaPUCCH_Shift;
LOG_D(PHY,"generate_pucch Start [deltaPUCCH_Shift %d, NRB2 %d, Ncs1_div_deltaPUCCH_Shift %d, n1_pucch %d]\n", deltaPUCCH_Shift, NRB2, Ncs1_div_deltaPUCCH_Shift,n1_pucch);
uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) {
printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift);
return;
}
if (Ncs1_div_deltaPUCCH_Shift > 7) {
printf("[PHY] generate_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift);
return;
}
zptr = z;
thres = (c*Ncs1_div_deltaPUCCH_Shift);
Nprime_div_deltaPUCCH_Shift = (n1_pucch < thres) ? Ncs1_div_deltaPUCCH_Shift : (12/deltaPUCCH_Shift);
Nprime = Nprime_div_deltaPUCCH_Shift * deltaPUCCH_Shift;
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch);
#endif
LOG_D(PHY,"[PHY] PUCCH: n1_pucch %d, thres %d Ncs1_div_deltaPUCCH_Shift %d (12/deltaPUCCH_Shift) %d Nprime_div_deltaPUCCH_Shift %d \n",
n1_pucch, thres, Ncs1_div_deltaPUCCH_Shift, (int)(12/deltaPUCCH_Shift), Nprime_div_deltaPUCCH_Shift);
LOG_D(PHY,"[PHY] PUCCH: deltaPUCCH_Shift %d, Nprime %d\n",deltaPUCCH_Shift,Nprime);
N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6;
if (n1_pucch < thres)
nprime0=n1_pucch;
else
nprime0 = (n1_pucch - thres)%(12*c/deltaPUCCH_Shift);
if (n1_pucch >= thres)
nprime1= ((c*(nprime0+1))%((12*c/deltaPUCCH_Shift)+1))-1;
else {
d = (frame_parms->Ncp==0) ? 2 : 0;
h= (nprime0+d)%(c*Nprime_div_deltaPUCCH_Shift);
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH: h %d, d %d\n",h,d);
#endif
nprime1 = (h/c) + (h%c)*Nprime_div_deltaPUCCH_Shift;
}
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH: nprime0 %d nprime1 %d, %s, payload (%d,%d)\n",nprime0,nprime1,pucch_format_string[fmt],payload[0],payload[1]);
#endif
n_oc0 = nprime0/Nprime_div_deltaPUCCH_Shift;
if (frame_parms->Ncp==1)
n_oc0<<=1;
n_oc1 = nprime1/Nprime_div_deltaPUCCH_Shift;
if (frame_parms->Ncp==1) // extended CP
n_oc1<<=1;
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH: noc0 %d noc1 %d\n",n_oc0,n_oc1);
#endif
nprime=nprime0;
n_oc =n_oc0;
// loop over 2 slots
for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) {
if ((nprime&1) == 0)
S=0; // 1
else
S=1; // j
//loop over symbols in slot
for (l=0; l<N_UL_symb; l++) {
// Compute n_cs (36.211 p. 18)
n_cs = ncs_cell[ns][l];
if (frame_parms->Ncp==0) { // normal CP
n_cs = ((uint16_t)n_cs + (nprime*deltaPUCCH_Shift + (n_oc%deltaPUCCH_Shift))%Nprime)%12;
} else {
n_cs = ((uint16_t)n_cs + (nprime*deltaPUCCH_Shift + (n_oc>>1))%Nprime)%12;
}
refs=0;
// Comput W_noc(m) (36.211 p. 19)
if ((ns==(1+(subframe<<1))) && (shortened_format==1)) { // second slot and shortened format
if (l<2) { // data
W_re=W3_re[n_oc][l];
W_im=W3_im[n_oc][l];
} else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==0)) { // reference and normal CP
W_re=W3_re[n_oc][l-2];
W_im=W3_im[n_oc][l-2];
refs=1;
} else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==1)) { // reference and extended CP
W_re=W4[n_oc][l-2];
W_im=0;
refs=1;
} else if ((l>=N_UL_symb-2)) { // data
W_re=W3_re[n_oc][l-N_UL_symb+4];
W_im=W3_im[n_oc][l-N_UL_symb+4];
}
} else {
if (l<2) { // data
W_re=W4[n_oc][l];
W_im=0;
} else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==0)) { // reference and normal CP
W_re=W3_re[n_oc][l-2];
W_im=W3_im[n_oc][l-2];
refs=1;
} else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==1)) { // reference and extended CP
W_re=W4[n_oc][l-2];
W_im=0;
refs=1;
} else if ((l>=N_UL_symb-2)) { // data
W_re=W4[n_oc][l-N_UL_symb+4];
W_im=0;
}
}
// multiply W by S(ns) (36.211 p.17). only for data, reference symbols do not have this factor
if ((S==1)&&(refs==0)) {
tmp_re = W_re;
W_re = -W_im;
W_im = tmp_re;
}
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH: ncs[%d][%d]=%d, W_re %d, W_im %d, S %d, refs %d\n",ns,l,n_cs,W_re,W_im,S,refs);
#endif
alpha_ind=0;
// compute output sequence
for (n=0; n<12; n++) {
// this is r_uv^alpha(n)
tmp_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15);
tmp_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15);
// this is S(ns)*w_noc(m)*r_uv^alpha(n)
ref_re = (tmp_re*W_re - tmp_im*W_im)>>15;
ref_im = (tmp_re*W_im + tmp_im*W_re)>>15;
if ((l<2)||(l>=(N_UL_symb-2))) { //these are PUCCH data symbols
switch (fmt) {
case pucch_format1: //OOK 1-bit
((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15;
break;
case pucch_format1a: //BPSK 1-bit
d0 = (payload[0]&1)==0 ? amp : -amp;
((int16_t *)&zptr[n])[0] = ((int32_t)d0*ref_re)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)d0*ref_im)>>15;
// printf("d0 %d\n",d0);
break;
case pucch_format1b: //QPSK 2-bits (Table 5.4.1-1 from 36.211, pg. 18)
if (((payload[0]&1)==0) && ((payload[1]&1)==0)) {// 1
((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15;
} else if (((payload[0]&1)==0) && ((payload[1]&1)==1)) { // -j
((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_im)>>15;
((int16_t *)&zptr[n])[1] = (-(int32_t)amp*ref_re)>>15;
} else if (((payload[0]&1)==1) && ((payload[1]&1)==0)) { // j
((int16_t *)&zptr[n])[0] = (-(int32_t)amp*ref_im)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_re)>>15;
} else { // -1
((int16_t *)&zptr[n])[0] = (-(int32_t)amp*ref_re)>>15;
((int16_t *)&zptr[n])[1] = (-(int32_t)amp*ref_im)>>15;
}
break;
case pucch_format1b_csA2:
case pucch_format1b_csA3:
case pucch_format1b_csA4:
AssertFatal(1==0,"PUCCH format 1b_csX not supported yet\n");
break;
case pucch_format2:
case pucch_format2a:
case pucch_format2b:
AssertFatal(1==0,"should not go here\n");
break;
case pucch_format3:
fprintf(stderr, "PUCCH format 3 not handled\n");
abort();
} // switch fmt
} else { // These are PUCCH reference symbols
((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15;
// printf("ref\n");
}
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH subframe %d z(%d,%d) => %d,%d, alpha(%d) => %d,%d\n",subframe,l,n,((int16_t *)&zptr[n])[0],((int16_t *)&zptr[n])[1],
alpha_ind,alpha_re[alpha_ind],alpha_im[alpha_ind]);
#endif
alpha_ind = (alpha_ind + n_cs)%12;
} // n
zptr+=12;
} // l
nprime=nprime1;
n_oc =n_oc1;
} // ns
rem = ((((12*Ncs1_div_deltaPUCCH_Shift)>>3)&7)>0) ? 1 : 0;
m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem);
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH: m %d\n",m);
#endif
nsymb = N_UL_symb<<1;
//for (j=0,l=0;l<(nsymb-1);l++) {
for (j=0,l=0; l<(nsymb); l++) {
if ((l<(nsymb>>1)) && ((m&1) == 0))
re_offset = (m*6) + frame_parms->first_carrier_offset;
else if ((l<(nsymb>>1)) && ((m&1) == 1))
re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12;
else if ((m&1) == 0)
re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12;
else
re_offset = ((m-1)*6) + frame_parms->first_carrier_offset;
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size);
symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb));
txptr = &txdataF[0][symbol_offset];
for (i=0; i<12; i++,j++) {
txptr[re_offset++] = z[j];
if (re_offset==frame_parms->ofdm_symbol_size)
re_offset = 0;
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
#endif
}
}
}
void generate_pucch_emul(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
PUCCH_FMT_t format,
uint8_t ncs1,
uint8_t *pucch_payload,
uint8_t sr)
{
int subframe = proc->subframe_tx;
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_flag = format;
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_Ncs1 = ncs1;
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.sr = sr;
// the value of ue->pucch_sel[subframe] is set by get_n1_pucch
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_sel = ue->pucch_sel[subframe];
// LOG_I(PHY,"subframe %d emu tx pucch_sel is %d sr is %d \n", subframe, UE_transport_info[ue->Mod_id].cntl.pucch_sel, sr);
if (format == pucch_format1a) {
ue->pucch_payload[0] = pucch_payload[0];
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0];
} else if (format == pucch_format1b) {
ue->pucch_payload[0] = pucch_payload[0] + (pucch_payload[1]<<1);
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1);
} else if (format == pucch_format1) {
// LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",ue->Mod_id,proc->frame_tx,subframe,sr);
}
ue->sr[subframe] = sr;
}
inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) __attribute__((always_inline));
inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) {
uint32_t x1, x2, s=0;
int i;
uint8_t c;
x2 = (rnti) + ((uint32_t)(1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1
s = lte_gold_generic(&x1, &x2, 1);
for (i=0;i<19;i++) {
c = (uint8_t)((s>>i)&1);
btilde[i] = (((B>>i)&1) ^ c);
}
}
inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) __attribute__((always_inline));
inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) {
int i;
for (i=0;i<20;i++)
d[i] = btilde[i] == 1 ? -amp : amp;
}
uint32_t pucch_code[13] = {0xFFFFF,0x5A933,0x10E5A,0x6339C,0x73CE0,
0xFFC00,0xD8E64,0x4F6B0,0x218EC,0x1B746,
0x0FFFF,0x33FFF,0x3FFFC};
void generate_pucch2x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *fp,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n2_pucch,
uint8_t *payload,
int A,
int B2,
int16_t amp,
uint8_t subframe,
uint16_t rnti) {
int i,j;
uint32_t B=0;
uint8_t btilde[20];
int16_t d[22];
uint8_t deltaPUCCH_Shift = fp->pucch_config_common.deltaPUCCH_Shift;
uint8_t NRB2 = fp->pucch_config_common.nRB_CQI;
uint8_t Ncs1 = fp->pucch_config_common.nCS_AN;
uint32_t u0 = fp->pucch_config_common.grouphop[subframe<<1];
uint32_t u1 = fp->pucch_config_common.grouphop[1+(subframe<<1)];
uint32_t v0 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
uint32_t z[12*14],*zptr;
uint32_t u,v,n;
uint8_t ns,N_UL_symb,nsymb_slot0,nsymb_pertti;
uint32_t nprime,l,n_cs;
int alpha_ind,data_ind;
int16_t ref_re,ref_im;
int m,re_offset,symbol_offset;
int32_t *txptr;
if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) {
printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift);
return;
}
if (Ncs1 > 7) {
printf("[PHY] generate_pucch: Illegal Ncs1 %d (should be 0...7)\n",Ncs1);
return;
}
// pucch2x_encoding
for (i=0;i<A;i++)
if ((*payload & (1<<i)) > 0)
B=B^pucch_code[i];
// scrambling
pucch2x_scrambling(fp,subframe,rnti,B,btilde);
// modulation
pucch2x_modulation(btilde,d,amp);
// add extra symbol for 2a/2b
d[20]=0;
d[21]=0;
if (fmt==pucch_format2a)
d[20] = (B2 == 0) ? amp : -amp;
else if (fmt==pucch_format2b) {
switch (B2) {
case 0:
d[20] = amp;
break;
case 1:
d[21] = -amp;
break;
case 2:
d[21] = amp;
break;
case 3:
d[20] = -amp;
break;
default:
AssertFatal(1==0,"Illegal modulation symbol %d for PUCCH %s\n",B2,pucch_format_string[fmt]);
break;
}
}
#ifdef DEBUG_PUCCH_TX
printf("[PHY] PUCCH2x: n2_pucch %d\n",n2_pucch);
#endif
N_UL_symb = (fp->Ncp==0) ? 7 : 6;
data_ind = 0;
zptr = z;
nprime = 0;
for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) {
if ((ns&1) == 0)
nprime = (n2_pucch < 12*NRB2) ?
n2_pucch % 12 :
(n2_pucch+Ncs1 + 1)%12;
else {
nprime = (n2_pucch < 12*NRB2) ?
((12*(nprime+1)) % 13)-1 :
(10-n2_pucch)%12;
}
//loop over symbols in slot
for (l=0; l<N_UL_symb; l++) {
// Compute n_cs (36.211 p. 18)
n_cs = (ncs_cell[ns][l]+nprime)%12;
alpha_ind = 0;
for (n=0; n<12; n++)
{
// this is r_uv^alpha(n)
ref_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15);
ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15);
if ((l!=1)&&(l!=5)) { //these are PUCCH data symbols
((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15;
((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15;
//LOG_I(PHY,"slot %d ofdm# %d ==> d[%d,%d] \n",ns,l,data_ind,n);
}
else {
if ((l==1) || ( (l==5) && (fmt==pucch_format2) ))
{
((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re>>15);
((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im>>15);
}
// l == 5 && pucch format 2a
else if (fmt==pucch_format2a)
{
((int16_t *)&zptr[n])[0] = ((int32_t)d[20]*ref_re>>15);
((int16_t *)&zptr[n])[1] = ((int32_t)d[21]*ref_im>>15);
}
// l == 5 && pucch format 2b
else if (fmt==pucch_format2b)
{
((int16_t *)&zptr[n])[0] = ((int32_t)d[20]*ref_re>>15);
((int16_t *)&zptr[n])[1] = ((int32_t)d[21]*ref_im>>15);
}
} // l==1 || l==5
alpha_ind = (alpha_ind + n_cs)%12;
} // n
zptr+=12;
if ((l!=1)&&(l!=5)) //these are PUCCH data symbols so increment data index
data_ind+=2;
} // l
} //ns
m = n2_pucch/12;
#ifdef DEBUG_PUCCH_TX
LOG_D(PHY,"[PHY] PUCCH: n2_pucch %d m %d\n",n2_pucch,m);
#endif
nsymb_slot0 = ((fp->Ncp==0) ? 7 : 6);
nsymb_pertti = nsymb_slot0 << 1;
//nsymb = nsymb_slot0<<1;
//for (j=0,l=0;l<(nsymb-1);l++) {
for (j=0,l=0; l<(nsymb_pertti); l++) {
if ((l<nsymb_slot0) && ((m&1) == 0))
re_offset = (m*6) + fp->first_carrier_offset;
else if ((l<nsymb_slot0) && ((m&1) == 1))
re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12;
else if ((m&1) == 0)
re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12;
else
re_offset = ((m-1)*6) + fp->first_carrier_offset;
if (re_offset > fp->ofdm_symbol_size)
re_offset -= (fp->ofdm_symbol_size);
symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb_pertti));
txptr = &txdataF[0][symbol_offset];
//LOG_I(PHY,"ofdmSymb %d/%d, firstCarrierOffset %d, symbolOffset[sfn %d] %d, reOffset %d, &txptr: %x \n", l, nsymb, fp->first_carrier_offset, subframe, symbol_offset, re_offset, &txptr[0]);
for (i=0; i<12; i++,j++) {
txptr[re_offset] = z[j];
re_offset++;
if (re_offset==fp->ofdm_symbol_size)
re_offset -= (fp->ofdm_symbol_size);
#ifdef DEBUG_PUCCH_TX
LOG_D(PHY,"[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
#endif
}
}
}
/* PUCCH format3 >> */
/* DFT */
void pucchfmt3_Dft( int16_t *x, int16_t *y )
{
int16_t i, k;
int16_t tmp[2];
int16_t calctmp[D_NSC1RB*2]={0};
for (i=0; i<D_NSC1RB; i++) {
for(k=0; k<D_NSC1RB; k++) {
tmp[0] = alphaTBL_re[(12-((i*k)%12))%12];
tmp[1] = alphaTBL_im[(12-((i*k)%12))%12];
calctmp[2*i] += (((int32_t)x[2*k] * tmp[0] - (int32_t)x[2*k+1] * tmp[1])>>15);
calctmp[2*i+1] += (((int32_t)x[2*k+1] * tmp[0] + (int32_t)x[2*k] * tmp[1])>>15);
}
y[2*i] = (int16_t)( (double) calctmp[2*i] / sqrt(D_NSC1RB));
y[2*i+1] = (int16_t)((double) calctmp[2*i+1] / sqrt(D_NSC1RB));
}
}
void generate_pucch3x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n3_pucch,
uint8_t shortened_format,
uint8_t *payload,
int16_t amp,
uint8_t subframe,
uint16_t rnti)
{
uint32_t u, v;
uint16_t i, j, re_offset;
uint32_t z[12*14], *zptr;
uint32_t y_tilda[12*14]={}, *y_tilda_ptr;
uint8_t ns, nsymb, n_oc, n_oc0, n_oc1;
uint8_t N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6;
uint8_t m, l;
uint8_t n_cs;
int16_t tmp_re, tmp_im, W_re=0, W_im=0;
int32_t *txptr;
uint32_t symbol_offset;
uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
// variables for channel coding
uint8_t chcod_tbl_idx = 0;
//uint8_t chcod_dt[48] = {};
// variables for Scrambling
uint32_t cinit = 0;
uint32_t x1;
uint32_t s,s0,s1;
uint8_t C[48] ={};
uint8_t scr_dt[48]={};
// variables for Modulation
int16_t d_re[24]={};
int16_t d_im[24]={};
// variables for orthogonal sequence selection
uint8_t N_PUCCH_SF0 = 5;
uint8_t N_PUCCH_SF1 = (shortened_format==0)? 5:4;
uint8_t first_slot = 0;
int16_t rot_re=0;
int16_t rot_im=0;
uint8_t dt_offset;
uint8_t sym_offset;
int16_t y_re[14][12]; //={0};
int16_t y_im[14][12]; //={0};
// DMRS
uint8_t alpha_idx=0;
uint8_t m_alpha_idx=0;
// TODO
// "SR+ACK/NACK" length is only 7 bits.
// This restriction will be lifted in the future.
// "CQI/PMI/RI+ACK/NACK" will be supported in the future.
// Channel Coding
for (uint8_t i=0; i<7; i++) {
chcod_tbl_idx += (payload[i]<<i);
}
// Scrambling
cinit = (subframe + 1) * ((2 * frame_parms->Nid_cell + 1)<<16) + rnti;
s0 = lte_gold_generic(&x1,&cinit,1);
s1 = lte_gold_generic(&x1,&cinit,0);
for (i=0; i<48; i++) {
s = (i<32)? s0:s1;
j = (i<32)? i:(i-32);
C[i] = ((s>>j)&1);
}
for (i=0; i<48; i++) {
scr_dt[i] = chcod_tbl[chcod_tbl_idx][i] ^ C[i];
}
// Modulation
for (uint8_t i=0; i<48; i+=2){
if (scr_dt[i]==0 && scr_dt[i+1]==0){
d_re[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15);
d_im[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15);
} else if (scr_dt[i]==0 && scr_dt[i+1]==1) {
d_re[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15);
d_im[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp) >>15);
} else if (scr_dt[i]==1 && scr_dt[i+1]==0) {
d_re[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15);
d_im[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp)>>15);
} else if (scr_dt[i]==1 && scr_dt[i+1]==1) {
d_re[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15);
d_im[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15);
} else {
//***log Modulation Error!
}
}
// Calculate Orthogonal Sequence index
n_oc0 = n3_pucch % N_PUCCH_SF1;
if (N_PUCCH_SF1 == 5) {
n_oc1 = (3 * n_oc0) % N_PUCCH_SF1;
} else {
n_oc1 = n_oc0 % N_PUCCH_SF1;
}
y_tilda_ptr = y_tilda;
zptr = z;
// loop over 2 slots
for (ns=(subframe<<1), u=u0, v=v0; ns<(2+(subframe<<1)); ns++, u=u1, v=v1) {
first_slot = (ns==(subframe<<1))?1:0;
//loop over symbols in slot
for (l=0; l<N_UL_symb; l++) {
rot_re = RotTBL_re[(uint8_t) ncs_cell[ns][l]/64] ;
rot_im = RotTBL_im[(uint8_t) ncs_cell[ns][l]/64] ;
// Comput W_noc(m) (36.211 p. 19)
if ( first_slot == 0 && shortened_format==1) { // second slot and shortened format
n_oc = n_oc1;
if (l<1) { // data
W_re=W4_fmt3[n_oc][l];
W_im=0;
} else if (l==1) { // DMRS
W_re=W2[0];
W_im=0;
} else if (l>=2 && l<5) { // data
W_re=W4_fmt3[n_oc][l-1];
W_im=0;
} else if (l==5) { // DMRS
W_re=W2[1];
W_im=0;
} else if ((l>=N_UL_symb-2)) { // data
;
} else {
//***log W Select Error!
}
} else {
if (first_slot == 1) { // 1st slot or 2nd slot and not shortened
n_oc=n_oc0;
} else {
n_oc=n_oc1;
}
if (l<1) { // data
W_re=W5_fmt3_re[n_oc][l];
W_im=W5_fmt3_im[n_oc][l];
} else if (l==1) { // DMRS
W_re=W2[0];
W_im=0;
} else if (l>=2 && l<5) { // data
W_re=W5_fmt3_re[n_oc][l-1];
W_im=W5_fmt3_im[n_oc][l-1];
} else if (l==5) { // DMRS
W_re=W2[1];
W_im=0;
} else if ((l>=N_UL_symb-1)) { // data
W_re=W5_fmt3_re[n_oc][l-N_UL_symb+5];
W_im=W5_fmt3_im[n_oc][l-N_UL_symb+5];
} else {
//***log W Select Error!
}
} // W Selection end
// Compute n_cs (36.211 p. 18)
n_cs = ncs_cell[ns][l];
if (N_PUCCH_SF1 == 5) {
alpha_idx = (n_cs + Np5_TBL[n_oc]) % 12;
} else {
alpha_idx = (n_cs + Np4_TBL[n_oc]) % 12;
}
// generate pucch data
dt_offset = (first_slot == 1) ? 0:12;
sym_offset = (first_slot == 1) ? 0:7;
for (i=0; i<12; i++) {
// Calculate yn(i)
tmp_re = (((int32_t) (W_re*rot_re - W_im*rot_im)) >>15);
tmp_im = (((int32_t) (W_re*rot_im + W_im*rot_re)) >>15);
y_re[l+sym_offset][i] = (((int32_t) (tmp_re*d_re[i+dt_offset] - tmp_im*d_im[i+dt_offset]))>>15);
y_im[l+sym_offset][i] = (((int32_t) (tmp_re*d_im[i+dt_offset] + tmp_im*d_re[i+dt_offset]))>>15);
// cyclic shift
((int16_t *)&y_tilda_ptr[(l+sym_offset)*12+(i-(ncs_cell[ns][l]%12)+12)%12])[0] = y_re[l+sym_offset][i];
((int16_t *)&y_tilda_ptr[(l+sym_offset)*12+(i-(ncs_cell[ns][l]%12)+12)%12])[1] = y_im[l+sym_offset][i];
// DMRS
m_alpha_idx = (alpha_idx * i) % 12;
if (l==1 || l==5) {
((int16_t *)&zptr[(l+sym_offset)*12+i])[0] =(((((int32_t) alphaTBL_re[m_alpha_idx]*ul_ref_sigs[u][v][0][i<<1] - (int32_t) alphaTBL_im[m_alpha_idx] * ul_ref_sigs[u][v][0][1+(i<<1)])>>15) * (int32_t)amp)>>15);
((int16_t *)&zptr[(l+sym_offset)*12+i])[1] =(((((int32_t) alphaTBL_re[m_alpha_idx]*ul_ref_sigs[u][v][0][1+(i<<1)] + (int32_t) alphaTBL_im[m_alpha_idx] * ul_ref_sigs[u][v][0][i<<1])>>15) * (int32_t)amp)>>15);
}
}
} // l loop
} // ns
// DFT for pucch-data
for (l=0; l<14; l++) {
if (l==1 || l==5 || l==8 || l==12) {
;
} else {
pucchfmt3_Dft((int16_t*)&y_tilda_ptr[l*12],(int16_t*)&zptr[l*12]);
}
}
// Mapping
m = n3_pucch / N_PUCCH_SF0;
if (shortened_format == 1) {
nsymb = (N_UL_symb<<1) - 1;
} else {
nsymb = (N_UL_symb<<1);
}
for (j=0,l=0; l<(nsymb); l++) {
if ((l<7) && ((m&1) == 0))
re_offset = (m*6) + frame_parms->first_carrier_offset;
else if ((l<7) && ((m&1) == 1))
re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12;
else if ((m&1) == 0)
re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12;
else
re_offset = ((m-1)*6) + frame_parms->first_carrier_offset;
if (re_offset > frame_parms->ofdm_symbol_size)
re_offset -= (frame_parms->ofdm_symbol_size);
symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*(l+(subframe*14));
txptr = &txdataF[0][symbol_offset];
for (i=0; i<12; i++,j++) {
txptr[re_offset++] = z[j];
if (re_offset==frame_parms->ofdm_symbol_size)
re_offset = 0;
#ifdef DEBUG_PUCCH_TX
msg("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
#endif
}
}
}
+420
View File
@@ -0,0 +1,420 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/sss_ue.c
* \brief Top-level routines for decoding the secondary synchronization signal (SSS) V8.6 2009-03
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "defs.h"
#include "PHY/extern.h"
//#define DEBUG_SSS
int pss_ch_est(PHY_VARS_UE *ue,
int32_t pss_ext[4][72],
int32_t sss_ext[4][72])
{
int16_t *pss;
int16_t *pss_ext2,*sss_ext2,*sss_ext3,tmp_re,tmp_im,tmp_re2,tmp_im2;
uint8_t aarx,i;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
switch (ue->common_vars.eNb_id) {
case 0:
pss = &primary_synch0[10];
break;
case 1:
pss = &primary_synch1[10];
break;
case 2:
pss = &primary_synch2[10];
break;
default:
pss = &primary_synch0[10];
break;
}
sss_ext3 = (int16_t*)&sss_ext[0][5];
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
sss_ext2 = (int16_t*)&sss_ext[aarx][5];
pss_ext2 = (int16_t*)&pss_ext[aarx][5];
for (i=0; i<62; i++) {
// This is H*(PSS) = R* \cdot PSS
tmp_re = (int16_t)(((pss_ext2[i<<1] * (int32_t)pss[i<<1])>>15) + ((pss_ext2[1+(i<<1)] * (int32_t)pss[1+(i<<1)])>>15));
tmp_im = (int16_t)(((pss_ext2[i<<1] * (int32_t)pss[1+(i<<1)])>>15) - ((pss_ext2[1+(i<<1)] * (int32_t)pss[(i<<1)])>>15));
// printf("H*(%d,%d) : (%d,%d)\n",aarx,i,tmp_re,tmp_im);
// This is R(SSS) \cdot H*(PSS)
tmp_re2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[i<<1])>>15) - ((tmp_im * (int32_t)sss_ext2[1+(i<<1)]>>15)));
tmp_im2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[1+(i<<1)])>>15) + ((tmp_im * (int32_t)sss_ext2[(i<<1)]>>15)));
// printf("SSSi(%d,%d) : (%d,%d)\n",aarx,i,sss_ext2[i<<1],sss_ext2[1+(i<<1)]);
// printf("SSSo(%d,%d) : (%d,%d)\n",aarx,i,tmp_re2,tmp_im2);
// MRC on RX antennas
if (aarx==0) {
sss_ext3[i<<1] = tmp_re2;
sss_ext3[1+(i<<1)] = tmp_im2;
} else {
sss_ext3[i<<1] += tmp_re2;
sss_ext3[1+(i<<1)] += tmp_im2;
}
}
}
// sss_ext now contains the compensated SSS
return(0);
}
int _do_pss_sss_extract(PHY_VARS_UE *ue,
int32_t pss_ext[4][72],
int32_t sss_ext[4][72],
uint8_t doPss, uint8_t doSss,
uint8_t subframe) // add flag to indicate extracting only PSS, only SSS, or both
{
uint16_t rb,nb_rb=6;
uint8_t i,aarx;
int32_t *pss_rxF,*pss_rxF_ext;
int32_t *sss_rxF,*sss_rxF_ext;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
uint8_t next_thread_id = ue->current_thread_id[subframe]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[subframe]+1);
int rx_offset = frame_parms->ofdm_symbol_size-3*12;
uint8_t pss_symb,sss_symb;
int32_t **rxdataF;
//LOG_I(PHY,"do_pss_sss_extract subframe %d \n",subframe);
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
if (frame_parms->frame_type == FDD) {
pss_symb = 6-frame_parms->Ncp;
sss_symb = pss_symb-1;
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))];
sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))];
} else {
pss_symb = 2;
sss_symb = frame_parms->symbols_per_tti-1;
if(subframe==5 || subframe==0)
{
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))];
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF;
pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))];
}
else if(subframe==6 || subframe==1)
{
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))];
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF;
sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))];
}
else
{
AssertFatal(0,"");
}
}
//printf("extract_rbs: symbol_mod=%d, rx_offset=%d, ch_offset=%d\n",symbol_mod,
// (rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2,
// LTE_CE_OFFSET+ch_offset+(symbol_mod*(frame_parms->ofdm_symbol_size)));
pss_rxF_ext = &pss_ext[aarx][0];
sss_rxF_ext = &sss_ext[aarx][0];
for (rb=0; rb<nb_rb; rb++) {
// skip DC carrier
if (rb==3) {
if(frame_parms->frame_type == FDD)
{
sss_rxF = &rxdataF[aarx][(1 + (sss_symb*(frame_parms->ofdm_symbol_size)))];
pss_rxF = &rxdataF[aarx][(1 + (pss_symb*(frame_parms->ofdm_symbol_size)))];
}
else
{
if(subframe==5 || subframe==0)
{
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
sss_rxF = &rxdataF[aarx][(1 + (sss_symb*(frame_parms->ofdm_symbol_size)))];
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF;
pss_rxF = &rxdataF[aarx][(1 + (pss_symb*(frame_parms->ofdm_symbol_size)))];
}
else if(subframe==6 || subframe==1)
{
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))];
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF;
sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))];
}
else
{
AssertFatal(0,"");
}
}
}
for (i=0; i<12; i++) {
if (doPss) {pss_rxF_ext[i]=pss_rxF[i];}
if (doSss) {sss_rxF_ext[i]=sss_rxF[i];}
}
pss_rxF+=12;
sss_rxF+=12;
pss_rxF_ext+=12;
sss_rxF_ext+=12;
}
}
return(0);
}
int pss_sss_extract(PHY_VARS_UE *phy_vars_ue,
int32_t pss_ext[4][72],
int32_t sss_ext[4][72],
uint8_t subframe)
{
return _do_pss_sss_extract(phy_vars_ue, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */, subframe);
}
int pss_only_extract(PHY_VARS_UE *phy_vars_ue,
int32_t pss_ext[4][72],
uint8_t subframe)
{
static int32_t dummy[4][72];
return _do_pss_sss_extract(phy_vars_ue, pss_ext, dummy, 1 /* doPss */, 0 /* doSss */, subframe);
}
int sss_only_extract(PHY_VARS_UE *phy_vars_ue,
int32_t sss_ext[4][72],
uint8_t subframe)
{
static int32_t dummy[4][72];
return _do_pss_sss_extract(phy_vars_ue, dummy, sss_ext, 0 /* doPss */, 1 /* doSss */, subframe);
}
int16_t phase_re[7] = {16383, 25101, 30791, 32767, 30791, 25101, 16383};
int16_t phase_im[7] = {-28378, -21063, -11208, 0, 11207, 21062, 28377};
int rx_sss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *flip_max,uint8_t *phase_max)
{
uint8_t i;
int32_t pss_ext[4][72];
int32_t sss0_ext[4][72],sss5_ext[4][72];
uint8_t Nid2 = ue->common_vars.eNb_id;
uint8_t flip,phase;
uint16_t Nid1;
int16_t *sss0,*sss5;
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int32_t metric;
int16_t *d0,*d5;
if (frame_parms->frame_type == FDD) {
#ifdef DEBUG_SSS
if (frame_parms->Ncp == NORMAL)
msg("[PHY][UE%d] Doing SSS for FDD Normal Prefix\n",ue->Mod_id);
else
msg("[PHY][UE%d] Doing SSS for FDD Extended Prefix\n",ue->Mod_id);
#endif
// Do FFTs for SSS/PSS
// SSS
slot_fep(ue,
(frame_parms->symbols_per_tti/2)-2, // second to last symbol of
0, // slot 0
ue->rx_offset,
0,
1);
// PSS
slot_fep(ue,
(frame_parms->symbols_per_tti/2)-1, // last symbol of
0, // slot 0
ue->rx_offset,
0,
1);
} else { // TDD
#ifdef DEBUG_SSS
if (ue->frame_parms->Ncp == NORMAL)
msg("[PHY][UE%d] Doing SSS for TDD Normal Prefix\n",ue->Mod_id);
else
msg("[PHY][UE%d] Doing SSS for TDD Extended Prefix\n",ue->Mod_id);
#endif
// SSS
slot_fep(ue,
(frame_parms->symbols_per_tti>>1)-1, // last symbol of
1, // slot 1
ue->rx_offset,
0,
1);
// PSS
slot_fep(ue,
2, // symbol 2 of
2, // slot 2
ue->rx_offset,
0,
1);
}
// pss sss extract for subframe 0
pss_sss_extract(ue,
pss_ext,
sss0_ext,0);
/*
write_output("rxsig0.m","rxs0",&ue->common_vars.rxdata[0][0],ue->frame_parms.samples_per_tti,1,1);
write_output("rxdataF0.m","rxF0",&ue->common_vars.rxdataF[0][0],2*14*ue->frame_parms.ofdm_symbol_size,2,1);
write_output("pss_ext0.m","pssext0",pss_ext,72,1,1);
write_output("sss0_ext0.m","sss0ext0",sss0_ext,72,1,1);
*/
// get conjugated channel estimate from PSS (symbol 6), H* = R* \cdot PSS
// and do channel estimation and compensation based on PSS
pss_ch_est(ue,
pss_ext,
sss0_ext);
// write_output("sss0_comp0.m","sss0comp0",sss0_ext,72,1,1);
if (ue->frame_parms.frame_type == FDD) { // FDD
// SSS
slot_fep(ue,
(frame_parms->symbols_per_tti/2)-2,
10,
ue->rx_offset,
0,1);
// PSS
slot_fep(ue,
(frame_parms->symbols_per_tti/2)-1,
10,
ue->rx_offset,
0,1);
} else { // TDD
// SSS
slot_fep(ue,
(frame_parms->symbols_per_tti>>1)-1,
11,
ue->rx_offset,
0,
1);
// PSS
slot_fep(ue,
2,
12,
ue->rx_offset,
0,
1);
}
// pss sss extract for subframe 5
pss_sss_extract(ue,
pss_ext,
sss5_ext,5);
// write_output("sss5_ext0.m","sss5ext0",sss5_ext,72,1,1);
// get conjugated channel estimate from PSS (symbol 6), H* = R* \cdot PSS
// and do channel estimation and compensation based on PSS
pss_ch_est(ue,
pss_ext,
sss5_ext);
// now do the SSS detection based on the precomputed sequences in PHY/LTE_TRANSPORT/sss.h
*tot_metric = -99999999;
sss0 = (int16_t*)&sss0_ext[0][5];
sss5 = (int16_t*)&sss5_ext[0][5];
for (flip=0; flip<2; flip++) { // d0/d5 flip in RX frame
for (phase=0; phase<7; phase++) { // phase offset between PSS and SSS
for (Nid1 = 0 ; Nid1 <= 167; Nid1++) { // 168 possible Nid1 values
metric = 0;
if (flip==0) {
d0 = &d0_sss[62*(Nid2 + (Nid1*3))];
d5 = &d5_sss[62*(Nid2 + (Nid1*3))];
} else {
d5 = &d0_sss[62*(Nid2 + (Nid1*3))];
d0 = &d5_sss[62*(Nid2 + (Nid1*3))];
}
// This is the inner product using one particular value of each unknown parameter
for (i=0; i<62; i++) {
metric += (int16_t)(((d0[i]*((((phase_re[phase]*(int32_t)sss0[i<<1])>>19)-((phase_im[phase]*(int32_t)sss0[1+(i<<1)])>>19)))) +
(d5[i]*((((phase_re[phase]*(int32_t)sss5[i<<1])>>19)-((phase_im[phase]*(int32_t)sss5[1+(i<<1)])>>19))))));
}
// if the current metric is better than the last save it
if (metric > *tot_metric) {
*tot_metric = metric;
ue->frame_parms.Nid_cell = Nid2+(3*Nid1);
*phase_max = phase;
*flip_max=flip;
#ifdef DEBUG_SSS
msg("(flip,phase,Nid1) (%d,%d,%d), metric_phase %d tot_metric %d, phase_max %d, flip_max %d\n",flip,phase,Nid1,metric,*tot_metric,*phase_max,*flip_max);
#endif
}
}
}
}
return(0);
}
@@ -0,0 +1,335 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/defs.h
* \brief data structures for PDSCH/DLSCH/PUSCH/ULSCH physical and transport channel descriptors (TX/RX)
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
* \note
* \warning
*/
#ifndef __TRANSPORT_UE__H__
#define __TRANSPORT_UE__H__
#include "PHY/defs.h"
#include "PHY/impl_defs_lte.h"
#include "dci.h"
#include "mdci.h"
#include "uci_common.h"
#ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h"
#endif
#include "../LTE_TRANSPORT/transport_common.h"
// structures below implement 36-211 and 36-212
/** @addtogroup _PHY_TRANSPORT_
* @{
*/
typedef struct {
/// Indicator of first transmission
uint8_t first_tx;
/// Last Ndi received for this process on DCI (used for C-RNTI only)
uint8_t DCINdi;
/// Flag indicating that this ULSCH has a new packet (start of new round)
// uint8_t Ndi;
/// Status Flag indicating for this ULSCH (idle,active,disabled)
SCH_status_t status;
/// Subframe scheduling indicator (i.e. Transmission opportunity indicator)
uint8_t subframe_scheduling_flag;
/// Subframe cba scheduling indicator (i.e. Transmission opportunity indicator)
uint8_t subframe_cba_scheduling_flag;
/// First Allocated RB
uint16_t first_rb;
/// Current Number of RBs
uint16_t nb_rb;
/// Last TPC command
uint8_t TPC;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Length of ACK information (bits)
uint8_t O_ACK;
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t *c[MAX_NUM_ULSCH_SEGMENTS];
/// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
uint32_t RTC[MAX_NUM_ULSCH_SEGMENTS];
/// Index of current HARQ round for this ULSCH
uint8_t round;
/// MCS format of this ULSCH
uint8_t mcs;
/// Redundancy-version of the current sub-frame
uint8_t rvidx;
/// Turbo-code outputs (36-212 V8.6 2009-03, p.12
uint8_t d[MAX_NUM_ULSCH_SEGMENTS][(96+3+(3*6144))];
/// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17)
uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*6144];
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9)
uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cminus;
/// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cplus;
/// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kminus;
/// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kplus;
/// Total number of bits across all segments
uint32_t sumKr;
/// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t F;
/// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint16_t Msc_initial;
/// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint8_t Nsymb_initial;
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2)
uint8_t n_DMRS;
/// n_DMRS2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1)
uint8_t n_DMRS2;
/// Flag to indicate that this is a control only ULSCH (i.e. no MAC SDU)
uint8_t control_only;
/// Flag to indicate that this is a calibration ULSCH (i.e. no MAC SDU and filled with TDD calibration information)
// int calibration_flag;
/// Number of soft channel bits
uint32_t G;
// decode phich
uint8_t decode_phich;
} LTE_UL_UE_HARQ_t;
typedef struct {
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// SRS active flag
uint8_t srs_active;
/// Pointers to 8 HARQ processes for the ULSCH
LTE_UL_UE_HARQ_t *harq_processes[8];
/// Pointer to CQI data (+1 for 8 bits crc)
uint8_t o[1+MAX_CQI_BYTES];
/// Length of CQI data (bits)
uint8_t O;
/// Format of CQI data
UCI_format_t uci_format;
/// Rank information
uint8_t o_RI[2];
/// Length of rank information (bits)
uint8_t O_RI;
/// Pointer to ACK
uint8_t o_ACK[4];
/// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37)
uint8_t O_CQI_MIN;
/// ACK/NAK Bundling flag
uint8_t bundling;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e[MAX_NUM_CHANNEL_BITS];
/// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t h[MAX_NUM_CHANNEL_BITS];
/// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
uint8_t b_tilde[MAX_NUM_CHANNEL_BITS];
/// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
int32_t d[MAX_NUM_RE];
/// Transform-coded "z"-sequences (for definition see 36-211 V8.6 2009-03, p.14-15)
int32_t z[MAX_NUM_RE];
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
uint8_t q[MAX_CQI_PAYLOAD];
/// coded and interleaved CQI bits
uint8_t o_w[(MAX_CQI_BITS+8)*3];
/// coded CQI bits
uint8_t o_d[96+((MAX_CQI_BITS+8)*3)];
/// coded ACK bits
uint8_t q_ACK[MAX_ACK_PAYLOAD];
/// coded RI bits
uint8_t q_RI[MAX_RI_PAYLOAD];
/// beta_offset_cqi times 8
uint16_t beta_offset_cqi_times8;
/// beta_offset_ri times 8
uint16_t beta_offset_ri_times8;
/// beta_offset_harqack times 8
uint16_t beta_offset_harqack_times8;
/// power_offset
uint8_t power_offset;
// for cooperative communication
uint8_t cooperation_flag;
/// RNTI attributed to this ULSCH
uint16_t rnti;
/// f_PUSCH parameter for PUSCH power control
int16_t f_pusch;
/// Po_PUSCH - target output power for PUSCH
int16_t Po_PUSCH;
/// PHR - current power headroom (based on last PUSCH transmission)
int16_t PHR;
/// Po_SRS - target output power for SRS
int16_t Po_SRS;
/// num active cba group
uint8_t num_active_cba_groups;
/// num dci found for cba
uint8_t num_cba_dci[10];
/// allocated CBA RNTI
uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
/// UL max-harq-retransmission
uint8_t Mlimit;
} LTE_UE_ULSCH_t;
typedef struct {
/// Indicator of first transmission
uint8_t first_tx;
/// Last Ndi received for this process on DCI (used for C-RNTI only)
uint8_t DCINdi;
/// DLSCH status flag indicating
SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits
uint32_t B;
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t *c[MAX_NUM_DLSCH_SEGMENTS];
/// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
uint32_t RTC[MAX_NUM_DLSCH_SEGMENTS];
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this DLSCH
uint8_t mcs;
/// Qm (modulation order) for this DLSCH
uint8_t Qm;
/// Redundancy-version of the current sub-frame
uint8_t rvidx;
/// MIMO mode for this DLSCH
MIMO_mode_t mimo_mode;
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)];
/// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
double w_abs[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)];
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
int16_t *d[MAX_NUM_DLSCH_SEGMENTS];
/// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9)
uint32_t C;
/// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cminus;
/// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Cplus;
/// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kminus;
/// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t Kplus;
/// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t F;
/// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Nl;
/// current delta_pucch
int8_t delta_PUCCH;
/// Number of soft channel bits
uint32_t G;
/// Current Number of RBs
uint16_t nb_rb;
/// Current subband PMI allocation
uint16_t pmi_alloc;
/// Current RB allocation (even slots)
uint32_t rb_alloc_even[4];
/// Current RB allocation (odd slots)
uint32_t rb_alloc_odd[4];
/// distributed/localized flag
vrb_t vrb_type;
/// downlink power offset field
uint8_t dl_power_off;
/// trials per round statistics
uint32_t trials[8];
/// error statistics per round
uint32_t errors[8];
/// codeword this transport block is mapped to
uint8_t codeword;
} LTE_DL_UE_HARQ_t;
typedef struct {
/// HARQ process id
uint8_t harq_id;
/// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX
uint8_t ack;
/// send status (for PUCCH)
uint8_t send_harq_status;
/// nCCE (for PUCCH)
uint8_t nCCE;
/// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched
uint8_t vDAI_DL;
/// DAI value detected from DCI0/4. 0xff indicates not touched
uint8_t vDAI_UL;
} harq_status_t;
typedef struct {
/// RNTI
uint16_t rnti;
/// Active flag for DLSCH demodulation
uint8_t active;
/// Transmission mode
uint8_t mode1_flag;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
/// Current HARQ process id threadRx Odd and threadRx Even
uint8_t current_harq_pid;
/// Current subband antenna selection
uint32_t antenna_alloc;
/// Current subband RI allocation
uint32_t ri_alloc;
/// Current subband CQI1 allocation
uint32_t cqi_alloc1;
/// Current subband CQI2 allocation
uint32_t cqi_alloc2;
/// saved subband PMI allocation from last PUSCH/PUCCH report
uint16_t pmi_alloc;
/// HARQ-ACKs
harq_status_t harq_ack[10];
/// Pointers to up to 8 HARQ processes
LTE_DL_UE_HARQ_t *harq_processes[8];
/// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17
uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// Maximum number of Turbo iterations
uint8_t max_turbo_iterations;
/// number of iterations used in last turbo decoding
uint8_t last_iteration_cnt;
/// accumulated tx power adjustment for PUCCH
int8_t g_pucch;
} LTE_UE_DLSCH_t;
/**@}*/
#endif
@@ -0,0 +1,264 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/phich.c
* \brief Routines for generation of and computations regarding the uplink control information (UCI) for PUSCH. V8.6 2009-03
* \author R. Knopp, F. Kaltenberger, A. Bhamri
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, ankit.bhamri@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#ifdef DEBUG_UCI_TOOLS
#include "PHY/vars.h"
#endif
//#define DEBUG_UCI 1
uint64_t pmi2hex_2Ar1(uint32_t pmi)
{
uint64_t pmil = (uint64_t)pmi;
return ((pmil&3) + (((pmil>>2)&3)<<4) + (((pmil>>4)&3)<<8) + (((pmil>>6)&3)<<12) +
(((pmil>>8)&3)<<16) + (((pmil>>10)&3)<<20) + (((pmil>>12)&3)<<24) +
(((pmil>>14)&3)<<28) + (((pmil>>16)&3)<<32) + (((pmil>>18)&3)<<36) +
(((pmil>>20)&3)<<40) + (((pmil>>22)&3)<<44) + (((pmil>>24)&3)<<48));
}
uint64_t pmi2hex_2Ar2(uint32_t pmi)
{
uint64_t pmil = (uint64_t)pmi;
return ((pmil&1) + (((pmil>>1)&1)<<4) + (((pmil>>2)&1)<<8) + (((pmil>>3)&1)<<12) +
(((pmil>>4)&1)<<16) + (((pmil>>5)&1)<<20) + (((pmil>>6)&1)<<24) +
(((pmil>>7)&1)<<28) + (((pmil>>8)&1)<<32) + (((pmil>>9)&1)<<36) +
(((pmil>>10)&1)<<40) + (((pmil>>11)&1)<<44) + (((pmil>>12)&1)<<48));
}
uint64_t cqi2hex(uint32_t cqi)
{
uint64_t cqil = (uint64_t)cqi;
return ((cqil&3) + (((cqil>>2)&3)<<4) + (((cqil>>4)&3)<<8) + (((cqil>>6)&3)<<12) +
(((cqil>>8)&3)<<16) + (((cqil>>10)&3)<<20) + (((cqil>>12)&3)<<24) +
(((cqil>>14)&3)<<28) + (((cqil>>16)&3)<<32) + (((cqil>>18)&3)<<36) +
(((cqil>>20)&3)<<40) + (((cqil>>22)&3)<<44) + (((cqil>>24)&3)<<48));
}
void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
{
switch(uci_format) {
case wideband_cqi_rank1_2A:
#ifdef DEBUG_UCI
LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA);
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi));
break;
case 25:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_5MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi));
break;
case 50:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_10MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_10MHz *)o)->pmi));
break;
case 100:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
((wideband_cqi_rank1_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,
((wideband_cqi_rank1_2A_20MHz *)o)->pmi,
pmi2hex_2Ar1(((wideband_cqi_rank1_2A_20MHz *)o)->pmi));
break;
}
#endif //DEBUG_UCI
break;
case wideband_cqi_rank2_2A:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi));
break;
case 25:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi));
break;
case 50:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_10MHz *)o)->pmi));
break;
case 100:
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_20MHz *)o)->pmi));
break;
}
#endif //DEBUG_UCI
break;
case HLC_subband_cqi_nopmi:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1));
break;
case 25:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
break;
case 50:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1));
break;
case 100:
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1));
break;
}
#endif //DEBUG_UCI
break;
case HLC_subband_cqi_rank1_2A:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
case 25:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
case 50:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
case 100:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi);
break;
}
#endif //DEBUG_UCI
break;
case HLC_subband_cqi_rank2_2A:
#ifdef DEBUG_UCI
switch(N_RB_DL) {
case 6:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi);
break;
case 25:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi);
break;
case 50:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi);
break;
case 100:
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2);
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2));
LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi);
break;
}
#endif //DEBUG_UCI
break;
case ue_selected:
#ifdef DEBUG_UCI
LOG_W(PHY,"[PRINT CQI] ue_selected CQI not supported yet!!!\n");
#endif //DEBUG_UCI
break;
default:
#ifdef DEBUG_UCI
LOG_E(PHY,"[PRINT CQI] unsupported CQI mode (%d)!!!\n",uci_format);
#endif //DEBUG_UCI
break;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -107,7 +107,7 @@
* @}
*/
#include "defs.h"
#include "defs_eNB.h"
#include "types.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 ;
-4
View File
@@ -30,10 +30,6 @@
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "nfapi_interface.h"
#include "fapi_l1.h"
+4 -4
View File
@@ -30,10 +30,10 @@
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
#include "SCHED/sched_eNB.h"
#include "SCHED/sched_extern_eNB.h"
#include "nfapi_interface.h"
void fill_uci_harq_indication(PHY_VARS_eNB *eNB,LTE_eNB_UCI *uci,int frame,int subframe,uint8_t *harq_ack,uint8_t tdd_mapping_mode,uint16_t tdd_multiplexing_mask);
@@ -43,11 +43,12 @@
#include <stdlib.h>
#include <string.h>
#include "PHY/defs.h"
#include "PHY/LTE_TRANSPORT/defs.h"
//#include "PHY/defs.h"
//#include "PHY/LTE_TRANSPORT/defs.h"
#include "COMMON/platform_constants.h"
#include "BCCH-BCH-Message.h"
#include "RadioResourceConfigCommon.h"
#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h"
#include "MeasGapConfig.h"
#include "SchedulingInfoList.h"
@@ -1355,6 +1356,6 @@ typedef struct {
uint8_t n_adj_cells;
} neigh_cell_id_t;
#include "proto.h"
#include "mac_proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
@@ -32,10 +32,10 @@
#ifndef __MAC_EXTERN_H__
#define __MAC_EXTERN_H__
#include "PHY/defs.h"
#include "defs.h"
//#include "PHY/defs_common.h"
#include "mac.h"
#include "RRC/LITE/defs.h"
#include "RRC/LTE/rrc_defs.h"
extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
//extern uint32_t EBSR_Level[63];
@@ -75,26 +75,5 @@ extern uint32_t RRC_CONNECTION_FLAG;
extern uint8_t rb_table[34];
extern DCI0_5MHz_TDD_1_6_t UL_alloc_pdu;
extern DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu;
extern DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A;
extern DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu;
extern DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
extern DCI1_5MHz_TDD_t DLSCH_alloc_pdu;
extern DCI0_5MHz_FDD_t UL_alloc_pdu_fdd;
extern DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd;
extern DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd;
extern DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd;
extern DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd;
extern DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd;
extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
#endif //DEF_H
@@ -29,7 +29,7 @@
#ifndef __LAYER2_MAC_PROTO_H__
#define __LAYER2_MAC_PROTO_H__
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/mac.h"
/** \addtogroup _mac
* @{
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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
@@ -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)
@@ -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)
+1 -1
View File
@@ -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"
+3 -2
View File
@@ -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
@@ -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"
@@ -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"

Some files were not shown because too many files have changed in this diff Show More