Commit dd24ddd6 authored by francescomani's avatar francescomani

remove NUMBER_OF_NR_PUCCH_MAX

parent 5d58645a
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
# define NUMBER_OF_NR_SCH_STATS_MAX 16 # define NUMBER_OF_NR_SCH_STATS_MAX 16
# define NUMBER_OF_NR_PUCCH_MAX 16
# define NUMBER_OF_NR_PDCCH_MAX 16 # define NUMBER_OF_NR_PDCCH_MAX 16
#define MAX_MANAGED_ENB_PER_MOBILE 2 #define MAX_MANAGED_ENB_PER_MOBILE 2
......
...@@ -198,7 +198,8 @@ void rx_func(void *param) { ...@@ -198,7 +198,8 @@ void rx_func(void *param) {
} }
up_removed++; up_removed++;
} }
for (j = 0; j < NUMBER_OF_NR_PUCCH_MAX; j++)
for (j = 0; j < gNB->max_nb_pucch; j++)
if (gNB->pucch[j]->active > 0 && if (gNB->pucch[j]->active > 0 &&
gNB->pucch[j]->pucch_pdu.rnti == rnti_to_remove[i]) { gNB->pucch[j]->pucch_pdu.rnti == rnti_to_remove[i]) {
gNB->pucch[j]->active = 0; gNB->pucch[j]->active = 0;
......
...@@ -134,7 +134,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { ...@@ -134,7 +134,7 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) {
int max_mimo_layers = (CSI_RS_antenna_ports<NR_MAX_NB_LAYERS) ? CSI_RS_antenna_ports : NR_MAX_NB_LAYERS; int max_mimo_layers = (CSI_RS_antenna_ports<NR_MAX_NB_LAYERS) ? CSI_RS_antenna_ports : NR_MAX_NB_LAYERS;
gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(max_mimo_layers* sizeof(int32_t **)); gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(max_mimo_layers * sizeof(int32_t **));
int32_t ***mat = gNB->nr_mimo_precoding_matrix; int32_t ***mat = gNB->nr_mimo_precoding_matrix;
double complex res_code; double complex res_code;
...@@ -1002,14 +1002,43 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) ...@@ -1002,14 +1002,43 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg)
free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp); free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp);
} }
void init_nr_transport(PHY_VARS_gNB *gNB) { void init_nr_transport(PHY_VARS_gNB *gNB)
{
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
LOG_I(PHY, "Initialise nr transport\n"); LOG_I(PHY, "Initialise nr transport\n");
for (int i=0; i<NUMBER_OF_NR_PUCCH_MAX; i++) { int nb_slots_per_period = cfg->cell_config.frame_duplex_type.value ?
LOG_I(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n",i,NUMBER_OF_NR_PUCCH_MAX); fp->slots_per_frame / get_nb_periods_per_frame(cfg->tdd_table.tdd_period.value) :
fp->slots_per_frame;
int nb_ul_slots_period = 0;
if (cfg->cell_config.frame_duplex_type.value) {
for(int i=0; i<nb_slots_per_period; i++) {
for(int j=0; j<NR_NUMBER_OF_SYMBOLS_PER_SLOT; j++) {
if(cfg->tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list[j].slot_config.value == 1) { // UL symbol
nb_ul_slots_period++;
break;
}
}
}
}
else
nb_ul_slots_period = fp->slots_per_frame;
int pucch_slots;
if (gNB->if_inst->sl_ahead > nb_slots_per_period)
pucch_slots = nb_ul_slots_period + (gNB->if_inst->sl_ahead - nb_slots_per_period);
else
pucch_slots = (nb_ul_slots_period < gNB->if_inst->sl_ahead) ? nb_ul_slots_period : gNB->if_inst->sl_ahead;
gNB->max_nb_pucch = MAX_MOBILES_PER_GNB * pucch_slots;
gNB->pucch = (NR_gNB_PUCCH_t **) malloc16(gNB->max_nb_pucch * sizeof(NR_gNB_PUCCH_t*));
for (int i = 0; i < gNB->max_nb_pucch; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n", i, gNB->max_nb_pucch);
gNB->pucch[i] = new_gNB_pucch(); gNB->pucch[i] = new_gNB_pucch();
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i); AssertFatal(gNB->pucch[i] != NULL,"Can't initialize pucch %d \n", i);
} }
for (int i=0; i<NUMBER_OF_NR_SRS_MAX; i++) { for (int i=0; i<NUMBER_OF_NR_SRS_MAX; i++) {
...@@ -1039,7 +1068,7 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1039,7 +1068,7 @@ void reset_nr_transport(PHY_VARS_gNB *gNB)
{ {
const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
for (int i = 0; i < NUMBER_OF_NR_PUCCH_MAX; i++) for (int i = 0; i < gNB->max_nb_pucch; i++)
free_gNB_pucch(gNB->pucch[i]); free_gNB_pucch(gNB->pucch[i]);
for (int i = 0; i < NUMBER_OF_NR_SRS_MAX; i++) for (int i = 0; i < NUMBER_OF_NR_SRS_MAX; i++)
......
...@@ -70,20 +70,21 @@ void free_gNB_pucch(NR_gNB_PUCCH_t *pucch) ...@@ -70,20 +70,21 @@ void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
int nr_find_pucch(uint16_t rnti, int nr_find_pucch(uint16_t rnti,
int frame, int frame,
int slot, int slot,
PHY_VARS_gNB *gNB) { PHY_VARS_gNB *gNB)
{
AssertFatal(gNB!=NULL,"gNB is null\n"); AssertFatal(gNB!=NULL,"gNB is null\n");
int index = -1; int index = -1;
for (int i = 0; i < NUMBER_OF_NR_PUCCH_MAX; i++) { for (int i = 0; i < gNB->max_nb_pucch; i++) {
AssertFatal(gNB->pucch[i] != NULL,"gNB->pucch[%d] is null\n",i); AssertFatal(gNB->pucch[i] != NULL,"gNB->pucch[%d] is null\n",i);
if ((gNB->pucch[i]->active > 0) && if ((gNB->pucch[i]->active > 0) &&
(gNB->pucch[i]->pucch_pdu.rnti == rnti) && (gNB->pucch[i]->pucch_pdu.rnti == rnti) &&
(gNB->pucch[i]->frame == frame) && (gNB->pucch[i]->frame == frame) &&
(gNB->pucch[i]->slot == slot)) (gNB->pucch[i]->slot == slot))
return(i); return i;
else if ((gNB->pucch[i]->active == 0) && (index == -1)) else if ((gNB->pucch[i]->active == 0) && (index == -1))
index=i; index = i;
} }
if (index==-1) if (index==-1)
...@@ -95,11 +96,13 @@ int nr_find_pucch(uint16_t rnti, ...@@ -95,11 +96,13 @@ int nr_find_pucch(uint16_t rnti,
void nr_fill_pucch(PHY_VARS_gNB *gNB, void nr_fill_pucch(PHY_VARS_gNB *gNB,
int frame, int frame,
int slot, int slot,
nfapi_nr_pucch_pdu_t *pucch_pdu) { nfapi_nr_pucch_pdu_t *pucch_pdu)
{
if (NFAPI_MODE == NFAPI_MODE_PNF) if (NFAPI_MODE == NFAPI_MODE_PNF)
gNB->pucch[0]->active = 0; //check if ture in monolithic mode gNB->pucch[0]->active = 0; //check if ture in monolithic mode
int id = nr_find_pucch(pucch_pdu->rnti,frame,slot,gNB); int id = nr_find_pucch(pucch_pdu->rnti,frame,slot,gNB);
AssertFatal((id >= 0) && (id < NUMBER_OF_NR_PUCCH_MAX), AssertFatal((id >= 0) && (id < gNB->max_nb_pucch),
"invalid id found for pucch !!! rnti %04x id %d\n",pucch_pdu->rnti,id); "invalid id found for pucch !!! rnti %04x id %d\n",pucch_pdu->rnti,id);
NR_gNB_PUCCH_t *pucch = gNB->pucch[id]; NR_gNB_PUCCH_t *pucch = gNB->pucch[id];
......
...@@ -617,12 +617,13 @@ typedef struct PHY_VARS_gNB_s { ...@@ -617,12 +617,13 @@ typedef struct PHY_VARS_gNB_s {
nfapi_nr_ul_tti_request_t UL_tti_req; nfapi_nr_ul_tti_request_t UL_tti_req;
nfapi_nr_uci_indication_t uci_indication; nfapi_nr_uci_indication_t uci_indication;
int max_nb_pucch;
NR_gNB_PBCH pbch; NR_gNB_PBCH pbch;
NR_gNB_COMMON common_vars; NR_gNB_COMMON common_vars;
NR_gNB_PRACH prach_vars; NR_gNB_PRACH prach_vars;
NR_gNB_PRS prs_vars; NR_gNB_PRS prs_vars;
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX];
NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX]; NR_gNB_PUCCH_t **pucch;
NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX]; NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX];
NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "SCHED_NR/phy_frame_config_nr.h" #include "SCHED_NR/phy_frame_config_nr.h"
#include "common/utils/nr/nr_common.h"
/******************************************************************* /*******************************************************************
* *
...@@ -53,48 +54,13 @@ ...@@ -53,48 +54,13 @@
int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg,
int mu, int mu,
int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofDownlinkSlots, int nrofDownlinkSymbols,
int nrofUplinkSlots, int nrofUplinkSymbols) { int nrofUplinkSlots, int nrofUplinkSymbols)
{
int slot_number = 0; int slot_number = 0;
int nb_periods_per_frame; int nb_periods_per_frame = get_nb_periods_per_frame(cfg->tdd_table.tdd_period.value);
int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
switch(cfg->tdd_table.tdd_period.value) {
case 0:
nb_periods_per_frame = 20; // 10ms/0p5ms
break;
case 1:
nb_periods_per_frame = 16; // 10ms/0p625ms
break;
case 2:
nb_periods_per_frame = 10; // 10ms/1ms
break;
case 3:
nb_periods_per_frame = 8; // 10ms/1p25ms
break;
case 4:
nb_periods_per_frame = 5; // 10ms/2ms
break;
case 5:
nb_periods_per_frame = 4; // 10ms/2p5ms
break;
case 6:
nb_periods_per_frame = 2; // 10ms/5ms
break;
case 7:
nb_periods_per_frame = 1; // 10ms/10ms
break;
default:
AssertFatal(1==0,"Undefined tdd period %d\n", cfg->tdd_table.tdd_period.value);
}
int nb_slots_per_period = ((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame; int nb_slots_per_period = ((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame;
if ( (nrofDownlinkSymbols + nrofUplinkSymbols) == 0 ) if ( (nrofDownlinkSymbols + nrofUplinkSymbols) == 0 )
......
...@@ -529,7 +529,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -529,7 +529,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
} }
} }
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){ for (int i = 0; i < gNB->max_nb_pucch; i++){
NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
if (pucch) { if (pucch) {
if ((pucch->active == 1) && if ((pucch->active == 1) &&
...@@ -713,7 +713,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -713,7 +713,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
start_meas(&gNB->phy_proc_rx); start_meas(&gNB->phy_proc_rx);
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){ for (int i = 0; i < gNB->max_nb_pucch; i++){
NR_gNB_PUCCH_t *pucch = gNB->pucch[i]; NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
if (pucch) { if (pucch) {
if (NFAPI_MODE == NFAPI_MODE_PNF) if (NFAPI_MODE == NFAPI_MODE_PNF)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment