Commit 399e6d78 authored by Robert Schmidt's avatar Robert Schmidt

new_nr_ue_ulsch(): no abstraction_flag, add term_nr_ue_transport()

parent 20a8704c
...@@ -170,7 +170,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, ...@@ -170,7 +170,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
init_nr_ue_signal(ue, nb_connected_gNB); init_nr_ue_signal(ue, nb_connected_gNB);
// intialize transport // intialize transport
init_nr_ue_transport(ue, abstraction_flag); init_nr_ue_transport(ue);
// init N_TA offset // init N_TA offset
init_N_TA_offset(ue); init_N_TA_offset(ue);
......
...@@ -685,14 +685,32 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -685,14 +685,32 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
free_and_zero(ue->sinr_CQI_dB); free_and_zero(ue->sinr_CQI_dB);
} }
void init_nr_ue_transport(PHY_VARS_NR_UE *ue, void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
int abstraction_flag) { {
const int N_RB_DL = ue->frame_parms.N_RB_DL;
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
for (int j = 0; j < 2; j++) {
for (int k = 0; k < RX_NB_TH_MAX; k++) {
free_nr_ue_dlsch(&ue->dlsch[k][i][j], N_RB_DL);
free_nr_ue_ulsch(&ue->ulsch[k][i][j], N_RB_DL);
}
}
free_nr_ue_dlsch(&ue->dlsch_SI[i], N_RB_DL);
free_nr_ue_dlsch(&ue->dlsch_ra[i], N_RB_DL);
}
free_nr_ue_dlsch(&ue->dlsch_MCH[0], N_RB_DL);
}
void init_nr_ue_transport(PHY_VARS_NR_UE *ue)
{
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) { for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
for (int j=0; j<2; j++) { for (int j=0; j<2; j++) {
for (int k=0; k<RX_NB_TH_MAX; k++) { for (int k=0; k<RX_NB_TH_MAX; k++) {
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n"); AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n");
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]); LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]);
AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n"); AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n");
LOG_D(PHY,"ulsch[%d][%d][%d] => %p\n",k,i,j,ue->ulsch[k][i][j]); LOG_D(PHY,"ulsch[%d][%d][%d] => %p\n",k,i,j,ue->ulsch[k][i][j]);
} }
} }
......
...@@ -398,7 +398,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_reques ...@@ -398,7 +398,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_reques
void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band); void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB); int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB);
void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB); void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB);
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag); void init_nr_ue_transport(PHY_VARS_NR_UE *ue);
void init_N_TA_offset(PHY_VARS_NR_UE *ue); void init_N_TA_offset(PHY_VARS_NR_UE *ue);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag);
......
...@@ -66,7 +66,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint ...@@ -66,7 +66,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch,unsigned char N_RB_UL); void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch,unsigned char N_RB_UL);
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag); NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids);
/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. /** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception.
@param stream0_in Input from channel compensated (MR combined) stream 0 @param stream0_in Input from channel compensated (MR combined) stream 0
......
...@@ -105,11 +105,8 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,unsigned char N_RB_UL) ...@@ -105,11 +105,8 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,unsigned char N_RB_UL)
} }
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids)
int number_of_harq_pids,
uint8_t abstraction_flag)
{ {
NR_UE_ULSCH_t *ulsch;
unsigned char exit_flag = 0,i,r; unsigned char exit_flag = 0,i,r;
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated
...@@ -120,97 +117,54 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, ...@@ -120,97 +117,54 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
ulsch = (NR_UE_ULSCH_t *)malloc16(sizeof(NR_UE_ULSCH_t)); NR_UE_ULSCH_t *ulsch = malloc16(sizeof(NR_UE_ULSCH_t));
DevAssert(ulsch);
memset(ulsch, 0, sizeof(*ulsch));
if (ulsch) { ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
memset(ulsch,0,sizeof(NR_UE_ULSCH_t)); ulsch->Mlimit = 4; // maximum harq retransmissions
ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
ulsch->Mlimit = 4; // maximum harq retransmissions
//for (i=0; i<10; i++) //for (i=0; i<10; i++)
//ulsch->harq_ids[i] = 0; //ulsch->harq_ids[i] = 0;
for (i=0; i<number_of_harq_pids; i++) { for (i=0; i<number_of_harq_pids; i++) {
ulsch->harq_processes[i] = (NR_UL_UE_HARQ_t *)malloc16(sizeof(NR_UL_UE_HARQ_t)); ulsch->harq_processes[i] = malloc16(sizeof(NR_UL_UE_HARQ_t));
DevAssert(ulsch->harq_processes[i]);
memset(ulsch->harq_processes[i], 0, sizeof(NR_UL_UE_HARQ_t));
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]); ulsch->harq_processes[i]->a = malloc16(ulsch_bytes);
if (ulsch->harq_processes[i]) { DevAssert(ulsch->harq_processes[i]->a);
memset(ulsch->harq_processes[i], 0, sizeof(NR_UL_UE_HARQ_t)); bzero(ulsch->harq_processes[i]->a,ulsch_bytes);
ulsch->harq_processes[i]->b = (uint8_t*)malloc16(ulsch_bytes);
ulsch->harq_processes[i]->a = (unsigned char*)malloc16(ulsch_bytes);
if (ulsch->harq_processes[i]->a) { ulsch->harq_processes[i]->b = malloc16(ulsch_bytes);
bzero(ulsch->harq_processes[i]->a,ulsch_bytes); DevAssert(ulsch->harq_processes[i]->b);
} else { bzero(ulsch->harq_processes[i]->b,ulsch_bytes);
printf("Can't allocate PDU\n");
exit_flag=1;
}
if (ulsch->harq_processes[i]->b) for (r=0; r<a_segments; r++) {
bzero(ulsch->harq_processes[i]->b,ulsch_bytes); // account for filler in first segment and CRCs for multiple segment case
else { ulsch->harq_processes[i]->c[r] = malloc16(8448);
LOG_E(PHY,"Can't get b\n"); DevAssert(ulsch->harq_processes[i]->c[r]);
exit_flag=1; bzero(ulsch->harq_processes[i]->c[r],8448);
}
if (abstraction_flag==0) {
for (r=0; r<a_segments; r++) {
// account for filler in first segment and CRCs for multiple segment case
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
ulsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
if (ulsch->harq_processes[i]->c[r]) {
bzero(ulsch->harq_processes[i]->c[r],8448);
} else {
printf("Can't get c\n");
exit_flag=2;
}
if (ulsch->harq_processes[i]->d[r]) {
bzero(ulsch->harq_processes[i]->d[r],(68*384));
} else {
printf("Can't get d\n");
exit_flag=2;
}
}
ulsch->harq_processes[i]->e = (uint8_t*)malloc16(14*N_RB_UL*12*8);
if (ulsch->harq_processes[i]->e) {
bzero(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
} else {
printf("Can't get e\n");
exit_flag=1;
}
ulsch->harq_processes[i]->f = (uint8_t*)malloc16(14*N_RB_UL*12*8);
if (ulsch->harq_processes[i]->f) {
bzero(ulsch->harq_processes[i]->f,14*N_RB_UL*12*8);
} else {
printf("Can't get f\n");
exit_flag=1;
}
}
ulsch->harq_processes[i]->subframe_scheduling_flag = 0; ulsch->harq_processes[i]->d[r] = malloc16(68*384); //max size for coded output
ulsch->harq_processes[i]->first_tx = 1; DevAssert(ulsch->harq_processes[i]->d[r]);
} else { bzero(ulsch->harq_processes[i]->d[r],(68*384));
LOG_E(PHY,"Can't get harq_p %d\n",i);
exit_flag=3;
}
} }
if (exit_flag==0) { ulsch->harq_processes[i]->e = malloc16(14*N_RB_UL*12*8);
for (i=0; i<number_of_harq_pids; i++) { DevAssert(ulsch->harq_processes[i]->e);
ulsch->harq_processes[i]->round=0; bzero(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
}
return(ulsch);
}
}
LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t)); ulsch->harq_processes[i]->f = malloc16(14*N_RB_UL*12*8);
free_nr_ue_ulsch(&ulsch,N_RB_UL); DevAssert(ulsch->harq_processes[i]->f);
return(NULL); bzero(ulsch->harq_processes[i]->f,14*N_RB_UL*12*8);
ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
ulsch->harq_processes[i]->first_tx = 1;
}
return(ulsch);
} }
......
...@@ -923,7 +923,7 @@ int main(int argc, char **argv) ...@@ -923,7 +923,7 @@ int main(int argc, char **argv)
exit(-1); exit(-1);
} }
init_nr_ue_transport(UE,0); init_nr_ue_transport(UE);
nr_gold_pbch(UE); nr_gold_pbch(UE);
nr_gold_pdcch(UE,0); nr_gold_pdcch(UE,0);
......
...@@ -400,7 +400,7 @@ int main(int argc, char **argv) ...@@ -400,7 +400,7 @@ int main(int argc, char **argv)
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS)); memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
//phy_init_nr_top(frame_parms); //phy_init_nr_top(frame_parms);
if (init_nr_ue_signal(UE, 1, 0) != 0) { if (init_nr_ue_signal(UE, 1) != 0) {
printf("Error at UE NR initialisation.\n"); printf("Error at UE NR initialisation.\n");
exit(-1); exit(-1);
} }
...@@ -408,7 +408,7 @@ int main(int argc, char **argv) ...@@ -408,7 +408,7 @@ int main(int argc, char **argv)
for (sf = 0; sf < 2; sf++) { for (sf = 0; sf < 2; sf++) {
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8, 0); UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8);
if (!UE->ulsch[sf][0][i]) { if (!UE->ulsch[sf][0][i]) {
printf("Can't get ue ulsch structures.\n"); printf("Can't get ue ulsch structures.\n");
......
...@@ -767,13 +767,13 @@ int main(int argc, char **argv) ...@@ -767,13 +767,13 @@ int main(int argc, char **argv)
} }
//nr_init_frame_parms_ue(&UE->frame_parms); //nr_init_frame_parms_ue(&UE->frame_parms);
init_nr_ue_transport(UE, 0); init_nr_ue_transport(UE);
/* /*
for (int sf = 0; sf < 2; sf++) { for (int sf = 0; sf < 2; sf++) {
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8, 0); UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8);
if (!UE->ulsch[sf][0][i]) { if (!UE->ulsch[sf][0][i]) {
printf("Can't get ue ulsch structures\n"); printf("Can't get ue ulsch structures\n");
......
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