From 9bf1fbc05dd6f8df82b8b3cbbbc85d306b195c67 Mon Sep 17 00:00:00 2001 From: Haoran Wan Date: Fri, 19 Jul 2024 17:07:34 -0400 Subject: [PATCH] update gitignore --- .gitignore | 2 +- build_trial.sh | 14 +++++++ lib/include/srsran/build_info.h.in | 60 ++++++++++++++++++++++++++++++ lib/src/phy/dft/ofdm.c | 20 +++------- nrscope/config/config.yaml | 2 +- nrscope/src/libs/dci_decoder.cc | 2 - nrscope/src/libs/rach_decoder.cc | 52 +++++++++++++------------- 7 files changed, 108 insertions(+), 44 deletions(-) create mode 100755 build_trial.sh create mode 100644 lib/include/srsran/build_info.h.in diff --git a/.gitignore b/.gitignore index 02bbb2ca..1de8a47a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -build* +build/ .vscode/ \ No newline at end of file diff --git a/build_trial.sh b/build_trial.sh new file mode 100755 index 00000000..17412142 --- /dev/null +++ b/build_trial.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +rm -rf sysroot && mkdir sysroot +cmake -DCMAKE_INSTALL_PREFIX="sysroot/" ../ +make install +this="$(date +%Y-%m-%d_%H_%M_%S)" +trialdir="srsran_trial_${this}" +tar="srsran.build-${this}.tgz" +mkdir ${trialdir} +tar czf "${trialdir}/$tar" -C "sysroot" . +md5sum "${trialdir}/$tar" >>${trialdir}/checksums.md5 + +echo "Built ${trialdir}" + diff --git a/lib/include/srsran/build_info.h.in b/lib/include/srsran/build_info.h.in new file mode 100644 index 00000000..9a7d182e --- /dev/null +++ b/lib/include/srsran/build_info.h.in @@ -0,0 +1,60 @@ +/** + * Copyright 2013-2023 Software Radio Systems Limited + * + * This file is part of srsRAN. + * + * srsRAN is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * srsRAN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * A copy of the GNU Affero General Public License can be found in + * the LICENSE file in the top-level directory of this distribution + * and at http://www.gnu.org/licenses/. + * + */ + +#ifndef SRSRAN_BUILD_INFO_H_IN +#define SRSRAN_BUILD_INFO_H_IN + +#include "srsran/config.h" + +# ifdef __cplusplus +extern "C" { +# endif + +#ifdef BUILD_TYPE_RELEASE + static char build_mode[] = "Release"; +#else + #ifdef BUILD_TYPE_DEBUG + static char build_mode[] = "Debug"; + #else + #ifdef BUILD_TYPE_RELWITHDEBINFO + static char build_mode[] = "RelWithDebInfo"; + #else + static char build_mode[] = "unknown"; + #endif + #endif +#endif + +// the configured build options for srsRAN +static char build_info[] = "commit @GIT_COMMIT_HASH@ on branch @GIT_BRANCH@"; + +SRSRAN_API char* srsran_get_build_info() { + return build_info; +}; + +SRSRAN_API char* srsran_get_build_mode() { + return build_mode; +} + +# ifdef __cplusplus +} +# endif + +#endif // BUILD_INFO_ diff --git a/lib/src/phy/dft/ofdm.c b/lib/src/phy/dft/ofdm.c index 4f519406..ce40f3bb 100644 --- a/lib/src/phy/dft/ofdm.c +++ b/lib/src/phy/dft/ofdm.c @@ -380,9 +380,9 @@ static int ofdm_init_nr_nrscope_30khz(srsran_ofdm_t* q, srsran_ofdm_cfg_t* cfg, q->window_offset_buffer[i] = cexpf(I * M_PI * 2.0f * (float)q->window_offset_n * (float)i / (float)symbol_sz); } - for (uint32_t i = symbol_sz; i < 2*symbol_sz; i++){ - q->window_offset_buffer[i] = cexpf(I * M_PI * 2.0f * (cp1 - cp2) * (float)(i-symbol_sz) / (float)symbol_sz); - } + // for (uint32_t i = symbol_sz; i < 2*symbol_sz; i++){ + // q->window_offset_buffer[i] = cexpf(I * M_PI * 2.0f * (cp1 - cp2) * (float)(i-symbol_sz) / (float)symbol_sz); + // } } // Zero temporal and input buffers always @@ -623,10 +623,6 @@ static int ofdm_init_nr_nrscope_15khz(srsran_ofdm_t* q, srsran_ofdm_cfg_t* cfg, for (uint32_t i = 0; i < symbol_sz; i++) { q->window_offset_buffer[i] = cexpf(I * M_PI * 2.0f * (float)q->window_offset_n * (float)i / (float)symbol_sz); } - - for (uint32_t i = symbol_sz; i < 2*symbol_sz; i++){ - q->window_offset_buffer[i] = cexpf(I * M_PI * 2.0f * (cp2 - cp1) * (float)(i-symbol_sz) / (float)symbol_sz); - } } // Zero temporal and input buffers always @@ -1133,10 +1129,6 @@ static void ofdm_rx_slot_nrscope_15khz(srsran_ofdm_t* q, int slot_in_sf, int cor if (q->window_offset_n) { srsran_vec_prod_ccc(tmp, q->window_offset_buffer, tmp, symbol_sz); - // if(scs_idx == 1 && slot_in_sf == 1) { - // srsran_vec_prod_ccc(tmp, &q->window_offset_buffer[symbol_sz], tmp, symbol_sz); - // } - // printf("q->window_offset_buffer:"); // srsran_vec_fprint_c(stdout, q->window_offset_buffer, symbol_sz); } @@ -1233,9 +1225,9 @@ static void ofdm_rx_slot_nrscope_30khz(srsran_ofdm_t* q, int slot_in_sf, int cor if (q->window_offset_n) { srsran_vec_prod_ccc(tmp, q->window_offset_buffer, tmp, symbol_sz); - if(scs_idx == 0 && i > 6) { - srsran_vec_prod_ccc(tmp, &q->window_offset_buffer[symbol_sz], tmp, symbol_sz); - } + // if(scs_idx == 0 && i > 6) { + // srsran_vec_prod_ccc(tmp, &q->window_offset_buffer[symbol_sz], tmp, symbol_sz); + // } // printf("q->window_offset_buffer:"); // srsran_vec_fprint_c(stdout, q->window_offset_buffer, symbol_sz); } diff --git a/nrscope/config/config.yaml b/nrscope/config/config.yaml index b20725a8..ffcd73cc 100644 --- a/nrscope/config/config.yaml +++ b/nrscope/config/config.yaml @@ -3,7 +3,7 @@ usrp_setting_0: ssb_freq: 1989850000 #1989850000 #1970450000 #3489600000 #3649440000 #3650880000 # 1970450000 #2600040000 #3488160000 #3685440000 #3561600000 #1842050000 #2528550000 #3565920000 #2524950000 #2523750000 # 3565920000 # 2527350000 #3408960000 # should be set to the ssb frequency of the cell rf_args: "clock=external,type=x300" #"type=x300" #"clock=external" rx_gain: 30 # for x310, max rx gain is 31.5, for b210, it's around 80 - srate_hz: 23040000 #11520000 #23040000 + srate_hz: 11520000 #11520000 #23040000 nof_carriers: 1 nof_antennas: 1 scs_index: 0 #(0: 15kHz, 1: 30kHz, ..., the u in standard) diff --git a/nrscope/src/libs/dci_decoder.cc b/nrscope/src/libs/dci_decoder.cc index 80727806..c9d3c118 100644 --- a/nrscope/src/libs/dci_decoder.cc +++ b/nrscope/src/libs/dci_decoder.cc @@ -615,8 +615,6 @@ int DCIDecoder::dci_decoder_and_reception_init(srsran_ue_dl_nr_sratescs_info arg carrier_ul.max_mimo_layers = dci_cfg.nof_ul_layers; printf("carrier_ul.max_mimo_layers: %d\n", carrier_ul.max_mimo_layers); - // update the nof_prb for carrier settings. - if (srsran_ue_dl_nr_init_nrscope(&ue_dl_dci, input, &ue_dl_args, arg_scs)) { ERROR("Error UE DL"); return SRSRAN_ERROR; diff --git a/nrscope/src/libs/rach_decoder.cc b/nrscope/src/libs/rach_decoder.cc index 39105452..eff5899e 100644 --- a/nrscope/src/libs/rach_decoder.cc +++ b/nrscope/src/libs/rach_decoder.cc @@ -273,24 +273,24 @@ int RachDecoder::decode_and_parse_msg4_from_slot(srsran_slot_cfg_t* slot, ERROR("RACHDecoder -- Error in blind search"); return SRSRAN_ERROR; } - for (uint32_t pdcch_idx = 0; pdcch_idx < ue_dl_rach.pdcch_info_count; pdcch_idx++) { - const srsran_ue_dl_nr_pdcch_info_t* info = &(ue_dl_rach.pdcch_info[pdcch_idx]); - if(info->result.crc){ // Only print the RSRP result when the DCI's CRC is correct. - printf("PDCCH: %s-rnti=0x%x, crst_id=%d, ss_type=%s, ncce=%d, al=%d, EPRE=%+.2f, RSRP=%+.2f, corr=%.3f; " - "nof_bits=%d; crc=%s;\n", - srsran_rnti_type_str_short(info->dci_ctx.rnti_type), - info->dci_ctx.rnti, - info->dci_ctx.coreset_id, - srsran_ss_type_str(info->dci_ctx.ss_type), - info->dci_ctx.location.ncce, - info->dci_ctx.location.L, - info->measure.epre_dBfs, - info->measure.rsrp_dBfs, - info->measure.norm_corr, - info->nof_bits, - info->result.crc ? "OK" : "KO"); - } - } + // for (uint32_t pdcch_idx = 0; pdcch_idx < ue_dl_rach.pdcch_info_count; pdcch_idx++) { + // const srsran_ue_dl_nr_pdcch_info_t* info = &(ue_dl_rach.pdcch_info[pdcch_idx]); + // if(info->result.crc){ // Only print the RSRP result when the DCI's CRC is correct. + // printf("PDCCH: %s-rnti=0x%x, crst_id=%d, ss_type=%s, ncce=%d, al=%d, EPRE=%+.2f, RSRP=%+.2f, corr=%.3f; " + // "nof_bits=%d; crc=%s;\n", + // srsran_rnti_type_str_short(info->dci_ctx.rnti_type), + // info->dci_ctx.rnti, + // info->dci_ctx.coreset_id, + // srsran_ss_type_str(info->dci_ctx.ss_type), + // info->dci_ctx.location.ncce, + // info->dci_ctx.location.L, + // info->measure.epre_dBfs, + // info->measure.rsrp_dBfs, + // info->measure.norm_corr, + // info->nof_bits, + // info->result.crc ? "OK" : "KO"); + // } + // } if (nof_found_dci < 1) { printf("RACHDecoder -- No DCI found :'(\n"); @@ -337,8 +337,8 @@ int RachDecoder::decode_and_parse_msg4_from_slot(srsran_slot_cfg_t* slot, return SRSRAN_ERROR; } - printf("Decoded PDSCH (%d B)\n", pdsch_cfg.grant.tb[0].tbs / 8); - srsran_vec_fprint_byte(stdout, pdsch_res.tb[0].payload, pdsch_cfg.grant.tb[0].tbs / 8); + // printf("Decoded PDSCH (%d B)\n", pdsch_cfg.grant.tb[0].tbs / 8); + // srsran_vec_fprint_byte(stdout, pdsch_res.tb[0].payload, pdsch_cfg.grant.tb[0].tbs / 8); uint32_t bytes_offset = 0; for (uint32_t pdsch_res_idx = 0; pdsch_res_idx < (uint32_t)pdsch_cfg.grant.tb[0].tbs / 8 - 1; pdsch_res_idx ++){ @@ -400,9 +400,9 @@ int RachDecoder::decode_and_parse_msg4_from_slot(srsran_slot_cfg_t* slot, break; } - asn1::json_writer js_msg4; - task_scheduler_nrscope->rrc_setup.to_json(js_msg4); - printf("rrcSetup content: %s\n", js_msg4.to_string().c_str()); + // asn1::json_writer js_msg4; + // task_scheduler_nrscope->rrc_setup.to_json(js_msg4); + // printf("rrcSetup content: %s\n", js_msg4.to_string().c_str()); asn1::cbit_ref bref_cg((task_scheduler_nrscope->rrc_setup).crit_exts.rrc_setup().master_cell_group.data(), (task_scheduler_nrscope->rrc_setup).crit_exts.rrc_setup().master_cell_group.size()); if (task_scheduler_nrscope->master_cell_group.unpack(bref_cg) != asn1::SRSASN_SUCCESS) { @@ -410,9 +410,9 @@ int RachDecoder::decode_and_parse_msg4_from_slot(srsran_slot_cfg_t* slot, return SRSRAN_ERROR; } - asn1::json_writer js; - task_scheduler_nrscope->master_cell_group.to_json(js); - printf("masterCellGroup: %s\n", js.to_string().c_str()); + // asn1::json_writer js; + // task_scheduler_nrscope->master_cell_group.to_json(js); + // printf("masterCellGroup: %s\n", js.to_string().c_str()); // Tells the task scheduler that the RACH is decoded and there are some entries in the know_rntis vector. task_scheduler_nrscope->rach_found = true;