From 8c59606d6f390bc998f86d203bffa4e7225b9f09 Mon Sep 17 00:00:00 2001 From: faluco Date: Mon, 25 May 2020 18:40:20 +0200 Subject: [PATCH] Add comment header to srslte_sfidx_tdd_type. Remove else after return. --- lib/include/srslte/phy/common/phy_common.h | 8 ++++++++ lib/src/phy/common/phy_common.c | 20 +++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/include/srslte/phy/common/phy_common.h b/lib/include/srslte/phy/common/phy_common.h index 5a4e5dbdd..53fcc80ab 100644 --- a/lib/include/srslte/phy/common/phy_common.h +++ b/lib/include/srslte/phy/common/phy_common.h @@ -369,6 +369,14 @@ SRSLTE_API bool srslte_cellid_isvalid(uint32_t cell_id); SRSLTE_API bool srslte_nofprb_isvalid(uint32_t nof_prb); +/** + * Returns the subframe type for a given subframe number and a TDD configuration. + * Check TS 36.211 v8.9.0 Table 4.2-2. + * + * @param tdd_config TDD configuration. + * @param sf_idx Subframe number, must be in range [0,9]. + * @return Returns the subframe type. + */ SRSLTE_API srslte_tdd_sf_t srslte_sfidx_tdd_type(srslte_tdd_config_t tdd_config, uint32_t sf_idx); SRSLTE_API uint32_t srslte_tdd_nof_harq(srslte_tdd_config_t tdd_config); diff --git a/lib/src/phy/common/phy_common.c b/lib/src/phy/common/phy_common.c index 752f70b18..bc7e2430e 100644 --- a/lib/src/phy/common/phy_common.c +++ b/lib/src/phy/common/phy_common.c @@ -93,13 +93,15 @@ void srslte_cell_fprint(FILE* stream, srslte_cell_t* cell, uint32_t sfn) #define U SRSLTE_TDD_SF_U #define S SRSLTE_TDD_SF_S -static srslte_tdd_sf_t tdd_sf[7][10] = {{D, S, U, U, U, D, S, U, U, U}, - {D, S, U, U, D, D, S, U, U, D}, - {D, S, U, D, D, D, S, U, D, D}, - {D, S, U, U, U, D, D, D, D, D}, - {D, S, U, U, D, D, D, D, D, D}, - {D, S, U, D, D, D, D, D, D, D}, - {D, S, U, U, U, D, S, U, U, D}}; +// TDD uplink-downlink configurations. +// TS 36.211 v8.9.0 Table 4.2-2. +static const srslte_tdd_sf_t tdd_sf[7][10] = {{D, S, U, U, U, D, S, U, U, U}, + {D, S, U, U, D, D, S, U, U, D}, + {D, S, U, D, D, D, S, U, D, D}, + {D, S, U, U, U, D, D, D, D, D}, + {D, S, U, U, D, D, D, D, D, D}, + {D, S, U, D, D, D, D, D, D, D}, + {D, S, U, U, U, D, S, U, U, D}}; #undef D #undef U @@ -109,9 +111,9 @@ srslte_tdd_sf_t srslte_sfidx_tdd_type(srslte_tdd_config_t tdd_config, uint32_t s { if (tdd_config.sf_config < 7 && sf_idx < 10 && tdd_config.configured) { return tdd_sf[tdd_config.sf_config][sf_idx]; - } else { - return SRSLTE_TDD_SF_D; } + + return SRSLTE_TDD_SF_D; } uint32_t srslte_sfidx_tdd_nof_dw_slot(srslte_tdd_config_t tdd_config, uint32_t slot, srslte_cp_t cp)