Skip to content

Commit

Permalink
Started on Rel-16 SCSs
Browse files Browse the repository at this point in the history
  • Loading branch information
kuehnhammer committed Oct 5, 2023
1 parent 3f08ef5 commit 8323741
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/include/srsran/interfaces/rrc_interface_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ struct mbms_notif_cfg_t {
struct mbsfn_area_info_t {
uint8_t mbsfn_area_id = 0;
enum class region_len_t { s1, s2, nulltype } non_mbsfn_region_len;
enum class subcarrier_spacing_t { khz_7dot5, khz_2dot5, khz_1dot25, khz_0dot25, nulltype } subcarrier_spacing;
enum class subcarrier_spacing_t { khz_7dot5, khz_2dot5, khz_1dot25, khz_0dot37, khz_15, nulltype } subcarrier_spacing;
uint8_t pmch_bandwidth = 0;
uint8_t notif_ind = 0;
struct mcch_cfg_t {
Expand Down
28 changes: 18 additions & 10 deletions lib/include/srsran/phy/common/phy_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ extern "C" {

typedef enum { SRSRAN_CP_NORM = 0, SRSRAN_CP_EXT } srsran_cp_t;
typedef enum { SRSRAN_SF_NORM = 0, SRSRAN_SF_MBSFN } srsran_sf_t;
//typedef enum { SRSRAN_SCS_15KHZ = 0, SRSRAN_SCS_7KHZ5, SRSRAN_SCS_2KHZ5, SRSRAN_SCS_1KHZ25, SRSRAN_SCS_0KHZ37 } srsran_scs_t;
typedef enum { SRSRAN_SCS_15KHZ = 0, SRSRAN_SCS_7KHZ5, SRSRAN_SCS_1KHZ25 } srsran_scs_t;
typedef enum { SRSRAN_SCS_15KHZ = 0, SRSRAN_SCS_7KHZ5, SRSRAN_SCS_2KHZ5, SRSRAN_SCS_1KHZ25, SRSRAN_SCS_0KHZ37 } srsran_scs_t;

#define SRSRAN_INVALID_RNTI 0x0 // TS 36.321 - Table 7.1-1 RNTI 0x0 isn't a valid DL RNTI
#define SRSRAN_CRNTI_START 0x000B
Expand All @@ -109,8 +108,12 @@ typedef enum { SRSRAN_SCS_15KHZ = 0, SRSRAN_SCS_7KHZ5, SRSRAN_SCS_1KHZ25 } srsra
#define SRSRAN_MAX_PRB 110
#define SRSRAN_NRE 12
#define SRSRAN_NRE_SCS_7KHZ5 24
#define SRSRAN_NRE_SCS_2KHZ5 72
#define SRSRAN_NRE_SCS_1KHZ25 144
#define SRSRAN_NRE_SCS(scs) (scs == SRSRAN_SCS_15KHZ ? SRSRAN_NRE : (scs == SRSRAN_SCS_7KHZ5 ? SRSRAN_NRE_SCS_7KHZ5 : SRSRAN_NRE_SCS_1KHZ25))
#define SRSRAN_NRE_SCS_0KHZ37 486
#define SRSRAN_NRE_SCS(scs) (scs == SRSRAN_SCS_15KHZ ? SRSRAN_NRE : (scs == SRSRAN_SCS_7KHZ5 ? SRSRAN_NRE_SCS_7KHZ5 : \
(scs == SRSRAN_SCS_2KHZ5 ? SRSRAN_NRE_SCS_2KHZ5 : \
(scs == SRSRAN_SCS_1KHZ25 ? SRSRAN_NRE_SCS_1KHZ25 : SRSRAN_NRE_SCS_0KHZ37))))


#define SRSRAN_SYMBOL_SZ_MAX 2048
Expand All @@ -127,10 +130,15 @@ typedef enum { SRSRAN_SCS_15KHZ = 0, SRSRAN_SCS_7KHZ5, SRSRAN_SCS_1KHZ25 } srsra

#define SRSRAN_CP_SCS_7KHZ5_NSYMB 3
#define SRSRAN_CP_SCS_1KHZ25_NSYMB 1
#define SRSRAN_CP_SCS_2KHZ5_NSYMB 1
#define SRSRAN_CP_SCS_0KHZ37_NSYMB 1
#define SRSRAN_CP_MBSFN_LEN(scs) (scs == SRSRAN_SCS_1KHZ25 ? 6144 : (scs == SRSRAN_SCS_7KHZ5 ? 1024 : SRSRAN_CP_EXT_LEN))

#define SRSRAN_MBSFN_NOF_SLOTS(scs) (scs == SRSRAN_SCS_1KHZ25 ? 1 : 2)
#define SRSRAN_MBSFN_NOF_SYMBOLS(scs) (scs == SRSRAN_SCS_1KHZ25 ? SRSRAN_CP_SCS_1KHZ25_NSYMB : (scs == SRSRAN_SCS_7KHZ5 ? SRSRAN_CP_SCS_7KHZ5_NSYMB : SRSRAN_CP_EXT_NSYMB ))
#define SRSRAN_MBSFN_NOF_SLOTS(scs) ((scs == SRSRAN_SCS_1KHZ25 || scs == SRSRAN_SCS_0KHZ37) ? 1 : 2)
#define SRSRAN_MBSFN_NOF_SYMBOLS(scs) (scs == SRSRAN_SCS_1KHZ25 ? SRSRAN_CP_SCS_1KHZ25_NSYMB : \
(scs == SRSRAN_SCS_7KHZ5 ? SRSRAN_CP_SCS_7KHZ5_NSYMB : \
(scs == SRSRAN_SCS_2KHZ5 ? SRSRAN_CP_SCS_2KHZ5_NSYMB : \
(scs == SRSRAN_SCS_0KHZ37 ? SRSRAN_CP_SCS_0KHZ37_NSYMB : SRSRAN_CP_EXT_NSYMB ))))


#define SRSRAN_CP_ISNORM(cp) (cp == SRSRAN_CP_NORM)
Expand Down Expand Up @@ -181,15 +189,15 @@ typedef enum { SRSRAN_SCS_15KHZ = 0, SRSRAN_SCS_7KHZ5, SRSRAN_SCS_1KHZ25 } srsra

#define SRSRAN_SYMBOL_HAS_REF_MBSFN(l, s) ((l == 2 && s == 0) || (l == 0 && s == 1) || (l == 4 && s == 1))
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_7KHZ5(l, s) ((l == 1 && s == 0) || (l == 0 && s == 1) || (l == 2 && s == 1))
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_2KHZ5(l, s) (true)
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_1KHZ25(l, s) (true)
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_0KHZ37(l, s) (true)
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_SCS(l, s, scs) (scs == SRSRAN_SCS_15KHZ ? SRSRAN_SYMBOL_HAS_REF_MBSFN(l, s) : \
(scs == SRSRAN_SCS_7KHZ5 ? SRSRAN_SYMBOL_HAS_REF_MBSFN_7KHZ5(l, s) : SRSRAN_SYMBOL_HAS_REF_MBSFN_1KHZ25(l, s)))
(scs == SRSRAN_SCS_7KHZ5 ? SRSRAN_SYMBOL_HAS_REF_MBSFN_7KHZ5(l, s) : \
(scs == SRSRAN_SCS_2KHZ5 ? SRSRAN_SYMBOL_HAS_REF_MBSFN_2KHZ5(l, s) : \
(scs == SRSRAN_SCS_1KHZ25 ? SRSRAN_SYMBOL_HAS_REF_MBSFN_1KHZ25(l, s) : SRSRAN_SYMBOL_HAS_REF_MBSFN_0KHZ37(l, s)))))

#define SRSRAN_SYMBOL_REF_OFFSET_MBSFN(l, s) ((l == 2 && s == 0) || (l == 0 && s == 1) || (l == 4 && s == 1))
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_7KHZ5(l, s) ((l == 1 && s == 0) || (l == 0 && s == 1) || (l == 2 && s == 1))
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_1KHZ25(l, s) (true)
#define SRSRAN_SYMBOL_HAS_REF_MBSFN_SCS(l, s, scs) (scs == SRSRAN_SCS_15KHZ ? SRSRAN_SYMBOL_HAS_REF_MBSFN(l, s) : \
(scs == SRSRAN_SCS_7KHZ5 ? SRSRAN_SYMBOL_HAS_REF_MBSFN_7KHZ5(l, s) : SRSRAN_SYMBOL_HAS_REF_MBSFN_1KHZ25(l, s)))

#define SRSRAN_NON_MBSFN_REGION_GUARD_LENGTH(non_mbsfn_region, symbol_sz) \
((non_mbsfn_region == 1) \
Expand Down
32 changes: 30 additions & 2 deletions lib/src/phy/ch_estimation/refsignal_dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,26 @@ SRSRAN_API int srsran_refsignal_mbsfn_put_sf(srsran_cell_t cell,

uint32_t srsran_refsignal_mbsfn_nof_symbols(srsran_scs_t scs)
{
return scs == SRSRAN_SCS_1KHZ25 ? 1 : 3;
switch (scs) {
case SRSRAN_SCS_15KHZ: return 3;
case SRSRAN_SCS_7KHZ5: return 3;
case SRSRAN_SCS_2KHZ5: return 2;
case SRSRAN_SCS_1KHZ25: return 1;
case SRSRAN_SCS_0KHZ37: return 1;
default: return 0;
}
}

uint32_t srsran_refsignal_mbsfn_rs_per_symbol(srsran_scs_t scs)
{
return scs == SRSRAN_SCS_1KHZ25 ? 24 : 6;
switch (scs) {
case SRSRAN_SCS_15KHZ: return 6;
case SRSRAN_SCS_7KHZ5: return 6;
case SRSRAN_SCS_2KHZ5: return 18;
case SRSRAN_SCS_1KHZ25: return 24;
case SRSRAN_SCS_0KHZ37: return 40; // [kku] add type 2
default: return 0;
}
}

uint32_t srsran_refsignal_mbsfn_rs_per_rb(srsran_scs_t scs)
Expand All @@ -367,7 +381,9 @@ uint32_t srsran_symbols_per_mbsfn_subframe(srsran_scs_t scs)
switch (scs) {
case SRSRAN_SCS_15KHZ: return 6;
case SRSRAN_SCS_7KHZ5: return 3;
case SRSRAN_SCS_2KHZ5: return 1;
case SRSRAN_SCS_1KHZ25: return 1;
case SRSRAN_SCS_0KHZ37: return 1;
default: return 0;
}
}
Expand Down Expand Up @@ -395,6 +411,8 @@ inline uint32_t srsran_refsignal_mbsfn_fidx(uint32_t l, srsran_scs_t scs)
}
break;
case SRSRAN_SCS_1KHZ25:
case SRSRAN_SCS_2KHZ5:
case SRSRAN_SCS_0KHZ37:
ret = 0;
break;
}
Expand All @@ -417,11 +435,19 @@ inline uint32_t srsran_refsignal_mbsfn_offset(uint32_t l, uint32_t s, uint32_t s
ret = 2;
}
break;
case SRSRAN_SCS_2KHZ5:
if (s == 1) {
ret = 2;
}
break;
case SRSRAN_SCS_1KHZ25:
if (sf%2 != 0) {
ret = 3;
}
break;
case SRSRAN_SCS_0KHZ37:
ret = 0; // [kku]
break;
}
return ret;
}
Expand Down Expand Up @@ -450,6 +476,8 @@ inline uint32_t srsran_refsignal_mbsfn_nsymbol(uint32_t l, srsran_scs_t scs)
}
break;
case SRSRAN_SCS_1KHZ25:
case SRSRAN_SCS_2KHZ5:
case SRSRAN_SCS_0KHZ37:
ret = 0;
break;
}
Expand Down
34 changes: 33 additions & 1 deletion lib/src/phy/common/phy_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ int srsran_symbol_sz_scs(uint32_t nof_prb, srsran_scs_t subcarrier_spacing)
if (nof_prb <= 0) {
return SRSRAN_ERROR;
}
if (subcarrier_spacing == SRSRAN_SCS_1KHZ25) {
if (subcarrier_spacing == SRSRAN_SCS_0KHZ37) {
if (nof_prb <= 6) {
return 1536;
} else if (nof_prb <= 15) {
Expand All @@ -384,6 +384,38 @@ int srsran_symbol_sz_scs(uint32_t nof_prb, srsran_scs_t subcarrier_spacing)
} else {
return SRSRAN_ERROR;
}
} else if (subcarrier_spacing == SRSRAN_SCS_1KHZ25) {
if (nof_prb <= 6) {
return 1536;
} else if (nof_prb <= 15) {
return 3072;
} else if (nof_prb <= 25) {
return 6144;
} else if (nof_prb <= 50) {
return 12288;
} else if (nof_prb <= 75) {
return 18432;
} else if (nof_prb <= 110) {
return 24567;
} else {
return SRSRAN_ERROR;
}
} else if (subcarrier_spacing == SRSRAN_SCS_2KHZ5) {
if (nof_prb <= 6) {
return 768;
} else if (nof_prb <= 15) {
return 1536;
} else if (nof_prb <= 25) {
return 3072;
} else if (nof_prb <= 50) {
return 6144;
} else if (nof_prb <= 75) {
return 9216;
} else if (nof_prb <= 110) {
return 12288;
} else {
return SRSRAN_ERROR;
}
} else if (subcarrier_spacing == SRSRAN_SCS_7KHZ5) {
if (nof_prb <= 6) {
return 256;
Expand Down
10 changes: 10 additions & 0 deletions lib/src/phy/dft/ofdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ static int ofdm_init_mbsfn_(srsran_ofdm_t* q, srsran_ofdm_cfg_t* cfg, srsran_dft
q->nof_re = cfg->nof_prb * SRSRAN_NRE_SCS_1KHZ25;
q->non_mbsfn_region = -1;
break;
case SRSRAN_SCS_2KHZ5:
q->nof_symbols_mbsfn = SRSRAN_CP_SCS_2KHZ5_NSYMB;
q->nof_re = cfg->nof_prb * SRSRAN_NRE_SCS_2KHZ5;
q->non_mbsfn_region = -1;
break;
case SRSRAN_SCS_0KHZ37:
q->nof_symbols_mbsfn = SRSRAN_CP_SCS_0KHZ37_NSYMB;
q->nof_re = cfg->nof_prb * SRSRAN_NRE_SCS_0KHZ37;
q->non_mbsfn_region = -1;
break;
}

q->nof_guards = (q->cfg.symbol_sz - q->nof_re) / 2U;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/phy/phch/ra_dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ uint32_t ra_re_x_prb(const srsran_cell_t* cell, srsran_dl_sf_cfg_t* sf, uint32_t
if (sf->subcarrier_spacing != SRSRAN_SCS_15KHZ) {
re = SRSRAN_NRE_SCS(sf->subcarrier_spacing) * SRSRAN_MBSFN_NOF_SYMBOLS(sf->subcarrier_spacing);
if (skip_refs) {
re -= srsran_refsignal_mbsfn_rs_per_symbol(sf->subcarrier_spacing) * (slot+1);
re -= srsran_refsignal_mbsfn_rs_per_symbol(sf->subcarrier_spacing) * (sf->subcarrier_spacing == SRSRAN_SCS_7KHZ5 ? slot+1 : 1);
}
return re;
}
Expand Down

0 comments on commit 8323741

Please sign in to comment.