Commit 9a45167b authored by Guy De Souza's avatar Guy De Souza

New mallocs for dlsch struct

parent e7ff8337
...@@ -194,8 +194,8 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -194,8 +194,8 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
nfapi_nr_dl_config_dlsch_pdu_rel15_t *rel15 = &harq->dlsch_pdu.dlsch_pdu_rel15; nfapi_nr_dl_config_dlsch_pdu_rel15_t *rel15 = &harq->dlsch_pdu.dlsch_pdu_rel15;
nfapi_nr_dl_config_pdcch_parameters_rel15_t pdcch_params = dci_alloc.pdcch_params; nfapi_nr_dl_config_pdcch_parameters_rel15_t pdcch_params = dci_alloc.pdcch_params;
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
int16_t mod_symbs[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>1]; int16_t **mod_symbs = (int16_t**)dlsch.mod_symbs;
int16_t tx_layers[NR_MAX_NB_LAYERS][NR_MAX_PDSCH_ENCODED_LENGTH>>1]; int16_t **tx_layers = (int16_t**)dlsch.txdataF;
uint16_t n_symbs; uint16_t n_symbs;
int8_t Wf[2], Wt[2], l0, delta; int8_t Wf[2], Wt[2], l0, delta;
uint16_t TBS = rel15->transport_block_size; uint16_t TBS = rel15->transport_block_size;
...@@ -243,10 +243,10 @@ for (int i=0; i<n_symbs; i++) { ...@@ -243,10 +243,10 @@ for (int i=0; i<n_symbs; i++) {
/// Layer mapping /// Layer mapping
nr_pdsch_layer_mapping((int16_t**)mod_symbs, nr_pdsch_layer_mapping(mod_symbs,
rel15->nb_layers, rel15->nb_layers,
n_symbs, n_symbs,
(int16_t**)tx_layers); tx_layers);
/// Antenna port mapping /// Antenna port mapping
//to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007 //to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007
......
...@@ -106,15 +106,21 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) ...@@ -106,15 +106,21 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
} }
NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag, NR_DL_FRAME_PARMS* frame_parms) NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,
unsigned char Mdlharq,
uint32_t Nsoft,
uint8_t abstraction_flag,
NR_DL_FRAME_PARMS *frame_parms,
nfapi_nr_config_request_t *config)
{ {
NR_gNB_DLSCH_t *dlsch; NR_gNB_DLSCH_t *dlsch;
unsigned char exit_flag = 0,i,r,aa,layer; unsigned char exit_flag = 0,i,r,aa,layer;
int re; int re;
unsigned char bw_scaling =1; unsigned char bw_scaling =1;
uint16_t N_RB = config->rf_config.dl_carrier_bandwidth.value;
switch (N_RB_DL) { switch (N_RB) {
case 106: case 106:
bw_scaling =2; bw_scaling =2;
...@@ -134,19 +140,24 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t ...@@ -134,19 +140,24 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t
dlsch->Mlimit = 4; dlsch->Mlimit = 4;
dlsch->Nsoft = Nsoft; dlsch->Nsoft = Nsoft;
for (layer=0; layer<4; layer++) { for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) {
dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(config->rf_config.tx_antenna_ports.value*sizeof(int32_t*));
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<config->rf_config.tx_antenna_ports.value; aa++) {
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
} }
} }
dlsch->txdataF[layer] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH>>1)*sizeof(int32_t*));
} }
dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { dlsch->mod_symbs[q] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH>>1)*sizeof(int32_t*));
dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(config->rf_config.tx_antenna_ports.value*sizeof(int32_t*));
for (aa=0; aa<config->rf_config.tx_antenna_ports.value; aa++) {
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
} }
...@@ -158,7 +169,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t ...@@ -158,7 +169,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t
for (i=0; i<Mdlharq; i++) { for (i=0; i<Mdlharq; i++) {
dlsch->harq_processes[i] = (NR_DL_gNB_HARQ_t *)malloc16(sizeof(NR_DL_gNB_HARQ_t)); dlsch->harq_processes[i] = (NR_DL_gNB_HARQ_t *)malloc16(sizeof(NR_DL_gNB_HARQ_t));
LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n", LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
MAX_NR_ULSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]); MAX_NR_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]);
if (dlsch->harq_processes[i]) { if (dlsch->harq_processes[i]) {
bzero(dlsch->harq_processes[i],sizeof(NR_DL_gNB_HARQ_t)); bzero(dlsch->harq_processes[i],sizeof(NR_DL_gNB_HARQ_t));
......
...@@ -105,9 +105,11 @@ typedef struct { ...@@ -105,9 +105,11 @@ typedef struct {
typedef struct { typedef struct {
/// Pointers to 16 HARQ processes for the DLSCH /// Pointers to 16 HARQ processes for the DLSCH
NR_DL_gNB_HARQ_t *harq_processes[16]; NR_DL_gNB_HARQ_t *harq_processes[NR_MAX_NB_HARQ_PROCESSES];
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8]; int32_t *txdataF[NR_MAX_NB_LAYERS];
/// Modulated symbols buffer
int32_t *mod_symbs[NR_MAX_NB_CODEWORDS];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4]; int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates) /// dl channel estimates (estimated from ul channel estimates)
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#define NR_MAX_NB_RBG 18 #define NR_MAX_NB_RBG 18
#define NR_MAX_NB_LAYERS 8 #define NR_MAX_NB_LAYERS 8
#define NR_MAX_NB_CODEWORDS 2 #define NR_MAX_NB_CODEWORDS 2
#define NR_MAX_NB_HARQ_PROCESSES 16
#define NR_MAX_PDSCH_ENCODED_LENGTH 950984 #define NR_MAX_PDSCH_ENCODED_LENGTH 950984
typedef enum { typedef enum {
......
...@@ -405,7 +405,7 @@ int main(int argc, char **argv) ...@@ -405,7 +405,7 @@ int main(int argc, char **argv)
for (int k=0; k<2; k++) { for (int k=0; k<2; k++) {
// Create transport channel structures for 2 transport blocks (MIMO) // Create transport channel structures for 2 transport blocks (MIMO)
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
gNB->dlsch[k][i] = new_gNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0,&gNB->frame_parms); gNB->dlsch[k][i] = new_gNB_dlsch(Kmimo,8,Nsoft,0,frame_parms,gNB_config);
if (!gNB->dlsch[k][i]) { if (!gNB->dlsch[k][i]) {
printf("Can't get eNB dlsch structures\n"); printf("Can't get eNB dlsch structures\n");
......
...@@ -755,7 +755,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { ...@@ -755,7 +755,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i); LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
for (j=0; j<2; j++) { for (j=0; j<2; j++) {
gNB->dlsch[i][j] = new_gNB_dlsch(1,16,NSOFT,cfg->rf_config.dl_carrier_bandwidth.value,0,fp); gNB->dlsch[i][j] = new_gNB_dlsch(1,16,NSOFT,cfg->rf_config.dl_carrier_bandwidth.value,0,cfg);
if (!gNB->dlsch[i][j]) { if (!gNB->dlsch[i][j]) {
LOG_E(PHY,"Can't get gNB dlsch structures for UE %d \n", i); LOG_E(PHY,"Can't get gNB dlsch structures for UE %d \n", i);
exit(-1); exit(-1);
...@@ -784,11 +784,11 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { ...@@ -784,11 +784,11 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
LOG_E(PHY,"Can't get gNB ulsch structures\n"); LOG_E(PHY,"Can't get gNB ulsch structures\n");
exit(-1); exit(-1);
}*/ }*/
gNB->dlsch_SI = new_gNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp); gNB->dlsch_SI = new_gNB_dlsch(1,8,NSOFT, 0, fp, cfg);
LOG_D(PHY,"gNB %d.%d : SI %p\n",gNB->Mod_id,gNB->CC_id,gNB->dlsch_SI); LOG_D(PHY,"gNB %d.%d : SI %p\n",gNB->Mod_id,gNB->CC_id,gNB->dlsch_SI);
gNB->dlsch_ra = new_gNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp); gNB->dlsch_ra = new_gNB_dlsch(1,8,NSOFT, 0, fp, cfg);
LOG_D(PHY,"gNB %d.%d : RA %p\n",gNB->Mod_id,gNB->CC_id,gNB->dlsch_ra); LOG_D(PHY,"gNB %d.%d : RA %p\n",gNB->Mod_id,gNB->CC_id,gNB->dlsch_ra);
gNB->dlsch_MCH = new_gNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp); gNB->dlsch_MCH = new_gNB_dlsch(1,8,NSOFT, 0, fp, cfg);
LOG_D(PHY,"gNB %d.%d : MCH %p\n",gNB->Mod_id,gNB->CC_id,gNB->dlsch_MCH); LOG_D(PHY,"gNB %d.%d : MCH %p\n",gNB->Mod_id,gNB->CC_id,gNB->dlsch_MCH);
......
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