Added CORESET start_rb helper function

master
Xavier Arteaga 3 years ago committed by Xavier Arteaga
parent 89ef3b64b4
commit 36207db615

@ -518,6 +518,18 @@ SRSRAN_API uint32_t srsran_coreset_get_bw(const srsran_coreset_t* coreset);
*/ */
SRSRAN_API uint32_t srsran_coreset_get_sz(const srsran_coreset_t* coreset); SRSRAN_API uint32_t srsran_coreset_get_sz(const srsran_coreset_t* coreset);
/**
* @brief Calculates the starting resource block index in the resource grid
*
* @remark Intended to be used for common search space as specifies the lat clause in TS 38.214 section 5.1.2.2 Resource
* allocation in frequency domain
*
* @param coreset provides the given CORESET configuration
* @return The index of the lowest resource block in the resource grid used by the given CORESET if the CORESET
* configuration is valid; Otherwise, 0.
*/
SRSRAN_API uint32_t srsran_coreset_start_rb(const srsran_coreset_t* coreset);
/** /**
* @brief Get the NR PDSCH mapping type in string * @brief Get the NR PDSCH mapping type in string
* @param mapping_type Mapping type * @param mapping_type Mapping type

@ -115,6 +115,26 @@ uint32_t srsran_coreset_get_sz(const srsran_coreset_t* coreset)
return srsran_coreset_get_bw(coreset) * SRSRAN_NRE * coreset->duration; return srsran_coreset_get_bw(coreset) * SRSRAN_NRE * coreset->duration;
} }
uint32_t srsran_coreset_start_rb(const srsran_coreset_t* coreset)
{
// Protect CORESET access
if (coreset == NULL) {
return 0;
}
// Iterates all the possible frequency resources trying to find the first enabled
for (uint32_t res = 0; res < SRSRAN_CORESET_FREQ_DOMAIN_RES_SIZE; res++) {
// If the frequency resource is enabled...
if (coreset->freq_resources[res]) {
// ... return the lowest resource block index
return 6 * res + coreset->offset_rb;
}
}
// Returns the start resource index
return 0;
}
const char* srsran_sch_mapping_type_to_str(srsran_sch_mapping_type_t mapping_type) const char* srsran_sch_mapping_type_to_str(srsran_sch_mapping_type_t mapping_type)
{ {
switch (mapping_type) { switch (mapping_type) {

Loading…
Cancel
Save