Hardcoded NR/MRDC-Capabilities

This commit is contained in:
David Rupprecht 2020-12-14 14:30:42 +01:00 committed by Andre Puschmann
parent b79eef0860
commit 4305929ec7
4 changed files with 188 additions and 20 deletions

View File

@ -67,7 +67,11 @@ public:
enum direction_t { Rx = 0, Tx };
template <class T>
void log_rrc_message(const std::string& source, direction_t dir, const srslte::byte_buffer_t* pdu, const T& msg);
void log_rrc_message(const std::string& source,
direction_t dir,
const srslte::byte_buffer_t* pdu,
const T& msg,
const std::string& msg_type);
// PHY interface
void in_sync() final;

View File

@ -69,8 +69,27 @@ void rrc_nr::timer_expired(uint32_t timeout_id) {}
void rrc_nr::srslte_rrc_log(const char* str) {}
template <class T>
void rrc_nr::log_rrc_message(const std::string& source, direction_t dir, const srslte::byte_buffer_t* pdu, const T& msg)
{}
void rrc_nr::log_rrc_message(const std::string& source,
direction_t dir,
const srslte::byte_buffer_t* pdu,
const T& msg,
const std::string& msg_type)
{
if (log_h->get_level() == srslte::LOG_LEVEL_INFO) {
log_h->info("%s - %s %s (%d B)\n", source.c_str(), (dir == Rx) ? "Rx" : "Tx", msg_type.c_str(), pdu->N_bytes);
} else if (log_h->get_level() >= srslte::LOG_LEVEL_DEBUG) {
asn1::json_writer json_writer;
msg.to_json(json_writer);
log_h->debug_hex(pdu->msg,
pdu->N_bytes,
"%s - %s %s (%d B)\n",
source.c_str(),
(dir == Rx) ? "Rx" : "Tx",
msg_type.c_str(),
pdu->N_bytes);
log_h->debug_long("Content:\n%s\n", json_writer.to_string().c_str());
}
}
// PHY interface
void rrc_nr::in_sync() {}
@ -86,30 +105,134 @@ void rrc_nr::write_pdu_bcch_dlsch(srslte::unique_byte_buffer_t pdu) {}
void rrc_nr::write_pdu_pcch(srslte::unique_byte_buffer_t pdu) {}
void rrc_nr::write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu) {}
void rrc_nr::get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps)
void rrc_nr::get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps_pdu)
{
uint8_t eutra_nr_cap_raw[] = {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};
struct ue_mrdc_cap_s mrdc_cap;
memcpy(eutra_nr_caps->msg, eutra_nr_cap_raw, sizeof(eutra_nr_cap_raw));
eutra_nr_caps->N_bytes = sizeof(eutra_nr_cap_raw);
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
asn1::bit_ref bref(eutra_nr_caps_pdu->msg, eutra_nr_caps_pdu->get_tailroom());
mrdc_cap.pack(bref);
eutra_nr_caps_pdu->N_bytes = bref.distance_bytes();
log_h->debug_hex(
eutra_nr_caps->msg, eutra_nr_caps->N_bytes, "EUTRA-NR capabilities (%u B)\n", eutra_nr_caps->N_bytes);
eutra_nr_caps_pdu->msg, eutra_nr_caps_pdu->N_bytes, "EUTRA-NR capabilities (%u B)\n", eutra_nr_caps_pdu->N_bytes);
return;
}
void rrc_nr::get_nr_capabilities(srslte::byte_buffer_t* nr_caps)
void rrc_nr::get_nr_capabilities(srslte::byte_buffer_t* nr_caps_pdu)
{
uint8_t nr_cap_raw[] = {
0xe1, 0x00, 0x00, 0x00, 0x01, 0x47, 0x7a, 0x03, 0x02, 0x00, 0x00, 0x01, 0x40, 0x48, 0x07, 0x06, 0x0e, 0x02, 0x0c,
0x00, 0x02, 0x13, 0x60, 0x10, 0x73, 0xe4, 0x20, 0xf0, 0x00, 0x80, 0xc1, 0x30, 0x08, 0x0c, 0x00, 0x00, 0x0a, 0x05,
0x89, 0xba, 0xc2, 0x19, 0x43, 0x40, 0x88, 0x10, 0x74, 0x18, 0x60, 0x4c, 0x04, 0x41, 0x6c, 0x90, 0x14, 0x06, 0x0c,
0x78, 0xc7, 0x3e, 0x42, 0x0f, 0x00, 0x58, 0x0c, 0x0e, 0x0e, 0x02, 0x21, 0x3c, 0x84, 0xfc, 0x4d, 0xe0, 0x00, 0x12,
0x00, 0x00, 0x00, 0x00, 0xe5, 0x4d, 0x00, 0x01, 0x00, 0x00, 0x04, 0x18, 0x60, 0x00, 0x34, 0xaa, 0x60};
memcpy(nr_caps->msg, nr_cap_raw, sizeof(nr_cap_raw));
nr_caps->N_bytes = sizeof(nr_cap_raw);
log_h->debug_hex(nr_caps->msg, nr_caps->N_bytes, "NR capabilities (%u B)\n", nr_caps->N_bytes);
struct ue_nr_cap_s nr_cap;
nr_cap.access_stratum_release = access_stratum_release_opts::rel15;
// PDCP
nr_cap.pdcp_params.max_num_rohc_context_sessions = pdcp_params_s::max_num_rohc_context_sessions_opts::cs2;
band_nr_s band_nr;
band_nr.band_nr = 78;
band_nr.ue_pwr_class_present = true;
band_nr.ue_pwr_class = band_nr_s::ue_pwr_class_opts::pc3;
nr_cap.rf_params.supported_band_list_nr.push_back(band_nr);
// Pack nr_caps
asn1::bit_ref bref(nr_caps_pdu->msg, nr_caps_pdu->get_tailroom());
nr_cap.pack(bref);
nr_caps_pdu->N_bytes = bref.distance_bytes();
log_h->debug_hex(nr_caps_pdu->msg, nr_caps_pdu->N_bytes, "NR capabilities (%u B)\n", nr_caps_pdu->N_bytes);
return;
}

View File

@ -47,6 +47,11 @@ else (ENABLE_5GNR)
endif(ENABLE_5GNR)
add_test(rrc_cell_test rrc_cell_test)
if (ENABLE_5GNR)
add_executable(ue_rrc_nr_test ue_rrc_nr_test.cc)
target_link_libraries(ue_rrc_nr_test srsue_rrc srsue_upper srslte_upper srslte_phy rrc_asn1 rrc_nr_asn1)
endif(ENABLE_5GNR)
########################################################################
# Option to run command after build (useful for remote builds)
########################################################################

View File

@ -0,0 +1,36 @@
/**
*
* \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/common/test_common.h"
#include "srsue/hdr/stack/rrc/rrc_nr.h"
using namespace srsue;
int rrc_nr_cap_request_test()
{
srslte::log_ref rrc_log("RRC");
rrc_log->set_level(srslte::LOG_LEVEL_DEBUG);
rrc_log->set_hex_limit(-1);
rrc_nr rrc_nr;
srslte::byte_buffer_t caps;
rrc_nr.get_eutra_nr_capabilities(&caps);
rrc_nr.get_nr_capabilities(&caps);
return SRSLTE_SUCCESS;
}
int main(int argc, char** argv)
{
TESTASSERT(rrc_nr_cap_request_test() == SRSLTE_SUCCESS);
return SRSLTE_SUCCESS;
}