Merge remote-tracking branch 'origin/NR_UE_ulsch_local_vars' into integration_2022_wk47
This commit is contained in:
+4
-2
@@ -608,6 +608,7 @@ void processSlotTX(void *arg) {
|
|||||||
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
|
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
|
||||||
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
||||||
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
||||||
|
nr_phy_data_tx_t phy_data = {0};
|
||||||
|
|
||||||
LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type);
|
LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type);
|
||||||
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT){
|
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT){
|
||||||
@@ -627,12 +628,13 @@ void processSlotTX(void *arg) {
|
|||||||
ul_indication.frame_tx = proc->frame_tx;
|
ul_indication.frame_tx = proc->frame_tx;
|
||||||
ul_indication.slot_tx = proc->nr_slot_tx;
|
ul_indication.slot_tx = proc->nr_slot_tx;
|
||||||
ul_indication.ue_sched_mode = rxtxD->ue_sched_mode;
|
ul_indication.ue_sched_mode = rxtxD->ue_sched_mode;
|
||||||
|
ul_indication.phy_data = &phy_data;
|
||||||
|
|
||||||
UE->if_inst->ul_indication(&ul_indication);
|
UE->if_inst->ul_indication(&ul_indication);
|
||||||
stop_meas(&UE->ue_ul_indication_stats);
|
stop_meas(&UE->ue_ul_indication_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
phy_procedures_nrUE_TX(UE,proc,proc->gNB_id);
|
phy_procedures_nrUE_TX(UE, proc, proc->gNB_id, &phy_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,7 +688,7 @@ void UE_processing(nr_rxtx_thread_data_t *rxtxD) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT) {
|
if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT) {
|
||||||
nr_phy_data_t phy_data = {0};
|
nr_phy_data_tx_t phy_data = {0};
|
||||||
if (UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
|
if (UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
|
||||||
nr_uplink_indication_t ul_indication;
|
nr_uplink_indication_t ul_indication;
|
||||||
memset((void*)&ul_indication, 0, sizeof(ul_indication));
|
memset((void*)&ul_indication, 0, sizeof(ul_indication));
|
||||||
|
|||||||
@@ -648,19 +648,42 @@ void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t* harq_list, int number_of_processes, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
|
void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t *harq_list, int number_of_processes, int num_rb, int num_ant_tx) {
|
||||||
{
|
|
||||||
const int N_RB_DL = ue->frame_parms.N_RB_DL;
|
int max_layers = (num_ant_tx < NR_MAX_NB_LAYERS) ? num_ant_tx : NR_MAX_NB_LAYERS;
|
||||||
int num_cw = NR_MAX_NB_LAYERS > 4? 2:1;
|
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
|
||||||
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
|
||||||
for (int j = 0; j < num_cw; j++) {
|
if (num_rb != 273) {
|
||||||
free_nr_ue_dl_harq(ue->dl_harq_processes[j], NR_MAX_DLSCH_HARQ_PROCESSES, N_RB_DL);
|
a_segments = a_segments*num_rb;
|
||||||
free_nr_ue_ulsch(&ue->ulsch[i], N_RB_DL, &ue->frame_parms);
|
a_segments = a_segments/273 +1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < number_of_processes; i++) {
|
||||||
|
free_and_zero(harq_list[i].a);
|
||||||
|
free_and_zero(harq_list[i].b);
|
||||||
|
for (int r = 0; r < a_segments; r++) {
|
||||||
|
free_and_zero(harq_list[i].c[r]);
|
||||||
|
free_and_zero(harq_list[i].d[r]);
|
||||||
}
|
}
|
||||||
|
free_and_zero(harq_list[i].c);
|
||||||
|
free_and_zero(harq_list[i].d);
|
||||||
|
free_and_zero(harq_list[i].e);
|
||||||
|
free_and_zero(harq_list[i].f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_init_harq_processes(NR_DL_UE_HARQ_t* harq_list, int number_of_processes, int num_rb) {
|
void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
|
||||||
|
{
|
||||||
|
const int N_RB_DL = ue->frame_parms.N_RB_DL;
|
||||||
|
const int N_RB_UL = ue->frame_parms.N_RB_UL;
|
||||||
|
int num_cw = NR_MAX_NB_LAYERS > 4? 2:1;
|
||||||
|
for (int j = 0; j < num_cw; j++) {
|
||||||
|
free_nr_ue_dl_harq(ue->dl_harq_processes[j], NR_MAX_DLSCH_HARQ_PROCESSES, N_RB_DL);
|
||||||
|
}
|
||||||
|
free_nr_ue_ul_harq(ue->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, N_RB_UL, ue->frame_parms.nb_antennas_tx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t* harq_list, int number_of_processes, int num_rb) {
|
||||||
|
|
||||||
int a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
|
int a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
|
||||||
if (num_rb != 273) {
|
if (num_rb != 273) {
|
||||||
@@ -698,19 +721,63 @@ void nr_init_harq_processes(NR_DL_UE_HARQ_t* harq_list, int number_of_processes,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t *harq_list, int number_of_processes, int num_rb, int num_ant_tx) {
|
||||||
|
|
||||||
|
int max_layers = (num_ant_tx < NR_MAX_NB_LAYERS) ? num_ant_tx : NR_MAX_NB_LAYERS;
|
||||||
|
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
|
||||||
|
|
||||||
|
if (num_rb != 273) {
|
||||||
|
a_segments = a_segments*num_rb;
|
||||||
|
a_segments = a_segments/273 +1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
|
||||||
|
|
||||||
|
for (int i = 0; i < number_of_processes; i++) {
|
||||||
|
|
||||||
|
memset(harq_list + i, 0, sizeof(NR_UL_UE_HARQ_t));
|
||||||
|
|
||||||
|
harq_list[i].a = malloc16(ulsch_bytes);
|
||||||
|
DevAssert(harq_list[i].a);
|
||||||
|
bzero(harq_list[i].a, ulsch_bytes);
|
||||||
|
|
||||||
|
harq_list[i].b = malloc16(ulsch_bytes);
|
||||||
|
DevAssert(harq_list[i].b);
|
||||||
|
bzero(harq_list[i].b, ulsch_bytes);
|
||||||
|
|
||||||
|
harq_list[i].c = malloc16(a_segments*sizeof(uint8_t *));
|
||||||
|
harq_list[i].d = malloc16(a_segments*sizeof(uint16_t *));
|
||||||
|
for (int r = 0; r < a_segments; r++) {
|
||||||
|
harq_list[i].c[r] = malloc16(8448);
|
||||||
|
DevAssert(harq_list[i].c[r]);
|
||||||
|
bzero(harq_list[i].c[r],8448);
|
||||||
|
|
||||||
|
harq_list[i].d[r] = malloc16(68*384); //max size for coded output
|
||||||
|
DevAssert(harq_list[i].d[r]);
|
||||||
|
bzero(harq_list[i].d[r],(68*384));
|
||||||
|
}
|
||||||
|
|
||||||
|
harq_list[i].e = malloc16(14*num_rb*12*8);
|
||||||
|
DevAssert(harq_list[i].e);
|
||||||
|
bzero(harq_list[i].e,14*num_rb*12*8);
|
||||||
|
|
||||||
|
harq_list[i].f = malloc16(14*num_rb*12*8);
|
||||||
|
DevAssert(harq_list[i].f);
|
||||||
|
bzero(harq_list[i].f,14*num_rb*12*8);
|
||||||
|
|
||||||
|
harq_list[i].first_tx = 1;
|
||||||
|
harq_list[i].round = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue) {
|
void init_nr_ue_transport(PHY_VARS_NR_UE *ue) {
|
||||||
|
|
||||||
int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1;
|
int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1;
|
||||||
|
|
||||||
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
for (int j=0; j<num_codeword; j++) {
|
||||||
for (int j=0; j<num_codeword; j++) {
|
nr_init_dl_harq_processes(ue->dl_harq_processes[j], NR_MAX_DLSCH_HARQ_PROCESSES, ue->frame_parms.N_RB_DL);
|
||||||
nr_init_harq_processes(ue->dl_harq_processes[j], NR_MAX_DLSCH_HARQ_PROCESSES, ue->frame_parms.N_RB_DL);
|
|
||||||
if (j==0) {
|
|
||||||
AssertFatal((ue->ulsch[i] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES,&ue->frame_parms))!=NULL,"Can't get ue ulsch structures\n");
|
|
||||||
LOG_D(PHY,"ulsch[%d] => %p\n",i,ue->ulsch[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
nr_init_ul_harq_processes(ue->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, ue->frame_parms.N_RB_UL, ue->frame_parms.nb_antennas_tx);
|
||||||
|
|
||||||
for(int i=0; i<5; i++)
|
for(int i=0; i<5; i++)
|
||||||
ue->dl_stats[i] = 0;
|
ue->dl_stats[i] = 0;
|
||||||
|
|||||||
@@ -418,8 +418,10 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg);
|
|||||||
|
|
||||||
void RCconfig_nrUE_prs(void *cfg);
|
void RCconfig_nrUE_prs(void *cfg);
|
||||||
void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue);
|
void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue);
|
||||||
void nr_init_harq_processes(NR_DL_UE_HARQ_t* harq_list, int number_of_processes, int num_rb);
|
void nr_init_dl_harq_processes(NR_DL_UE_HARQ_t* harq_list, int number_of_processes, int num_rb);
|
||||||
|
void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t *harq_list, int number_of_processes, int num_rb, int num_ant_tx);
|
||||||
void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t* harq_list, int number_of_processes, int num_rb);
|
void free_nr_ue_dl_harq(NR_DL_UE_HARQ_t* harq_list, int number_of_processes, int num_rb);
|
||||||
|
void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t *harq_list, int number_of_processes, int num_rb, int num_ant_tx);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -52,13 +52,6 @@
|
|||||||
*/
|
*/
|
||||||
void nr_ue_dlsch_init(NR_UE_DLSCH_t *dlsch_list, int num_dlsch, uint8_t max_ldpc_iterations);
|
void nr_ue_dlsch_init(NR_UE_DLSCH_t *dlsch_list, int num_dlsch, uint8_t max_ldpc_iterations);
|
||||||
|
|
||||||
void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,
|
|
||||||
uint16_t N_RB_UL,
|
|
||||||
NR_DL_FRAME_PARMS* frame_parms);
|
|
||||||
|
|
||||||
|
|
||||||
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids, NR_DL_FRAME_PARMS* frame_parms);
|
|
||||||
|
|
||||||
/** \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
|
||||||
@param stream1_in Input from channel compensated (MR combined) stream 1
|
@param stream1_in Input from channel compensated (MR combined) stream 1
|
||||||
@@ -735,7 +728,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
unsigned char harq_pid,
|
unsigned char harq_pid,
|
||||||
uint32_t frame,
|
uint32_t frame,
|
||||||
uint8_t slot,
|
uint8_t slot,
|
||||||
int gNB_id);
|
int gNB_id,
|
||||||
|
nr_phy_data_tx_t *phy_data);
|
||||||
|
|
||||||
|
|
||||||
/** \brief This function does IFFT for PUSCH
|
/** \brief This function does IFFT for PUSCH
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ typedef enum {
|
|||||||
} harq_result_t;
|
} harq_result_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// NDAPI struct for UE
|
|
||||||
nfapi_nr_ue_pusch_pdu_t pusch_pdu;
|
|
||||||
/// Indicator of first transmission
|
/// Indicator of first transmission
|
||||||
uint8_t first_tx;
|
uint8_t first_tx;
|
||||||
/// HARQ tx status
|
/// HARQ tx status
|
||||||
@@ -120,11 +118,10 @@ typedef struct {
|
|||||||
} NR_UL_UE_HARQ_t;
|
} NR_UL_UE_HARQ_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/// NDAPI struct for UE
|
||||||
|
nfapi_nr_ue_pusch_pdu_t pusch_pdu;
|
||||||
/// SRS active flag
|
/// SRS active flag
|
||||||
uint8_t srs_active;
|
uint8_t srs_active;
|
||||||
// Pointers to HARQ processes for the ULSCH
|
|
||||||
NR_UL_UE_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
|
|
||||||
int harq_process_id[NR_MAX_SLOTS_PER_FRAME];
|
|
||||||
// UL number of harq processes
|
// UL number of harq processes
|
||||||
uint8_t number_harq_processes_for_pusch;
|
uint8_t number_harq_processes_for_pusch;
|
||||||
/// 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)
|
||||||
|
|||||||
@@ -43,137 +43,6 @@
|
|||||||
|
|
||||||
//#define DEBUG_ULSCH_CODING
|
//#define DEBUG_ULSCH_CODING
|
||||||
|
|
||||||
void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,
|
|
||||||
uint16_t N_RB_UL,
|
|
||||||
NR_DL_FRAME_PARMS* frame_parms) {
|
|
||||||
|
|
||||||
NR_UE_ULSCH_t *ulsch = *ulschptr;
|
|
||||||
|
|
||||||
if (ulsch) {
|
|
||||||
#ifdef DEBUG_ULSCH_FREE
|
|
||||||
printf("Freeing ulsch %p\n",ulsch);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
|
|
||||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
|
|
||||||
|
|
||||||
if (N_RB_UL != 273) {
|
|
||||||
a_segments = a_segments*N_RB_UL;
|
|
||||||
a_segments = a_segments/273 +1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
|
||||||
if (ulsch->harq_processes[i]) {
|
|
||||||
|
|
||||||
if (ulsch->harq_processes[i]->a) {
|
|
||||||
free16(ulsch->harq_processes[i]->a,a_segments*1056);
|
|
||||||
ulsch->harq_processes[i]->a = NULL;
|
|
||||||
}
|
|
||||||
if (ulsch->harq_processes[i]->b) {
|
|
||||||
free16(ulsch->harq_processes[i]->b,a_segments*1056);
|
|
||||||
ulsch->harq_processes[i]->b = NULL;
|
|
||||||
}
|
|
||||||
if (ulsch->harq_processes[i]->e) {
|
|
||||||
free16(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
|
|
||||||
ulsch->harq_processes[i]->e = NULL;
|
|
||||||
}
|
|
||||||
if (ulsch->harq_processes[i]->f) {
|
|
||||||
free16(ulsch->harq_processes[i]->f,14*N_RB_UL*12*8);
|
|
||||||
ulsch->harq_processes[i]->f = NULL;
|
|
||||||
}
|
|
||||||
for (int r=0; r<a_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]->c) {
|
|
||||||
free16(ulsch->harq_processes[i]->c,a_segments);
|
|
||||||
ulsch->harq_processes[i]->c = NULL;
|
|
||||||
}
|
|
||||||
if (ulsch->harq_processes[i]->d) {
|
|
||||||
free16(ulsch->harq_processes[i]->d,a_segments);
|
|
||||||
ulsch->harq_processes[i]->d = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
free16(ulsch->harq_processes[i],sizeof(NR_UL_UE_HARQ_t));
|
|
||||||
ulsch->harq_processes[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free16(ulsch,sizeof(NR_UE_ULSCH_t));
|
|
||||||
*ulschptr = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids, NR_DL_FRAME_PARMS* frame_parms) {
|
|
||||||
|
|
||||||
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
|
|
||||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
|
|
||||||
|
|
||||||
if (N_RB_UL != 273) {
|
|
||||||
a_segments = a_segments*N_RB_UL;
|
|
||||||
a_segments = a_segments/273 +1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
|
|
||||||
|
|
||||||
NR_UE_ULSCH_t *ulsch = malloc16(sizeof(NR_UE_ULSCH_t));
|
|
||||||
DevAssert(ulsch);
|
|
||||||
memset(ulsch, 0, sizeof(*ulsch));
|
|
||||||
|
|
||||||
ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
|
|
||||||
|
|
||||||
for (int i = 0; i < number_of_harq_pids; i++) {
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
ulsch->harq_processes[i]->a = malloc16(ulsch_bytes);
|
|
||||||
DevAssert(ulsch->harq_processes[i]->a);
|
|
||||||
bzero(ulsch->harq_processes[i]->a,ulsch_bytes);
|
|
||||||
|
|
||||||
ulsch->harq_processes[i]->b = malloc16(ulsch_bytes);
|
|
||||||
DevAssert(ulsch->harq_processes[i]->b);
|
|
||||||
bzero(ulsch->harq_processes[i]->b,ulsch_bytes);
|
|
||||||
|
|
||||||
ulsch->harq_processes[i]->c = malloc16(a_segments*sizeof(uint8_t *));
|
|
||||||
ulsch->harq_processes[i]->d = malloc16(a_segments*sizeof(uint16_t *));
|
|
||||||
for (int r = 0; r < a_segments; r++) {
|
|
||||||
// account for filler in first segment and CRCs for multiple segment case
|
|
||||||
ulsch->harq_processes[i]->c[r] = malloc16(8448);
|
|
||||||
DevAssert(ulsch->harq_processes[i]->c[r]);
|
|
||||||
bzero(ulsch->harq_processes[i]->c[r],8448);
|
|
||||||
|
|
||||||
ulsch->harq_processes[i]->d[r] = malloc16(68*384); //max size for coded output
|
|
||||||
DevAssert(ulsch->harq_processes[i]->d[r]);
|
|
||||||
bzero(ulsch->harq_processes[i]->d[r],(68*384));
|
|
||||||
}
|
|
||||||
|
|
||||||
ulsch->harq_processes[i]->e = malloc16(14*N_RB_UL*12*8);
|
|
||||||
DevAssert(ulsch->harq_processes[i]->e);
|
|
||||||
bzero(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
|
|
||||||
|
|
||||||
ulsch->harq_processes[i]->f = malloc16(14*N_RB_UL*12*8);
|
|
||||||
DevAssert(ulsch->harq_processes[i]->f);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||||
NR_UE_ULSCH_t *ulsch,
|
NR_UE_ULSCH_t *ulsch,
|
||||||
NR_DL_FRAME_PARMS* frame_parms,
|
NR_DL_FRAME_PARMS* frame_parms,
|
||||||
@@ -186,29 +55,29 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
|||||||
///////////
|
///////////
|
||||||
|
|
||||||
unsigned int crc = 1;
|
unsigned int crc = 1;
|
||||||
NR_UL_UE_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
NR_UL_UE_HARQ_t *harq_process = &ue->ul_harq_processes[harq_pid];
|
||||||
uint16_t nb_rb = harq_process->pusch_pdu.rb_size;
|
uint16_t nb_rb = ulsch->pusch_pdu.rb_size;
|
||||||
uint32_t A = harq_process->pusch_pdu.pusch_data.tb_size<<3;
|
uint32_t A = ulsch->pusch_pdu.pusch_data.tb_size<<3;
|
||||||
uint32_t *pz = &harq_process->Z;
|
uint32_t *pz = &harq_process->Z;
|
||||||
uint8_t mod_order = harq_process->pusch_pdu.qam_mod_order;
|
uint8_t mod_order = ulsch->pusch_pdu.qam_mod_order;
|
||||||
uint16_t Kr=0;
|
uint16_t Kr=0;
|
||||||
uint32_t r_offset=0;
|
uint32_t r_offset=0;
|
||||||
uint32_t F=0;
|
uint32_t F=0;
|
||||||
// target_code_rate is in 0.1 units
|
// target_code_rate is in 0.1 units
|
||||||
float Coderate = (float) harq_process->pusch_pdu.target_code_rate / 10240.0f;
|
float Coderate = (float) ulsch->pusch_pdu.target_code_rate / 10240.0f;
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
LOG_D(NR_PHY, "ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers);
|
LOG_D(NR_PHY, "ulsch coding nb_rb %d, Nl = %d\n", nb_rb, ulsch->pusch_pdu.nrOfLayers);
|
||||||
LOG_D(NR_PHY, "ulsch coding A %d G %d mod_order %d Coderate %f\n", A, G, mod_order, Coderate);
|
LOG_D(NR_PHY, "ulsch coding A %d G %d mod_order %d Coderate %f\n", A, G, mod_order, Coderate);
|
||||||
LOG_D(NR_PHY, "harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n",
|
LOG_D(NR_PHY, "harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n",
|
||||||
harq_pid,harq_process->ndi,harq_process->pusch_pdu.pusch_data.new_data_indicator);
|
harq_pid,harq_process->ndi,ulsch->pusch_pdu.pusch_data.new_data_indicator);
|
||||||
|
|
||||||
if (harq_process->first_tx == 1 ||
|
if (harq_process->first_tx == 1 ||
|
||||||
harq_process->ndi != harq_process->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet
|
harq_process->ndi != ulsch->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet
|
||||||
#ifdef DEBUG_ULSCH_CODING
|
#ifdef DEBUG_ULSCH_CODING
|
||||||
printf("encoding thinks this is a new packet \n");
|
printf("encoding thinks this is a new packet \n");
|
||||||
#endif
|
#endif
|
||||||
@@ -223,7 +92,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int max_payload_bytes = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*harq_process->pusch_pdu.nrOfLayers*1056;
|
int max_payload_bytes = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*ulsch->pusch_pdu.nrOfLayers*1056;
|
||||||
|
|
||||||
if (A > 3824) {
|
if (A > 3824) {
|
||||||
// Add 24-bit crc (polynomial A) to payload
|
// Add 24-bit crc (polynomial A) to payload
|
||||||
@@ -278,7 +147,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
|||||||
&harq_process->F,
|
&harq_process->F,
|
||||||
harq_process->BG);
|
harq_process->BG);
|
||||||
|
|
||||||
if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->pusch_pdu.nrOfLayers) {
|
if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*ulsch->pusch_pdu.nrOfLayers) {
|
||||||
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B);
|
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@@ -350,8 +219,8 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
///////////
|
///////////
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
LOG_D(PHY,"setting ndi to %d from pusch_data\n", harq_process->pusch_pdu.pusch_data.new_data_indicator);
|
LOG_D(PHY,"setting ndi to %d from pusch_data\n", ulsch->pusch_pdu.pusch_data.new_data_indicator);
|
||||||
harq_process->ndi = harq_process->pusch_pdu.pusch_data.new_data_indicator;
|
harq_process->ndi = ulsch->pusch_pdu.pusch_data.new_data_indicator;
|
||||||
}
|
}
|
||||||
F = harq_process->F;
|
F = harq_process->F;
|
||||||
Kr = harq_process->K;
|
Kr = harq_process->K;
|
||||||
@@ -371,17 +240,17 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
|||||||
G,
|
G,
|
||||||
Kr*3,
|
Kr*3,
|
||||||
mod_order,nb_rb,
|
mod_order,nb_rb,
|
||||||
harq_process->pusch_pdu.pusch_data.rv_index);
|
ulsch->pusch_pdu.pusch_data.rv_index);
|
||||||
|
|
||||||
//start_meas(rm_stats);
|
//start_meas(rm_stats);
|
||||||
///////////////////////// d---->| Rate matching bit selection |---->e /////////////////////////
|
///////////////////////// d---->| Rate matching bit selection |---->e /////////////////////////
|
||||||
///////////
|
///////////
|
||||||
|
|
||||||
uint32_t E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r);
|
uint32_t E = nr_get_E(G, harq_process->C, mod_order, ulsch->pusch_pdu.nrOfLayers, r);
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
|
||||||
start_meas(&ue->ulsch_rate_matching_stats);
|
start_meas(&ue->ulsch_rate_matching_stats);
|
||||||
if (nr_rate_matching_ldpc(harq_process->pusch_pdu.tbslbrm,
|
if (nr_rate_matching_ldpc(ulsch->pusch_pdu.tbslbrm,
|
||||||
harq_process->BG,
|
harq_process->BG,
|
||||||
*pz,
|
*pz,
|
||||||
harq_process->d[r],
|
harq_process->d[r],
|
||||||
@@ -389,7 +258,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
|||||||
harq_process->C,
|
harq_process->C,
|
||||||
F,
|
F,
|
||||||
Kr-F-2*(*pz),
|
Kr-F-2*(*pz),
|
||||||
harq_process->pusch_pdu.pusch_data.rv_index,
|
ulsch->pusch_pdu.pusch_data.rv_index,
|
||||||
E) == -1)
|
E) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
unsigned char harq_pid,
|
unsigned char harq_pid,
|
||||||
uint32_t frame,
|
uint32_t frame,
|
||||||
uint8_t slot,
|
uint8_t slot,
|
||||||
int gNB_id) {
|
int gNB_id,
|
||||||
|
nr_phy_data_tx_t *phy_data) {
|
||||||
|
|
||||||
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
||||||
|
|
||||||
@@ -126,9 +127,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||||
uint16_t number_dmrs_symbols = 0;
|
uint16_t number_dmrs_symbols = 0;
|
||||||
|
|
||||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[gNB_id];
|
NR_UE_ULSCH_t *ulsch_ue = &phy_data->ulsch;
|
||||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
NR_UL_UE_HARQ_t *harq_process_ul_ue = &UE->ul_harq_processes[harq_pid];
|
||||||
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu;
|
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch_ue->pusch_pdu;
|
||||||
|
|
||||||
int start_symbol = pusch_pdu->start_symbol_index;
|
int start_symbol = pusch_pdu->start_symbol_index;
|
||||||
uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos;
|
uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos;
|
||||||
@@ -169,7 +170,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
|
|
||||||
trace_NRpdu(DIRECTION_UPLINK,
|
trace_NRpdu(DIRECTION_UPLINK,
|
||||||
harq_process_ul_ue->a,
|
harq_process_ul_ue->a,
|
||||||
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size,
|
pusch_pdu->pusch_data.tb_size,
|
||||||
WS_C_RNTI, rnti, frame, slot, 0, 0);
|
WS_C_RNTI, rnti, frame, slot, 0, 0);
|
||||||
|
|
||||||
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1)
|
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1)
|
||||||
@@ -236,8 +237,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
|
|
||||||
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||||
|
|
||||||
K_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density;
|
K_ptrs = pusch_pdu->pusch_ptrs.ptrs_freq_density;
|
||||||
L_ptrs = 1<<harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_time_density;
|
L_ptrs = 1<<pusch_pdu->pusch_ptrs.ptrs_time_density;
|
||||||
|
|
||||||
beta_ptrs = 1; // temp value until power control is implemented
|
beta_ptrs = 1; // temp value until power control is implemented
|
||||||
|
|
||||||
@@ -572,7 +573,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
}// port loop
|
}// port loop
|
||||||
|
|
||||||
NR_UL_UE_HARQ_t *harq_process_ulsch=NULL;
|
NR_UL_UE_HARQ_t *harq_process_ulsch=NULL;
|
||||||
harq_process_ulsch = UE->ulsch[gNB_id]->harq_processes[harq_pid];
|
harq_process_ulsch = &UE->ul_harq_processes[harq_pid];
|
||||||
harq_process_ulsch->status = SCH_IDLE;
|
harq_process_ulsch->status = SCH_IDLE;
|
||||||
|
|
||||||
for (int nl = 0; nl < Nl; nl++) {
|
for (int nl = 0; nl < Nl; nl++) {
|
||||||
|
|||||||
@@ -538,10 +538,10 @@ typedef struct {
|
|||||||
NR_UE_CSI_IM *csiim_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
NR_UE_CSI_IM *csiim_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_CSI_RS *csirs_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
NR_UE_CSI_RS *csirs_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||||
NR_UE_ULSCH_t *ulsch[NUMBER_OF_CONNECTED_gNB_MAX];
|
|
||||||
NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE];
|
NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE];
|
||||||
uint8_t prs_active_gNBs;
|
uint8_t prs_active_gNBs;
|
||||||
NR_DL_UE_HARQ_t dl_harq_processes[NR_MAX_NB_LAYERS>4 ? 2:1][NR_MAX_DLSCH_HARQ_PROCESSES];
|
NR_DL_UE_HARQ_t dl_harq_processes[NR_MAX_NB_LAYERS>4 ? 2:1][NR_MAX_DLSCH_HARQ_PROCESSES];
|
||||||
|
NR_UL_UE_HARQ_t ul_harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
|
||||||
|
|
||||||
//Paging parameters
|
//Paging parameters
|
||||||
uint32_t IMSImod1024;
|
uint32_t IMSImod1024;
|
||||||
@@ -752,8 +752,12 @@ typedef struct {
|
|||||||
void* scopeData;
|
void* scopeData;
|
||||||
} PHY_VARS_NR_UE;
|
} PHY_VARS_NR_UE;
|
||||||
|
|
||||||
typedef struct nr_phy_data_s {
|
typedef struct nr_phy_data_tx_s {
|
||||||
|
NR_UE_ULSCH_t ulsch;
|
||||||
NR_UE_PUCCH pucch_vars;
|
NR_UE_PUCCH pucch_vars;
|
||||||
|
} nr_phy_data_tx_t;
|
||||||
|
|
||||||
|
typedef struct nr_phy_data_s {
|
||||||
NR_UE_PDCCH_CONFIG phy_pdcch_config;
|
NR_UE_PDCCH_CONFIG phy_pdcch_config;
|
||||||
NR_UE_DLSCH_t dlsch[NR_MAX_NB_LAYERS>4 ? 2:1];
|
NR_UE_DLSCH_t dlsch[NR_MAX_NB_LAYERS>4 ? 2:1];
|
||||||
} nr_phy_data_t;
|
} nr_phy_data_t;
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ typedef struct {
|
|||||||
@param proc Pointer to RXn-TXnp4 proc information
|
@param proc Pointer to RXn-TXnp4 proc information
|
||||||
@param eNB_id Local id of eNB on which to act
|
@param eNB_id Local id of eNB on which to act
|
||||||
*/
|
*/
|
||||||
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id);
|
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, nr_phy_data_tx_t *phy_data);
|
||||||
|
|
||||||
/*! \brief Scheduling for UE RX procedures in normal subframes.
|
/*! \brief Scheduling for UE RX procedures in normal subframes.
|
||||||
@param ue Pointer to UE variables on which to act
|
@param ue Pointer to UE variables on which to act
|
||||||
|
|||||||
@@ -329,8 +329,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
|
|
||||||
// Note: we have to handle the thread IDs for this. To be revisited completely.
|
// Note: we have to handle the thread IDs for this. To be revisited completely.
|
||||||
NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0];
|
NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0];
|
||||||
NR_UE_ULSCH_t *ulsch = PHY_vars_UE_g[module_id][cc_id]->ulsch[0];
|
NR_UE_ULSCH_t *ulsch = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->ulsch;
|
||||||
NR_UE_PUCCH *pucch_vars = &((nr_phy_data_t *)scheduled_response->phy_data)->pucch_vars;
|
NR_UE_PUCCH *pucch_vars = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->pucch_vars;
|
||||||
NR_UE_CSI_IM *csiim_vars = PHY_vars_UE_g[module_id][cc_id]->csiim_vars[0];
|
NR_UE_CSI_IM *csiim_vars = PHY_vars_UE_g[module_id][cc_id]->csiim_vars[0];
|
||||||
NR_UE_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0];
|
NR_UE_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0];
|
||||||
NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL;
|
NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL;
|
||||||
@@ -426,26 +426,21 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
// pusch config pdu
|
// pusch config pdu
|
||||||
pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu;
|
pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu;
|
||||||
current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id;
|
current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id;
|
||||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch->harq_processes[current_harq_pid];
|
NR_UL_UE_HARQ_t *harq_process_ul_ue = &PHY_vars_UE_g[module_id][cc_id]->ul_harq_processes[current_harq_pid];
|
||||||
|
|
||||||
if (harq_process_ul_ue){
|
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch->pusch_pdu;
|
||||||
|
|
||||||
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu;
|
LOG_D(PHY, "In %s i %d: copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n", __FUNCTION__, i, pusch_config_pdu->nrOfLayers,pusch_config_pdu->num_dmrs_cdm_grps_no_data);
|
||||||
|
|
||||||
LOG_D(PHY, "In %s i %d: copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n", __FUNCTION__, i, pusch_config_pdu->nrOfLayers,pusch_config_pdu->num_dmrs_cdm_grps_no_data);
|
|
||||||
|
|
||||||
memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t));
|
memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t));
|
||||||
|
|
||||||
ulsch->f_pusch = pusch_config_pdu->absolute_delta_PUSCH;
|
if (scheduled_response->tx_request) {
|
||||||
|
for (int j=0; j<scheduled_response->tx_request->number_of_pdus; j++) {
|
||||||
if (scheduled_response->tx_request) {
|
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j];
|
||||||
for (int j=0; j<scheduled_response->tx_request->number_of_pdus; j++) {
|
if ((tx_req_body->pdu_index == i) && (tx_req_body->pdu_length > 0)) {
|
||||||
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j];
|
LOG_D(PHY,"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",scheduled_response->frame,slot,tx_req_body->pdu_length,current_harq_pid);
|
||||||
if ((tx_req_body->pdu_index == i) && (tx_req_body->pdu_length > 0)) {
|
memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length);
|
||||||
LOG_D(PHY,"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",scheduled_response->frame,slot,tx_req_body->pdu_length,current_harq_pid);
|
break;
|
||||||
memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-134
@@ -98,128 +98,6 @@
|
|||||||
#define DL_DCI (1)
|
#define DL_DCI (1)
|
||||||
#define UL_DCI (0)
|
#define UL_DCI (0)
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
*
|
|
||||||
* NAME : config_uplink_harq_process
|
|
||||||
*
|
|
||||||
* PARAMETERS : pointer to ue context
|
|
||||||
* id of current gNB
|
|
||||||
* number of uplink processes
|
|
||||||
* maximum number of uplink retransmissions
|
|
||||||
* RETURN : none
|
|
||||||
*
|
|
||||||
* DESCRIPTION : configuration of uplink HARQ entity
|
|
||||||
*
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx, uint8_t number_harq_processes_pusch)
|
|
||||||
{
|
|
||||||
NR_UE_ULSCH_t *ulsch;
|
|
||||||
|
|
||||||
ulsch = (NR_UE_ULSCH_t *)malloc16(sizeof(NR_UE_ULSCH_t));
|
|
||||||
|
|
||||||
if (ulsch != NULL) {
|
|
||||||
|
|
||||||
memset(ulsch,0,sizeof(NR_UE_ULSCH_t));
|
|
||||||
|
|
||||||
ue->ulsch[gNB_id] = ulsch;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LOG_E(PHY, "Fatal memory allocation problem at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__);
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ulsch->number_harq_processes_for_pusch = number_harq_processes_pusch;
|
|
||||||
|
|
||||||
/* allocation of HARQ process context */
|
|
||||||
for (int harq_pid = 0; harq_pid < number_harq_processes_pusch; harq_pid++) {
|
|
||||||
|
|
||||||
ulsch->harq_processes[harq_pid] = (NR_UL_UE_HARQ_t *)malloc16(sizeof(NR_UL_UE_HARQ_t));
|
|
||||||
|
|
||||||
if (ulsch->harq_processes[harq_pid] == NULL) {
|
|
||||||
LOG_E(PHY, "Fatal memory allocation problem at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__);
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
|
|
||||||
ulsch->harq_processes[harq_pid]->first_tx = 1;
|
|
||||||
ulsch->harq_processes[harq_pid]->round = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
*
|
|
||||||
* NAME : release_uplink_harq_process
|
|
||||||
*
|
|
||||||
* PARAMETERS : pointer to ue context
|
|
||||||
* id of current gNB
|
|
||||||
*
|
|
||||||
* RETURN : none
|
|
||||||
*
|
|
||||||
* DESCRIPTION : release of HARQ uplink entity
|
|
||||||
*
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx)
|
|
||||||
{
|
|
||||||
NR_UE_ULSCH_t *ulsch = ue->ulsch[gNB_id];
|
|
||||||
|
|
||||||
for (int process_id = 0; process_id < ulsch->number_harq_processes_for_pusch; process_id++) {
|
|
||||||
|
|
||||||
free16(ulsch->harq_processes[process_id],sizeof(NR_UL_UE_HARQ_t));
|
|
||||||
|
|
||||||
ulsch->harq_processes[process_id] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
free16(ulsch, sizeof(NR_UE_ULSCH_t));
|
|
||||||
|
|
||||||
ue->ulsch[gNB_id] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
*
|
|
||||||
* NAME : set_tx_harq_id
|
|
||||||
*
|
|
||||||
* PARAMETERS : ue context
|
|
||||||
* slot_tx slot for transmission
|
|
||||||
* gNB_id identifier
|
|
||||||
*
|
|
||||||
* RETURN : none
|
|
||||||
*
|
|
||||||
* DESCRIPTION : store tx harq process identifier for given transmission slot
|
|
||||||
*
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx)
|
|
||||||
{
|
|
||||||
ulsch->harq_process_id[slot_tx] = harq_pid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
*
|
|
||||||
* NAME : get_tx_harq_id
|
|
||||||
*
|
|
||||||
* PARAMETERS : ue context
|
|
||||||
* slot_tx slot for transmission
|
|
||||||
* gNB_id identifier
|
|
||||||
*
|
|
||||||
* RETURN : harq process identifier
|
|
||||||
*
|
|
||||||
* DESCRIPTION : return tx harq process identifier for given slot transmission
|
|
||||||
*
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx)
|
|
||||||
{
|
|
||||||
|
|
||||||
return (ulsch->harq_process_id[slot_tx]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
*
|
*
|
||||||
* NAME : uplink_harq_process
|
* NAME : uplink_harq_process
|
||||||
@@ -239,7 +117,7 @@ int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx)
|
|||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, uint8_t rnti_type)
|
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, NR_UL_UE_HARQ_t harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES], int ndi, uint8_t rnti_type)
|
||||||
{
|
{
|
||||||
harq_result_t result_harq = RETRANSMISSION_HARQ;
|
harq_result_t result_harq = RETRANSMISSION_HARQ;
|
||||||
|
|
||||||
@@ -257,11 +135,10 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
|
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
|
||||||
if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
|
if ((harq_processes[harq_pid].first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
|
||||||
ulsch->harq_processes[harq_pid]->first_tx = 0;
|
harq_processes[harq_pid].first_tx = 0;
|
||||||
ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */
|
harq_processes[harq_pid].ndi = ndi; /* store first value of ndi */
|
||||||
ulsch->harq_processes[harq_pid]->round = 0;
|
harq_processes[harq_pid].round = 0;
|
||||||
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
|
|
||||||
|
|
||||||
result_harq = NEW_TRANSMISSION_HARQ;
|
result_harq = NEW_TRANSMISSION_HARQ;
|
||||||
|
|
||||||
@@ -269,10 +146,9 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
|||||||
}
|
}
|
||||||
/* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */
|
/* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */
|
||||||
/* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */
|
/* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */
|
||||||
else if ((ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */
|
else if ((harq_processes[harq_pid].ndi != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */
|
||||||
ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */
|
harq_processes[harq_pid].ndi = ndi; /* store first value of ndi */
|
||||||
ulsch->harq_processes[harq_pid]->round = 0;
|
harq_processes[harq_pid].round = 0;
|
||||||
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
|
|
||||||
|
|
||||||
result_harq = NEW_TRANSMISSION_HARQ;
|
result_harq = NEW_TRANSMISSION_HARQ;
|
||||||
|
|
||||||
@@ -280,8 +156,8 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
|||||||
}
|
}
|
||||||
/* 38.321 5.4.2.1 2> else (i.e. retransmission): */
|
/* 38.321 5.4.2.1 2> else (i.e. retransmission): */
|
||||||
else {
|
else {
|
||||||
ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* ndi has not toggled si this is a retransmission */
|
harq_processes[harq_pid].ndi = ndi; /* ndi has not toggled si this is a retransmission */
|
||||||
ulsch->harq_processes[harq_pid]->round++; /* increment number of retransmission */
|
harq_processes[harq_pid].round++; /* increment number of retransmission */
|
||||||
|
|
||||||
result_harq = RETRANSMISSION_HARQ;
|
result_harq = RETRANSMISSION_HARQ;
|
||||||
|
|
||||||
|
|||||||
@@ -65,45 +65,7 @@
|
|||||||
|
|
||||||
/*************** FUNCTIONS ****************************************/
|
/*************** FUNCTIONS ****************************************/
|
||||||
|
|
||||||
|
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, NR_UL_UE_HARQ_t harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES], int ndi, uint8_t rnti_type);
|
||||||
/** \brief This function configures uplink HARQ context
|
|
||||||
@param PHY_VARS_NR_UE ue context
|
|
||||||
@param gNB_id gNodeB identifier
|
|
||||||
@param code_word_idx code word index
|
|
||||||
@param number_harq_processes_pusch maximum number of uplink HARQ processes
|
|
||||||
@returns none */
|
|
||||||
|
|
||||||
void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx, uint8_t number_harq_processes_pusch);
|
|
||||||
|
|
||||||
/** \brief This function releases uplink HARQ context
|
|
||||||
@param PHY_VARS_NR_UE ue context
|
|
||||||
@param gNB_id gNodeB identifier
|
|
||||||
@param code_word_idx code word index
|
|
||||||
@returns none */
|
|
||||||
|
|
||||||
void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx);
|
|
||||||
|
|
||||||
/** \brief This function stores slot for transmission in HARQ context
|
|
||||||
@param ulsch uplink context
|
|
||||||
@param harq process identifier harq_pid
|
|
||||||
@param slot_tx slot for transmission related to current downlink PDCCH
|
|
||||||
@returns 0 none */
|
|
||||||
|
|
||||||
void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx);
|
|
||||||
|
|
||||||
/** \brief This function initialises context of an uplink HARQ process
|
|
||||||
@param ulsch uplink context
|
|
||||||
@param harq process identifier harq_pid
|
|
||||||
@returns harq number for tx slot */
|
|
||||||
|
|
||||||
int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
|
|
||||||
|
|
||||||
/** \brief This function update uplink harq context and return transmission type (new transmission or retransmission)
|
|
||||||
@param ulsch uplink harq context
|
|
||||||
@param harq process identifier harq_pid
|
|
||||||
@returns retransmission or new transmission */
|
|
||||||
|
|
||||||
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, uint8_t rnti_type);
|
|
||||||
|
|
||||||
/** \brief This function initialises downlink HARQ status
|
/** \brief This function initialises downlink HARQ status
|
||||||
@param pointer to downlink harq status
|
@param pointer to downlink harq status
|
||||||
|
|||||||
@@ -269,7 +269,8 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
|||||||
|
|
||||||
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id) {
|
uint8_t gNB_id,
|
||||||
|
nr_phy_data_tx_t *phy_data) {
|
||||||
|
|
||||||
int slot_tx = proc->nr_slot_tx;
|
int slot_tx = proc->nr_slot_tx;
|
||||||
int frame_tx = proc->frame_tx;
|
int frame_tx = proc->frame_tx;
|
||||||
@@ -287,9 +288,9 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
if (ue->UE_mode[gNB_id] <= PUSCH){
|
if (ue->UE_mode[gNB_id] <= PUSCH){
|
||||||
|
|
||||||
for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[gNB_id]->number_harq_processes_for_pusch; harq_pid++) {
|
for (uint8_t harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) {
|
||||||
if (ue->ulsch[gNB_id]->harq_processes[harq_pid]->status == ACTIVE)
|
if (ue->ul_harq_processes[harq_pid].status == ACTIVE)
|
||||||
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, gNB_id);
|
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, gNB_id, phy_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,7 +493,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
|||||||
int frame_rx = proc->frame_rx;
|
int frame_rx = proc->frame_rx;
|
||||||
int nr_slot_rx = proc->nr_slot_rx;
|
int nr_slot_rx = proc->nr_slot_rx;
|
||||||
unsigned int dci_cnt=0;
|
unsigned int dci_cnt=0;
|
||||||
fapi_nr_dci_indication_t *dci_ind = calloc(1, sizeof(*dci_ind));
|
fapi_nr_dci_indication_t dci_ind = {0};
|
||||||
nr_downlink_indication_t dl_indication;
|
nr_downlink_indication_t dl_indication;
|
||||||
NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config;
|
NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config;
|
||||||
|
|
||||||
@@ -516,7 +517,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
|||||||
n_ss);
|
n_ss);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dci_cnt = nr_dci_decoding_procedure(ue, proc, pdcch_e_rx, dci_ind, rel15);
|
dci_cnt = nr_dci_decoding_procedure(ue, proc, pdcch_e_rx, &dci_ind, rel15);
|
||||||
|
|
||||||
#ifdef NR_PDCCH_SCHED_DEBUG
|
#ifdef NR_PDCCH_SCHED_DEBUG
|
||||||
LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt);
|
LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt);
|
||||||
@@ -530,14 +531,14 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
|||||||
ue->Mod_id,frame_rx%1024,nr_slot_rx,nr_mode_string[ue->UE_mode[gNB_id]],
|
ue->Mod_id,frame_rx%1024,nr_slot_rx,nr_mode_string[ue->UE_mode[gNB_id]],
|
||||||
i + 1,
|
i + 1,
|
||||||
dci_cnt,
|
dci_cnt,
|
||||||
dci_ind->dci_list[i].rnti,
|
dci_ind.dci_list[i].rnti,
|
||||||
dci_ind->dci_list[i].dci_format);
|
dci_ind.dci_list[i].dci_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
dci_ind->number_of_dcis = dci_cnt;
|
dci_ind.number_of_dcis = dci_cnt;
|
||||||
|
|
||||||
// fill dl_indication message
|
// fill dl_indication message
|
||||||
nr_fill_dl_indication(&dl_indication, dci_ind, NULL, proc, ue, gNB_id, phy_data);
|
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, gNB_id, phy_data);
|
||||||
// send to mac
|
// send to mac
|
||||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ void nr_generate_pucch3_4(int32_t **txdataF,
|
|||||||
void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue,
|
void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
nr_phy_data_t *phy_data) {
|
nr_phy_data_tx_t *phy_data) {
|
||||||
|
|
||||||
int nr_slot_tx = proc->nr_slot_tx;
|
int nr_slot_tx = proc->nr_slot_tx;
|
||||||
fapi_nr_ul_config_pucch_pdu *pucch_pdu;
|
fapi_nr_ul_config_pucch_pdu *pucch_pdu;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue,
|
void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
nr_phy_data_t *phy_data);
|
nr_phy_data_tx_t *phy_data);
|
||||||
|
|
||||||
|
|
||||||
void set_csi_nr(int csi_status, uint32_t csi_payload);
|
void set_csi_nr(int csi_status, uint32_t csi_payload);
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ int main(int argc, char **argv)
|
|||||||
nr_ue_dlsch_init(dlsch_ue, num_codeword, 5);
|
nr_ue_dlsch_init(dlsch_ue, num_codeword, 5);
|
||||||
for (int i=0; i < num_codeword; i++)
|
for (int i=0; i < num_codeword; i++)
|
||||||
dlsch_ue[0].rnti = n_rnti;
|
dlsch_ue[0].rnti = n_rnti;
|
||||||
nr_init_harq_processes(UE->dl_harq_processes[0], 8, nb_rb);
|
nr_init_dl_harq_processes(UE->dl_harq_processes[0], 8, nb_rb);
|
||||||
|
|
||||||
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
|
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
|
||||||
processingData_L1tx_t msgDataTx;
|
processingData_L1tx_t msgDataTx;
|
||||||
|
|||||||
@@ -432,11 +432,7 @@ int main(int argc, char **argv)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
UE->ulsch[0] = new_nr_ue_ulsch(N_RB_UL, 8, frame_parms);
|
nr_init_ul_harq_processes(UE->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, UE->frame_parms.N_RB_UL, UE->frame_parms.nb_antennas_tx);
|
||||||
if (!UE->ulsch[0]) {
|
|
||||||
printf("Can't get ue ulsch structures.\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char harq_pid = 0;
|
unsigned char harq_pid = 0;
|
||||||
unsigned int TBS = 8424;
|
unsigned int TBS = 8424;
|
||||||
@@ -453,7 +449,8 @@ int main(int argc, char **argv)
|
|||||||
NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid];
|
NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid];
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu;
|
nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu;
|
||||||
|
|
||||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0];
|
nr_phy_data_tx_t phy_data = {0};
|
||||||
|
NR_UE_ULSCH_t *ulsch_ue = &phy_data.ulsch;
|
||||||
|
|
||||||
if ((Nl==4)||(Nl==3))
|
if ((Nl==4)||(Nl==3))
|
||||||
nb_re_dmrs = nb_re_dmrs*2;
|
nb_re_dmrs = nb_re_dmrs*2;
|
||||||
@@ -488,22 +485,22 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
|
/////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
|
||||||
///////////
|
///////////
|
||||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
NR_UL_UE_HARQ_t *harq_process_ul_ue = &UE->ul_harq_processes[harq_pid];
|
||||||
DevAssert(harq_process_ul_ue);
|
DevAssert(harq_process_ul_ue);
|
||||||
|
|
||||||
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||||
N_RE_prime = NR_NB_SC_PER_RB*nb_symb_sch - nb_re_dmrs - N_PRB_oh;
|
N_RE_prime = NR_NB_SC_PER_RB*nb_symb_sch - nb_re_dmrs - N_PRB_oh;
|
||||||
|
|
||||||
harq_process_ul_ue->pusch_pdu.rnti = n_rnti;
|
ulsch_ue->pusch_pdu.rnti = n_rnti;
|
||||||
harq_process_ul_ue->pusch_pdu.mcs_index = Imcs;
|
ulsch_ue->pusch_pdu.mcs_index = Imcs;
|
||||||
harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl;
|
ulsch_ue->pusch_pdu.nrOfLayers = Nl;
|
||||||
harq_process_ul_ue->pusch_pdu.rb_size = nb_rb;
|
ulsch_ue->pusch_pdu.rb_size = nb_rb;
|
||||||
harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
|
ulsch_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
|
||||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
|
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
|
||||||
harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx;
|
ulsch_ue->pusch_pdu.pusch_data.rv_index = rvidx;
|
||||||
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS>>3;
|
ulsch_ue->pusch_pdu.pusch_data.tb_size = TBS>>3;
|
||||||
harq_process_ul_ue->pusch_pdu.target_code_rate = code_rate;
|
ulsch_ue->pusch_pdu.target_code_rate = code_rate;
|
||||||
harq_process_ul_ue->pusch_pdu.qam_mod_order = mod_order;
|
ulsch_ue->pusch_pdu.qam_mod_order = mod_order;
|
||||||
unsigned char *test_input = harq_process_ul_ue->a;
|
unsigned char *test_input = harq_process_ul_ue->a;
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
@@ -549,7 +546,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ulsch_ue->harq_processes[harq_pid]->f[i] == 0)
|
if (harq_process_ul_ue->f[i] == 0)
|
||||||
modulated_input[i] = 1.0; ///sqrt(2); //QPSK
|
modulated_input[i] = 1.0; ///sqrt(2); //QPSK
|
||||||
else
|
else
|
||||||
modulated_input[i] = -1.0; ///sqrt(2);
|
modulated_input[i] = -1.0; ///sqrt(2);
|
||||||
@@ -573,7 +570,7 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
channel_output_uncoded[i] = 0;
|
channel_output_uncoded[i] = 0;
|
||||||
|
|
||||||
if (channel_output_uncoded[i] != ulsch_ue->harq_processes[harq_pid]->f[i])
|
if (channel_output_uncoded[i] != harq_process_ul_ue->f[i])
|
||||||
errors_bit_uncoded = errors_bit_uncoded + 1;
|
errors_bit_uncoded = errors_bit_uncoded + 1;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -638,7 +635,7 @@ int main(int argc, char **argv)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
free_nr_ue_ulsch(&UE->ulsch[0], N_RB_UL, frame_parms);
|
free_nr_ue_ul_harq(UE->ul_harq_processes, NR_MAX_ULSCH_HARQ_PROCESSES, UE->frame_parms.N_RB_UL, UE->frame_parms.nb_antennas_tx);
|
||||||
|
|
||||||
term_nr_ue_signal(UE, 1);
|
term_nr_ue_signal(UE, 1);
|
||||||
free(UE);
|
free(UE);
|
||||||
|
|||||||
@@ -868,7 +868,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
|
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
|
||||||
|
|
||||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0];
|
nr_phy_data_tx_t phy_data = {0};
|
||||||
|
|
||||||
unsigned char *estimated_output_bit;
|
unsigned char *estimated_output_bit;
|
||||||
unsigned char *test_input_bit;
|
unsigned char *test_input_bit;
|
||||||
@@ -1093,7 +1093,7 @@ int main(int argc, char **argv)
|
|||||||
errors_decoding = 0;
|
errors_decoding = 0;
|
||||||
while (round < max_rounds && crc_status) {
|
while (round < max_rounds && crc_status) {
|
||||||
round_trials[round]++;
|
round_trials[round]++;
|
||||||
ulsch_ue->harq_processes[harq_pid]->round = round;
|
UE->ul_harq_processes[harq_pid].round = round;
|
||||||
rv_index = nr_rv_round_map[round % 4];
|
rv_index = nr_rv_round_map[round % 4];
|
||||||
|
|
||||||
UE_proc.nr_slot_tx = slot;
|
UE_proc.nr_slot_tx = slot;
|
||||||
@@ -1178,6 +1178,7 @@ int main(int argc, char **argv)
|
|||||||
scheduled_response.dl_config = NULL;
|
scheduled_response.dl_config = NULL;
|
||||||
scheduled_response.ul_config = &ul_config;
|
scheduled_response.ul_config = &ul_config;
|
||||||
scheduled_response.tx_request = &tx_req;
|
scheduled_response.tx_request = &tx_req;
|
||||||
|
scheduled_response.phy_data = (void *)&phy_data;
|
||||||
|
|
||||||
// Config UL TX PDU
|
// Config UL TX PDU
|
||||||
tx_req.slot = slot;
|
tx_req.slot = slot;
|
||||||
@@ -1232,7 +1233,7 @@ int main(int argc, char **argv)
|
|||||||
// nr_fill_ulsch(gNB,frame,slot,pusch_pdu); // Not needed as its its already filled as apart of "nr_schedule_response(Sched_INFO);"
|
// nr_fill_ulsch(gNB,frame,slot,pusch_pdu); // Not needed as its its already filled as apart of "nr_schedule_response(Sched_INFO);"
|
||||||
|
|
||||||
for (int i = 0; i < (TBS / 8); i++)
|
for (int i = 0; i < (TBS / 8); i++)
|
||||||
ulsch_ue->harq_processes[harq_pid]->a[i] = i & 0xff;
|
UE->ul_harq_processes[harq_pid].a[i] = i & 0xff;
|
||||||
if (input_fd == NULL) {
|
if (input_fd == NULL) {
|
||||||
// set FAPI parameters for UE, put them in the scheduled response and call
|
// set FAPI parameters for UE, put them in the scheduled response and call
|
||||||
nr_ue_scheduled_response(&scheduled_response);
|
nr_ue_scheduled_response(&scheduled_response);
|
||||||
@@ -1240,7 +1241,7 @@ int main(int argc, char **argv)
|
|||||||
/////////////////////////phy_procedures_nr_ue_TX///////////////////////
|
/////////////////////////phy_procedures_nr_ue_TX///////////////////////
|
||||||
///////////
|
///////////
|
||||||
|
|
||||||
phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id);
|
phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id, &phy_data);
|
||||||
|
|
||||||
/* We need to call common sending function to send signal */
|
/* We need to call common sending function to send signal */
|
||||||
LOG_D(PHY, "Sending Uplink data \n");
|
LOG_D(PHY, "Sending Uplink data \n");
|
||||||
@@ -1507,8 +1508,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < available_bits; i++) {
|
for (i = 0; i < available_bits; i++) {
|
||||||
if (((ulsch_ue->harq_processes[harq_pid]->f[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0))
|
if (((UE->ul_harq_processes[harq_pid].f[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0))
|
||||||
|| ((ulsch_ue->harq_processes[harq_pid]->f[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) {
|
|| ((UE->ul_harq_processes[harq_pid].f[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) {
|
||||||
/*if(errors_scrambling == 0)
|
/*if(errors_scrambling == 0)
|
||||||
printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/
|
printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/
|
||||||
errors_scrambling[round]++;
|
errors_scrambling[round]++;
|
||||||
@@ -1524,7 +1525,7 @@ int main(int argc, char **argv)
|
|||||||
for (i = 0; i < TBS; i++) {
|
for (i = 0; i < TBS; i++) {
|
||||||
|
|
||||||
estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7);
|
estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7);
|
||||||
test_input_bit[i] = (ulsch_ue->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7);
|
test_input_bit[i] = (UE->ul_harq_processes[harq_pid].b[i / 8] & (1 << (i & 7))) >> (i & 7);
|
||||||
|
|
||||||
if (estimated_output_bit[i] != test_input_bit[i]) {
|
if (estimated_output_bit[i] != test_input_bit[i]) {
|
||||||
/*if(errors_decoding == 0)
|
/*if(errors_decoding == 0)
|
||||||
@@ -1533,14 +1534,14 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n_trials == 1) {
|
if (n_trials == 1) {
|
||||||
for (int r = 0; r < ulsch_ue->harq_processes[harq_pid]->C; r++)
|
for (int r = 0; r < UE->ul_harq_processes[harq_pid].C; r++)
|
||||||
for (int i = 0; i < ulsch_ue->harq_processes[harq_pid]->K >> 3; i++) {
|
for (int i = 0; i < UE->ul_harq_processes[harq_pid].K >> 3; i++) {
|
||||||
if ((ulsch_ue->harq_processes[harq_pid]->c[r][i] ^ ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0)
|
if ((UE->ul_harq_processes[harq_pid].c[r][i] ^ ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0)
|
||||||
printf("************");
|
printf("************");
|
||||||
/*printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
|
/*printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
|
||||||
i,ulsch_ue->harq_processes[harq_pid]->c[r][i],
|
i,UE->ul_harq_processes[harq_pid].c[r][i],
|
||||||
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i],
|
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i],
|
||||||
ulsch_ue->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/
|
UE->ul_harq_processes[harq_pid].c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errors_decoding > 0 && error_flag == 0) {
|
if (errors_decoding > 0 && error_flag == 0) {
|
||||||
|
|||||||
@@ -1251,7 +1251,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
}
|
}
|
||||||
pthread_mutex_unlock(&ul_config->mutex_ul_config); // avoid double lock
|
pthread_mutex_unlock(&ul_config->mutex_ul_config); // avoid double lock
|
||||||
|
|
||||||
fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, frame_tx, slot_tx, NULL);
|
fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, frame_tx, slot_tx, ul_info->phy_data);
|
||||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
|
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){
|
||||||
LOG_D(NR_MAC,"3# scheduled_response transmitted,%d, %d\n", frame_tx, slot_tx);
|
LOG_D(NR_MAC,"3# scheduled_response transmitted,%d, %d\n", frame_tx, slot_tx);
|
||||||
mac->if_module->scheduled_response(&scheduled_response);
|
mac->if_module->scheduled_response(&scheduled_response);
|
||||||
|
|||||||
@@ -1214,7 +1214,6 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
|||||||
}
|
}
|
||||||
memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15));
|
memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15));
|
||||||
}
|
}
|
||||||
free(dl_info->dci_ind);
|
|
||||||
dl_info->dci_ind = NULL;
|
dl_info->dci_ind = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user