Commit 5f9e0a23 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge remote-tracking branch 'origin/code-cleanup-20210716' into integration_2021_w32

parents 3e6ef7ba b7857a50
......@@ -328,7 +328,7 @@ void mch_channel_compensation(int **rxdataF_ext,
int aarx,nre,i;
#if defined(__x86_64__) || defined(__i386__)
__m128i *dl_ch128,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128={0},QAM_amp128b={0};
#elif defined(__arm__)
#endif
......@@ -455,7 +455,7 @@ void mch_channel_compensation_khz_1dot25(int **rxdataF_ext,
int aarx,nre,i;
#if defined(__x86_64__) || defined(__i386__)
__m128i *dl_ch128,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128={0},QAM_amp128b={0};
#elif defined(__arm__)
#endif
/*if ((symbol == 2) || (symbol == 6) || (symbol == 10))
......
......@@ -52,8 +52,7 @@
void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
{
void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch) {
int i;
int r;
......@@ -68,6 +67,7 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
free16(ulsch->harq_processes[i]->b,MAX_ULSCH_PAYLOAD_BYTES);
ulsch->harq_processes[i]->b = NULL;
}
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
if (ulsch->harq_processes[i]->c[r]) {
free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
......@@ -79,14 +79,12 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
ulsch->harq_processes[i] = NULL;
}
}
free16(ulsch,sizeof(LTE_UE_ULSCH_t));
}
}
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
{
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) {
LTE_UE_ULSCH_t *ulsch;
unsigned char exit_flag = 0,i,j,r;
unsigned char bw_scaling =1;
......@@ -113,17 +111,15 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
if (ulsch) {
memset(ulsch,0,sizeof(LTE_UE_ULSCH_t));
ulsch->Mlimit = 4;
for (i=0; i<8; i++) {
ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t));
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
if (ulsch->harq_processes[i]) {
memset(ulsch->harq_processes[i], 0, sizeof(LTE_UL_UE_HARQ_t));
ulsch->harq_processes[i]->b = (unsigned char*)malloc16(MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
ulsch->harq_processes[i]->b = (unsigned char *)malloc16(MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
if (ulsch->harq_processes[i]->b)
memset(ulsch->harq_processes[i]->b,0,MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
......@@ -134,7 +130,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
if (abstraction_flag==0) {
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
ulsch->harq_processes[i]->c[r] = (unsigned char*)malloc16(((r==0)?8:0) + 3+768); // account for filler in first segment and CRCs for multiple segment case
ulsch->harq_processes[i]->c[r] = (unsigned char *)malloc16(((r==0)?8:0) + 3+768); // account for filler in first segment and CRCs for multiple segment case
if (ulsch->harq_processes[i]->c[r])
memset(ulsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+768);
......@@ -167,8 +163,6 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t));
free_ue_ulsch(ulsch);
return(NULL);
}
......@@ -179,15 +173,12 @@ uint32_t ulsch_encoding(uint8_t *a,
uint8_t subframe_rx,
uint8_t tmode,
uint8_t control_only_flag,
uint8_t Nbundled)
{
uint8_t Nbundled) {
time_stats_t *seg_stats=&ue->ulsch_segmentation_stats;
time_stats_t *rm_stats=&ue->ulsch_rate_matching_stats;
time_stats_t *te_stats=&ue->ulsch_turbo_encoding_stats;
time_stats_t *i_stats=&ue->ulsch_interleaving_stats;
time_stats_t *m_stats=&ue->ulsch_multiplexing_stats;
// uint16_t offset;
uint32_t crc=1;
uint32_t A;
......@@ -237,7 +228,6 @@ uint32_t ulsch_encoding(uint8_t *a,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_IN);
rnti = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti;
fill_CQI(ulsch,meas,0,harq_pid,ue->frame_parms.N_RB_DL,rnti, tmode,ue->sinr_eff);
LOG_D(PHY,"ULSCH Encoding rnti %x \n", rnti);
print_CQI(ulsch->o,ulsch->uci_format,0,ue->frame_parms.N_RB_DL);
......@@ -246,6 +236,7 @@ uint32_t ulsch_encoding(uint8_t *a,
//LOG_I(PHY,"XXX saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi));
dlsch[0]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_OUT);
}
......@@ -268,9 +259,7 @@ uint32_t ulsch_encoding(uint8_t *a,
if (control_only_flag == 0) {
A=ulsch->harq_processes[harq_pid]->TBS;
Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs);
ulsch->harq_processes[harq_pid]->control_only = 0;
#ifdef DEBUG_ULSCH_CODING
printf("[PHY][UE] ULSCH coding : A %d, Qm %d, mcs %d, harq_pid %d, round %d, RV %d\n",
ulsch->harq_processes[harq_pid]->TBS,
......@@ -301,16 +290,13 @@ uint32_t ulsch_encoding(uint8_t *a,
#endif
if (ulsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
start_meas(seg_stats);
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(a,
A)>>8;
a[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
a[A>>3] = ((uint8_t *)&crc)[2];
a[1+(A>>3)] = ((uint8_t *)&crc)[1];
a[2+(A>>3)] = ((uint8_t *)&crc)[0];
ulsch->harq_processes[harq_pid]->B = A+24;
ulsch->harq_processes[harq_pid]->b = a;
lte_segmentation(ulsch->harq_processes[harq_pid]->b,
......@@ -322,7 +308,6 @@ uint32_t ulsch_encoding(uint8_t *a,
&ulsch->harq_processes[harq_pid]->Kplus,
&ulsch->harq_processes[harq_pid]->Kminus,
&ulsch->harq_processes[harq_pid]->F);
stop_meas(seg_stats);
for (r=0; r<ulsch->harq_processes[harq_pid]->C; r++) {
......@@ -332,20 +317,15 @@ uint32_t ulsch_encoding(uint8_t *a,
Kr = ulsch->harq_processes[harq_pid]->Kplus;
Kr_bytes = Kr>>3;
#ifdef DEBUG_ULSCH_CODING
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
// generate codewords
printf("bits_per_codeword (Kr)= %d\n",Kr);
printf("N_RB = %d\n",ulsch->harq_processes[harq_pid]->nb_rb);
printf("Ncp %d\n",frame_parms->Ncp);
printf("Qm %d\n",Q_m);
#endif
// offset=0;
start_meas(te_stats);
encoder(ulsch->harq_processes[harq_pid]->c[r],
Kr>>3,
......@@ -366,7 +346,6 @@ uint32_t ulsch_encoding(uint8_t *a,
ulsch->harq_processes[harq_pid]->w[r]);
stop_meas(i_stats);
}
}
if (ulsch->harq_processes[harq_pid]->C == 0) {
......@@ -392,7 +371,6 @@ uint32_t ulsch_encoding(uint8_t *a,
ulsch->harq_processes[harq_pid]->sumKr = sumKr;
// Compute Q_ri (p. 23 36-212)
Qprime = ulsch->O_RI*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_ri_times8;
if (Qprime > 0) {
......@@ -407,7 +385,6 @@ uint32_t ulsch_encoding(uint8_t *a,
Q_RI = Q_m*Qprime;
Qprime_RI = Qprime;
// Compute Q_ack (p. 23 36-212)
Qprime = ulsch->harq_processes[harq_pid]->O_ACK*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_harqack_times8;
......@@ -423,7 +400,6 @@ uint32_t ulsch_encoding(uint8_t *a,
Q_ACK = Qprime * Q_m;
Qprime_ACK = Qprime;
LOG_D(PHY,"UE (%x/%d) O_ACK %d, Mcs_initial %d, Nsymb_initial %d, beta_offset_harqack*8 %d, sum Kr %d, Qprime_ACK %d, Q_ACK %d\n",
rnti, harq_pid,
ulsch->harq_processes[harq_pid]->O_ACK,
......@@ -436,7 +412,6 @@ uint32_t ulsch_encoding(uint8_t *a,
// Compute Q_cqi, assume O>11, p. 26 36-212
if (control_only_flag == 0) {
if (ulsch->O < 12)
L=0;
else
......@@ -446,6 +421,7 @@ uint32_t ulsch_encoding(uint8_t *a,
Qprime = (ulsch->O + L) * ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_cqi_times8;
else
Qprime = 0;
LOG_D(PHY,"Qprime %d, O_RI %d + %d, Msc %d, Nym %d beta %d\n",
Qprime,
ulsch->O, L,
......@@ -453,7 +429,6 @@ uint32_t ulsch_encoding(uint8_t *a,
ulsch->harq_processes[harq_pid]->Nsymb_initial,
ulsch->beta_offset_cqi_times8);
if (Qprime > 0) {
if ((Qprime % (8*sumKr)) > 0)
Qprime = 1+(Qprime/(8*sumKr));
......@@ -463,19 +438,17 @@ uint32_t ulsch_encoding(uint8_t *a,
G = ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch);
LOG_D(PHY,"G: rb %d * ( 12 * Qm %d ) * nsymb %d, Qprime %d, O_RI %d\n", ulsch->harq_processes[harq_pid]->nb_rb, Q_m, ulsch->Nsymb_pusch, Qprime, ulsch->O_RI);
if (Qprime > (G - ulsch->O_RI))
Qprime = G - ulsch->O_RI;
Q_CQI = Q_m * Qprime;
Qprime_CQI = Qprime;
G = G - Q_RI - Q_CQI;
LOG_D(PHY,"new G: %d, Q_RI %d Q_CQI %d\n", G , Q_RI , Q_CQI);
LOG_D(PHY,"new G: %d, Q_RI %d Q_CQI %d\n", G, Q_RI, Q_CQI);
ulsch->harq_processes[harq_pid]->G = G;
/*
/*
LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK);
LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n",
......@@ -487,7 +460,7 @@ uint32_t ulsch_encoding(uint8_t *a,
ulsch->O_RI,
ulsch->harq_processes[harq_pid]->O_ACK,
G);
*/
*/
if ((int)G < 0) {
LOG_E(PHY,"FATAL: ulsch_coding.c G < 0 (%d) : Q_RI %d, Q_CQI %d, O %d, betaCQI_times8 %d)\n",G,Q_RI,Q_CQI,ulsch->O,ulsch->beta_offset_cqi_times8);
......@@ -495,14 +468,10 @@ uint32_t ulsch_encoding(uint8_t *a,
return(-1);
}
// Data and control multiplexing (5.2.2.7 36-212)
H = G + Q_CQI;
Hprime = H/Q_m;
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
// outputs for each code segment, see Section 5.1.5 p.20
......@@ -514,7 +483,6 @@ uint32_t ulsch_encoding(uint8_t *a,
Kr*3,
Q_m,ulsch->harq_processes[harq_pid]->nb_rb);
#endif
start_meas(rm_stats);
r_offset += lte_rate_matching_turbo(ulsch->harq_processes[harq_pid]->RTC[r],
G,
......@@ -544,7 +512,6 @@ uint32_t ulsch_encoding(uint8_t *a,
Hprime = H/Q_m;
}
// Do CQI coding
if ((ulsch->O>1) && (ulsch->O < 12)) {
LOG_E(PHY,"short CQI sizes not supported yet\n");
......@@ -558,23 +525,18 @@ uint32_t ulsch_encoding(uint8_t *a,
printf("crc(cqi) tx : %x\n",crc);
#endif
memset((void *)&ulsch->o_d[0],LTE_NULL,96);
ccodelte_encode(ulsch->O,
1,
o_flip,
&ulsch->o_d[96],
0);
o_RCC = sub_block_interleaving_cc(8+ulsch->O,
&ulsch->o_d[96],
ulsch->o_w);
lte_rate_matching_cc(o_RCC,
Q_CQI,
ulsch->o_w,
ulsch->q);
}
i=0;
......@@ -686,14 +648,12 @@ uint32_t ulsch_encoding(uint8_t *a,
ulsch->q_ACK[3] = PUSCH_x;
ulsch->q_ACK[4] = PUSCH_x;
ulsch->q_ACK[5] = PUSCH_x;
ulsch->q_ACK[6] = (ack_parity+wACK[wACK_idx][0])&1;
ulsch->q_ACK[7] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[8] = PUSCH_x;
ulsch->q_ACK[9] = PUSCH_x;
ulsch->q_ACK[10] = PUSCH_x;
ulsch->q_ACK[11] = PUSCH_x;
ulsch->q_ACK[12] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[13] = (ack_parity+wACK[wACK_idx][1])&1;
ulsch->q_ACK[14] = PUSCH_x;
......@@ -701,7 +661,6 @@ uint32_t ulsch_encoding(uint8_t *a,
ulsch->q_ACK[16] = PUSCH_x;
ulsch->q_ACK[17] = PUSCH_x;
len_ACK = 18;
break;
}
}
......@@ -712,23 +671,17 @@ uint32_t ulsch_encoding(uint8_t *a,
return(-1);
}
// channel multiplexing/interleaving
start_meas(m_stats);
Hpp = Hprime + Q_RI;
Cmux = ulsch->Nsymb_pusch;
Rmux = Hpp*Q_m/Cmux;
Rmux_prime = Rmux/Q_m;
Qprime_RI = Q_RI / Q_m;
Qprime_ACK = Q_ACK / Q_m;
Qprime_CQI = Q_CQI / Q_m;
// printf("Qprime_CQI = %d\n",Qprime_CQI);
// RI BITS
memset(y,LTE_NULL,Q_m*Hpp);
if (frame_parms->Ncp == 0)
......@@ -747,10 +700,8 @@ uint32_t ulsch_encoding(uint8_t *a,
}
j=(j+3)&3;
}
// CQI and Data bits
j=0;
/*
......@@ -775,7 +726,6 @@ uint32_t ulsch_encoding(uint8_t *a,
*/
for (i=0; i<Qprime_CQI; i++) {
while (y[Q_m*j] != LTE_NULL) j++;
for (q=0; q<Q_m; q++) {
......@@ -789,9 +739,7 @@ uint32_t ulsch_encoding(uint8_t *a,
j2 = j*Q_m;
switch (Q_m) {
case 2:
for (iprime=0; iprime<(Hprime-Qprime_CQI)<<1; iprime+=2) {
while (y[j2] != LTE_NULL) j2+=2;
......@@ -829,7 +777,6 @@ uint32_t ulsch_encoding(uint8_t *a,
}
break;
}
// HARQ-ACK Bits (Note these overwrite some bits)
......@@ -854,7 +801,6 @@ uint32_t ulsch_encoding(uint8_t *a,
}
j=(j+3)&3;
}
// write out buffer
......
......@@ -42,7 +42,7 @@
extern short nr_qpsk_mod_table[8];
uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
const uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31
};
......@@ -141,7 +141,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
return 0;
}
void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
static void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
uint32_t Nid,
uint8_t nushift,
uint16_t M,
......
......@@ -78,19 +78,6 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
nfapi_nr_config_request_scf_t *config,
NR_DL_FRAME_PARMS *frame_parms);
/*!
\fn int nr_pbch_scrambling
\brief PBCH scrambling function
@param
*/
void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
uint32_t Nid,
uint8_t nushift,
uint16_t M,
uint16_t length,
uint8_t encoded,
uint32_t unscrambling_mask);
/*!
\fn int nr_generate_pbch
\brief Generation of the PBCH
......
......@@ -630,7 +630,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
unsigned short rb;
unsigned char aatx,aarx;
__m128i *ul_ch128,*ul_ch128_2,*ul_ch_mag128,*ul_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128={0},QAM_amp128b={0};
QAM_amp128b = _mm_setzero_si128();
for (aatx=0; aatx<nrOfLayers; aatx++) {
......
......@@ -60,23 +60,22 @@ int nbDlProcessing =0;
static tpool_t pool_dl;
//extern double cpuf;
void init_dlsch_tpool(uint8_t num_dlsch_threads)
{
void init_dlsch_tpool(uint8_t num_dlsch_threads) {
if( num_dlsch_threads==0)
return;
char *params=calloc(1,(num_dlsch_threads*3)+1);
for (int i=0; i<num_dlsch_threads; i++) {
memcpy(params+(i*3),"-1,",3);
}
initNamedTpool(params, &pool_dl, false,"dlsch");
free(params);
}
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL)
{
void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
int i,r;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
NR_UE_DLSCH_t *dlsch=*dlschptr;
......@@ -87,7 +86,6 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL)
a_segments = a_segments/273 +1;
}
for (i=0; i<dlsch->Mdlharq; i++) {
if (dlsch->harq_processes[i]) {
if (dlsch->harq_processes[i]->b) {
......@@ -113,7 +111,7 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL)
}
for (r=0; r<a_segments; r++) {
if (dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]){
if (dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]) {
nrLDPC_free_mem(dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL;
}
......@@ -129,12 +127,9 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL)
}
}
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL, uint8_t abstraction_flag)
{
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL, uint8_t abstraction_flag) {
NR_UE_DLSCH_t *dlsch;
uint8_t exit_flag = 0,i,r;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
if (N_RB_DL != 273) {
......@@ -143,7 +138,6 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
}
uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
dlsch = (NR_UE_DLSCH_t *)malloc16(sizeof(NR_UE_DLSCH_t));
if (dlsch) {
......@@ -162,7 +156,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
memset(dlsch->harq_processes[i],0,sizeof(NR_DL_UE_HARQ_t));
init_downlink_harq_status(dlsch->harq_processes[i]);
dlsch->harq_processes[i]->first_tx=1;
dlsch->harq_processes[i]->b = (uint8_t*)malloc16(dlsch_bytes);
dlsch->harq_processes[i]->b = (uint8_t *)malloc16(dlsch_bytes);
if (dlsch->harq_processes[i]->b)
memset(dlsch->harq_processes[i]->b,0,dlsch_bytes);
......@@ -172,21 +166,21 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
if (abstraction_flag == 0) {
for (r=0; r<a_segments; r++) {
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(1056);
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
if (dlsch->harq_processes[i]->c[r])
memset(dlsch->harq_processes[i]->c[r],0,1056);
else
exit_flag=2;
dlsch->harq_processes[i]->d[r] = (short*)malloc16((5*8448)*sizeof(short));
dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short));
if (dlsch->harq_processes[i]->d[r])
memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short));
else
exit_flag=2;
dlsch->harq_processes[i]->w[r] = (short*)malloc16((5*8448)*sizeof(short));
dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short));
if (dlsch->harq_processes[i]->w[r])
memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short));
......@@ -205,19 +199,16 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
LOG_D(PHY,"new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(NR_DL_UE_HARQ_t), exit_flag);
free_nr_ue_dlsch(&dlsch,N_RB_DL);
return(NULL);
}
void nr_dlsch_unscrambling(int16_t* llr,
void nr_dlsch_unscrambling(int16_t *llr,
uint32_t size,
uint8_t q,
uint32_t Nid,
uint32_t n_RNTI) {
uint8_t reset;
uint32_t x1, x2, s=0;
reset = 1;
x2 = (n_RNTI<<15) + (q<<14) + Nid;
......@@ -226,10 +217,10 @@ void nr_dlsch_unscrambling(int16_t* llr,
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
if (((s>>(i&0x1f))&1)==1)
llr[i] = -llr[i];
}
}
uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
......@@ -244,9 +235,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t nr_slot_rx,
uint8_t harq_pid,
uint8_t is_crnti,
uint8_t llr8_flag)
{
uint8_t llr8_flag) {
#if UE_TIMING_TRACE
time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats;
time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats;
......@@ -260,46 +249,41 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t crc_type;
int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
t_nrLDPC_dec_params decParams;
t_nrLDPC_dec_params* p_decParams = &decParams;
t_nrLDPC_dec_params *p_decParams = &decParams;
t_nrLDPC_time_stats procTime = {0};
t_nrLDPC_time_stats* p_procTime =&procTime ;
t_nrLDPC_time_stats *p_procTime =&procTime ;
if (!harq_process) {
LOG_E(PHY,"dlsch_decoding.c: NULL harq_process pointer\n");