Added NR type1 RIV function helper

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent d49734b1bc
commit 9126ad3b8b

@ -139,4 +139,13 @@ SRSRAN_API int srsran_ra_ul_set_grant_uci_nr(const srsran_carrier_nr_t* carri
const srsran_uci_cfg_nr_t* uci_cfg,
srsran_sch_cfg_nr_t* pusch_cfg);
/**
* @brief Calculates frequency allocation type 1 RIV field
* @param N_rb Number of resource blocks
* @param start_rb Start resource block index
* @param length_rb Number of resource blocks
* @return The RIV field with the encoded value
*/
SRSRAN_API uint32_t srsran_ra_nr_type1_riv(uint32_t N_rb, uint32_t start_rb, uint32_t length_rb);
#endif // SRSRAN_RA_NR_H

@ -319,3 +319,8 @@ int srsran_ra_dl_nr_freq(const srsran_carrier_nr_t* carrier,
ERROR("Unhandled case");
return SRSRAN_ERROR;
}
uint32_t srsran_ra_nr_type1_riv(uint32_t N_prb, uint32_t start_rb, uint32_t length_rb)
{
return ra_helper_from_s_and_l(N_prb, start_rb, length_rb);
}

@ -73,6 +73,14 @@ static inline void ra_helper_compute_s_and_l(uint32_t N, uint32_t v, uint32_t* S
}
}
static inline uint32_t ra_helper_from_s_and_l(uint32_t N, uint32_t S, uint32_t L)
{
if ((L - 1) <= N / 2) {
return N * (L - 1) + S;
}
return N * (N - L + 1) + (N - 1 - S);
}
static int ra_helper_freq_type1(uint32_t N_bwp_size, uint32_t riv, srsran_sch_grant_nr_t* grant)
{
uint32_t start = 0;

Loading…
Cancel
Save