Commit 009b195d authored by Khalid Ahmed's avatar Khalid Ahmed Committed by Thomas Schlichter

Initializing and freeing NR_UE_ULSCH_t. Creating nr_ulsch_coding.c

parent ad402982
...@@ -1304,6 +1304,7 @@ set(PHY_SRC_UE ...@@ -1304,6 +1304,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_initial_sync.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_pbch.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_pbch.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_tbs_tools.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_tbs_tools.c
......
...@@ -361,8 +361,13 @@ void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id, ...@@ -361,8 +361,13 @@ void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
uint16_t max_harq_tx ) uint16_t max_harq_tx )
{ {
int num_of_threads,num_of_code_words;
PHY_VARS_NR_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id]; PHY_VARS_NR_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
phy_vars_ue->ulsch[eNB_id]->Mlimit = max_harq_tx;
for (num_of_threads=0;num_of_threads<RX_NB_TH_MAX;num_of_threads++)
for (num_of_code_words=0;num_of_code_words<NR_MAX_NB_CODEWORDS;num_of_code_words++)
phy_vars_ue->ulsch[eNB_id][num_of_threads][num_of_code_words]->Mlimit = max_harq_tx;
} }
extern uint16_t beta_cqi[16]; extern uint16_t beta_cqi[16];
...@@ -923,11 +928,12 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) { ...@@ -923,11 +928,12 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag) {
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n"); AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=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, NUMBER_OF_HARQ_PID_MAX, abstraction_flag))!=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]);
} }
} }
//AssertFatal((ue->ulsch[i] = new_ue_ulsch(ue->frame_parms.N_RB_UL, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag); ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag); ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
......
...@@ -69,7 +69,7 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) ...@@ -69,7 +69,7 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
#endif #endif
if (dlsch->harq_processes[i]->b) { if (dlsch->harq_processes[i]->b) {
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES); free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES); //this should be MAX_NR_DLSCH_PAYLOAD_BYTES
dlsch->harq_processes[i]->b = NULL; dlsch->harq_processes[i]->b = NULL;
#ifdef DEBUG_DLSCH_FREE #ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch process %d b (%p)\n",i,dlsch->harq_processes[i]->b); printf("Freeing dlsch process %d b (%p)\n",i,dlsch->harq_processes[i]->b);
...@@ -196,7 +196,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo, ...@@ -196,7 +196,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,
for (r=0; r<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling; r++) { for (r=0; r<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling; r++) {
// account for filler in first segment and CRCs for multiple segment case // account for filler in first segment and CRCs for multiple segment case
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448); dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
if (dlsch->harq_processes[i]->c[r]) { if (dlsch->harq_processes[i]->c[r]) {
bzero(dlsch->harq_processes[i]->c[r],8448); bzero(dlsch->harq_processes[i]->c[r],8448);
} else { } else {
......
...@@ -61,10 +61,10 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t *dlsch); ...@@ -61,10 +61,10 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t *dlsch);
NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_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_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag);
void free_ue_ulsch(NR_UE_ULSCH_t *ulsch); void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch);
NR_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag); NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag);
void fill_UE_dlsch_MCH(PHY_VARS_NR_UE *ue,int mcs,int ndi,int rvidx,int eNB_id); void fill_UE_dlsch_MCH(PHY_VARS_NR_UE *ue,int mcs,int ndi,int rvidx,int eNB_id);
......
...@@ -110,20 +110,24 @@ typedef struct { ...@@ -110,20 +110,24 @@ typedef struct {
uint32_t B; uint32_t B;
/// Length of ACK information (bits) /// Length of ACK information (bits)
uint8_t O_ACK; uint8_t O_ACK;
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t *c[MAX_NUM_ULSCH_SEGMENTS];
/// Index of current HARQ round for this ULSCH /// Index of current HARQ round for this ULSCH
uint8_t round; uint8_t round;
/// MCS format of this ULSCH /// MCS format of this ULSCH
uint8_t mcs; uint8_t mcs;
/// Redundancy-version of the current sub-frame /// Redundancy-version of the current sub-frame
uint8_t rvidx; uint8_t rvidx;
/// LDPC-code outputs /// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
uint8_t d[MAX_NUM_ULSCH_SEGMENTS][3*8448]; uint8_t *a;
/// Interleaver outputs /// Pointer to the payload + CRC
uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*8448]; uint8_t *b;
/// Pointers to transport block segments
uint8_t *c[MAX_NUM_NR_ULSCH_SEGMENTS];
/// LDPC-code outputs (TS 36.212 V15.4.0, Sec 5.3.2 p. 17)
uint8_t *d[MAX_NUM_NR_ULSCH_SEGMENTS]; // 66*Z_c is the maximum LDPC block length. We use 68 for internal manipulation of the buffer
/// Rate matching (Bit selection) outputs (TS 36.212 V15.4.0, Sec 5.4.2.1 p. 28)
uint8_t *e[MAX_NUM_NR_ULSCH_SEGMENTS];
/// Rate matching (Interleaving) outputs (TS 36.212 V15.4.0, Sec 5.4.2.2 p. 30)
uint8_t *f[MAX_NUM_NR_ULSCH_SEGMENTS];
/// Number of code segments /// Number of code segments
uint32_t C; uint32_t C;
/// Number of bits in code segments /// Number of bits in code segments
...@@ -168,6 +172,7 @@ typedef struct { ...@@ -168,6 +172,7 @@ typedef struct {
// UL number of harq processes // UL number of harq processes
uint8_t number_harq_processes_for_pusch; uint8_t number_harq_processes_for_pusch;
#endif #endif
/*
/// Pointer to CQI data (+1 for 8 bits crc) /// Pointer to CQI data (+1 for 8 bits crc)
uint8_t o[1+MAX_CQI_BYTES]; uint8_t o[1+MAX_CQI_BYTES];
/// Length of CQI data (bits) /// Length of CQI data (bits)
...@@ -180,22 +185,25 @@ typedef struct { ...@@ -180,22 +185,25 @@ typedef struct {
uint8_t O_RI; uint8_t O_RI;
/// Pointer to ACK /// Pointer to ACK
uint8_t o_ACK[4]; uint8_t o_ACK[4];
*/
/// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37) /// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37)
uint8_t O_CQI_MIN; uint8_t O_CQI_MIN;
/// ACK/NAK Bundling flag /// ACK/NAK Bundling flag
uint8_t bundling; uint8_t bundling;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) /// Concatenated "g"-sequences (for definition see 36-212 V15.4.0 2018-12, p.31)
uint8_t e[MAX_NUM_CHANNEL_BITS]; uint8_t g[MAX_NUM_NR_CHANNEL_BITS];
/// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) /// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t h[MAX_NUM_CHANNEL_BITS]; uint8_t h[MAX_NUM_NR_CHANNEL_BITS];
/// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14) /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
uint8_t b_tilde[MAX_NUM_CHANNEL_BITS]; uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS];
/// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14) /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
int32_t d[MAX_NUM_RE]; int32_t d[MAX_NUM_NR_RE];
/// Transform-coded "z"-sequences (for definition see 36-211 V8.6 2009-03, p.14-15) /// Transform-coded "z"-sequences (for definition see 36-211 V8.6 2009-03, p.14-15)
int32_t z[MAX_NUM_RE]; int32_t z[MAX_NUM_NR_RE];
/*
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27) /// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
uint8_t q[MAX_CQI_PAYLOAD]; uint8_t q[MAX_CQI_PAYLOAD];
/// coded and interleaved CQI bits /// coded and interleaved CQI bits
uint8_t o_w[(MAX_CQI_BITS+8)*3]; uint8_t o_w[(MAX_CQI_BITS+8)*3];
/// coded CQI bits /// coded CQI bits
...@@ -204,6 +212,7 @@ typedef struct { ...@@ -204,6 +212,7 @@ typedef struct {
uint8_t q_ACK[MAX_ACK_PAYLOAD]; uint8_t q_ACK[MAX_ACK_PAYLOAD];
/// coded RI bits /// coded RI bits
uint8_t q_RI[MAX_RI_PAYLOAD]; uint8_t q_RI[MAX_RI_PAYLOAD];
*/
/// beta_offset_cqi times 8 /// beta_offset_cqi times 8
uint16_t beta_offset_cqi_times8; uint16_t beta_offset_cqi_times8;
/// beta_offset_ri times 8 /// beta_offset_ri times 8
...@@ -229,9 +238,9 @@ typedef struct { ...@@ -229,9 +238,9 @@ typedef struct {
/// num active cba group /// num active cba group
uint8_t num_active_cba_groups; uint8_t num_active_cba_groups;
/// num dci found for cba /// num dci found for cba
uint8_t num_cba_dci[10]; //uint8_t num_cba_dci[10];
/// allocated CBA RNTI /// allocated CBA RNTI
uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; //uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
/// UL max-harq-retransmission /// UL max-harq-retransmission
uint8_t Mlimit; uint8_t Mlimit;
} NR_UE_ULSCH_t; } NR_UE_ULSCH_t;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
* \brief Top-level routines for coding the ULSCH transport channel as described in 38.212 V15.4 2018-12
* \author Khalid Ahmed
* \date 2019
* \version 0.1
* \company Fraunhofer IIS
* \email: khalid.ahmed@iis.fraunhofer.de
* \note
* \warning
*/
#include "PHY/defs_UE.h"
#include "PHY/phy_extern_ue.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/coding_extern.h"
#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/CODING/nrLDPC_encoder/defs.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch)
{
int i;
int r;
if (ulsch) {
#ifdef DEBUG_ULSCH_FREE
printf("Freeing ulsch %p\n",ulsch);
#endif
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
if (ulsch->harq_processes[i]) {
if (ulsch->harq_processes[i]->b) {
free16(ulsch->harq_processes[i]->b,MAX_NR_ULSCH_PAYLOAD_BYTES);
ulsch->harq_processes[i]->b = NULL;
}
for (r=0; r<MAX_NUM_NR_ULSCH_SEGMENTS; r++) {
if (ulsch->harq_processes[i]->c[r]) {
free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
ulsch->harq_processes[i]->c[r] = NULL;
}
if (ulsch->harq_processes[i]->d[r]) {
free16(ulsch->harq_processes[i]->d[r],68*384);
ulsch->harq_processes[i]->d[r] = NULL;
}
if (ulsch->harq_processes[i]->e[r]) {
free16(ulsch->harq_processes[i]->e[r],68*384);
ulsch->harq_processes[i]->e[r] = NULL;
}
if (ulsch->harq_processes[i]->f[r]) {
free16(ulsch->harq_processes[i]->f[r],68*384);
ulsch->harq_processes[i]->f[r] = NULL;
}
}
free16(ulsch->harq_processes[i],sizeof(NR_UL_UE_HARQ_t));
ulsch->harq_processes[i] = NULL;
}
}
free16(ulsch,sizeof(NR_UE_ULSCH_t));
ulsch = NULL;
}
}
NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag)
{
NR_UE_ULSCH_t *ulsch;
unsigned char exit_flag = 0,i,j,r;
unsigned char bw_scaling =1;
switch (N_RB_UL) {
case 106:
bw_scaling =2;
break;
default:
bw_scaling =1;
break;
}
ulsch = (NR_UE_ULSCH_t *)malloc16(sizeof(NR_UE_ULSCH_t));
if (ulsch) {
memset(ulsch,0,sizeof(NR_UE_ULSCH_t));
ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
ulsch->Mlimit = 4; // maximum harq retransmissions
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));
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
if (ulsch->harq_processes[i]) {
memset(ulsch->harq_processes[i], 0, sizeof(NR_UL_UE_HARQ_t));
ulsch->harq_processes[i]->b = (unsigned char*)malloc16(MAX_NR_ULSCH_PAYLOAD_BYTES/bw_scaling);
ulsch->harq_processes[i]->a = (uint8_t*)malloc16(MAX_NR_ULSCH_PAYLOAD_BYTES/bw_scaling);
if (ulsch->harq_processes[i]->a) {
bzero(ulsch->harq_processes[i]->a,MAX_NR_ULSCH_PAYLOAD_BYTES/bw_scaling);
} else {
printf("Can't allocate PDU\n");
exit_flag=1;
}
if (ulsch->harq_processes[i]->b)
memset(ulsch->harq_processes[i]->b,0,MAX_NR_ULSCH_PAYLOAD_BYTES/bw_scaling);
else {
LOG_E(PHY,"Can't get b\n");
exit_flag=1;
}
if (abstraction_flag==0) {
for (r=0; r<MAX_NUM_NR_ULSCH_SEGMENTS/bw_scaling; 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
ulsch->harq_processes[i]->e[r] = (uint8_t*)malloc16(68*384);
ulsch->harq_processes[i]->f[r] = (uint8_t*)malloc16(68*384);
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;
}
if (ulsch->harq_processes[i]->e[r]) {
bzero(ulsch->harq_processes[i]->e[r],(68*384));
} else {
printf("Can't get e\n");
exit_flag=2;
}
if (ulsch->harq_processes[i]->f[r]) {
bzero(ulsch->harq_processes[i]->f[r],(68*384));
} else {
printf("Can't get f\n");
exit_flag=2;
}
}
}
ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
ulsch->harq_processes[i]->first_tx = 1;
} else {
LOG_E(PHY,"Can't get harq_p %d\n",i);
exit_flag=3;
}
}
if ((abstraction_flag == 0) && (exit_flag==0)) {
for (i=0; i<8; i++)
for (j=0; j<96; j++)
for (r=0; r<MAX_NUM_NR_ULSCH_SEGMENTS/bw_scaling; r++)
ulsch->harq_processes[i]->d[r][j] = NR_NULL;
return(ulsch);
} else if (abstraction_flag==1)
return(ulsch);
}
LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t));
free_nr_ue_ulsch(ulsch);
return(NULL);
}
\ No newline at end of file
...@@ -1044,8 +1044,8 @@ typedef struct { ...@@ -1044,8 +1044,8 @@ typedef struct {
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_eNB_MAX]; NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX]; NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_eNB_MAX]; NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][2]; // two RxTx Threads NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads
NR_UE_ULSCH_t *ulsch[NUMBER_OF_CONNECTED_eNB_MAX]; NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words
NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_eNB_MAX]; NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_eNB_MAX]; NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_eNB_MAX];
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_eNB_MAX]; NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_eNB_MAX];
......
...@@ -150,7 +150,7 @@ void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_i ...@@ -150,7 +150,7 @@ void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_i
* *
*********************************************************************/ *********************************************************************/
void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_harq_processes_pusch) void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx, uint8_t number_harq_processes_pusch)
{ {
NR_UE_ULSCH_t *ulsch; NR_UE_ULSCH_t *ulsch;
...@@ -160,7 +160,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h ...@@ -160,7 +160,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h
memset(ulsch,0,sizeof(NR_UE_ULSCH_t)); memset(ulsch,0,sizeof(NR_UE_ULSCH_t));
ue->ulsch[gNB_id] = ulsch; ue->ulsch[thread_id][gNB_id][code_word_idx] = ulsch;
} }
else { else {
LOG_E(PHY, "Fatal memory allocation problem at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__); LOG_E(PHY, "Fatal memory allocation problem at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__);
...@@ -185,7 +185,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h ...@@ -185,7 +185,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h
} }
for (int slot_tx = 0; slot_tx < NR_MAX_SLOTS_PER_FRAME; slot_tx++) { for (int slot_tx = 0; slot_tx < NR_MAX_SLOTS_PER_FRAME; slot_tx++) {
ue->ulsch[gNB_id]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES; ue->ulsch[thread_id][gNB_id][code_word_idx]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES;
} }
} }
...@@ -202,9 +202,9 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h ...@@ -202,9 +202,9 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_h
* *
*********************************************************************/ *********************************************************************/
void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id) void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx)
{ {
NR_UE_ULSCH_t *ulsch = ue->ulsch[gNB_id]; NR_UE_ULSCH_t *ulsch = ue->ulsch[thread_id][gNB_id][code_word_idx];
for (int process_id = 0; process_id < ulsch->number_harq_processes_for_pusch; process_id++) { for (int process_id = 0; process_id < ulsch->number_harq_processes_for_pusch; process_id++) {
...@@ -215,7 +215,7 @@ void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id) ...@@ -215,7 +215,7 @@ void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id)
free16(ulsch, sizeof(NR_UE_ULSCH_t)); free16(ulsch, sizeof(NR_UE_ULSCH_t));
ue->ulsch[gNB_id] = NULL; ue->ulsch[thread_id][gNB_id][code_word_idx] = NULL;
} }
/******************************************************************* /*******************************************************************
......
...@@ -83,17 +83,21 @@ void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_i ...@@ -83,17 +83,21 @@ void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_i
/** \brief This function configures uplink HARQ context /** \brief This function configures uplink HARQ context
@param PHY_VARS_NR_UE ue context @param PHY_VARS_NR_UE ue context
@param gNB_id gNodeB identifier @param gNB_id gNodeB identifier
@param thread_id RXTX thread index
@param code_word_idx code word index
@param number_harq_processes_pusch maximum number of uplink HARQ processes @param number_harq_processes_pusch maximum number of uplink HARQ processes
@returns none */ @returns none */
void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_harq_processes_pusch); void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx, uint8_t number_harq_processes_pusch);
/** \brief This function releases uplink HARQ context /** \brief This function releases uplink HARQ context
@param PHY_VARS_NR_UE ue context @param PHY_VARS_NR_UE ue context
@param gNB_id gNodeB identifier @param gNB_id gNodeB identifier
@param thread_id RXTX thread index
@param code_word_idx code word index
@returns none */ @returns none */
void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id); void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx);
/** \brief This function stores slot for transmission in HARQ context /** \brief This function stores slot for transmission in HARQ context
@param ulsch uplink context @param ulsch uplink context
......
...@@ -144,7 +144,7 @@ int main(int argc, char **argv) { ...@@ -144,7 +144,7 @@ int main(int argc, char **argv) {
//char input_val_str[50],input_val_str2[50]; //char input_val_str[50],input_val_str2[50];
//uint16_t NB_RB=25; //uint16_t NB_RB=25;
SCM_t channel_model = AWGN; //Rayleigh1_anticorr; SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
uint16_t N_RB_DL = 106, mu = 1; uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
unsigned char frame_type = 0; unsigned char frame_type = 0;
unsigned char pbch_phase = 0; unsigned char pbch_phase = 0;
int frame = 0, subframe = 0; int frame = 0, subframe = 0;
...@@ -291,6 +291,7 @@ int main(int argc, char **argv) { ...@@ -291,6 +291,7 @@ int main(int argc, char **argv) {
case 'R': case 'R':
N_RB_DL = atoi(optarg); N_RB_DL = atoi(optarg);
N_RB_UL = N_RB_DL;
break; break;
case 'F': case 'F':
...@@ -381,6 +382,7 @@ int main(int argc, char **argv) { ...@@ -381,6 +382,7 @@ int main(int argc, char **argv) {
frame_parms->nb_antennas_tx = n_tx; frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx; frame_parms->nb_antennas_rx = n_rx;
frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_DL = N_RB_DL;
frame_parms->N_RB_UL = N_RB_UL;
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
crcTableInit(); crcTableInit();
nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell); nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell);
...@@ -446,6 +448,13 @@ int main(int argc, char **argv) { ...@@ -446,6 +448,13 @@ int main(int argc, char **argv) {
exit(-1); exit(-1);
} }
UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8, 0);
if (!UE->ulsch[sf][0][i]) {
printf("Can't get ue ulsch structures\n");
exit(-1);
}
UE->dlsch[sf][0][i]->rnti = n_rnti; UE->dlsch[sf][0][i]->rnti = n_rnti;
} }
} }
...@@ -649,6 +658,7 @@ int main(int argc, char **argv) { ...@@ -649,6 +658,7 @@ int main(int argc, char **argv) {
free_gNB_dlsch(gNB->dlsch[0][i]); free_gNB_dlsch(gNB->dlsch[0][i]);
printf("UE %d\n", i); printf("UE %d\n", i);
free_nr_ue_dlsch(UE->dlsch[0][0][i]); free_nr_ue_dlsch(UE->dlsch[0][0][i]);
free_nr_ue_ulsch(UE->ulsch[0][0][i]);
} }
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
......
...@@ -54,6 +54,8 @@ ...@@ -54,6 +54,8 @@
int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue) int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue)
{ {
int gNB_id = 0; int gNB_id = 0;
int thread_number = 0;
int code_word_idx = 0;
int harq_pid = 0; int harq_pid = 0;
int ndi = 1; int ndi = 1;
uint8_t rnti_type = _C_RNTI_; uint8_t rnti_type = _C_RNTI_;
...@@ -61,7 +63,7 @@ int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue) ...@@ -61,7 +63,7 @@ int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue)
printf("\nHARQ Uplink \n"); printf("\nHARQ Uplink \n");
config_uplink_harq_process(phy_vars_ue , gNB_id, NR_DEFAULT_DLSCH_HARQ_PROCESSES); config_uplink_harq_process(phy_vars_ue , gNB_id, thread_number, code_word_idx, NR_DEFAULT_DLSCH_HARQ_PROCESSES);
NR_UE_ULSCH_t *ulsch_harq = phy_vars_ue->ulsch[gNB_id]; NR_UE_ULSCH_t *ulsch_harq = phy_vars_ue->ulsch[gNB_id];
...@@ -91,7 +93,7 @@ int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue) ...@@ -91,7 +93,7 @@ int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue)
} }
} }
release_uplink_harq_process(phy_vars_ue , gNB_id); release_uplink_harq_process(phy_vars_ue , gNB_id, thread_number, code_word_idx);
return 0; return 0;
} }
......
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