SRSUE: Initial NR MAC-PHY interfaces

SRSUE Fix compilation

SRSUE: temporary fixes LTE/NR PHY/Stack interface problem

fix

fix
This commit is contained in:
Xavier Arteaga 2021-02-12 17:33:43 +01:00 committed by Xavier Arteaga
parent 9546634b37
commit 784a33583b
20 changed files with 179 additions and 640 deletions

View File

@ -589,14 +589,6 @@ typedef struct {
srslte::vnf_args_t vnf_args;
} phy_args_t;
typedef struct {
uint32_t nof_prb;
uint32_t nof_carriers;
uint32_t nof_phy_threads;
uint32_t worker_cpu_mask;
srslte::phy_log_args_t log;
} phy_args_nr_t;
/* RAT agnostic Interface MAC -> PHY */
class phy_interface_mac_common
{

View File

@ -15,6 +15,7 @@
#include "srslte/common/interfaces_common.h"
#include "srslte/interfaces/mac_interface_types.h"
#include "srslte/interfaces/rrc_nr_interface_types.h"
#include <array>
#include <string>
@ -83,6 +84,28 @@ public:
virtual bool set_crnti(const uint16_t crnti) = 0;
};
struct phy_args_nr_t {
uint32_t nof_carriers;
uint32_t nof_prb;
uint32_t nof_phy_threads;
uint32_t worker_cpu_mask;
srslte::phy_log_args_t log;
srslte_ue_dl_nr_args_t dl;
srslte_ue_ul_nr_args_t ul;
phy_args_nr_t()
{
dl.nof_rx_antennas = 1;
dl.nof_max_prb = 100;
dl.pdsch.measure_evm = true;
dl.pdsch.measure_time = true;
dl.pdsch.sch.disable_simd = false;
ul.nof_max_prb = 100;
ul.pusch.measure_time = true;
ul.pusch.sch.disable_simd = false;
}
};
class phy_interface_mac_nr
{
public:
@ -103,7 +126,10 @@ public:
};
class phy_interface_rrc_nr
{};
{
public:
virtual bool set_config(const srslte::phy_cfg_nr_t& cfg) = 0;
};
// Combined interface for PHY to access stack (MAC and RRC)
class stack_interface_phy_nr : public mac_interface_phy_nr,

View File

@ -147,8 +147,7 @@ typedef enum SRSLTE_API {
srslte_search_space_type_common_1, ///< configured by ra-SearchSpace in PDCCH-ConfigCommon
srslte_search_space_type_common_2, ///< configured by pagingSearchSpace in PDCCH-ConfigCommon
srslte_search_space_type_common_3, ///< configured by SearchSpace in PDCCH-Config with searchSpaceType = common
srslte_search_space_type_ue, ///< configured by SearchSpace in PDCCH-Config with searchSpaceType = ue-Specific
srslte_search_space_rar ///< No search space associated, used for grants given by Random Access Response (RAR)
srslte_search_space_type_ue ///< configured by SearchSpace in PDCCH-Config with searchSpaceType = ue-Specific
} srslte_search_space_type_t;
/**

View File

@ -140,12 +140,14 @@ SRSLTE_API void srslte_ue_dl_nr_estimate_fft(srslte_ue_dl_nr_t* q, const srslte_
SRSLTE_API int srslte_ue_dl_nr_find_dl_dci(srslte_ue_dl_nr_t* q,
const srslte_slot_cfg_t* slot_cfg,
uint16_t rnti,
srslte_rnti_type_t rnti_type,
srslte_dci_dl_nr_t* dci_dl_list,
uint32_t nof_dci_msg);
SRSLTE_API int srslte_ue_dl_nr_find_ul_dci(srslte_ue_dl_nr_t* q,
const srslte_slot_cfg_t* slot_cfg,
uint16_t rnti,
srslte_rnti_type_t rnti_type,
srslte_dci_ul_nr_t* dci_ul_list,
uint32_t nof_dci_msg);

View File

@ -137,7 +137,7 @@ int srslte_ra_ul_nr_time(const srslte_sch_hl_cfg_nr_t* cfg,
}
// Determine which PUSCH Time domain RA configuration to apply (TS 38.214 Table 6.1.2.1.1-1:)
if (ss_type == srslte_search_space_rar) {
if (rnti_type == srslte_rnti_type_ra) {
// Row 1
if (cfg->nof_common_time_ra == 0) {
srslte_ra_ul_nr_pdsch_time_resource_default_A(cfg->scs_cfg, m, grant);
@ -172,7 +172,7 @@ int srslte_ra_ul_nr_time(const srslte_sch_hl_cfg_nr_t* cfg,
// Table 6.1.2.1.1-5 defines the additional subcarrier spacing specific slot delay value for the first transmission of
// PUSCH scheduled by the RAR. When the UE transmits a PUSCH scheduled by RAR, the Δ value specific to the PUSCH
// subcarrier spacing μ PUSCH is applied in addition to the K 2 value.
if (ss_type == srslte_search_space_rar) {
if (rnti_type == srslte_rnti_type_ra) {
uint32_t delta[4] = {2, 3, 4, 6};
if (cfg->scs_cfg >= 4) {
ERROR("Invalid numerology");

View File

@ -388,6 +388,7 @@ static int ue_dl_nr_find_dl_dci_ss(srslte_ue_dl_nr_t* q,
int srslte_ue_dl_nr_find_dl_dci(srslte_ue_dl_nr_t* q,
const srslte_slot_cfg_t* slot_cfg,
uint16_t rnti,
srslte_rnti_type_t rnti_type,
srslte_dci_dl_nr_t* dci_dl_list,
uint32_t nof_dci_msg)
{
@ -403,10 +404,9 @@ int srslte_ue_dl_nr_find_dl_dci(srslte_ue_dl_nr_t* q,
nof_dci_msg = SRSLTE_MIN(nof_dci_msg, SRSLTE_MAX_DCI_MSG_NR);
// If the UE looks for a RAR and RA search space is provided, search for it
if (q->cfg.ra_search_space_present && rnti == q->cfg.ra_rnti) {
if (q->cfg.ra_search_space_present && rnti_type == srslte_rnti_type_ra) {
// Find DCIs in the RA search space
int ret = ue_dl_nr_find_dl_dci_ss(
q, slot_cfg, &q->cfg.ra_search_space, rnti, srslte_rnti_type_ra, &dci_msg_list[count], nof_dci_msg - count);
int ret = ue_dl_nr_find_dl_dci_ss(q, slot_cfg, &q->cfg.ra_search_space, rnti, rnti_type, dci_msg_list, nof_dci_msg);
if (ret < SRSLTE_SUCCESS) {
ERROR("Error searching RAR DCI");
return SRSLTE_ERROR;
@ -415,7 +415,7 @@ int srslte_ue_dl_nr_find_dl_dci(srslte_ue_dl_nr_t* q,
// Count the found DCIs
count += ret;
} else {
// Iterate all possible search spaces
// Iterate all possible common and UE search spaces
for (uint32_t i = 0; i < SRSLTE_UE_DL_NR_MAX_NOF_SEARCH_SPACE && count < nof_dci_msg; i++) {
// Skip search space if not present
if (!q->cfg.search_space_present[i]) {
@ -424,7 +424,7 @@ int srslte_ue_dl_nr_find_dl_dci(srslte_ue_dl_nr_t* q,
// Find DCIs in the selected search space
int ret = ue_dl_nr_find_dl_dci_ss(
q, slot_cfg, &q->cfg.search_space[i], rnti, srslte_rnti_type_c, &dci_msg_list[count], nof_dci_msg - count);
q, slot_cfg, &q->cfg.search_space[i], rnti, rnti_type, &dci_msg_list[count], nof_dci_msg - count);
if (ret < SRSLTE_SUCCESS) {
ERROR("Error searching DCI");
return SRSLTE_ERROR;
@ -447,6 +447,7 @@ int srslte_ue_dl_nr_find_dl_dci(srslte_ue_dl_nr_t* q,
int srslte_ue_dl_nr_find_ul_dci(srslte_ue_dl_nr_t* q,
const srslte_slot_cfg_t* slot_cfg,
uint16_t rnti,
srslte_rnti_type_t rnti_type,
srslte_dci_ul_nr_t* dci_ul_list,
uint32_t nof_dci_msg)
{
@ -459,7 +460,12 @@ int srslte_ue_dl_nr_find_ul_dci(srslte_ue_dl_nr_t* q,
// Get DCI messages from the pending list
for (uint32_t i = 0; i < q->pending_ul_dci_count && count < nof_dci_msg; i++) {
srslte_dci_msg_nr_t* dci_msg = &q->pending_ul_dci_msg[i];
srslte_dci_msg_nr_t* dci_msg = &q->pending_ul_dci_msg[i];
if (dci_msg->rnti_type != rnti_type || dci_msg->rnti != rnti) {
continue;
}
const srslte_coreset_t* coreset = &q->cfg.coreset[dci_msg->coreset_id];
if (srslte_dci_nr_format_0_0_unpack(&q->carrier, coreset, dci_msg, &dci_ul_list[count]) < SRSLTE_SUCCESS) {
ERROR("Unpacking DCI 0_0");

View File

@ -125,7 +125,7 @@ static int work_ue_dl(srslte_ue_dl_nr_t* ue_dl, srslte_slot_cfg_t* slot, srslte_
srslte_ue_dl_nr_estimate_fft(ue_dl, slot);
srslte_dci_dl_nr_t dci_dl_rx = {};
int nof_found_dci = srslte_ue_dl_nr_find_dl_dci(ue_dl, slot, rnti, &dci_dl_rx, 1);
int nof_found_dci = srslte_ue_dl_nr_find_dl_dci(ue_dl, slot, rnti, srslte_rnti_type_c, &dci_dl_rx, 1);
if (nof_found_dci < SRSLTE_SUCCESS) {
ERROR("Error decoding");
return SRSLTE_ERROR;

View File

@ -55,6 +55,7 @@ private:
state* phy_state = nullptr;
srslog::basic_logger& logger;
uint32_t tti_rx = 0;
cf_t* prach_ptr = nullptr;
float prach_power = 0;
};

View File

@ -24,21 +24,6 @@
namespace srsue {
namespace nr {
typedef struct {
uint32_t nof_carriers;
srslte_ue_dl_nr_args_t dl;
srslte_ue_ul_nr_args_t ul;
} phy_nr_args_t;
typedef struct {
srslte_sch_hl_cfg_nr_t pdsch;
srslte_sch_hl_cfg_nr_t pusch;
srslte_pucch_nr_hl_cfg_t pucch;
srslte_prach_cfg_t prach;
srslte_ue_dl_nr_pdcch_cfg_t pdcch;
srslte_ue_dl_nr_harq_ack_cfg_t harq_ack;
} phy_nr_cfg_t;
class state
{
private:
@ -63,549 +48,19 @@ private:
mutable std::mutex pending_ack_mutex;
public:
mac_interface_phy_nr* stack = nullptr;
srslte_carrier_nr_t carrier = {};
phy_nr_args_t args = {};
phy_nr_cfg_t cfg = {};
int32_t test_rnti = 0x1234; // Fix PDSCH RNTI for testing
mac_interface_phy_nr* stack = nullptr;
srslte_carrier_nr_t carrier = {};
srslte::phy_cfg_nr_t cfg;
phy_args_nr_t args;
uint16_t ra_rnti = 0;
uint32_t rar_grant_tti = 0;
state()
{
carrier.id = 500;
carrier.nof_prb = 100;
carrier.max_mimo_layers = 1;
// Default arguments
args.nof_carriers = 1;
args.dl.nof_rx_antennas = 1;
args.dl.nof_max_prb = 100;
args.dl.pdsch.measure_evm = true;
args.dl.pdsch.measure_time = true;
args.dl.pdsch.sch.disable_simd = false;
args.ul.nof_max_prb = 100;
args.ul.pusch.measure_time = true;
args.ul.pusch.sch.disable_simd = false;
// Default PDSCH configuration
cfg.pdsch.sch_cfg.mcs_table = srslte_mcs_table_256qam;
// Default PRACH configuration
cfg.prach.is_nr = true;
cfg.prach.config_idx = 16;
cfg.prach.root_seq_idx = 1;
cfg.prach.freq_offset = 0;
cfg.prach.zero_corr_zone = 0;
cfg.prach.num_ra_preambles = 64;
cfg.prach.hs_flag = false;
// physicalCellGroupConfig
// pdsch-HARQ-ACK-Codebook: dynamic (1)
cfg.harq_ack.pdsch_harq_ack_codebook = srslte_pdsch_harq_ack_codebook_dynamic;
// commonControlResourceSet
// controlResourceSetId: 1
// frequencyDomainResources: ff0000000000
// duration: 1
// cce-REG-MappingType: nonInterleaved (1)
// nonInterleaved: NULL
// precoderGranularity: sameAsREG-bundle (0)
cfg.pdcch.coreset[1].coreset_id = 1;
cfg.pdcch.coreset[1].precoder_granularity = srslte_coreset_precoder_granularity_reg_bundle;
cfg.pdcch.coreset[1].duration = 1;
cfg.pdcch.coreset[1].mapping_type = srslte_coreset_mapping_type_non_interleaved;
for (uint32_t i = 0; i < SRSLTE_CORESET_FREQ_DOMAIN_RES_SIZE; i++) {
cfg.pdcch.coreset[1].freq_resources[i] = (i < 8);
}
cfg.pdcch.coreset_present[1] = true;
// SearchSpace
// searchSpaceId: 1
// controlResourceSetId: 1
// monitoringSlotPeriodicityAndOffset: sl1 (0)
// sl1: NULL
// monitoringSymbolsWithinSlot: 8000 [bit length 14, 2 LSB pad bits, 1000 0000 0000 00.. decimal value 8192]
// nrofCandidates
// aggregationLevel1: n0 (0)
// aggregationLevel2: n0 (0)
// aggregationLevel4: n1 (1)
// aggregationLevel8: n0 (0)
// aggregationLevel16: n0 (0)
// searchSpaceType: common (0)
// common
// dci-Format0-0-AndFormat1-0
srslte_search_space_t search_space1 = {};
search_space1.id = 1;
search_space1.coreset_id = 1;
search_space1.nof_candidates[0] = 0;
search_space1.nof_candidates[1] = 0;
search_space1.nof_candidates[2] = 1;
search_space1.nof_candidates[3] = 0;
search_space1.nof_candidates[4] = 0;
search_space1.type = srslte_search_space_type_common_3;
cfg.pdcch.search_space[1] = search_space1;
cfg.pdcch.search_space_present[1] = true;
// ra-SearchSpace: 1
cfg.pdcch.ra_rnti = 0x16; //< Supposed to be deduced from PRACH configuration
cfg.pdcch.ra_search_space = search_space1;
cfg.pdcch.ra_search_space.type = srslte_search_space_type_common_1;
cfg.pdcch.ra_search_space_present = true;
// pdsch-ConfigCommon: setup (1)
// setup
// pdsch-TimeDomainAllocationList: 2 items
// Item 0
// PDSCH-TimeDomainResourceAllocation
// mappingType: typeA (0)
// startSymbolAndLength: 40
// Item 1
// PDSCH-TimeDomainResourceAllocation
// mappingType: typeA (0)
// startSymbolAndLength: 57
cfg.pdsch.common_time_ra[0].mapping_type = srslte_sch_mapping_type_A;
cfg.pdsch.common_time_ra[0].sliv = 40;
cfg.pdsch.common_time_ra[0].k = 0;
cfg.pdsch.common_time_ra[1].mapping_type = srslte_sch_mapping_type_A;
cfg.pdsch.common_time_ra[1].sliv = 57;
cfg.pdsch.common_time_ra[1].k = 0;
cfg.pdsch.nof_common_time_ra = 2;
// pusch-ConfigCommon: setup (1)
// setup
// pusch-TimeDomainAllocationList: 2 items
// Item 0
// PUSCH-TimeDomainResourceAllocation
// k2: 4
// mappingType: typeA (0)
// startSymbolAndLength: 27
// Item 1
// PUSCH-TimeDomainResourceAllocation
// k2: 5
// mappingType: typeA (0)
// startSymbolAndLength: 27
// p0-NominalWithGrant: -90dBm
cfg.pusch.common_time_ra[0].mapping_type = srslte_sch_mapping_type_A;
cfg.pusch.common_time_ra[0].sliv = 27;
cfg.pusch.common_time_ra[0].k = 4;
cfg.pusch.common_time_ra[1].mapping_type = srslte_sch_mapping_type_A;
cfg.pusch.common_time_ra[1].sliv = 27;
cfg.pusch.common_time_ra[1].k = 5;
cfg.pusch.nof_common_time_ra = 2;
// pusch-Config: setup (1)
// setup
// dmrs-UplinkForPUSCH-MappingTypeA: setup (1)
// setup
// dmrs-AdditionalPosition: pos1 (1)
// transformPrecodingDisabled
cfg.pusch.dmrs_typeA.additional_pos = srslte_dmrs_sch_add_pos_1;
cfg.pusch.dmrs_typeA.present = true;
// pusch-PowerControl
// msg3-Alpha: alpha1 (7)
// p0-NominalWithoutGrant: -90dBm
// p0-AlphaSets: 1 item
// Item 0
// P0-PUSCH-AlphaSet
// p0-PUSCH-AlphaSetId: 0
// p0: 0dB
// alpha: alpha1 (7)
// pathlossReferenceRSToAddModList: 1 item
// Item 0
// PUSCH-PathlossReferenceRS
// pusch-PathlossReferenceRS-Id: 0
// referenceSignal: ssb-Index (0)
// ssb-Index: 0
// sri-PUSCH-MappingToAddModList: 1 item
// Item 0
// SRI-PUSCH-PowerControl
// sri-PUSCH-PowerControlId: 0
// sri-PUSCH-PathlossReferenceRS-Id: 0
// sri-P0-PUSCH-AlphaSetId: 0
// sri-PUSCH-ClosedLoopIndex: i0 (0)
// resourceAllocation: resourceAllocationType1 (1)
// uci-OnPUSCH: setup (1)
// setup
// betaOffsets: semiStatic (1)
// semiStatic
// betaOffsetACK-Index1: 9
// betaOffsetACK-Index2: 9
// betaOffsetACK-Index3: 9
// betaOffsetCSI-Part1-Index1: 6
// betaOffsetCSI-Part1-Index2: 6
// betaOffsetCSI-Part2-Index1: 6
// betaOffsetCSI-Part2-Index2: 6
// scaling: f1 (3)
// pucch-Config: setup (1)
// setup
// resourceSetToAddModList: 2 items
cfg.pucch.enabled = true;
// Item 0
// PUCCH-ResourceSet
// pucch-ResourceSetId: 0
// resourceList: 8 items
// Item 0
// PUCCH-ResourceId: 0
// Item 1
// PUCCH-ResourceId: 1
// Item 2
// PUCCH-ResourceId: 2
// Item 3
// PUCCH-ResourceId: 3
// Item 4
// PUCCH-ResourceId: 4
// Item 5
// PUCCH-ResourceId: 5
// Item 6
// PUCCH-ResourceId: 6
// Item 7
// PUCCH-ResourceId: 7
cfg.pucch.sets[0].nof_resources = 8;
// Item 1
// PUCCH-ResourceSet
// pucch-ResourceSetId: 1
// resourceList: 8 items
// Item 0
// PUCCH-ResourceId: 8
// Item 1
// PUCCH-ResourceId: 9
// Item 2
// PUCCH-ResourceId: 10
// Item 3
// PUCCH-ResourceId: 11
// Item 4
// PUCCH-ResourceId: 12
// Item 5
// PUCCH-ResourceId: 13
// Item 6
// PUCCH-ResourceId: 14
// Item 7
// PUCCH-ResourceId: 15
cfg.pucch.sets[1].nof_resources = 8;
// resourceToAddModList: 18 items
// Item 0
// PUCCH-Resource
// pucch-ResourceId: 0
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 0
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 0
cfg.pucch.sets[0].resources[0].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[0].starting_prb = 0;
cfg.pucch.sets[0].resources[0].initial_cyclic_shift = 0;
cfg.pucch.sets[0].resources[0].nof_symbols = 14;
cfg.pucch.sets[0].resources[0].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[0].time_domain_occ = 0;
// Item 1
// PUCCH-Resource
// pucch-ResourceId: 1
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 4
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 0
cfg.pucch.sets[0].resources[1].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[1].starting_prb = 0;
cfg.pucch.sets[0].resources[1].initial_cyclic_shift = 4;
cfg.pucch.sets[0].resources[1].nof_symbols = 14;
cfg.pucch.sets[0].resources[1].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[1].time_domain_occ = 0;
// Item 2
// PUCCH-Resource
// pucch-ResourceId: 2
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 8
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 0
cfg.pucch.sets[0].resources[2].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[2].starting_prb = 0;
cfg.pucch.sets[0].resources[2].initial_cyclic_shift = 8;
cfg.pucch.sets[0].resources[2].nof_symbols = 14;
cfg.pucch.sets[0].resources[2].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[2].time_domain_occ = 0;
// Item 3
// PUCCH-Resource
// pucch-ResourceId: 3
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 0
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 1
cfg.pucch.sets[0].resources[3].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[3].starting_prb = 0;
cfg.pucch.sets[0].resources[3].initial_cyclic_shift = 0;
cfg.pucch.sets[0].resources[3].nof_symbols = 14;
cfg.pucch.sets[0].resources[3].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[3].time_domain_occ = 1;
// Item 4
// PUCCH-Resource
// pucch-ResourceId: 4
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 4
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 1
cfg.pucch.sets[0].resources[4].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[4].starting_prb = 0;
cfg.pucch.sets[0].resources[4].initial_cyclic_shift = 4;
cfg.pucch.sets[0].resources[4].nof_symbols = 14;
cfg.pucch.sets[0].resources[4].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[4].time_domain_occ = 1;
// Item 5
// PUCCH-Resource
// pucch-ResourceId: 5
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 8
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 1
cfg.pucch.sets[0].resources[5].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[5].starting_prb = 0;
cfg.pucch.sets[0].resources[5].initial_cyclic_shift = 8;
cfg.pucch.sets[0].resources[5].nof_symbols = 14;
cfg.pucch.sets[0].resources[5].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[5].time_domain_occ = 1;
// Item 6
// PUCCH-Resource
// pucch-ResourceId: 6
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 0
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 2
cfg.pucch.sets[0].resources[6].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[6].starting_prb = 0;
cfg.pucch.sets[0].resources[6].initial_cyclic_shift = 0;
cfg.pucch.sets[0].resources[6].nof_symbols = 14;
cfg.pucch.sets[0].resources[6].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[6].time_domain_occ = 2;
// Item 7
// PUCCH-Resource
// pucch-ResourceId: 7
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 4
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 2
cfg.pucch.sets[0].resources[7].format = SRSLTE_PUCCH_NR_FORMAT_1;
cfg.pucch.sets[0].resources[7].starting_prb = 0;
cfg.pucch.sets[0].resources[7].initial_cyclic_shift = 0;
cfg.pucch.sets[0].resources[7].nof_symbols = 14;
cfg.pucch.sets[0].resources[7].start_symbol_idx = 0;
cfg.pucch.sets[0].resources[7].time_domain_occ = 2;
// Item 8
// PUCCH-Resource
// pucch-ResourceId: 8
// startingPRB: 51
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 0
cfg.pucch.sets[1].resources[0].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[0].starting_prb = 51;
cfg.pucch.sets[1].resources[0].nof_prb = 1;
cfg.pucch.sets[1].resources[0].nof_symbols = 2;
cfg.pucch.sets[1].resources[0].start_symbol_idx = 0;
// Item 9
// PUCCH-Resource
// pucch-ResourceId: 9
// startingPRB: 51
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 2
cfg.pucch.sets[1].resources[1].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[1].starting_prb = 51;
cfg.pucch.sets[1].resources[1].nof_prb = 1;
cfg.pucch.sets[1].resources[1].nof_symbols = 2;
cfg.pucch.sets[1].resources[1].start_symbol_idx = 2;
// Item 10
// PUCCH-Resource
// pucch-ResourceId: 10
// startingPRB: 51
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 4
cfg.pucch.sets[1].resources[2].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[2].starting_prb = 51;
cfg.pucch.sets[1].resources[2].nof_prb = 1;
cfg.pucch.sets[1].resources[2].nof_symbols = 2;
cfg.pucch.sets[1].resources[2].start_symbol_idx = 4;
// Item 11
// PUCCH-Resource
// pucch-ResourceId: 11
// startingPRB: 51
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 6
cfg.pucch.sets[1].resources[3].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[3].starting_prb = 51;
cfg.pucch.sets[1].resources[3].nof_prb = 1;
cfg.pucch.sets[1].resources[3].nof_symbols = 2;
cfg.pucch.sets[1].resources[3].start_symbol_idx = 6;
// Item 12
// PUCCH-Resource
// pucch-ResourceId: 12
// startingPRB: 51
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 8
cfg.pucch.sets[1].resources[4].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[4].starting_prb = 51;
cfg.pucch.sets[1].resources[4].nof_prb = 1;
cfg.pucch.sets[1].resources[4].nof_symbols = 2;
cfg.pucch.sets[1].resources[4].start_symbol_idx = 8;
// Item 13
// PUCCH-Resource
// pucch-ResourceId: 13
// startingPRB: 51
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 10
cfg.pucch.sets[1].resources[5].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[5].starting_prb = 51;
cfg.pucch.sets[1].resources[5].nof_prb = 1;
cfg.pucch.sets[1].resources[5].nof_symbols = 2;
cfg.pucch.sets[1].resources[5].start_symbol_idx = 10;
// Item 14
// PUCCH-Resource
// pucch-ResourceId: 14
// startingPRB: 51
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 12
cfg.pucch.sets[1].resources[6].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[6].starting_prb = 51;
cfg.pucch.sets[1].resources[6].nof_prb = 1;
cfg.pucch.sets[1].resources[6].nof_symbols = 2;
cfg.pucch.sets[1].resources[6].start_symbol_idx = 12;
// Item 15
// PUCCH-Resource
// pucch-ResourceId: 15
// startingPRB: 1
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 0
cfg.pucch.sets[1].resources[7].format = SRSLTE_PUCCH_NR_FORMAT_2;
cfg.pucch.sets[1].resources[7].starting_prb = 51;
cfg.pucch.sets[1].resources[7].nof_prb = 1;
cfg.pucch.sets[1].resources[7].nof_symbols = 2;
cfg.pucch.sets[1].resources[7].start_symbol_idx = 2;
// Item 16
// PUCCH-Resource
// pucch-ResourceId: 16
// startingPRB: 0
// format: format1 (1)
// format1
// initialCyclicShift: 8
// nrofSymbols: 14
// startingSymbolIndex: 0
// timeDomainOCC: 2
// Item 17
// PUCCH-Resource
// pucch-ResourceId: 17
// startingPRB: 1
// format: format2 (2)
// format2
// nrofPRBs: 1
// nrofSymbols: 2
// startingSymbolIndex: 2
// format1: setup (1)
// setup
// format2: setup (1)
// setup
// maxCodeRate: zeroDot25 (2)
for (uint32_t i = 0; i < SRSLTE_PUCCH_NR_MAX_NOF_SETS; i++) {
srslte_pucch_nr_resource_set_t* set = &cfg.pucch.sets[i];
for (uint32_t j = 0; j < set->nof_resources; j++) {
if (set->resources[j].format == SRSLTE_PUCCH_NR_FORMAT_2) {
set->resources[j].max_code_rate = 2; // 0.25
}
}
}
// schedulingRequestResourceToAddModList: 1 item
// Item 0
// SchedulingRequestResourceConfig
// schedulingRequestResourceId: 1
// schedulingRequestID: 0
// periodicityAndOffset: sl40 (10)
// sl40: 8
// resource: 16
// dl-DataToUL-ACK: 7 items
// Item 0
// dl-DataToUL-ACK item: 8
// Item 1
// dl-DataToUL-ACK item: 7
// Item 2
// dl-DataToUL-ACK item: 6
// Item 3
// dl-DataToUL-ACK item: 5
// Item 4
// dl-DataToUL-ACK item: 4
// Item 5
// dl-DataToUL-ACK item: 12
// Item 6
// dl-DataToUL-ACK item: 11
cfg.harq_ack.dl_data_to_ul_ack[0] = 8;
cfg.harq_ack.dl_data_to_ul_ack[1] = 7;
cfg.harq_ack.dl_data_to_ul_ack[2] = 6;
cfg.harq_ack.dl_data_to_ul_ack[3] = 5;
cfg.harq_ack.dl_data_to_ul_ack[4] = 4;
cfg.harq_ack.dl_data_to_ul_ack[5] = 12;
cfg.harq_ack.dl_data_to_ul_ack[6] = 11;
cfg.harq_ack.nof_dl_data_to_ul_ack = 7;
}
/**

View File

@ -40,6 +40,9 @@ public:
sf_worker* wait_worker(uint32_t tti);
void start_worker(sf_worker* w);
void stop();
void send_prach(uint32_t prach_occasion, uint32_t preamble_index, int preamble_received_target_power);
int set_ul_grant(std::array<uint8_t, SRSLTE_RAR_UL_GRANT_NBITS> array);
bool set_config(const srslte::phy_cfg_nr_t& cfg);
};
} // namespace nr

View File

@ -28,6 +28,7 @@
#include "srsue/hdr/phy/lte/worker_pool.h"
#include "srsue/hdr/phy/nr/worker_pool.h"
#include "srsue/hdr/phy/ue_lte_phy_base.h"
#include "srsue/hdr/phy/ue_nr_phy_base.h"
#include "sync.h"
namespace srsue {
@ -65,7 +66,7 @@ private:
srslte::block_queue<std::function<void(void)> > cmd_queue;
};
class phy final : public ue_lte_phy_base, public srslte::thread
class phy final : public ue_lte_phy_base, public ue_nr_phy_base, public srslte::thread
{
public:
explicit phy(srslog::sink& log_sink) :
@ -77,7 +78,10 @@ public:
common(logger_phy),
sfsync(logger_phy, logger_phy_lib),
prach_buffer(logger_phy),
thread("PHY"){};
thread("PHY")
{}
bool set_config(const srslte::phy_cfg_nr_t& cfg) final;
~phy() final { stop(); }
// Init defined in base class
@ -86,7 +90,7 @@ public:
// Init for LTE PHYs
int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) final;
int init(const phy_args_nr_t& args_, stack_interface_phy_nr* stack_, srslte::radio_interface_phy* radio_);
int init(const phy_args_nr_t& args_, stack_interface_phy_nr* stack_, srslte::radio_interface_phy* radio_) final;
void stop() final;
@ -169,6 +173,10 @@ public:
const static int DEFAULT_WORKERS = 4;
std::string get_type() final { return "lte_soft"; }
int set_ul_grant(std::array<uint8_t, SRSLTE_RAR_UL_GRANT_NBITS> array) final;
void send_prach(uint32_t prach_occasion, uint32_t preamble_index, int preamble_received_target_power) final;
int tx_request(const tx_request_t& request) final;
void set_earfcn(std::vector<uint32_t> earfcns) final;
private:
void run_thread() final;

View File

@ -25,23 +25,20 @@
namespace srsue {
class ue_phy_nr_base : public ue_phy_base, public phy_interface_stack_nr, public srslte::phy_interface_radio
class ue_nr_phy_base : public phy_interface_stack_nr
{
public:
ue_phy_nr_base(){};
virtual ~ue_phy_nr_base() {}
ue_nr_phy_base(){};
virtual ~ue_nr_phy_base() {}
virtual std::string get_type() = 0;
virtual int init(const phy_args_t& args_) = 0;
virtual int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) = 0;
virtual void stop() = 0;
virtual int init(const phy_args_t& args_) = 0;
virtual int init(const phy_args_nr_t& args_, stack_interface_phy_nr* stack_, srslte::radio_interface_phy* radio_) = 0;
virtual void stop() = 0;
virtual void set_earfcn(std::vector<uint32_t> earfcns) = 0;
virtual void wait_initialize() = 0;
virtual void start_plot() = 0;
virtual void get_metrics(phy_metrics_t* m) = 0;
};

View File

@ -21,7 +21,7 @@
#include "srslte/interfaces/radio_interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/interfaces/ue_nr_interfaces.h"
#include "srsue/hdr/phy/ue_phy_nr_base.h"
#include "srsue/hdr/phy/ue_nr_phy_base.h"
namespace srsue {
@ -46,6 +46,9 @@ public:
void start_plot();
// RRC interface
bool set_config(const srslte::phy_cfg_nr_t& cfg) override;
// MAC interface
int tx_request(const tx_request_t& request);
int set_ul_grant(std::array<uint8_t, SRSLTE_RAR_UL_GRANT_NBITS>) { return SRSLTE_SUCCESS; };
@ -61,4 +64,4 @@ private:
} // namespace srsue
#endif // SRSUE_VNF_PHY_NR_H
#endif // SRSUE_VNF_PHY_NR_H

View File

@ -128,37 +128,19 @@ uint32_t cc_worker::get_buffer_len()
void cc_worker::decode_pdcch_dl()
{
std::array<srslte_dci_dl_nr_t, 5> dci_rx = {};
uint32_t nof_found_dci = 0;
std::array<srslte_dci_dl_nr_t, 5> dci_rx = {};
uint16_t rnti = phy->stack->get_dl_sched_rnti(dl_slot_cfg.idx);
// Search for test RNTI
if (phy->test_rnti > 0) {
// Search for test DL grants
int n_dl = srslte_ue_dl_nr_find_dl_dci(&ue_dl,
&dl_slot_cfg,
(uint16_t)phy->test_rnti,
&dci_rx[nof_found_dci],
(uint32_t)dci_rx.size() - nof_found_dci);
if (n_dl < SRSLTE_SUCCESS) {
logger.error("Error decoding DL NR-PDCCH for test RNTI");
return;
}
nof_found_dci += n_dl;
// Search for grants
int n_dl = srslte_ue_dl_nr_find_dl_dci(
&ue_dl, &dl_slot_cfg, rnti, srslte_rnti_type_c, dci_rx.data(), (uint32_t)dci_rx.size());
if (n_dl < SRSLTE_SUCCESS) {
logger.error("Error decoding DL NR-PDCCH");
return;
}
// Search for RA DCI
if (phy->cfg.pdcch.ra_search_space_present) {
int n_ra = srslte_ue_dl_nr_find_dl_dci(
&ue_dl, &dl_slot_cfg, phy->cfg.pdcch.ra_rnti, &dci_rx[nof_found_dci], (uint32_t)dci_rx.size() - nof_found_dci);
if (n_ra < SRSLTE_SUCCESS) {
logger.error("Error decoding DL NR-PDCCH for RA-RNTI");
return;
}
nof_found_dci += n_ra;
}
// Iterate over all DL received grants
for (uint32_t i = 0; i < nof_found_dci; i++) {
// Iterate over all received grants
for (int i = 0; i < n_dl; i++) {
// Log found DCI
if (logger.info.enabled()) {
std::array<char, 512> str;
@ -173,26 +155,19 @@ void cc_worker::decode_pdcch_dl()
void cc_worker::decode_pdcch_ul()
{
std::array<srslte_dci_ul_nr_t, 5> dci_rx = {};
uint32_t nof_found_dci = 0;
std::array<srslte_dci_ul_nr_t, 5> dci_rx = {};
uint16_t rnti = phy->stack->get_ul_sched_rnti(ul_slot_cfg.idx);
// Search for test RNTI
if (phy->test_rnti > 0) {
// Search for test DL grants
int n_dl = srslte_ue_dl_nr_find_ul_dci(&ue_dl,
&dl_slot_cfg,
(uint16_t)phy->test_rnti,
&dci_rx[nof_found_dci],
(uint32_t)dci_rx.size() - nof_found_dci);
if (n_dl < SRSLTE_SUCCESS) {
logger.error("Error decoding DL NR-PDCCH for test RNTI");
return;
}
nof_found_dci += n_dl;
// Search for grants
int n_dl = srslte_ue_dl_nr_find_ul_dci(
&ue_dl, &dl_slot_cfg, rnti, srslte_rnti_type_c, dci_rx.data(), (uint32_t)dci_rx.size());
if (n_dl < SRSLTE_SUCCESS) {
logger.error("Error decoding UL NR-PDCCH");
return;
}
// Iterate over all UL received grants
for (uint32_t i = 0; i < nof_found_dci; i++) {
// Iterate over all received grants
for (int i = 0; i < n_dl; i++) {
// Log found DCI
if (logger.info.enabled()) {
std::array<char, 512> str;
@ -247,8 +222,10 @@ bool cc_worker::work_dl()
logger.info(pdsch_res[0].payload, pdsch_cfg.grant.tb[0].tbs / 8, "PDSCH: cc=%d, %s", cc_idx, str.data());
}
// Enqueue PDSCH ACK information
phy->set_pending_ack(dl_slot_cfg.idx, ack_resource, pdsch_res[0].crc);
// Enqueue PDSCH ACK information only if the RNTI is type C
if (pdsch_cfg.grant.rnti_type == srslte_rnti_type_c) {
phy->set_pending_ack(dl_slot_cfg.idx, ack_resource, pdsch_res[0].crc);
}
// Notify MAC about PDSCH decoding result
if (pdsch_res[0].crc) {

View File

@ -60,6 +60,7 @@ uint32_t sf_worker::get_buffer_len()
void sf_worker::set_tti(uint32_t tti)
{
tti_rx = tti;
logger.set_context(tti);
for (auto& w : cc_workers) {
w->set_tti(tti);
@ -81,6 +82,9 @@ void sf_worker::work_imp()
// PRACH is available, set buffer, transmit and return
tx_buffer.set(0, prach_ptr);
// Notify MAC about PRACH transmission
phy_state->stack->prach_sent(tti_rx, 7, 1, 0, 0);
// Transmit NR PRACH
phy->worker_end(this, false, tx_buffer, dummy_ts, true);

View File

@ -23,6 +23,7 @@ bool worker_pool::init(const phy_args_nr_t& args,
int prio)
{
phy_state.stack = stack_;
phy_state.args = args;
// Set carrier attributes
phy_state.carrier.id = 500;
@ -79,9 +80,6 @@ sf_worker* worker_pool::wait_worker(uint32_t tti)
{
sf_worker* worker = (sf_worker*)pool.wait_worker(tti);
// Prepare PRACH, send always sequence 0
prach_buffer->prepare_to_send(0);
// Generate PRACH if ready
if (prach_buffer->is_ready_to_send(tti, phy_state.carrier.id)) {
uint32_t nof_prach_sf = 0;
@ -98,5 +96,36 @@ void worker_pool::stop()
pool.stop();
}
void worker_pool::send_prach(uint32_t prach_occasion, uint32_t preamble_index, int preamble_received_target_power)
{
prach_buffer->prepare_to_send(preamble_index);
}
int worker_pool::set_ul_grant(std::array<uint8_t, SRSLTE_RAR_UL_GRANT_NBITS> array)
{
// Copy DCI bits and setup DCI context
srslte_dci_msg_nr_t dci_msg = {};
dci_msg.format = srslte_dci_format_nr_rar;
dci_msg.rnti_type = srslte_rnti_type_ra;
dci_msg.rnti = phy_state.ra_rnti;
dci_msg.nof_bits = SRSLTE_RAR_UL_GRANT_NBITS;
srslte_vec_u8_copy(dci_msg.payload, array.data(), SRSLTE_RAR_UL_GRANT_NBITS);
srslte_dci_ul_nr_t dci_ul = {};
if (srslte_dci_nr_format_0_0_unpack(&phy_state.carrier, &phy_state.cfg.pdcch.coreset[1], &dci_msg, &dci_ul) <
SRSLTE_SUCCESS) {
return SRSLTE_ERROR;
}
phy_state.set_ul_pending_grant(phy_state.rar_grant_tti, dci_ul);
return SRSLTE_SUCCESS;
}
bool worker_pool::set_config(const srslte::phy_cfg_nr_t& cfg)
{
phy_state.cfg = cfg;
return true;
}
} // namespace nr
} // namespace srsue

View File

@ -614,4 +614,29 @@ void phy::set_mch_period_stop(uint32_t stop)
common.set_mch_period_stop(stop);
}
int phy::set_ul_grant(std::array<uint8_t, SRSLTE_RAR_UL_GRANT_NBITS> array)
{
return nr_workers.set_ul_grant(array);
}
void phy::send_prach(uint32_t prach_occasion, uint32_t preamble_index, int preamble_received_target_power)
{
nr_workers.send_prach(prach_occasion, preamble_index, preamble_received_target_power);
}
int phy::tx_request(const phy_interface_mac_nr::tx_request_t& request)
{
return 0;
}
void phy::set_earfcn(std::vector<uint32_t> earfcns)
{
// Do nothing
}
bool phy::set_config(const srslte::phy_cfg_nr_t& cfg)
{
return nr_workers.set_config(cfg);
}
} // namespace srsue

View File

@ -69,5 +69,9 @@ int vnf_phy_nr::tx_request(const tx_request_t& request)
// send Tx request over basic API
return vnf->tx_request(request);
}
bool vnf_phy_nr::set_config(const srslte::phy_cfg_nr_t& cfg)
{
return false;
}
} // namespace srsue

View File

@ -144,9 +144,17 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_)
nas.init(usim.get(), &rrc, gw, args.nas);
#ifdef HAVE_5GNR
mac_nr_args_t mac_nr_args = {};
mac_nr.init(mac_nr_args, nullptr, &rlc);
rrc_nr.init(
nullptr, &mac_nr, &rlc, &pdcp, gw, &rrc, usim.get(), task_sched.get_timer_handler(), nullptr, args.rrc_nr);
mac_nr.init(mac_nr_args, (phy_interface_mac_nr*)phy, &rlc);
rrc_nr.init((phy_interface_rrc_nr*)phy,
&mac_nr,
&rlc,
&pdcp,
gw,
&rrc,
usim.get(),
task_sched.get_timer_handler(),
nullptr,
args.rrc_nr);
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, &rrc_nr, args.rrc);
#else
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, args.rrc);

View File

@ -97,7 +97,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_)
}
#ifdef HAVE_5GNR
srsue::phy_args_nr_t phy_args_nr = {};
srsue::phy_args_nr_t phy_args_nr;
phy_args_nr.nof_prb = args.phy.nr_nof_prb;
phy_args_nr.nof_carriers = args.phy.nof_nr_carriers;
phy_args_nr.nof_phy_threads = args.phy.nof_phy_threads;