Renamed constants to SRSLTE and use SRSLTE_CFI macros

master
Ismael Gomez 4 years ago committed by Xavier Arteaga
parent 38e2ffe414
commit e2154d2213

@ -64,6 +64,10 @@ extern "C" {
#define SRSLTE_MAX_CODEBOOKS 4 #define SRSLTE_MAX_CODEBOOKS 4
#define SRSLTE_NOF_CFI 3
#define SRSLTE_CFI_ISVALID(x) ((x >= 1 && x <= 3))
#define SRSLTE_CFI_IDX(x) ((x - 1) % SRSLTE_NOF_CFI)
#define SRSLTE_LTE_CRC24A 0x1864CFB #define SRSLTE_LTE_CRC24A 0x1864CFB
#define SRSLTE_LTE_CRC24B 0X1800063 #define SRSLTE_LTE_CRC24B 0X1800063
#define SRSLTE_LTE_CRC16 0x11021 #define SRSLTE_LTE_CRC16 0x11021

@ -85,7 +85,7 @@ typedef struct SRSLTE_API {
float sss_signal5[SRSLTE_SSS_LEN]; float sss_signal5[SRSLTE_SSS_LEN];
uint32_t nof_common_locations[3]; uint32_t nof_common_locations[3];
srslte_dci_location_t common_locations[3][MAX_CANDIDATES_COM]; srslte_dci_location_t common_locations[3][SRSLTE_MAX_CANDIDATES_COM];
} srslte_enb_dl_t; } srslte_enb_dl_t;

@ -56,20 +56,20 @@
#include "srslte/config.h" #include "srslte/config.h"
#define MAX_CANDIDATES_UE 16 // From 36.213 Table 9.1.1-1 #define SRSLTE_MAX_CANDIDATES_UE 16 // From 36.213 Table 9.1.1-1
#define MAX_CANDIDATES_COM 6 // From 36.213 Table 9.1.1-1 #define SRSLTE_MAX_CANDIDATES_COM 6 // From 36.213 Table 9.1.1-1
#define MAX_CANDIDATES (MAX_CANDIDATES_UE + MAX_CANDIDATES_COM) #define SRSLTE_MAX_CANDIDATES (SRSLTE_MAX_CANDIDATES_UE + SRSLTE_MAX_CANDIDATES_COM)
#define MAX_FORMATS 4 #define SRSLTE_MAX_FORMATS 4
#define MI_NOF_REGS ((q->cell.frame_type == SRSLTE_FDD) ? 1 : 6) #define SRSLTE_MI_NOF_REGS ((q->cell.frame_type == SRSLTE_FDD) ? 1 : 6)
#define MI_MAX_REGS 6 #define SRSLTE_MI_MAX_REGS 6
#define SRSLTE_MAX_DCI_MSG SRSLTE_MAX_CARRIERS #define SRSLTE_MAX_DCI_MSG SRSLTE_MAX_CARRIERS
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_dci_format_t formats[MAX_FORMATS]; srslte_dci_format_t formats[SRSLTE_MAX_FORMATS];
srslte_dci_location_t loc[MAX_CANDIDATES]; srslte_dci_location_t loc[SRSLTE_MAX_CANDIDATES];
uint32_t nof_locations; uint32_t nof_locations;
uint32_t nof_formats; uint32_t nof_formats;
} dci_blind_search_t; } dci_blind_search_t;
@ -89,7 +89,7 @@ typedef struct SRSLTE_API {
srslte_phich_t phich; srslte_phich_t phich;
// Control region // Control region
srslte_regs_t regs[MI_MAX_REGS]; srslte_regs_t regs[SRSLTE_MI_MAX_REGS];
uint32_t mi_manual_index; uint32_t mi_manual_index;
bool mi_auto; bool mi_auto;
@ -103,8 +103,8 @@ typedef struct SRSLTE_API {
cf_t* sf_symbols[SRSLTE_MAX_PORTS]; cf_t* sf_symbols[SRSLTE_MAX_PORTS];
// Variables for blind DCI search // Variables for blind DCI search
dci_blind_search_t current_ss_ue[MI_MAX_REGS][3][10]; dci_blind_search_t current_ss_ue[SRSLTE_MI_MAX_REGS][SRSLTE_NOF_CFI][SRSLTE_NOF_SF_X_FRAME];
dci_blind_search_t current_ss_common[MI_MAX_REGS][3]; dci_blind_search_t current_ss_common[SRSLTE_MI_MAX_REGS][SRSLTE_NOF_CFI];
srslte_dci_msg_t pending_ul_dci_msg[SRSLTE_MAX_DCI_MSG]; srslte_dci_msg_t pending_ul_dci_msg[SRSLTE_MAX_DCI_MSG];
uint32_t pending_ul_dci_count; uint32_t pending_ul_dci_count;

@ -220,8 +220,8 @@ int srslte_enb_dl_set_cell(srslte_enb_dl_t* q, srslte_cell_t cell)
// Calculate common DCI locations // Calculate common DCI locations
for (int32_t cfi = 1; cfi <= 3; cfi++) { for (int32_t cfi = 1; cfi <= 3; cfi++) {
q->nof_common_locations[cfi - 1] = q->nof_common_locations[SRSLTE_CFI_IDX(cfi)] = srslte_pdcch_common_locations(
srslte_pdcch_common_locations(&q->pdcch, q->common_locations[cfi - 1], MAX_CANDIDATES_COM, cfi); &q->pdcch, q->common_locations[SRSLTE_CFI_IDX(cfi)], SRSLTE_MAX_CANDIDATES_COM, cfi);
} }
} }
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
@ -371,8 +371,12 @@ void srslte_enb_dl_put_phich(srslte_enb_dl_t* q, srslte_phich_grant_t* grant, bo
bool srslte_enb_dl_location_is_common_ncce(srslte_enb_dl_t* q, uint32_t ncce) bool srslte_enb_dl_location_is_common_ncce(srslte_enb_dl_t* q, uint32_t ncce)
{ {
if (SRSLTE_CFI_ISVALID(q->dl_sf.cfi)) {
return srslte_location_find_ncce( return srslte_location_find_ncce(
q->common_locations[q->dl_sf.cfi - 1], q->nof_common_locations[q->dl_sf.cfi - 1], ncce); q->common_locations[SRSLTE_CFI_IDX(q->dl_sf.cfi)], q->nof_common_locations[SRSLTE_CFI_IDX(q->dl_sf.cfi)], ncce);
} else {
return false;
}
} }
int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t* q, srslte_dci_cfg_t* dci_cfg, srslte_dci_dl_t* dci_dl) int srslte_enb_dl_put_pdcch_dl(srslte_enb_dl_t* q, srslte_dci_cfg_t* dci_cfg, srslte_dci_dl_t* dci_dl)

@ -199,7 +199,7 @@ int main(int argc, char** argv)
int i; int i;
int frame_cnt; int frame_cnt;
int ret; int ret;
srslte_dci_location_t locations[MAX_CANDIDATES]; srslte_dci_location_t locations[SRSLTE_MAX_CANDIDATES];
uint32_t nof_locations; uint32_t nof_locations;
srslte_dci_msg_t dci_msg; srslte_dci_msg_t dci_msg;
@ -238,10 +238,10 @@ int main(int argc, char** argv)
} }
if (rnti == SRSLTE_SIRNTI) { if (rnti == SRSLTE_SIRNTI) {
INFO("Initializing common search space for SI-RNTI\n"); INFO("Initializing common search space for SI-RNTI\n");
nof_locations = srslte_pdcch_common_locations(&pdcch, locations, MAX_CANDIDATES, cfi); nof_locations = srslte_pdcch_common_locations(&pdcch, locations, SRSLTE_MAX_CANDIDATES, cfi);
} else { } else {
INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti); INFO("Initializing user-specific search space for RNTI: 0x%x\n", rnti);
nof_locations = srslte_pdcch_ue_locations(&pdcch, &dl_sf, locations, MAX_CANDIDATES, rnti); nof_locations = srslte_pdcch_ue_locations(&pdcch, &dl_sf, locations, SRSLTE_MAX_CANDIDATES, rnti);
} }
srslte_dci_cfg_t dci_cfg; srslte_dci_cfg_t dci_cfg;

@ -164,7 +164,7 @@ void srslte_ue_dl_free(srslte_ue_dl_t* q)
srslte_ofdm_rx_free(&q->fft_mbsfn); srslte_ofdm_rx_free(&q->fft_mbsfn);
srslte_chest_dl_free(&q->chest); srslte_chest_dl_free(&q->chest);
srslte_chest_dl_res_free(&q->chest_res); srslte_chest_dl_res_free(&q->chest_res);
for (int i = 0; i < MI_NOF_REGS; i++) { for (int i = 0; i < SRSLTE_MI_NOF_REGS; i++) {
srslte_regs_free(&q->regs[i]); srslte_regs_free(&q->regs[i]);
} }
srslte_pcfich_free(&q->pcfich); srslte_pcfich_free(&q->pcfich);
@ -190,12 +190,12 @@ int srslte_ue_dl_set_cell(srslte_ue_dl_t* q, srslte_cell_t cell)
if (q->cell.id != cell.id || q->cell.nof_prb == 0) { if (q->cell.id != cell.id || q->cell.nof_prb == 0) {
if (q->cell.nof_prb != 0) { if (q->cell.nof_prb != 0) {
for (int i = 0; i < MI_NOF_REGS; i++) { for (int i = 0; i < SRSLTE_MI_NOF_REGS; i++) {
srslte_regs_free(&q->regs[i]); srslte_regs_free(&q->regs[i]);
} }
} }
q->cell = cell; q->cell = cell;
for (int i = 0; i < MI_NOF_REGS; i++) { for (int i = 0; i < SRSLTE_MI_NOF_REGS; i++) {
if (srslte_regs_init_opts(&q->regs[i], q->cell, mi_reg_idx[i % 3], i > 2)) { if (srslte_regs_init_opts(&q->regs[i], q->cell, mi_reg_idx[i % 3], i > 2)) {
ERROR("Error resizing REGs\n"); ERROR("Error resizing REGs\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
@ -288,17 +288,17 @@ void srslte_ue_dl_set_rnti(srslte_ue_dl_t* q, uint16_t rnti)
ZERO_OBJECT(sf_cfg); ZERO_OBJECT(sf_cfg);
// Compute UE-specific and Common search space for this RNTI // Compute UE-specific and Common search space for this RNTI
for (int i = 0; i < MI_NOF_REGS; i++) { for (int i = 0; i < SRSLTE_MI_NOF_REGS; i++) {
srslte_pdcch_set_regs(&q->pdcch, &q->regs[i]); srslte_pdcch_set_regs(&q->pdcch, &q->regs[i]);
for (int cfi = 0; cfi < 3; cfi++) { for (int cfi = 1; cfi <= SRSLTE_NOF_CFI; cfi++) {
sf_cfg.cfi = cfi + 1; sf_cfg.cfi = cfi;
for (int sf_idx = 0; sf_idx < 10; sf_idx++) { for (int sf_idx = 0; sf_idx < SRSLTE_NOF_SF_X_FRAME; sf_idx++) {
sf_cfg.tti = sf_idx; sf_cfg.tti = sf_idx;
q->current_ss_ue[i][cfi][sf_idx].nof_locations = srslte_pdcch_ue_locations( q->current_ss_ue[i][SRSLTE_CFI_IDX(cfi)][sf_idx].nof_locations = srslte_pdcch_ue_locations(
&q->pdcch, &sf_cfg, q->current_ss_ue[i][cfi][sf_idx].loc, MAX_CANDIDATES_UE, rnti); &q->pdcch, &sf_cfg, q->current_ss_ue[i][SRSLTE_CFI_IDX(cfi)][sf_idx].loc, SRSLTE_MAX_CANDIDATES_UE, rnti);
} }
q->current_ss_common[i][cfi].nof_locations = q->current_ss_common[i][SRSLTE_CFI_IDX(cfi)].nof_locations = srslte_pdcch_common_locations(
srslte_pdcch_common_locations(&q->pdcch, q->current_ss_common[i][cfi].loc, MAX_CANDIDATES_COM, cfi + 1); &q->pdcch, q->current_ss_common[i][SRSLTE_CFI_IDX(cfi)].loc, SRSLTE_MAX_CANDIDATES_COM, cfi);
} }
} }
q->pregen_rnti = rnti; q->pregen_rnti = rnti;
@ -561,27 +561,34 @@ static int find_dci_ss(srslte_ue_dl_t* q,
dci_blind_search_t search_space = {}; dci_blind_search_t search_space = {};
dci_blind_search_t* current_ss = &search_space; dci_blind_search_t* current_ss = &search_space;
uint32_t sf_idx = sf->tti % 10; uint32_t sf_idx = sf->tti % SRSLTE_NOF_SF_X_FRAME;
uint32_t cfi = sf->cfi; uint32_t cfi = sf->cfi;
srslte_dci_cfg_t dci_cfg = cfg->cfg.dci; srslte_dci_cfg_t dci_cfg = cfg->cfg.dci;
if (!SRSLTE_CFI_ISVALID(cfi)) {
ERROR("Invalid CFI=%d\n", cfi);
return SRSLTE_ERROR_INVALID_INPUTS;
}
// Generate Search Space // Generate Search Space
if (is_ue) { if (is_ue) {
if (q->pregen_rnti == rnti) { if (q->pregen_rnti == rnti) {
current_ss = &q->current_ss_ue[MI_IDX(sf_idx)][cfi - 1][sf_idx]; current_ss = &q->current_ss_ue[MI_IDX(sf_idx)][SRSLTE_CFI_IDX(cfi)][sf_idx];
} else { } else {
// If locations are not pre-generated, generate them now // If locations are not pre-generated, generate them now
current_ss->nof_locations = srslte_pdcch_ue_locations(&q->pdcch, sf, current_ss->loc, MAX_CANDIDATES_UE, rnti); current_ss->nof_locations =
srslte_pdcch_ue_locations(&q->pdcch, sf, current_ss->loc, SRSLTE_MAX_CANDIDATES_UE, rnti);
} }
} else { } else {
// Disable extended CSI request and SRS request in common SS // Disable extended CSI request and SRS request in common SS
srslte_dci_cfg_set_common_ss(&dci_cfg); srslte_dci_cfg_set_common_ss(&dci_cfg);
if (q->pregen_rnti == rnti) { if (q->pregen_rnti == rnti) {
current_ss = &q->current_ss_common[MI_IDX(sf_idx)][cfi - 1]; current_ss = &q->current_ss_common[MI_IDX(sf_idx)][SRSLTE_CFI_IDX(cfi)];
} else { } else {
// If locations are not pre-generated, generate them now // If locations are not pre-generated, generate them now
current_ss->nof_locations = srslte_pdcch_common_locations(&q->pdcch, current_ss->loc, MAX_CANDIDATES_COM, cfi); current_ss->nof_locations =
srslte_pdcch_common_locations(&q->pdcch, current_ss->loc, SRSLTE_MAX_CANDIDATES_COM, cfi);
} }
} }

@ -588,14 +588,14 @@ uint32_t srslte_nbiot_ue_dl_get_ncce(srslte_nbiot_ue_dl_t* q)
return q->last_n_cce; return q->last_n_cce;
} }
#define MAX_CANDIDATES_UE 3 // From 36.213 Table 16.6-1 NPDCCH Format0 and NPDCCH Format1 #define SRSLTE_MAX_CANDIDATES_UE 3 // From 36.213 Table 16.6-1 NPDCCH Format0 and NPDCCH Format1
#define MAX_CANDIDATES_COM \ #define SRSLTE_MAX_CANDIDATES_COM \
1 // From 36.213 Table 16.6-2 and Table 16.6-3, only AL2 is defined here which uses NPDCCH Format1 1 // From 36.213 Table 16.6-2 and Table 16.6-3, only AL2 is defined here which uses NPDCCH Format1
#define MAX_CANDIDATES (MAX_CANDIDATES_UE + MAX_CANDIDATES_COM) #define SRSLTE_MAX_CANDIDATES (SRSLTE_MAX_CANDIDATES_UE + SRSLTE_MAX_CANDIDATES_COM)
typedef struct { typedef struct {
srslte_dci_format_t format; srslte_dci_format_t format;
srslte_dci_location_t loc[MAX_CANDIDATES]; srslte_dci_location_t loc[SRSLTE_MAX_CANDIDATES];
uint32_t nof_locations; uint32_t nof_locations;
} dci_blind_search_t; } dci_blind_search_t;
@ -646,7 +646,7 @@ int srslte_nbiot_ue_dl_find_dl_dci_type_siprarnti(srslte_nbiot_ue_dl_t* q, uint1
// Configure and run DCI blind search // Configure and run DCI blind search
dci_blind_search_t search_space; dci_blind_search_t search_space;
search_space.nof_locations = srslte_npdcch_common_locations(search_space.loc, MAX_CANDIDATES_COM); search_space.nof_locations = srslte_npdcch_common_locations(search_space.loc, SRSLTE_MAX_CANDIDATES_COM);
DEBUG( DEBUG(
"Searching SI/P/RA-RNTI in %d common locations, %d formats\n", search_space.nof_locations, nb_nof_common_formats); "Searching SI/P/RA-RNTI in %d common locations, %d formats\n", search_space.nof_locations, nb_nof_common_formats);
// Search for RNTI only if there is room for the common search space // Search for RNTI only if there is room for the common search space
@ -671,7 +671,7 @@ int srslte_nbiot_ue_dl_find_dl_dci_type_crnti(srslte_nbiot_ue_dl_t* q,
// Search UE-specific search space // Search UE-specific search space
dci_blind_search_t search_space; dci_blind_search_t search_space;
search_space.nof_locations = srslte_npdcch_ue_locations(search_space.loc, MAX_CANDIDATES_UE); search_space.nof_locations = srslte_npdcch_ue_locations(search_space.loc, SRSLTE_MAX_CANDIDATES_UE);
DEBUG("x.%d: Searching DL C-RNTI=0x%x in %d locations, %d formats\n", DEBUG("x.%d: Searching DL C-RNTI=0x%x in %d locations, %d formats\n",
sf_idx, sf_idx,
rnti, rnti,
@ -999,7 +999,7 @@ int srslte_nbiot_ue_dl_find_ul_dci(srslte_nbiot_ue_dl_t* q, uint32_t tti, uint32
// Search UE-specific search space // Search UE-specific search space
dci_blind_search_t search_space; dci_blind_search_t search_space;
search_space.nof_locations = srslte_npdcch_ue_locations(search_space.loc, MAX_CANDIDATES_UE); search_space.nof_locations = srslte_npdcch_ue_locations(search_space.loc, SRSLTE_MAX_CANDIDATES_UE);
DEBUG("x.%d: Searching UL C-RNTI=0x%x in %d locations, %d formats\n", DEBUG("x.%d: Searching UL C-RNTI=0x%x in %d locations, %d formats\n",
tti % 10, tti % 10,
rnti, rnti,

@ -410,7 +410,7 @@ int main(int argc, char** argv)
* Create PDCCH Allocations * Create PDCCH Allocations
*/ */
uint32_t nof_locations[SRSLTE_NOF_SF_X_FRAME]; uint32_t nof_locations[SRSLTE_NOF_SF_X_FRAME];
srslte_dci_location_t dci_locations[SRSLTE_NOF_SF_X_FRAME][MAX_CANDIDATES_UE]; srslte_dci_location_t dci_locations[SRSLTE_NOF_SF_X_FRAME][SRSLTE_MAX_CANDIDATES_UE];
uint32_t location_counter = 0; uint32_t location_counter = 0;
for (uint32_t i = 0; i < SRSLTE_NOF_SF_X_FRAME; i++) { for (uint32_t i = 0; i < SRSLTE_NOF_SF_X_FRAME; i++) {
srslte_dl_sf_cfg_t sf_cfg_dl; srslte_dl_sf_cfg_t sf_cfg_dl;
@ -419,7 +419,8 @@ int main(int argc, char** argv)
sf_cfg_dl.cfi = cfi; sf_cfg_dl.cfi = cfi;
sf_cfg_dl.sf_type = SRSLTE_SF_NORM; sf_cfg_dl.sf_type = SRSLTE_SF_NORM;
nof_locations[i] = srslte_pdcch_ue_locations(&enb_dl->pdcch, &sf_cfg_dl, dci_locations[i], MAX_CANDIDATES_UE, rnti); nof_locations[i] =
srslte_pdcch_ue_locations(&enb_dl->pdcch, &sf_cfg_dl, dci_locations[i], SRSLTE_MAX_CANDIDATES_UE, rnti);
location_counter += nof_locations[i]; location_counter += nof_locations[i];
} }

@ -336,7 +336,7 @@ private:
std::vector<uint32_t> active_cell_list; std::vector<uint32_t> active_cell_list;
uint32_t nof_locations[SRSLTE_NOF_SF_X_FRAME] = {}; uint32_t nof_locations[SRSLTE_NOF_SF_X_FRAME] = {};
srslte_dci_location_t dci_locations[SRSLTE_NOF_SF_X_FRAME][MAX_CANDIDATES_UE] = {}; srslte_dci_location_t dci_locations[SRSLTE_NOF_SF_X_FRAME][SRSLTE_MAX_CANDIDATES_UE] = {};
uint32_t ul_riv = 0; uint32_t ul_riv = 0;
public: public:
@ -371,11 +371,11 @@ public:
sf_cfg_dl.sf_type = SRSLTE_SF_NORM; sf_cfg_dl.sf_type = SRSLTE_SF_NORM;
uint32_t _nof_locations = {}; uint32_t _nof_locations = {};
srslte_dci_location_t _dci_locations[MAX_CANDIDATES_UE] = {}; srslte_dci_location_t _dci_locations[SRSLTE_MAX_CANDIDATES_UE] = {};
_nof_locations = srslte_pdcch_ue_locations(&pdcch, &sf_cfg_dl, _dci_locations, MAX_CANDIDATES_UE, ue_rnti); _nof_locations = srslte_pdcch_ue_locations(&pdcch, &sf_cfg_dl, _dci_locations, SRSLTE_MAX_CANDIDATES_UE, ue_rnti);
// Take L == 0 aggregation levels // Take L == 0 aggregation levels
for (uint32_t j = 0; j < _nof_locations && nof_locations[i] < MAX_CANDIDATES_UE; j++) { for (uint32_t j = 0; j < _nof_locations && nof_locations[i] < SRSLTE_MAX_CANDIDATES_UE; j++) {
if (_dci_locations[j].L == 0) { if (_dci_locations[j].L == 0) {
dci_locations[i][nof_locations[i]] = _dci_locations[j]; dci_locations[i][nof_locations[i]] = _dci_locations[j];
nof_locations[i]++; nof_locations[i]++;

Loading…
Cancel
Save