|
|
@ -164,16 +164,19 @@ static uint32_t srslte_dmrs_put_pilots(srslte_dmrs_pdsch_t* q,
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int srslte_dmrs_pdsch_put_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
static int srslte_dmrs_pdsch_put_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
uint32_t cinit,
|
|
|
|
const srslte_pdsch_grant_nr_t* grant,
|
|
|
|
uint32_t delta,
|
|
|
|
uint32_t cinit,
|
|
|
|
cf_t* symbols)
|
|
|
|
uint32_t delta,
|
|
|
|
|
|
|
|
cf_t* symbols)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
|
|
|
|
|
|
|
|
grant->mapping == srslte_pdsch_mapping_type_A ? &pdsch_cfg->dmrs_cfg_typeA : &pdsch_cfg->dmrs_cfg_typeB;
|
|
|
|
uint32_t prb_count = 0; // Counts consecutive used PRB
|
|
|
|
uint32_t prb_count = 0; // Counts consecutive used PRB
|
|
|
|
uint32_t prb_start = 0; // Start consecutive used PRB
|
|
|
|
uint32_t prb_start = 0; // Start consecutive used PRB
|
|
|
|
uint32_t prb_skip = 0; // Number of PRB to skip
|
|
|
|
uint32_t prb_skip = 0; // Number of PRB to skip
|
|
|
|
uint32_t nof_pilots_x_prb = pdsch_cfg->dmrs_cfg.type == srslte_dmrs_pdsch_type_1 ? 6 : 4;
|
|
|
|
uint32_t nof_pilots_x_prb = dmrs_cfg->type == srslte_dmrs_pdsch_type_1 ? 6 : 4;
|
|
|
|
uint32_t pilot_count = 0;
|
|
|
|
uint32_t pilot_count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// Initialise sequence
|
|
|
|
// Initialise sequence
|
|
|
@ -183,7 +186,7 @@ static int srslte_dmrs_pdsch_put_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
// Iterate over PRBs
|
|
|
|
// Iterate over PRBs
|
|
|
|
for (uint32_t prb_idx = 0; prb_idx < q->carrier.nof_prb; prb_idx++) {
|
|
|
|
for (uint32_t prb_idx = 0; prb_idx < q->carrier.nof_prb; prb_idx++) {
|
|
|
|
// If the PRB is used for PDSCH transmission count
|
|
|
|
// If the PRB is used for PDSCH transmission count
|
|
|
|
if (pdsch_cfg->grant.prb_idx[prb_idx]) {
|
|
|
|
if (grant->prb_idx[prb_idx]) {
|
|
|
|
// If it is the first PRB...
|
|
|
|
// If it is the first PRB...
|
|
|
|
if (prb_count == 0) {
|
|
|
|
if (prb_count == 0) {
|
|
|
|
// ... save first consecutive PRB in the group
|
|
|
|
// ... save first consecutive PRB in the group
|
|
|
@ -208,7 +211,7 @@ static int srslte_dmrs_pdsch_put_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
|
|
|
|
|
|
|
|
// Get contiguous pilots
|
|
|
|
// Get contiguous pilots
|
|
|
|
pilot_count += srslte_dmrs_put_pilots(
|
|
|
|
pilot_count += srslte_dmrs_put_pilots(
|
|
|
|
q, &sequence_state, pdsch_cfg->dmrs_cfg.type, prb_start, prb_count, delta, &symbols[prb_start * SRSLTE_NRE]);
|
|
|
|
q, &sequence_state, dmrs_cfg->type, prb_start, prb_count, delta, &symbols[prb_start * SRSLTE_NRE]);
|
|
|
|
|
|
|
|
|
|
|
|
// Reset counter
|
|
|
|
// Reset counter
|
|
|
|
prb_count = 0;
|
|
|
|
prb_count = 0;
|
|
|
@ -216,15 +219,15 @@ static int srslte_dmrs_pdsch_put_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
|
|
|
|
|
|
|
|
if (prb_count > 0) {
|
|
|
|
if (prb_count > 0) {
|
|
|
|
pilot_count += srslte_dmrs_put_pilots(
|
|
|
|
pilot_count += srslte_dmrs_put_pilots(
|
|
|
|
q, &sequence_state, pdsch_cfg->dmrs_cfg.type, prb_start, prb_count, delta, &symbols[prb_start * SRSLTE_NRE]);
|
|
|
|
q, &sequence_state, dmrs_cfg->type, prb_start, prb_count, delta, &symbols[prb_start * SRSLTE_NRE]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pilot_count;
|
|
|
|
return pilot_count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Implements 3GPP 38.211 R.15 Table 7.4.1.1.2-3 PDSCH mapping type A Single
|
|
|
|
// Implements 3GPP 38.211 R.15 Table 7.4.1.1.2-3 PDSCH mapping type A Single
|
|
|
|
static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_pdsch_cfg_nr_t* cfg,
|
|
|
|
static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_pdsch_dmrs_cfg_t* dmrs_cfg,
|
|
|
|
uint32_t ld,
|
|
|
|
uint32_t ld,
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS])
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
int count = 0;
|
|
|
@ -235,7 +238,7 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// l0 = 3 if the higher-layer parameter dmrs-TypeA-Position is equal to 'pos3' and l0 = 2 otherwise
|
|
|
|
// l0 = 3 if the higher-layer parameter dmrs-TypeA-Position is equal to 'pos3' and l0 = 2 otherwise
|
|
|
|
int l0 = (cfg->dmrs_cfg.typeA_pos == srslte_dmrs_pdsch_typeA_pos_3) ? 3 : 2;
|
|
|
|
int l0 = (dmrs_cfg->typeA_pos == srslte_dmrs_pdsch_typeA_pos_3) ? 3 : 2;
|
|
|
|
|
|
|
|
|
|
|
|
// For PDSCH mapping Type A single-symbol DM-RS, l1 = 11 except if all of the following conditions are fulfilled in
|
|
|
|
// For PDSCH mapping Type A single-symbol DM-RS, l1 = 11 except if all of the following conditions are fulfilled in
|
|
|
|
// which case l1 = 12:
|
|
|
|
// which case l1 = 12:
|
|
|
@ -243,15 +246,15 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_
|
|
|
|
// - the higher-layer parameters dmrs-AdditionalPosition is equal to 'pos1' and l0 = 3; and
|
|
|
|
// - the higher-layer parameters dmrs-AdditionalPosition is equal to 'pos1' and l0 = 3; and
|
|
|
|
// - the UE has indicated it is capable of additionalDMRS-DL-Alt
|
|
|
|
// - the UE has indicated it is capable of additionalDMRS-DL-Alt
|
|
|
|
int l1 = 11;
|
|
|
|
int l1 = 11;
|
|
|
|
if (cfg->dmrs_cfg.lte_CRS_to_match_around && cfg->dmrs_cfg.additional_pos == srslte_dmrs_pdsch_add_pos_1 &&
|
|
|
|
if (dmrs_cfg->lte_CRS_to_match_around && dmrs_cfg->additional_pos == srslte_dmrs_pdsch_add_pos_1 &&
|
|
|
|
cfg->dmrs_cfg.typeA_pos == srslte_dmrs_pdsch_typeA_pos_3 && cfg->dmrs_cfg.additional_DMRS_DL_Alt) {
|
|
|
|
dmrs_cfg->typeA_pos == srslte_dmrs_pdsch_typeA_pos_3 && dmrs_cfg->additional_DMRS_DL_Alt) {
|
|
|
|
l1 = 12;
|
|
|
|
l1 = 12;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
symbols[count] = l0;
|
|
|
|
symbols[count] = l0;
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
|
|
|
|
|
|
|
|
if (ld < 8 || cfg->dmrs_cfg.additional_pos == srslte_dmrs_pdsch_add_pos_0) {
|
|
|
|
if (ld < 8 || dmrs_cfg->additional_pos == srslte_dmrs_pdsch_add_pos_0) {
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -259,7 +262,7 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_
|
|
|
|
symbols[count] = 7;
|
|
|
|
symbols[count] = 7;
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
} else if (ld < 12) {
|
|
|
|
} else if (ld < 12) {
|
|
|
|
if (cfg->dmrs_cfg.additional_pos > srslte_dmrs_pdsch_add_pos_2) {
|
|
|
|
if (dmrs_cfg->additional_pos > srslte_dmrs_pdsch_add_pos_2) {
|
|
|
|
symbols[count] = 6;
|
|
|
|
symbols[count] = 6;
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -268,7 +271,7 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
|
|
|
|
|
|
|
|
} else if (ld == 12) {
|
|
|
|
} else if (ld == 12) {
|
|
|
|
switch (cfg->dmrs_cfg.additional_pos) {
|
|
|
|
switch (dmrs_cfg->additional_pos) {
|
|
|
|
case srslte_dmrs_pdsch_add_pos_1:
|
|
|
|
case srslte_dmrs_pdsch_add_pos_1:
|
|
|
|
symbols[count] = 9;
|
|
|
|
symbols[count] = 9;
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
@ -288,7 +291,7 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
switch (cfg->dmrs_cfg.additional_pos) {
|
|
|
|
switch (dmrs_cfg->additional_pos) {
|
|
|
|
case srslte_dmrs_pdsch_add_pos_1:
|
|
|
|
case srslte_dmrs_pdsch_add_pos_1:
|
|
|
|
symbols[count] = l1;
|
|
|
|
symbols[count] = l1;
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
@ -313,8 +316,8 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(const srslte_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Implements 3GPP 38.211 R.15 Table 7.4.1.1.2-4 PDSCH mapping type A Double
|
|
|
|
// Implements 3GPP 38.211 R.15 Table 7.4.1.1.2-4 PDSCH mapping type A Double
|
|
|
|
static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_double(const srslte_pdsch_cfg_nr_t* cfg,
|
|
|
|
static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_double(const srslte_pdsch_dmrs_cfg_t* dmrs_cfg,
|
|
|
|
uint32_t ld,
|
|
|
|
uint32_t ld,
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS])
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
int count = 0;
|
|
|
@ -324,14 +327,14 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_double(const srslte_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// l0 = 3 if the higher-layer parameter dmrs-TypeA-Position is equal to 'pos3' and l0 = 2 otherwise
|
|
|
|
// l0 = 3 if the higher-layer parameter dmrs-TypeA-Position is equal to 'pos3' and l0 = 2 otherwise
|
|
|
|
int l0 = (cfg->dmrs_cfg.typeA_pos == srslte_dmrs_pdsch_typeA_pos_3) ? 3 : 2;
|
|
|
|
int l0 = (dmrs_cfg->typeA_pos == srslte_dmrs_pdsch_typeA_pos_3) ? 3 : 2;
|
|
|
|
|
|
|
|
|
|
|
|
symbols[count] = l0;
|
|
|
|
symbols[count] = l0;
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
symbols[count] = symbols[count - 1] + 1;
|
|
|
|
symbols[count] = symbols[count - 1] + 1;
|
|
|
|
count++;
|
|
|
|
count++;
|
|
|
|
|
|
|
|
|
|
|
|
if (ld < 10 || cfg->dmrs_cfg.additional_pos == srslte_dmrs_pdsch_add_pos_0) {
|
|
|
|
if (ld < 10 || dmrs_cfg->additional_pos == srslte_dmrs_pdsch_add_pos_0) {
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -350,22 +353,27 @@ static int srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_double(const srslte_
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int srslte_dmrs_pdsch_get_symbols_idx(const srslte_pdsch_cfg_nr_t* cfg, uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS])
|
|
|
|
int srslte_dmrs_pdsch_get_symbols_idx(const srslte_pdsch_cfg_nr_t* cfg,
|
|
|
|
|
|
|
|
const srslte_pdsch_grant_nr_t* grant,
|
|
|
|
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// The position(s) of the DM-RS symbols is given by l and duration ld where
|
|
|
|
// The position(s) of the DM-RS symbols is given by l and duration ld where
|
|
|
|
// - for PDSCH mapping type A, ld is the duration between the first OFDM symbol of the slot and the last OFDM symbol
|
|
|
|
// - for PDSCH mapping type A, ld is the duration between the first OFDM symbol of the slot and the last OFDM symbol
|
|
|
|
// of the scheduled PDSCH resources in the slot
|
|
|
|
// of the scheduled PDSCH resources in the slot
|
|
|
|
// - for PDSCH mapping type B, ld is the duration of the scheduled PDSCH resources
|
|
|
|
// - for PDSCH mapping type B, ld is the duration of the scheduled PDSCH resources
|
|
|
|
uint32_t ld = cfg->grant.L;
|
|
|
|
uint32_t ld = grant->L;
|
|
|
|
if (cfg->grant.mapping == srslte_pdsch_mapping_type_A) {
|
|
|
|
if (grant->mapping == srslte_pdsch_mapping_type_A) {
|
|
|
|
ld = cfg->grant.S + cfg->grant.L;
|
|
|
|
ld = grant->S + grant->L;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (cfg->grant.mapping) {
|
|
|
|
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
|
|
|
|
|
|
|
|
grant->mapping == srslte_pdsch_mapping_type_A ? &cfg->dmrs_cfg_typeA : &cfg->dmrs_cfg_typeB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (grant->mapping) {
|
|
|
|
case srslte_pdsch_mapping_type_A:
|
|
|
|
case srslte_pdsch_mapping_type_A:
|
|
|
|
// The case dmrs-AdditionalPosition equals to 'pos3' is only supported when dmrs-TypeA-Position is equal to 'pos2'
|
|
|
|
// The case dmrs-AdditionalPosition equals to 'pos3' is only supported when dmrs-TypeA-Position is equal to 'pos2'
|
|
|
|
if (cfg->dmrs_cfg.typeA_pos != srslte_dmrs_pdsch_typeA_pos_2 &&
|
|
|
|
if (dmrs_cfg->typeA_pos != srslte_dmrs_pdsch_typeA_pos_2 &&
|
|
|
|
cfg->dmrs_cfg.additional_pos == srslte_dmrs_pdsch_add_pos_3) {
|
|
|
|
dmrs_cfg->additional_pos == srslte_dmrs_pdsch_add_pos_3) {
|
|
|
|
ERROR("The case dmrs-AdditionalPosition equals to 'pos3' is only supported when dmrs-TypeA-Position is equal "
|
|
|
|
ERROR("The case dmrs-AdditionalPosition equals to 'pos3' is only supported when dmrs-TypeA-Position is equal "
|
|
|
|
"to 'pos2'\n");
|
|
|
|
"to 'pos2'\n");
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
@ -373,16 +381,16 @@ int srslte_dmrs_pdsch_get_symbols_idx(const srslte_pdsch_cfg_nr_t* cfg, uint32_t
|
|
|
|
|
|
|
|
|
|
|
|
// For PDSCH mapping type A, ld = 3 and ld = 4 symbols in Tables 7.4.1.1.2-3 and 7.4.1.1.2-4 respectively is only
|
|
|
|
// For PDSCH mapping type A, ld = 3 and ld = 4 symbols in Tables 7.4.1.1.2-3 and 7.4.1.1.2-4 respectively is only
|
|
|
|
// applicable when dmrs-TypeA-Position is equal to 'pos2
|
|
|
|
// applicable when dmrs-TypeA-Position is equal to 'pos2
|
|
|
|
if ((ld == 3 || ld == 4) && cfg->dmrs_cfg.typeA_pos != srslte_dmrs_pdsch_typeA_pos_2) {
|
|
|
|
if ((ld == 3 || ld == 4) && dmrs_cfg->typeA_pos != srslte_dmrs_pdsch_typeA_pos_2) {
|
|
|
|
ERROR("For PDSCH mapping type A, ld = 3 and ld = 4 symbols in Tables 7.4.1.1.2-3 and 7.4.1.1.2-4 respectively "
|
|
|
|
ERROR("For PDSCH mapping type A, ld = 3 and ld = 4 symbols in Tables 7.4.1.1.2-3 and 7.4.1.1.2-4 respectively "
|
|
|
|
"is only applicable when dmrs-TypeA-Position is equal to 'pos2\n");
|
|
|
|
"is only applicable when dmrs-TypeA-Position is equal to 'pos2\n");
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (cfg->dmrs_cfg.length == srslte_dmrs_pdsch_len_1) {
|
|
|
|
if (dmrs_cfg->length == srslte_dmrs_pdsch_len_1) {
|
|
|
|
return srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(cfg, ld, symbols);
|
|
|
|
return srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_single(dmrs_cfg, ld, symbols);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_double(cfg, ld, symbols);
|
|
|
|
return srslte_dmrs_pdsch_get_symbols_idx_mapping_type_A_double(dmrs_cfg, ld, symbols);
|
|
|
|
case srslte_pdsch_mapping_type_B:
|
|
|
|
case srslte_pdsch_mapping_type_B:
|
|
|
|
ERROR("Error PDSCH mapping type B not supported\n");
|
|
|
|
ERROR("Error PDSCH mapping type B not supported\n");
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
@ -413,20 +421,42 @@ int srslte_dmrs_pdsch_get_sc_idx(const srslte_pdsch_dmrs_cfg_t* cfg, uint32_t ma
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static uint32_t srslte_dmrs_pdsch_seed(const srslte_carrier_nr_t* carrier,
|
|
|
|
int srslte_dmrs_pdsch_get_N_prb(const srslte_pdsch_cfg_nr_t* cfg, const srslte_pdsch_grant_nr_t* grant)
|
|
|
|
const srslte_pdsch_cfg_nr_t* cfg,
|
|
|
|
{
|
|
|
|
uint32_t slot_idx,
|
|
|
|
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
|
|
|
|
uint32_t symbol_idx)
|
|
|
|
grant->mapping == srslte_pdsch_mapping_type_A ? &cfg->dmrs_cfg_typeA : &cfg->dmrs_cfg_typeB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get number of frequency domain resource elements used for DMRS
|
|
|
|
|
|
|
|
int nof_sc = dmrs_cfg->type == srslte_dmrs_pdsch_type_1 ? 6 : 4;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get number of symbols used for DMRS
|
|
|
|
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS] = {};
|
|
|
|
|
|
|
|
int ret = srslte_dmrs_pdsch_get_symbols_idx(cfg, grant, symbols);
|
|
|
|
|
|
|
|
if (ret < SRSLTE_SUCCESS) {
|
|
|
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nof_sc * ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint32_t srslte_dmrs_pdsch_seed(const srslte_carrier_nr_t* carrier,
|
|
|
|
|
|
|
|
const srslte_pdsch_cfg_nr_t* cfg,
|
|
|
|
|
|
|
|
const srslte_pdsch_grant_nr_t* grant,
|
|
|
|
|
|
|
|
uint32_t slot_idx,
|
|
|
|
|
|
|
|
uint32_t symbol_idx)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
|
|
|
|
|
|
|
|
grant->mapping == srslte_pdsch_mapping_type_A ? &cfg->dmrs_cfg_typeA : &cfg->dmrs_cfg_typeB;
|
|
|
|
|
|
|
|
|
|
|
|
// Calculate scrambling IDs
|
|
|
|
// Calculate scrambling IDs
|
|
|
|
uint32_t n_id = carrier->id;
|
|
|
|
uint32_t n_id = carrier->id;
|
|
|
|
uint32_t n_scid = (cfg->grant.n_scid) ? 1 : 0;
|
|
|
|
uint32_t n_scid = (grant->n_scid) ? 1 : 0;
|
|
|
|
if (!cfg->grant.n_scid && cfg->dmrs_cfg.scrambling_id0_present) {
|
|
|
|
if (!grant->n_scid && dmrs_cfg->scrambling_id0_present) {
|
|
|
|
// n_scid = 0 and ID0 present
|
|
|
|
// n_scid = 0 and ID0 present
|
|
|
|
n_id = cfg->dmrs_cfg.scrambling_id0;
|
|
|
|
n_id = dmrs_cfg->scrambling_id0;
|
|
|
|
} else if (cfg->grant.n_scid && cfg->dmrs_cfg.scrambling_id1_present) {
|
|
|
|
} else if (grant->n_scid && dmrs_cfg->scrambling_id1_present) {
|
|
|
|
// n_scid = 1 and ID1 present
|
|
|
|
// n_scid = 1 and ID1 present
|
|
|
|
n_id = cfg->dmrs_cfg.scrambling_id1;
|
|
|
|
n_id = dmrs_cfg->scrambling_id1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (uint32_t)(((((SRSLTE_MAX_NSYMB * slot_idx + symbol_idx + 1UL) * (2UL * n_id + 1UL)) << 17UL) +
|
|
|
|
return (uint32_t)(((((SRSLTE_MAX_NSYMB * slot_idx + symbol_idx + 1UL) * (2UL * n_id + 1UL)) << 17UL) +
|
|
|
@ -468,7 +498,7 @@ int srslte_dmrs_pdsch_set_carrier(srslte_dmrs_pdsch_t* q, const srslte_carrier_n
|
|
|
|
bool max_nof_prb_changed = q->max_nof_prb < carrier->nof_prb;
|
|
|
|
bool max_nof_prb_changed = q->max_nof_prb < carrier->nof_prb;
|
|
|
|
|
|
|
|
|
|
|
|
// Set carrier and update maximum number of PRB
|
|
|
|
// Set carrier and update maximum number of PRB
|
|
|
|
q->carrier = *carrier;
|
|
|
|
q->carrier = *carrier;
|
|
|
|
q->max_nof_prb = SRSLTE_MAX(q->max_nof_prb, carrier->nof_prb);
|
|
|
|
q->max_nof_prb = SRSLTE_MAX(q->max_nof_prb, carrier->nof_prb);
|
|
|
|
|
|
|
|
|
|
|
|
// Resize/allocate temp for gNb and UE
|
|
|
|
// Resize/allocate temp for gNb and UE
|
|
|
@ -516,10 +546,11 @@ int srslte_dmrs_pdsch_set_carrier(srslte_dmrs_pdsch_t* q, const srslte_carrier_n
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int srslte_dmrs_pdsch_put_sf(srslte_dmrs_pdsch_t* q,
|
|
|
|
int srslte_dmrs_pdsch_put_sf(srslte_dmrs_pdsch_t* q,
|
|
|
|
const srslte_dl_slot_cfg_t* slot_cfg,
|
|
|
|
const srslte_dl_slot_cfg_t* slot_cfg,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
cf_t* sf_symbols)
|
|
|
|
const srslte_pdsch_grant_nr_t* grant,
|
|
|
|
|
|
|
|
cf_t* sf_symbols)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t delta = 0;
|
|
|
|
uint32_t delta = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -531,7 +562,7 @@ int srslte_dmrs_pdsch_put_sf(srslte_dmrs_pdsch_t* q,
|
|
|
|
|
|
|
|
|
|
|
|
// Get symbols indexes
|
|
|
|
// Get symbols indexes
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS] = {};
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS] = {};
|
|
|
|
int nof_symbols = srslte_dmrs_pdsch_get_symbols_idx(pdsch_cfg, symbols);
|
|
|
|
int nof_symbols = srslte_dmrs_pdsch_get_symbols_idx(pdsch_cfg, grant, symbols);
|
|
|
|
if (nof_symbols < SRSLTE_SUCCESS) {
|
|
|
|
if (nof_symbols < SRSLTE_SUCCESS) {
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -540,25 +571,29 @@ int srslte_dmrs_pdsch_put_sf(srslte_dmrs_pdsch_t* q,
|
|
|
|
for (uint32_t i = 0; i < nof_symbols; i++) {
|
|
|
|
for (uint32_t i = 0; i < nof_symbols; i++) {
|
|
|
|
uint32_t l = symbols[i]; // Symbol index inside the slot
|
|
|
|
uint32_t l = symbols[i]; // Symbol index inside the slot
|
|
|
|
uint32_t slot_idx = slot_cfg->idx; // Slot index in the frame
|
|
|
|
uint32_t slot_idx = slot_cfg->idx; // Slot index in the frame
|
|
|
|
uint32_t cinit = srslte_dmrs_pdsch_seed(&q->carrier, pdsch_cfg, slot_idx, l);
|
|
|
|
uint32_t cinit = srslte_dmrs_pdsch_seed(&q->carrier, pdsch_cfg, grant, slot_idx, l);
|
|
|
|
|
|
|
|
|
|
|
|
srslte_dmrs_pdsch_put_symbol(q, pdsch_cfg, cinit, delta, &sf_symbols[symbol_sz * l]);
|
|
|
|
srslte_dmrs_pdsch_put_symbol(q, pdsch_cfg, grant, cinit, delta, &sf_symbols[symbol_sz * l]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int srslte_dmrs_pdsch_get_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
static int srslte_dmrs_pdsch_get_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
uint32_t cinit,
|
|
|
|
const srslte_pdsch_grant_nr_t* grant,
|
|
|
|
uint32_t delta,
|
|
|
|
uint32_t cinit,
|
|
|
|
const cf_t* symbols,
|
|
|
|
uint32_t delta,
|
|
|
|
cf_t* least_square_estimates)
|
|
|
|
const cf_t* symbols,
|
|
|
|
|
|
|
|
cf_t* least_square_estimates)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
|
|
|
|
|
|
|
|
grant->mapping == srslte_pdsch_mapping_type_A ? &pdsch_cfg->dmrs_cfg_typeA : &pdsch_cfg->dmrs_cfg_typeB;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t prb_count = 0; // Counts consecutive used PRB
|
|
|
|
uint32_t prb_count = 0; // Counts consecutive used PRB
|
|
|
|
uint32_t prb_start = 0; // Start consecutive used PRB
|
|
|
|
uint32_t prb_start = 0; // Start consecutive used PRB
|
|
|
|
uint32_t prb_skip = 0; // Number of PRB to skip
|
|
|
|
uint32_t prb_skip = 0; // Number of PRB to skip
|
|
|
|
uint32_t nof_pilots_x_prb = pdsch_cfg->dmrs_cfg.type == srslte_dmrs_pdsch_type_1 ? 6 : 4;
|
|
|
|
uint32_t nof_pilots_x_prb = dmrs_cfg->type == srslte_dmrs_pdsch_type_1 ? 6 : 4;
|
|
|
|
uint32_t pilot_count = 0;
|
|
|
|
uint32_t pilot_count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// Initialise sequence
|
|
|
|
// Initialise sequence
|
|
|
@ -568,7 +603,7 @@ static int srslte_dmrs_pdsch_get_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
// Iterate over PRBs
|
|
|
|
// Iterate over PRBs
|
|
|
|
for (uint32_t prb_idx = 0; prb_idx < q->carrier.nof_prb; prb_idx++) {
|
|
|
|
for (uint32_t prb_idx = 0; prb_idx < q->carrier.nof_prb; prb_idx++) {
|
|
|
|
// If the PRB is used for PDSCH transmission count
|
|
|
|
// If the PRB is used for PDSCH transmission count
|
|
|
|
if (pdsch_cfg->grant.prb_idx[prb_idx]) {
|
|
|
|
if (grant->prb_idx[prb_idx]) {
|
|
|
|
// If it is the first PRB...
|
|
|
|
// If it is the first PRB...
|
|
|
|
if (prb_count == 0) {
|
|
|
|
if (prb_count == 0) {
|
|
|
|
// ... save first consecutive PRB in the group
|
|
|
|
// ... save first consecutive PRB in the group
|
|
|
@ -594,7 +629,7 @@ static int srslte_dmrs_pdsch_get_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
// Get contiguous pilots
|
|
|
|
// Get contiguous pilots
|
|
|
|
pilot_count += srslte_dmrs_get_lse(q,
|
|
|
|
pilot_count += srslte_dmrs_get_lse(q,
|
|
|
|
&sequence_state,
|
|
|
|
&sequence_state,
|
|
|
|
pdsch_cfg->dmrs_cfg.type,
|
|
|
|
dmrs_cfg->type,
|
|
|
|
prb_start,
|
|
|
|
prb_start,
|
|
|
|
prb_count,
|
|
|
|
prb_count,
|
|
|
|
delta,
|
|
|
|
delta,
|
|
|
@ -608,7 +643,7 @@ static int srslte_dmrs_pdsch_get_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
if (prb_count > 0) {
|
|
|
|
if (prb_count > 0) {
|
|
|
|
pilot_count += srslte_dmrs_get_lse(q,
|
|
|
|
pilot_count += srslte_dmrs_get_lse(q,
|
|
|
|
&sequence_state,
|
|
|
|
&sequence_state,
|
|
|
|
pdsch_cfg->dmrs_cfg.type,
|
|
|
|
dmrs_cfg->type,
|
|
|
|
prb_start,
|
|
|
|
prb_start,
|
|
|
|
prb_count,
|
|
|
|
prb_count,
|
|
|
|
delta,
|
|
|
|
delta,
|
|
|
@ -619,23 +654,28 @@ static int srslte_dmrs_pdsch_get_symbol(srslte_dmrs_pdsch_t* q,
|
|
|
|
return pilot_count;
|
|
|
|
return pilot_count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int srslte_dmrs_pdsch_estimate(srslte_dmrs_pdsch_t* q,
|
|
|
|
int srslte_dmrs_pdsch_estimate(srslte_dmrs_pdsch_t* q,
|
|
|
|
const srslte_dl_slot_cfg_t* slot_cfg,
|
|
|
|
const srslte_dl_slot_cfg_t* slot_cfg,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
const srslte_pdsch_cfg_nr_t* pdsch_cfg,
|
|
|
|
const cf_t* sf_symbols,
|
|
|
|
const srslte_pdsch_grant_nr_t* grant,
|
|
|
|
srslte_chest_dl_res_t* chest_res)
|
|
|
|
const cf_t* sf_symbols,
|
|
|
|
|
|
|
|
srslte_chest_dl_res_t* chest_res)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const uint32_t delta = 0;
|
|
|
|
const uint32_t delta = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (q == NULL || slot_cfg == NULL || sf_symbols == NULL || chest_res == NULL) {
|
|
|
|
if (q == NULL || slot_cfg == NULL || sf_symbols == NULL || chest_res == NULL) {
|
|
|
|
return SRSLTE_ERROR_INVALID_INPUTS;
|
|
|
|
return SRSLTE_ERROR_INVALID_INPUTS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
|
|
|
|
|
|
|
|
grant->mapping == srslte_pdsch_mapping_type_A ? &pdsch_cfg->dmrs_cfg_typeA : &pdsch_cfg->dmrs_cfg_typeB;
|
|
|
|
|
|
|
|
|
|
|
|
cf_t* ce = chest_res->ce[0][0];
|
|
|
|
cf_t* ce = chest_res->ce[0][0];
|
|
|
|
uint32_t symbol_sz = q->carrier.nof_prb * SRSLTE_NRE; // Symbol size in resource elements
|
|
|
|
uint32_t symbol_sz = q->carrier.nof_prb * SRSLTE_NRE; // Symbol size in resource elements
|
|
|
|
|
|
|
|
|
|
|
|
// Get symbols indexes
|
|
|
|
// Get symbols indexes
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS] = {};
|
|
|
|
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS] = {};
|
|
|
|
int nof_symbols = srslte_dmrs_pdsch_get_symbols_idx(pdsch_cfg, symbols);
|
|
|
|
int nof_symbols = srslte_dmrs_pdsch_get_symbols_idx(pdsch_cfg, grant, symbols);
|
|
|
|
if (nof_symbols < SRSLTE_SUCCESS) {
|
|
|
|
if (nof_symbols < SRSLTE_SUCCESS) {
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -646,10 +686,10 @@ int srslte_dmrs_pdsch_estimate(srslte_dmrs_pdsch_t* q,
|
|
|
|
for (uint32_t i = 0; i < nof_symbols; i++) {
|
|
|
|
for (uint32_t i = 0; i < nof_symbols; i++) {
|
|
|
|
uint32_t l = symbols[i]; // Symbol index inside the slot
|
|
|
|
uint32_t l = symbols[i]; // Symbol index inside the slot
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t cinit = srslte_dmrs_pdsch_seed(&q->carrier, pdsch_cfg, slot_cfg->idx, l);
|
|
|
|
uint32_t cinit = srslte_dmrs_pdsch_seed(&q->carrier, pdsch_cfg, grant, slot_cfg->idx, l);
|
|
|
|
|
|
|
|
|
|
|
|
nof_pilots_x_symbol = srslte_dmrs_pdsch_get_symbol(
|
|
|
|
nof_pilots_x_symbol = srslte_dmrs_pdsch_get_symbol(
|
|
|
|
q, pdsch_cfg, cinit, delta, &sf_symbols[symbol_sz * l], &q->pilot_estimates[nof_pilots_x_symbol * i]);
|
|
|
|
q, pdsch_cfg, grant, cinit, delta, &sf_symbols[symbol_sz * l], &q->pilot_estimates[nof_pilots_x_symbol * i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Perform measurements here
|
|
|
|
// Perform measurements here
|
|
|
@ -666,8 +706,8 @@ int srslte_dmrs_pdsch_estimate(srslte_dmrs_pdsch_t* q,
|
|
|
|
|
|
|
|
|
|
|
|
// Frequency domain interpolate
|
|
|
|
// Frequency domain interpolate
|
|
|
|
uint32_t nof_re_x_symbol =
|
|
|
|
uint32_t nof_re_x_symbol =
|
|
|
|
(pdsch_cfg->dmrs_cfg.type == srslte_dmrs_pdsch_type_1) ? nof_pilots_x_symbol * 2 : nof_pilots_x_symbol * 3;
|
|
|
|
(dmrs_cfg->type == srslte_dmrs_pdsch_type_1) ? nof_pilots_x_symbol * 2 : nof_pilots_x_symbol * 3;
|
|
|
|
if (pdsch_cfg->dmrs_cfg.type == srslte_dmrs_pdsch_type_1) {
|
|
|
|
if (dmrs_cfg->type == srslte_dmrs_pdsch_type_1) {
|
|
|
|
// Prepare interpolator
|
|
|
|
// Prepare interpolator
|
|
|
|
srslte_interp_linear_resize(&q->interpolator_type1, nof_pilots_x_symbol, 2);
|
|
|
|
srslte_interp_linear_resize(&q->interpolator_type1, nof_pilots_x_symbol, 2);
|
|
|
|
|
|
|
|
|
|
|
@ -683,12 +723,12 @@ int srslte_dmrs_pdsch_estimate(srslte_dmrs_pdsch_t* q,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Time domain hold
|
|
|
|
// Time domain hold
|
|
|
|
for (uint32_t i = 1; i < pdsch_cfg->grant.L; i++) {
|
|
|
|
for (uint32_t i = 1; i < grant->L; i++) {
|
|
|
|
srslte_vec_cf_copy(&ce[i * nof_re_x_symbol], ce, nof_re_x_symbol);
|
|
|
|
srslte_vec_cf_copy(&ce[i * nof_re_x_symbol], ce, nof_re_x_symbol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Set other values in the estimation result
|
|
|
|
// Set other values in the estimation result
|
|
|
|
chest_res->nof_re = nof_re_x_symbol * pdsch_cfg->grant.L;
|
|
|
|
chest_res->nof_re = nof_re_x_symbol * grant->L;
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|