You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
6.1 KiB
C++

/**
*
* \section COPYRIGHT
*
* Copyright 2013-2020 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#include "srslte/asn1/rrc_nr.h"
#include "srslte/common/test_common.h"
#include <cstdio>
using namespace asn1;
using namespace asn1::rrc_nr;
int test_eutra_nr_capabilities()
{
struct ue_mrdc_cap_s mrdc_cap;
band_combination_s band_combination;
struct band_params_c band_param_eutra;
band_param_eutra.set_eutra();
band_param_eutra.eutra().ca_bw_class_dl_eutra_present = true;
band_param_eutra.eutra().ca_bw_class_ul_eutra_present = true;
band_param_eutra.eutra().band_eutra = 1;
band_param_eutra.eutra().ca_bw_class_dl_eutra = asn1::rrc_nr::ca_bw_class_eutra_opts::options::a;
band_param_eutra.eutra().ca_bw_class_ul_eutra = asn1::rrc_nr::ca_bw_class_eutra_opts::options::a;
band_combination.band_list.push_back(band_param_eutra);
struct band_params_c band_param_nr;
band_param_nr.set_nr();
band_param_nr.nr().ca_bw_class_dl_nr_present = true;
band_param_nr.nr().ca_bw_class_ul_nr_present = true;
band_param_nr.nr().band_nr = 78;
band_param_nr.nr().ca_bw_class_dl_nr = asn1::rrc_nr::ca_bw_class_nr_opts::options::a;
band_param_nr.nr().ca_bw_class_ul_nr = asn1::rrc_nr::ca_bw_class_nr_opts::options::a;
band_combination.band_list.push_back(band_param_nr);
mrdc_cap.rf_params_mrdc.supported_band_combination_list.push_back(band_combination);
mrdc_cap.rf_params_mrdc.supported_band_combination_list_present = true;
mrdc_cap.rf_params_mrdc.ext = true;
// RF Params MRDC applied_freq_band_list_filt
freq_band_info_c band_info_eutra;
band_info_eutra.set_band_info_eutra();
band_info_eutra.band_info_eutra().ca_bw_class_dl_eutra_present = false;
band_info_eutra.band_info_eutra().ca_bw_class_ul_eutra_present = false;
band_info_eutra.band_info_eutra().band_eutra = 1;
mrdc_cap.rf_params_mrdc.applied_freq_band_list_filt.push_back(band_info_eutra);
freq_band_info_c band_info_nr;
band_info_nr.set_band_info_nr();
band_info_nr.band_info_nr().band_nr = 78;
mrdc_cap.rf_params_mrdc.applied_freq_band_list_filt.push_back(band_info_nr);
mrdc_cap.rf_params_mrdc.applied_freq_band_list_filt_present = true;
// rf_params_mrdc supported band combination list v1540
band_combination_list_v1540_l* band_combination_list_v1450 = new band_combination_list_v1540_l();
band_combination_v1540_s band_combination_v1540;
band_params_v1540_s band_params_a;
band_params_a.srs_tx_switch_present = true;
band_params_a.srs_carrier_switch_present = false;
band_params_a.srs_tx_switch.supported_srs_tx_port_switch =
band_params_v1540_s::srs_tx_switch_s_::supported_srs_tx_port_switch_opts::not_supported;
band_combination_v1540.band_list_v1540.push_back(band_params_a);
band_params_v1540_s band_params_b;
band_params_b.srs_tx_switch_present = true;
band_params_b.srs_tx_switch.supported_srs_tx_port_switch =
band_params_v1540_s::srs_tx_switch_s_::supported_srs_tx_port_switch_opts::t1r2;
band_params_b.srs_carrier_switch_present = false;
band_combination_v1540.band_list_v1540.push_back(band_params_b);
// clang-format off
band_combination_v1540.ca_params_nr_v1540_present = false;
band_combination_v1540.ca_params_nr_v1540.simul_csi_reports_all_cc_present = true;
band_combination_v1540.ca_params_nr_v1540.csi_rs_im_reception_for_feedback_per_band_comb.max_num_simul_nzp_csi_rs_act_bwp_all_cc_present = true;
band_combination_v1540.ca_params_nr_v1540.csi_rs_im_reception_for_feedback_per_band_comb.max_num_simul_nzp_csi_rs_act_bwp_all_cc = 5;
band_combination_v1540.ca_params_nr_v1540.csi_rs_im_reception_for_feedback_per_band_comb.total_num_ports_simul_nzp_csi_rs_act_bwp_all_cc_present = true;
band_combination_v1540.ca_params_nr_v1540.csi_rs_im_reception_for_feedback_per_band_comb.total_num_ports_simul_nzp_csi_rs_act_bwp_all_cc = 32;
// clang-format on
band_combination_list_v1450->push_back(band_combination_v1540);
mrdc_cap.rf_params_mrdc.supported_band_combination_list_v1540.reset(band_combination_list_v1450);
feature_set_combination_l feature_set_combination;
feature_sets_per_band_l feature_sets_per_band;
feature_set_c feature_set_eutra;
feature_set_eutra.set_eutra();
feature_set_eutra.eutra().dl_set_eutra = 1;
feature_set_eutra.eutra().ul_set_eutra = 1;
feature_sets_per_band.push_back(feature_set_eutra);
feature_set_combination.push_back(feature_sets_per_band);
feature_set_c feature_set_nr;
feature_set_nr.set_nr();
feature_set_nr.nr().dl_set_nr = 1;
feature_set_nr.nr().ul_set_nr = 1;
feature_sets_per_band.push_back(feature_set_nr);
feature_set_combination.push_back(feature_sets_per_band);
mrdc_cap.feature_set_combinations.push_back(feature_set_combination);
mrdc_cap.feature_set_combinations_present = true;
// Pack mrdc_cap
uint8_t buffer[1024];
asn1::bit_ref bref(buffer, sizeof(buffer));
mrdc_cap.pack(bref);
TESTASSERT(test_pack_unpack_consistency(mrdc_cap) == SRSASN_SUCCESS);
srslte::logmap::get("RRC")->info_hex(
buffer, bref.distance_bytes(), "Packed cap struct (%d bytes):\n", bref.distance_bytes());
return SRSLTE_SUCCESS;
}
int test_ue_mrdc_capabilities()
{
uint8_t msg[] = {0x01, 0x1c, 0x04, 0x81, 0x60, 0x00, 0x1c, 0x4d, 0x00, 0x00, 0x00, 0x04,
0x00, 0x40, 0x04, 0x04, 0xd0, 0x10, 0x74, 0x06, 0x14, 0xe8, 0x1b, 0x10,
0x78, 0x00, 0x00, 0x20, 0x00, 0x10, 0x08, 0x08, 0x01, 0x00, 0x20};
// 011c048160001c4d0000000400400404d010740614e81b107800002000100808010020
asn1::cbit_ref bref{msg, sizeof(msg)};
ue_mrdc_cap_s mrdc_cap;
TESTASSERT(mrdc_cap.unpack(bref) == SRSASN_SUCCESS);
TESTASSERT(test_pack_unpack_consistency(mrdc_cap) == SRSASN_SUCCESS);
return SRSLTE_SUCCESS;
}
int main()
{
srslte::logmap::set_default_log_level(srslte::LOG_LEVEL_DEBUG);
TESTASSERT(test_eutra_nr_capabilities() == 0);
TESTASSERT(test_ue_mrdc_capabilities() == 0);
printf("Success\n");
return 0;
}