From cb6a8444df0f600b187b72a67f3e26b9ca1942f8 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 7 Apr 2020 17:20:36 +0200 Subject: [PATCH] Added srsLTE helper for determining number of RI bits --- lib/include/srslte/phy/common/phy_common.h | 7 +++++++ lib/src/phy/common/phy_common.c | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/include/srslte/phy/common/phy_common.h b/lib/include/srslte/phy/common/phy_common.h index de7a122c7..856a37682 100644 --- a/lib/include/srslte/phy/common/phy_common.h +++ b/lib/include/srslte/phy/common/phy_common.h @@ -451,6 +451,13 @@ SRSLTE_API const char* srslte_ack_nack_feedback_mode_string(srslte_ack_nack_feed */ SRSLTE_API srslte_ack_nack_feedback_mode_t srslte_string_ack_nack_feedback_mode(const char* str); +/** + * Returns the number of bits for Rank Indicador reporting depending on the cell + * + * @param cell + */ +SRSLTE_API uint32_t srslte_ri_nof_bits(const srslte_cell_t* cell); + #ifdef __cplusplus } #endif diff --git a/lib/src/phy/common/phy_common.c b/lib/src/phy/common/phy_common.c index 741dc24f2..26542867c 100644 --- a/lib/src/phy/common/phy_common.c +++ b/lib/src/phy/common/phy_common.c @@ -854,4 +854,17 @@ srslte_ack_nack_feedback_mode_t srslte_string_ack_nack_feedback_mode(const char* // Otherwise Normal return SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_NORMAL; -} \ No newline at end of file +} + +uint32_t srslte_ri_nof_bits(const srslte_cell_t* cell) +{ + uint32_t ret = 0; + + if (cell->nof_ports == 2) { + ret = 1; + } else if (cell->nof_ports > 2) { + ret = 2; + } + + return ret; +}