Merge remote-tracking branch 'origin/develop-SA-CBRA' into integration_2020_wk15
Conflicts: openair1/PHY/TOOLS/nr_phy_scope.c targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
This commit is contained in:
@@ -42,9 +42,9 @@
|
|||||||
/* maximum size of a message - increase if needed */
|
/* maximum size of a message - increase if needed */
|
||||||
#if BASIC_SIMULATOR
|
#if BASIC_SIMULATOR
|
||||||
/* let's have 100 RBs functional for the basic simulator */
|
/* let's have 100 RBs functional for the basic simulator */
|
||||||
# define T_BUFFER_MAX (1024*64*2)
|
# define T_BUFFER_MAX (1024*64*4)
|
||||||
#else
|
#else
|
||||||
# define T_BUFFER_MAX (1024*64*2)
|
# define T_BUFFER_MAX (1024*64*4)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* size of the local cache for messages (must be pow(2,something)) */
|
/* size of the local cache for messages (must be pow(2,something)) */
|
||||||
|
|||||||
@@ -93,6 +93,10 @@ ID = GNB_PHY_PUCCH_PUSCH_IQ
|
|||||||
DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done
|
DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done
|
||||||
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
|
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
|
||||||
FORMAT = int,frame : int,slot : buffer,rxdataF
|
FORMAT = int,frame : int,slot : buffer,rxdataF
|
||||||
|
ID = GNB_PHY_PRACH_INPUT_SIGNAL
|
||||||
|
DESC = gNodeB input data in the time domain for slots with PRACH detection
|
||||||
|
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
|
||||||
|
FORMAT = int,frame : int,slot : int,antenna : buffer,rxdata
|
||||||
|
|
||||||
#MAC logs
|
#MAC logs
|
||||||
ID = ENB_MAC_UE_DL_SDU
|
ID = ENB_MAC_UE_DL_SDU
|
||||||
|
|||||||
@@ -1350,6 +1350,10 @@ void *ru_thread( void *param ) {
|
|||||||
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
|
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
|
||||||
uint8_t prachStartSymbol,N_dur;
|
uint8_t prachStartSymbol,N_dur;
|
||||||
if (prach_id>=0) {
|
if (prach_id>=0) {
|
||||||
|
|
||||||
|
T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0),
|
||||||
|
T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2));
|
||||||
|
|
||||||
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
|
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
|
||||||
/*
|
/*
|
||||||
get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value,
|
get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value,
|
||||||
|
|||||||
@@ -181,6 +181,23 @@ void print_difftimes(void) {
|
|||||||
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
|
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int create_tasks_nrue(uint32_t ue_nb) {
|
||||||
|
LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
|
||||||
|
itti_wait_ready(1);
|
||||||
|
|
||||||
|
if (ue_nb > 0) {
|
||||||
|
LOG_I(NR_RRC,"create TASK_RRC_NRUE \n");
|
||||||
|
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
|
||||||
|
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
itti_wait_ready(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void exit_function(const char *file, const char *function, const int line, const char *s) {
|
void exit_function(const char *file, const char *function, const int line, const char *s) {
|
||||||
int CC_id;
|
int CC_id;
|
||||||
|
|
||||||
@@ -482,6 +499,12 @@ int main( int argc, char **argv ) {
|
|||||||
|
|
||||||
// wait for end of program
|
// wait for end of program
|
||||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||||
|
|
||||||
|
if (create_tasks_nrue(1) < 0) {
|
||||||
|
printf("cannot create ITTI tasks\n");
|
||||||
|
exit(-1); // need a softer mode
|
||||||
|
}
|
||||||
|
|
||||||
// Sleep a while before checking all parameters have been used
|
// Sleep a while before checking all parameters have been used
|
||||||
// Some are used directly in external threads, asynchronously
|
// Some are used directly in external threads, asynchronously
|
||||||
sleep(20);
|
sleep(20);
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
debug_ch_est = fopen("debug_ch_est.txt","w");
|
debug_ch_est = fopen("debug_ch_est.txt","w");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1];
|
||||||
|
|
||||||
uint8_t nushift;
|
uint8_t nushift;
|
||||||
int **ul_ch_estimates = gNB->pusch_vars[ul_id]->ul_ch_estimates;
|
int **ul_ch_estimates = gNB->pusch_vars[ul_id]->ul_ch_estimates;
|
||||||
int **rxdataF = gNB->common_vars.rxdataF;
|
int **rxdataF = gNB->common_vars.rxdataF;
|
||||||
@@ -128,7 +130,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
//------------------generate DMRS------------------//
|
//------------------generate DMRS------------------//
|
||||||
|
|
||||||
if (pusch_pdu->transform_precoding == transform_precoder_disabled) {
|
if (pusch_pdu->transform_precoding == transform_precoder_disabled) {
|
||||||
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, pusch_pdu->rb_start*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type);
|
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, (pusch_pdu->bwp_start + pusch_pdu->rb_start)*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type);
|
||||||
}
|
}
|
||||||
else { // if transform precoding or SC-FDMA is enabled in Uplink
|
else { // if transform precoding or SC-FDMA is enabled in Uplink
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
|||||||
else {
|
else {
|
||||||
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
|
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
|
||||||
}
|
}
|
||||||
n_dmrs = (rel15->rbSize+rel15->rbStart)*nb_re_dmrs;
|
n_dmrs = (rel15->BWPStart+rel15->rbStart+rel15->rbSize)*nb_re_dmrs;
|
||||||
|
|
||||||
uint16_t dmrs_symbol_map = rel15->dlDmrsSymbPos;//single DMRS: 010000100 Double DMRS 110001100
|
uint16_t dmrs_symbol_map = rel15->dlDmrsSymbPos;//single DMRS: 010000100 Double DMRS 110001100
|
||||||
uint8_t dmrs_len = get_num_dmrs(rel15->dlDmrsSymbPos);
|
uint8_t dmrs_len = get_num_dmrs(rel15->dlDmrsSymbPos);
|
||||||
@@ -266,6 +266,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// DMRS QPSK modulation
|
/// DMRS QPSK modulation
|
||||||
|
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
|
||||||
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
|
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
|
||||||
if (rel15->dlDmrsSymbPos & (1 << l)) {
|
if (rel15->dlDmrsSymbPos & (1 << l)) {
|
||||||
nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||||
@@ -318,11 +319,24 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
|||||||
/// DMRS QPSK modulation
|
/// DMRS QPSK modulation
|
||||||
uint8_t k_prime=0;
|
uint8_t k_prime=0;
|
||||||
uint16_t n=0;
|
uint16_t n=0;
|
||||||
if ((dmrs_symbol_map & (1 << l))){ //DMRS time occasion
|
|
||||||
if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) // another if condition to be included to check pdsch config type (reference of k)
|
if ((dmrs_symbol_map & (1 << l))){ // DMRS time occasion
|
||||||
dmrs_idx = rel15->rbStart*6;
|
// The reference point for is subcarrier 0 of the lowest-numbered resource block in CORESET 0 if the corresponding
|
||||||
else
|
// PDCCH is associated with CORESET 0 and Type0-PDCCH common search space and is addressed to SI-RNTI
|
||||||
dmrs_idx = rel15->rbStart*4;
|
// 3GPP TS 38.211 V15.8.0 Section 7.4.1.1.2 Mapping to physical resources
|
||||||
|
if (rel15->rnti==SI_RNTI) {
|
||||||
|
if (dmrs_Type==NFAPI_NR_DMRS_TYPE1) {
|
||||||
|
dmrs_idx = rel15->rbStart*6;
|
||||||
|
} else {
|
||||||
|
dmrs_idx = rel15->rbStart*4;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) {
|
||||||
|
dmrs_idx = (rel15->rbStart+rel15->BWPStart)*6;
|
||||||
|
} else {
|
||||||
|
dmrs_idx = (rel15->rbStart+rel15->BWPStart)*4;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update l_prime in the case of double DMRS config
|
// Update l_prime in the case of double DMRS config
|
||||||
@@ -507,7 +521,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
|||||||
gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot+j] = rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx;
|
gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot+j] = rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_W(PHY,"beam index for PDSCH allocation already taken\n");
|
LOG_D(PHY,"beam index for PDSCH allocation already taken\n");
|
||||||
}
|
}
|
||||||
}// dlsch loop
|
}// dlsch loop
|
||||||
|
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t is_dmrs_re;
|
uint8_t is_dmrs_re;
|
||||||
start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start * NR_NB_SC_PER_RB))%frame_parms->ofdm_symbol_size;
|
start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start + pusch_pdu->bwp_start) * NR_NB_SC_PER_RB)%frame_parms->ofdm_symbol_size;
|
||||||
nb_re_pusch = NR_NB_SC_PER_RB * pusch_pdu->rb_size;
|
nb_re_pusch = NR_NB_SC_PER_RB * pusch_pdu->rb_size;
|
||||||
#ifdef __AVX2__
|
#ifdef __AVX2__
|
||||||
int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7);
|
int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7);
|
||||||
@@ -1178,7 +1178,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bwp_start_subcarrier = (rel15_ul->rb_start*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
|
bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
|
||||||
|
|
||||||
dmrs_symbol_flag = ((rel15_ul->ul_dmrs_symb_pos)>>symbol)&0x01;
|
dmrs_symbol_flag = ((rel15_ul->ul_dmrs_symb_pos)>>symbol)&0x01;
|
||||||
|
|
||||||
|
|||||||
@@ -657,6 +657,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t eNB_offset,
|
uint8_t eNB_offset,
|
||||||
|
bool is_SI,
|
||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned short p,
|
unsigned short p,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
@@ -694,7 +695,10 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// generate pilot for gNB port number 1000+p
|
// generate pilot for gNB port number 1000+p
|
||||||
uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12 - BWPStart;
|
uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12;
|
||||||
|
if (is_SI) {
|
||||||
|
rb_offset -= BWPStart;
|
||||||
|
}
|
||||||
uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type;
|
uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type;
|
||||||
int8_t delta = get_delta(p, config_type);
|
int8_t delta = get_delta(p, config_type);
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t eNB_offset,
|
uint8_t eNB_offset,
|
||||||
|
bool is_SI,
|
||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
unsigned short p,
|
unsigned short p,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
uint8_t mod_order = pusch_pdu->qam_mod_order;
|
uint8_t mod_order = pusch_pdu->qam_mod_order;
|
||||||
uint16_t rnti = pusch_pdu->rnti;
|
uint16_t rnti = pusch_pdu->rnti;
|
||||||
uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data;
|
uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||||
uint16_t start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB;
|
uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB;
|
||||||
|
|
||||||
if (start_sc >= frame_parms->ofdm_symbol_size)
|
if (start_sc >= frame_parms->ofdm_symbol_size)
|
||||||
start_sc -= frame_parms->ofdm_symbol_size;
|
start_sc -= frame_parms->ofdm_symbol_size;
|
||||||
@@ -195,7 +195,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
/////////////////////////DMRS Modulation/////////////////////////
|
/////////////////////////DMRS Modulation/////////////////////////
|
||||||
///////////
|
///////////
|
||||||
uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
||||||
uint16_t n_dmrs = (start_rb+nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4);
|
uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4);
|
||||||
int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16)));
|
int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16)));
|
||||||
///////////
|
///////////
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@@ -355,16 +355,17 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
if (pusch_pdu->transform_precoding == transform_precoder_disabled){
|
if (pusch_pdu->transform_precoding == transform_precoder_disabled){
|
||||||
|
|
||||||
if (dmrs_type == pusch_dmrs_type1)
|
if (dmrs_type == pusch_dmrs_type1)
|
||||||
dmrs_idx = start_rb*6;
|
dmrs_idx = (pusch_pdu->bwp_start + start_rb)*6;
|
||||||
else
|
else
|
||||||
dmrs_idx = start_rb*4;
|
dmrs_idx = (pusch_pdu->bwp_start + start_rb)*4;
|
||||||
|
|
||||||
|
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
|
||||||
// Perform this on gold sequence, not required when SC FDMA operation is done,
|
// Perform this on gold sequence, not required when SC FDMA operation is done,
|
||||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dmrs_idx = 0;
|
dmrs_idx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
} else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||||
|
|||||||
@@ -425,8 +425,10 @@ static void pucchEnergy (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pucchIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
static void pucchIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void puschThroughtput (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
static void puschThroughtput (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
||||||
// PUSCH Throughput
|
// PUSCH Throughput
|
||||||
/*
|
/*
|
||||||
@@ -543,17 +545,16 @@ static void copyRxdataF(int32_t *data, int slot, void *scopeData) {
|
|||||||
data,
|
data,
|
||||||
scope->gNB->frame_parms.samples_per_slot_wCP);
|
scope->gNB->frame_parms.samples_per_slot_wCP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gNBinitScope(scopeParms_t *p) {
|
void gNBinitScope(scopeParms_t *p) {
|
||||||
p->gNB->scopeData=malloc(sizeof(scopeData_t));
|
AssertFatal(p->gNB->scopeData=malloc(sizeof(scopeData_t)),"");
|
||||||
AssertFatal(p->gNB->scopeData,"");
|
|
||||||
scopeData_t *scope=(scopeData_t *) p->gNB->scopeData;
|
scopeData_t *scope=(scopeData_t *) p->gNB->scopeData;
|
||||||
scope->argc=p->argc;
|
scope->argc=p->argc;
|
||||||
scope->argv=p->argv;
|
scope->argv=p->argv;
|
||||||
scope->ru=p->ru;
|
scope->ru=p->ru;
|
||||||
scope->gNB=p->gNB;
|
scope->gNB=p->gNB;
|
||||||
scope->slotFunc=copyRxdataF;
|
scope->slotFunc=copyRxdataF;
|
||||||
scope->rxdataF=(int32_t *) calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1);
|
AssertFatal(scope->rxdataF=(int32_t *) calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1),"");
|
||||||
AssertFatal(scope->rxdataF,"");
|
|
||||||
pthread_t forms_thread;
|
pthread_t forms_thread;
|
||||||
threadCreate(&forms_thread, scope_thread_gNB, p->gNB->scopeData, "scope", -1, OAI_PRIORITY_RT_LOW);
|
threadCreate(&forms_thread, scope_thread_gNB, p->gNB->scopeData, "scope", -1, OAI_PRIORITY_RT_LOW);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "phy_scope_interface.h"
|
#include "phy_scope_interface.h"
|
||||||
|
|
||||||
#define SOFTSCOPE_ENDFUNC_IDX 0
|
#define SOFTSCOPE_ENDFUNC_IDX 0
|
||||||
|
|
||||||
static loader_shlibfunc_t scope_fdesc[]= {{"end_forms",NULL}};
|
static loader_shlibfunc_t scope_fdesc[]= {{"end_forms",NULL}};
|
||||||
|
|
||||||
int load_softscope(char *exectype, void *initarg) {
|
int load_softscope(char *exectype, void *initarg) {
|
||||||
|
|||||||
@@ -867,8 +867,9 @@ typedef enum {
|
|||||||
NOT_SYNCHED=0,
|
NOT_SYNCHED=0,
|
||||||
PRACH=1,
|
PRACH=1,
|
||||||
RA_RESPONSE=2,
|
RA_RESPONSE=2,
|
||||||
PUSCH=3,
|
RA_WAIT_CR=3,
|
||||||
RESYNCH=4
|
PUSCH=4,
|
||||||
|
RESYNCH=5
|
||||||
} UE_MODE_t;
|
} UE_MODE_t;
|
||||||
|
|
||||||
#define FOREACH_PARALLEL(GEN) \
|
#define FOREACH_PARALLEL(GEN) \
|
||||||
|
|||||||
@@ -664,6 +664,7 @@ typedef struct {
|
|||||||
int prach_I0;
|
int prach_I0;
|
||||||
} PHY_MEASUREMENTS_gNB;
|
} PHY_MEASUREMENTS_gNB;
|
||||||
|
|
||||||
|
#define MAX_NUM_NR_PRACH_PREAMBLES 64
|
||||||
#define MAX_NUM_NR_RX_RACH_PDUS 4
|
#define MAX_NUM_NR_RX_RACH_PDUS 4
|
||||||
#define MAX_NUM_NR_RX_PRACH_PREAMBLES 4
|
#define MAX_NUM_NR_RX_PRACH_PREAMBLES 4
|
||||||
#define MAX_UL_PDUS_PER_SLOT 8
|
#define MAX_UL_PDUS_PER_SLOT 8
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
|||||||
}
|
}
|
||||||
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
|
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
|
||||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
|
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
|
||||||
|
dlsch0->rnti_type = _RA_RNTI_;
|
||||||
|
dlsch0->harq_processes[dlsch0->current_harq_pid]->status = ACTIVE;
|
||||||
}
|
}
|
||||||
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){
|
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){
|
||||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0];
|
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0];
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
|||||||
|
|
||||||
ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling;
|
ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling;
|
||||||
|
|
||||||
LOG_I(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
|
LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
ue->Mod_id,
|
ue->Mod_id,
|
||||||
frame_tx,
|
frame_tx,
|
||||||
@@ -771,6 +771,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
uint16_t pdsch_nb_rb = dlsch0_harq->nb_rb;
|
uint16_t pdsch_nb_rb = dlsch0_harq->nb_rb;
|
||||||
uint16_t s0 = dlsch0_harq->start_symbol;
|
uint16_t s0 = dlsch0_harq->start_symbol;
|
||||||
uint16_t s1 = dlsch0_harq->nb_symbols;
|
uint16_t s1 = dlsch0_harq->nb_symbols;
|
||||||
|
bool is_SI = dlsch0->rnti_type == _SI_RNTI_;
|
||||||
|
|
||||||
LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos);
|
LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos);
|
||||||
|
|
||||||
@@ -780,6 +781,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
|||||||
nr_pdsch_channel_estimation(ue,
|
nr_pdsch_channel_estimation(ue,
|
||||||
proc,
|
proc,
|
||||||
0 /*eNB_id*/,
|
0 /*eNB_id*/,
|
||||||
|
is_SI,
|
||||||
nr_slot_rx,
|
nr_slot_rx,
|
||||||
aatx /*p*/,
|
aatx /*p*/,
|
||||||
m,
|
m,
|
||||||
@@ -1690,9 +1692,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((frame_rx%64 == 0) && (nr_slot_rx==0)) {
|
if ((frame_rx%64 == 0) && (nr_slot_rx==0)) {
|
||||||
printf("============================================\n");
|
LOG_I(PHY,"============================================\n");
|
||||||
LOG_I(PHY,"Harq round stats for Downlink: %d/%d/%d/%d DLSCH errors: %d\n",ue->dl_stats[0],ue->dl_stats[1],ue->dl_stats[2],ue->dl_stats[3],ue->dl_stats[4]);
|
LOG_I(PHY,"Harq round stats for Downlink: %d/%d/%d/%d DLSCH errors: %d\n",ue->dl_stats[0],ue->dl_stats[1],ue->dl_stats[2],ue->dl_stats[3],ue->dl_stats[4]);
|
||||||
printf("============================================\n");
|
LOG_I(PHY,"============================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NR_PDCCH_SCHED
|
#ifdef NR_PDCCH_SCHED
|
||||||
@@ -2068,7 +2070,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nr_prach == 1) {
|
if (nr_prach == GENERATE_PREAMBLE) {
|
||||||
|
|
||||||
if (ue->mac_enabled == 1) {
|
if (ue->mac_enabled == 1) {
|
||||||
int16_t pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
|
int16_t pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
|
||||||
@@ -2114,18 +2116,15 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
|||||||
if (ue->mac_enabled == 1)
|
if (ue->mac_enabled == 1)
|
||||||
nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id);
|
nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id);
|
||||||
|
|
||||||
} else if (nr_prach == 2) {
|
} else if (nr_prach == WAIT_CONTENTION_RESOLUTION) {
|
||||||
|
LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id);
|
||||||
|
ue->UE_mode[gNB_id] = RA_WAIT_CR;
|
||||||
|
} else if (nr_prach == RA_SUCCEEDED) {
|
||||||
LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id);
|
LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id);
|
||||||
|
|
||||||
ue->UE_mode[gNB_id] = PUSCH;
|
ue->UE_mode[gNB_id] = PUSCH;
|
||||||
|
} else if(nr_prach == RA_FAILED){
|
||||||
} else if(nr_prach == 3){
|
|
||||||
|
|
||||||
LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id);
|
LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id);
|
||||||
|
|
||||||
ue->UE_mode[gNB_id] = PRACH;
|
ue->UE_mode[gNB_id] = PRACH;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
|
||||||
|
|||||||
@@ -91,12 +91,15 @@ msc_interface_t msc_interface;
|
|||||||
// dummy functions
|
// dummy functions
|
||||||
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
||||||
|
|
||||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||||
const int CC_id,
|
const int CC_id,
|
||||||
const uint8_t gNB_index,
|
const uint8_t gNB_index,
|
||||||
const int8_t channel,
|
const frame_t frame,
|
||||||
const uint8_t* pduP,
|
const sub_frame_t sub_frame,
|
||||||
const sdu_size_t pdu_len)
|
const rnti_t rnti,
|
||||||
|
const channel_t channel,
|
||||||
|
const uint8_t* pduP,
|
||||||
|
const sdu_size_t pdu_len)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "SCHED_NR_UE/phy_frame_config_nr.h"
|
#include "SCHED_NR_UE/phy_frame_config_nr.h"
|
||||||
#include "PHY/phy_vars_nr_ue.h"
|
#include "PHY/phy_vars_nr_ue.h"
|
||||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||||
|
#include "PHY/MODULATION/nr_modulation.h"
|
||||||
#include "PHY/MODULATION/modulation_eNB.h"
|
#include "PHY/MODULATION/modulation_eNB.h"
|
||||||
#include "PHY/MODULATION/modulation_UE.h"
|
#include "PHY/MODULATION/modulation_UE.h"
|
||||||
#include "PHY/INIT/phy_init.h"
|
#include "PHY/INIT/phy_init.h"
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
#include "OCG_vars.h"
|
#include "OCG_vars.h"
|
||||||
#include <openair2/LAYER2/MAC/mac_vars.h>
|
#include <openair2/LAYER2/MAC/mac_vars.h>
|
||||||
#include <openair2/RRC/LTE/rrc_vars.h>
|
#include <openair2/RRC/LTE/rrc_vars.h>
|
||||||
|
#include <openair2/RRC/NR_UE/rrc_defs.h>
|
||||||
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
|
||||||
|
|
||||||
|
|
||||||
@@ -132,7 +134,18 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return 0;}
|
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||||
|
const int CC_id,
|
||||||
|
const uint8_t gNB_index,
|
||||||
|
const frame_t frame,
|
||||||
|
const sub_frame_t sub_frame,
|
||||||
|
const rnti_t rnti,
|
||||||
|
const channel_t channel,
|
||||||
|
const uint8_t* pduP,
|
||||||
|
const sdu_size_t pdu_len)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index)
|
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index)
|
||||||
{
|
{
|
||||||
@@ -167,7 +180,7 @@ int main(int argc, char **argv){
|
|||||||
|
|
||||||
double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0;
|
double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0;
|
||||||
double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs, bw;
|
double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs, bw;
|
||||||
int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
|
int i, l, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1;
|
||||||
int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0;
|
int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0;
|
||||||
uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0;
|
uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0;
|
||||||
uint8_t frame = 1, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol;
|
uint8_t frame = 1, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol;
|
||||||
@@ -802,6 +815,16 @@ int main(int argc, char **argv){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (l = 0; l < frame_parms->symbols_per_slot; l++) {
|
||||||
|
for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
|
||||||
|
nr_slot_fep_ul(frame_parms,
|
||||||
|
ru->common.rxdata[aa],
|
||||||
|
ru->common.rxdataF[aa],
|
||||||
|
l,
|
||||||
|
slot,
|
||||||
|
ru->N_TA_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot);
|
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot);
|
||||||
|
|
||||||
@@ -825,7 +848,8 @@ int main(int argc, char **argv){
|
|||||||
LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1);
|
LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1);
|
||||||
LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||||
LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
|
||||||
LOG_M("ru_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1);
|
LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1);
|
||||||
|
LOG_M("ru_prach_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1);
|
||||||
LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1);
|
LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1);
|
||||||
LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1);
|
LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -87,8 +87,19 @@ msc_interface_t msc_interface;
|
|||||||
|
|
||||||
extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration
|
extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration
|
||||||
|
|
||||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
|
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||||
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; }
|
const int CC_id,
|
||||||
|
const uint8_t gNB_index,
|
||||||
|
const frame_t frame,
|
||||||
|
const sub_frame_t sub_frame,
|
||||||
|
const rnti_t rnti,
|
||||||
|
const channel_t channel,
|
||||||
|
const uint8_t* pduP,
|
||||||
|
const sdu_size_t pdu_len)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int generate_dlsch_header(unsigned char *mac_header,
|
int generate_dlsch_header(unsigned char *mac_header,
|
||||||
unsigned char num_sdus,
|
unsigned char num_sdus,
|
||||||
unsigned short *sdu_lengths,
|
unsigned short *sdu_lengths,
|
||||||
|
|||||||
@@ -124,7 +124,37 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) {
|
|||||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon));
|
scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon));
|
||||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = CALLOC(1,sizeof(long));
|
scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = CALLOC(1,sizeof(long));
|
||||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero = CALLOC(1,sizeof(long));
|
scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero = CALLOC(1,sizeof(long));
|
||||||
// scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = CALLOC(1,sizeof(struct NR_ControlResourceSet));
|
|
||||||
|
NR_ControlResourceSet_t *coreset0 = CALLOC(1,sizeof(struct NR_ControlResourceSet));
|
||||||
|
coreset0->controlResourceSetId = 0;
|
||||||
|
// frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B,
|
||||||
|
if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6);
|
||||||
|
coreset0->frequencyDomainResources.buf[0] = 0xff;
|
||||||
|
coreset0->frequencyDomainResources.buf[1] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[2] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[3] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[4] = 0;
|
||||||
|
coreset0->frequencyDomainResources.buf[5] = 0;
|
||||||
|
coreset0->frequencyDomainResources.size = 6;
|
||||||
|
coreset0->frequencyDomainResources.bits_unused = 3;
|
||||||
|
coreset0->duration = 1;
|
||||||
|
coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved;
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved));
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6;
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2;
|
||||||
|
coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId;
|
||||||
|
coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
|
||||||
|
if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList));
|
||||||
|
NR_TCI_StateId_t *tci[8];
|
||||||
|
for (int i=0;i<8;i++) {
|
||||||
|
tci[i]=calloc(1,sizeof(*tci[i]));
|
||||||
|
*tci[i] = i;
|
||||||
|
ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]);
|
||||||
|
}
|
||||||
|
coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
|
||||||
|
coreset0->tci_PresentInDCI = NULL;
|
||||||
|
coreset0->pdcch_DMRS_ScramblingID = NULL;
|
||||||
|
scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = coreset0;
|
||||||
|
|
||||||
// scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
|
// scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
|
||||||
// scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = CALLOC(1,sizeof(NR_SearchSpaceId_t));
|
// scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = CALLOC(1,sizeof(NR_SearchSpaceId_t));
|
||||||
|
|||||||
@@ -335,12 +335,12 @@ typedef struct {
|
|||||||
#define DL_SCH_LCID_CON_RES_ID 0x3E
|
#define DL_SCH_LCID_CON_RES_ID 0x3E
|
||||||
#define DL_SCH_LCID_PADDING 0x3F
|
#define DL_SCH_LCID_PADDING 0x3F
|
||||||
|
|
||||||
#define UL_SCH_LCID_CCCH 0x00
|
#define UL_SCH_LCID_CCCH1 0x00
|
||||||
#define UL_SCH_LCID_SRB1 0x01
|
#define UL_SCH_LCID_SRB1 0x01
|
||||||
#define UL_SCH_LCID_SRB2 0x02
|
#define UL_SCH_LCID_SRB2 0x02
|
||||||
#define UL_SCH_LCID_SRB3 0x03
|
#define UL_SCH_LCID_SRB3 0x03
|
||||||
#define UL_SCH_LCID_DTCH 0x04
|
#define UL_SCH_LCID_DTCH 0x04
|
||||||
#define UL_SCH_LCID_CCCH_MSG3 0x21
|
#define UL_SCH_LCID_CCCH 0x34
|
||||||
#define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35
|
#define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35
|
||||||
#define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36
|
#define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36
|
||||||
#define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37
|
#define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37
|
||||||
|
|||||||
@@ -125,6 +125,152 @@ const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f
|
|||||||
|
|
||||||
const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 };
|
const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 };
|
||||||
|
|
||||||
|
// for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
||||||
|
const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3]={
|
||||||
|
{0,2,12}, // row index 1
|
||||||
|
{0,2,10}, // row index 2
|
||||||
|
{0,2,9}, // row index 3
|
||||||
|
{0,2,7}, // row index 4
|
||||||
|
{0,2,5}, // row index 5
|
||||||
|
{0,9,4}, // row index 6
|
||||||
|
{0,4,4}, // row index 7
|
||||||
|
{0,5,7}, // row index 8
|
||||||
|
{0,5,2}, // row index 9
|
||||||
|
{0,9,2}, // row index 10
|
||||||
|
{0,12,2}, // row index 11
|
||||||
|
{0,1,13}, // row index 12
|
||||||
|
{0,1,6}, // row index 13
|
||||||
|
{0,2,4}, // row index 14
|
||||||
|
{0,4,7}, // row index 15
|
||||||
|
{0,8,4} // row index 16
|
||||||
|
};
|
||||||
|
const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3]={
|
||||||
|
{0,3,11}, // row index 1
|
||||||
|
{0,3,9}, // row index 2
|
||||||
|
{0,3,8}, // row index 3
|
||||||
|
{0,3,6}, // row index 4
|
||||||
|
{0,3,4}, // row index 5
|
||||||
|
{0,10,4}, // row index 6
|
||||||
|
{0,6,4}, // row index 7
|
||||||
|
{0,5,7}, // row index 8
|
||||||
|
{0,5,2}, // row index 9
|
||||||
|
{0,9,2}, // row index 10
|
||||||
|
{0,12,2}, // row index 11
|
||||||
|
{0,1,13}, // row index 12
|
||||||
|
{0,1,6}, // row index 13
|
||||||
|
{0,2,4}, // row index 14
|
||||||
|
{0,4,7}, // row index 15
|
||||||
|
{0,8,4} // row index 16
|
||||||
|
};
|
||||||
|
const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3]={
|
||||||
|
{0,2,6}, // row index 1
|
||||||
|
{0,2,10}, // row index 2
|
||||||
|
{0,2,9}, // row index 3
|
||||||
|
{0,2,7}, // row index 4
|
||||||
|
{0,2,5}, // row index 5
|
||||||
|
{0,6,4}, // row index 6
|
||||||
|
{0,4,4}, // row index 7
|
||||||
|
{0,5,6}, // row index 8
|
||||||
|
{0,5,2}, // row index 9
|
||||||
|
{0,9,2}, // row index 10
|
||||||
|
{0,10,2}, // row index 11
|
||||||
|
{0,1,11}, // row index 12
|
||||||
|
{0,1,6}, // row index 13
|
||||||
|
{0,2,4}, // row index 14
|
||||||
|
{0,4,6}, // row index 15
|
||||||
|
{0,8,4} // row index 16
|
||||||
|
};
|
||||||
|
const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3]={
|
||||||
|
{0,3,5}, // row index 1
|
||||||
|
{0,3,9}, // row index 2
|
||||||
|
{0,3,8}, // row index 3
|
||||||
|
{0,3,6}, // row index 4
|
||||||
|
{0,3,4}, // row index 5
|
||||||
|
{0,8,2}, // row index 6
|
||||||
|
{0,6,4}, // row index 7
|
||||||
|
{0,5,6}, // row index 8
|
||||||
|
{0,5,2}, // row index 9
|
||||||
|
{0,9,2}, // row index 10
|
||||||
|
{0,10,2}, // row index 11
|
||||||
|
{0,1,11}, // row index 12
|
||||||
|
{0,1,6}, // row index 13
|
||||||
|
{0,2,4}, // row index 14
|
||||||
|
{0,4,6}, // row index 15
|
||||||
|
{0,8,4} // row index 16
|
||||||
|
};
|
||||||
|
const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3]={
|
||||||
|
{0,2,2}, // row index 1
|
||||||
|
{0,4,2}, // row index 2
|
||||||
|
{0,6,2}, // row index 3
|
||||||
|
{0,8,2}, // row index 4
|
||||||
|
{0,10,2}, // row index 5
|
||||||
|
{1,2,2}, // row index 6
|
||||||
|
{1,4,2}, // row index 7
|
||||||
|
{0,2,4}, // row index 8
|
||||||
|
{0,4,4}, // row index 9
|
||||||
|
{0,6,4}, // row index 10
|
||||||
|
{0,8,4}, // row index 11
|
||||||
|
{0,10,4}, // row index 12
|
||||||
|
{0,2,7}, // row index 13
|
||||||
|
{0,2,12}, // row index 14
|
||||||
|
{1,2,4}, // row index 15
|
||||||
|
{0,0,0} // row index 16
|
||||||
|
};
|
||||||
|
const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3]={
|
||||||
|
{0,2,2}, // row index 1
|
||||||
|
{0,4,2}, // row index 2
|
||||||
|
{0,6,2}, // row index 3
|
||||||
|
{0,8,2}, // row index 4
|
||||||
|
{0,10,2}, // row index 5
|
||||||
|
{1,2,2}, // row index 6
|
||||||
|
{1,4,2}, // row index 7
|
||||||
|
{0,2,4}, // row index 8
|
||||||
|
{0,4,4}, // row index 9
|
||||||
|
{0,6,4}, // row index 10
|
||||||
|
{0,8,4}, // row index 11
|
||||||
|
{0,10,4}, // row index 12
|
||||||
|
{0,2,7}, // row index 13
|
||||||
|
{0,3,11}, // row index 14
|
||||||
|
{1,2,4}, // row index 15
|
||||||
|
{0,0,0} // row index 16
|
||||||
|
};
|
||||||
|
const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3]={
|
||||||
|
{0,2,2}, // row index 1
|
||||||
|
{0,4,2}, // row index 2
|
||||||
|
{0,6,2}, // row index 3
|
||||||
|
{0,8,2}, // row index 4
|
||||||
|
{0,10,2}, // row index 5
|
||||||
|
{0,0,0}, // row index 6
|
||||||
|
{0,0,0}, // row index 7
|
||||||
|
{0,2,4}, // row index 8
|
||||||
|
{0,4,4}, // row index 9
|
||||||
|
{0,6,4}, // row index 10
|
||||||
|
{0,8,4}, // row index 11
|
||||||
|
{0,10,4}, // row index 12
|
||||||
|
{0,2,7}, // row index 13
|
||||||
|
{0,2,12}, // row index 14
|
||||||
|
{0,0,6}, // row index 15
|
||||||
|
{0,2,6} // row index 16
|
||||||
|
};
|
||||||
|
const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3]={
|
||||||
|
{0,2,2}, // row index 1
|
||||||
|
{0,4,2}, // row index 2
|
||||||
|
{0,6,2}, // row index 3
|
||||||
|
{0,8,2}, // row index 4
|
||||||
|
{0,10,2}, // row index 5
|
||||||
|
{0,0,0}, // row index 6
|
||||||
|
{0,0,0}, // row index 7
|
||||||
|
{0,2,4}, // row index 8
|
||||||
|
{0,4,4}, // row index 9
|
||||||
|
{0,6,4}, // row index 10
|
||||||
|
{0,8,4}, // row index 11
|
||||||
|
{0,10,4}, // row index 12
|
||||||
|
{0,2,7}, // row index 13
|
||||||
|
{0,3,11}, // row index 14
|
||||||
|
{0,0,6}, // row index 15
|
||||||
|
{0,2,6} // row index 16
|
||||||
|
};
|
||||||
|
|
||||||
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
|
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
|
||||||
const char *duplex_mode[]={"FDD","TDD"};
|
const char *duplex_mode[]={"FDD","TDD"};
|
||||||
|
|
||||||
@@ -2166,8 +2312,8 @@ int get_num_dmrs(uint16_t dmrs_mask ) {
|
|||||||
return(num_dmrs);
|
return(num_dmrs);
|
||||||
}
|
}
|
||||||
/* returns the total DMRS symbols in a slot*/
|
/* returns the total DMRS symbols in a slot*/
|
||||||
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols){
|
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol){
|
||||||
return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols));
|
return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols,startSymbol));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table 5.1.2.2.1-1 38.214
|
// Table 5.1.2.2.1-1 38.214
|
||||||
@@ -2806,21 +2952,25 @@ int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slot, lte_frame_type
|
|||||||
else return(slot_in_period >= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
else return(slot_in_period >= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols) {
|
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol) {
|
||||||
|
|
||||||
int l0;
|
int l0;
|
||||||
|
int ld = NrOfSymbols+startSymbol;
|
||||||
if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2;
|
if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2;
|
||||||
else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3;
|
else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3;
|
||||||
else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position);
|
else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position);
|
||||||
if (pdsch_Config == NULL) { // Initial BWP
|
if (pdsch_Config == NULL) { // Initial BWP
|
||||||
return(1<<l0);
|
if (ld <= 7) return(1<<l0);
|
||||||
|
else if (ld <= 9) return(1<<l0 | 1<<7);
|
||||||
|
else if (ld <= 12) return(1<<l0 | 1<<6 | 1<<9);
|
||||||
|
else if (ld <= 14) return(1<<l0 | 1<<7 | 1<<11);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA &&
|
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA &&
|
||||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) {
|
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) {
|
||||||
// Relative to start of slot
|
// Relative to start of slot
|
||||||
NR_DMRS_DownlinkConfig_t *dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
|
NR_DMRS_DownlinkConfig_t *dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
|
||||||
AssertFatal(NrOfSymbols>1 && NrOfSymbols < 15,"Illegal NrOfSymbols %d\n",NrOfSymbols);
|
AssertFatal(ld>1 && ld < 15,"Illegal l_d %d\n",ld);
|
||||||
int pos2=0;
|
int pos2=0;
|
||||||
if (dmrs_config->maxLength == NULL) {
|
if (dmrs_config->maxLength == NULL) {
|
||||||
// this is Table 7.4.1.1.2-3: PDSCH DM-RS positions l for single-symbol DM-RS
|
// this is Table 7.4.1.1.2-3: PDSCH DM-RS positions l for single-symbol DM-RS
|
||||||
@@ -2829,7 +2979,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
|||||||
return(1<<l0);
|
return(1<<l0);
|
||||||
|
|
||||||
|
|
||||||
switch (NrOfSymbols) {
|
switch (ld) {
|
||||||
case 2 :
|
case 2 :
|
||||||
case 3 :
|
case 3 :
|
||||||
case 4 :
|
case 4 :
|
||||||
@@ -2870,10 +3020,10 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Table 7.4.1.1.2-4: PDSCH DM-RS positions l for double-symbol DM-RS.
|
// Table 7.4.1.1.2-4: PDSCH DM-RS positions l for double-symbol DM-RS.
|
||||||
AssertFatal(NrOfSymbols>3,"Illegal NrOfSymbols %d for len2 DMRS\n",NrOfSymbols);
|
AssertFatal(ld>3,"Illegal l_d %d for len2 DMRS\n",ld);
|
||||||
if (NrOfSymbols < 10) return(1<<l0);
|
if (ld < 10) return(1<<l0);
|
||||||
if (NrOfSymbols < 13 && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
if (ld < 13 && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
||||||
if (NrOfSymbols < 13 && *dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0 | 1<<8);
|
if (ld < 13 && *dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0 | 1<<8);
|
||||||
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
||||||
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<<l0 | 1<<10);
|
if (*dmrs_config->dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<<l0 | 1<<10);
|
||||||
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<<l0);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
|||||||
|
|
||||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
|
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
|
||||||
|
|
||||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
|
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol);
|
||||||
|
|
||||||
int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
|
int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
|
||||||
|
|
||||||
@@ -152,7 +152,8 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config,
|
|||||||
uint8_t *K_ptrs, uint8_t *L_ptrs,
|
uint8_t *K_ptrs, uint8_t *L_ptrs,
|
||||||
uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower,
|
uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower,
|
||||||
uint8_t NrOfSymbols);
|
uint8_t NrOfSymbols);
|
||||||
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
|
|
||||||
|
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol);
|
||||||
|
|
||||||
/* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16
|
/* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16
|
||||||
@param *pusch_config, pointer to pusch config
|
@param *pusch_config, pointer to pusch config
|
||||||
|
|||||||
@@ -139,4 +139,13 @@ extern const float table_38213_13_12_c3[16];
|
|||||||
|
|
||||||
extern const int32_t table_38213_10_1_1_c2[5];
|
extern const int32_t table_38213_10_1_1_c2[5];
|
||||||
|
|
||||||
|
extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3];
|
||||||
|
extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3];
|
||||||
|
extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3];
|
||||||
|
extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3];
|
||||||
|
extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3];
|
||||||
|
extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3];
|
||||||
|
extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3];
|
||||||
|
extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3];
|
||||||
|
|
||||||
#endif //DEF_H
|
#endif //DEF_H
|
||||||
|
|||||||
@@ -31,9 +31,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//#include "mac_defs.h"
|
//#include "mac_defs.h"
|
||||||
|
#include <NR_MAC_gNB/mac_proto.h>
|
||||||
#include "NR_MAC_UE/mac_proto.h"
|
#include "NR_MAC_UE/mac_proto.h"
|
||||||
#include "NR_MAC-CellGroupConfig.h"
|
#include "NR_MAC-CellGroupConfig.h"
|
||||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||||
|
#include "executables/softmodem-common.h"
|
||||||
|
|
||||||
int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg,
|
int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg,
|
||||||
int mu,
|
int mu,
|
||||||
@@ -309,8 +311,11 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
|||||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
|
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
|
||||||
else
|
else
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
||||||
|
if (get_softmodem_params()->sa) {
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart;
|
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||||
|
} else {
|
||||||
|
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||||
|
}
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range);
|
cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range);
|
||||||
//cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ???
|
//cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ???
|
||||||
@@ -528,11 +533,13 @@ int nr_rrc_mac_config_req_ue(
|
|||||||
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
||||||
config_control_ue(mac);
|
config_control_ue(mac);
|
||||||
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
||||||
ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
if (cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) {
|
||||||
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||||
config_common_ue(mac,module_id,cc_idP);
|
}
|
||||||
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
||||||
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
|
config_common_ue(mac,module_id,cc_idP);
|
||||||
|
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
||||||
|
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the SSB to Rach Occasions mapping according to the config
|
// Setup the SSB to Rach Occasions mapping according to the config
|
||||||
|
|||||||
@@ -234,9 +234,12 @@ typedef struct {
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RA_UE_IDLE = 0,
|
RA_UE_IDLE = 0,
|
||||||
WAIT_RAR = 1,
|
GENERATE_IDLE = 0,
|
||||||
WAIT_CONTENTION_RESOLUTION = 2,
|
GENERATE_PREAMBLE = 1,
|
||||||
RA_SUCCEEDED = 3
|
WAIT_RAR = 2,
|
||||||
|
WAIT_CONTENTION_RESOLUTION = 3,
|
||||||
|
RA_SUCCEEDED = 4,
|
||||||
|
RA_FAILED = 5
|
||||||
} RA_state_t;
|
} RA_state_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -257,8 +260,10 @@ typedef struct {
|
|||||||
uint8_t RA_attempt_number;
|
uint8_t RA_attempt_number;
|
||||||
/// Random-access procedure flag
|
/// Random-access procedure flag
|
||||||
uint8_t RA_active;
|
uint8_t RA_active;
|
||||||
|
/// Random-access preamble index
|
||||||
|
int ra_PreambleIndex;
|
||||||
/// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot
|
/// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot
|
||||||
uint8_t generate_nr_prach;
|
RA_state_t generate_nr_prach;
|
||||||
|
|
||||||
/// Random-access window counter
|
/// Random-access window counter
|
||||||
int16_t RA_window_cnt;
|
int16_t RA_window_cnt;
|
||||||
@@ -289,6 +294,8 @@ typedef struct {
|
|||||||
uint8_t RA_contention_resolution_timer_active;
|
uint8_t RA_contention_resolution_timer_active;
|
||||||
/// Random-access Contention Resolution Timer count value
|
/// Random-access Contention Resolution Timer count value
|
||||||
uint8_t RA_contention_resolution_cnt;
|
uint8_t RA_contention_resolution_cnt;
|
||||||
|
/// Transmitted UE Contention Resolution Identifier
|
||||||
|
uint8_t cont_res_id[6];
|
||||||
|
|
||||||
/// BeamfailurerecoveryConfig
|
/// BeamfailurerecoveryConfig
|
||||||
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
|
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
|
||||||
|
|||||||
@@ -178,7 +178,8 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
|||||||
int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
|
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
|
||||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
|
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
|
||||||
uint8_t time_domain_ind);
|
uint8_t time_domain_ind,
|
||||||
|
bool use_default);
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||||
|
|||||||
@@ -146,17 +146,11 @@ int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t m
|
|||||||
|
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||||
int8_t receivedTargerPower, delta_preamble;
|
int8_t receivedTargerPower;
|
||||||
long preambleReceivedTargetPower = 0;
|
int8_t delta_preamble;
|
||||||
|
|
||||||
if (prach_resources->RA_TYPE == RA_4STEP){
|
|
||||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
|
||||||
preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower;
|
|
||||||
} else if (prach_resources->RA_TYPE == RA_2STEP){
|
|
||||||
// msgA-PreambleReceivedTargetPower
|
|
||||||
LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||||
|
long preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower;
|
||||||
delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format);
|
delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format);
|
||||||
|
|
||||||
receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA;
|
receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA;
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ void init_RA(module_id_t mod_id,
|
|||||||
|
|
||||||
RA_config_t *ra = &mac->ra;
|
RA_config_t *ra = &mac->ra;
|
||||||
ra->RA_active = 1;
|
ra->RA_active = 1;
|
||||||
|
ra->ra_PreambleIndex = -1;
|
||||||
|
ra->RA_usedGroupA = 1;
|
||||||
ra->RA_RAPID_found = 0;
|
ra->RA_RAPID_found = 0;
|
||||||
ra->preambleTransMax = 0;
|
ra->preambleTransMax = 0;
|
||||||
ra->first_Msg3 = 1;
|
ra->first_Msg3 = 1;
|
||||||
@@ -79,8 +81,8 @@ void init_RA(module_id_t mod_id,
|
|||||||
|
|
||||||
if (rach_ConfigDedicated) {
|
if (rach_ConfigDedicated) {
|
||||||
if (rach_ConfigDedicated->cfra){
|
if (rach_ConfigDedicated->cfra){
|
||||||
LOG_I(MAC, "Initialization of 4-step contention-free random access procedure\n");
|
LOG_I(MAC, "Initialization of 2-step contention-free random access procedure\n");
|
||||||
prach_resources->RA_TYPE = RA_4STEP;
|
prach_resources->RA_TYPE = RA_2STEP;
|
||||||
ra->cfra = 1;
|
ra->cfra = 1;
|
||||||
} else if (rach_ConfigDedicated->ext1){
|
} else if (rach_ConfigDedicated->ext1){
|
||||||
if (rach_ConfigDedicated->ext1->cfra_TwoStep_r16){
|
if (rach_ConfigDedicated->ext1->cfra_TwoStep_r16){
|
||||||
@@ -93,161 +95,152 @@ void init_RA(module_id_t mod_id,
|
|||||||
} else {
|
} else {
|
||||||
LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__);
|
LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
} else if (nr_rach_ConfigCommon){
|
||||||
|
LOG_I(MAC, "Initialization of 4-step contention-based random access procedure\n");
|
||||||
|
prach_resources->RA_TYPE = RA_4STEP;
|
||||||
|
ra->cfra = 0;
|
||||||
} else {
|
} else {
|
||||||
LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__);
|
LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prach_resources->RA_TYPE == RA_2STEP){
|
switch (rach_ConfigGeneric->powerRampingStep){ // in dB
|
||||||
LOG_E(MAC, "Missing implementation of initialization of 2-step RA specific variables...\n");
|
case 0:
|
||||||
} else if (prach_resources->RA_TYPE == RA_4STEP){
|
|
||||||
LOG_D(MAC, "Initialization of 4-step RA specific variables...\n");
|
|
||||||
switch (rach_ConfigGeneric->powerRampingStep){ // in dB
|
|
||||||
case 0:
|
|
||||||
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 0;
|
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 2;
|
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 4;
|
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 4;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 6;
|
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 6;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
switch (rach_ConfigGeneric->preambleTransMax) {
|
|
||||||
case 0:
|
|
||||||
ra->preambleTransMax = 3;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
ra->preambleTransMax = 4;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ra->preambleTransMax = 5;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
ra->preambleTransMax = 6;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
ra->preambleTransMax = 7;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
ra->preambleTransMax = 8;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
ra->preambleTransMax = 10;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
ra->preambleTransMax = 20;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
ra->preambleTransMax = 50;
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
ra->preambleTransMax = 100;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
ra->preambleTransMax = 200;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (nr_rach_ConfigCommon->ext1) {
|
|
||||||
if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){
|
|
||||||
LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
switch (rach_ConfigGeneric->preambleTransMax) {
|
||||||
|
case 0:
|
||||||
|
ra->preambleTransMax = 3;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
ra->preambleTransMax = 4;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ra->preambleTransMax = 5;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
ra->preambleTransMax = 6;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
ra->preambleTransMax = 7;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
ra->preambleTransMax = 8;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
ra->preambleTransMax = 10;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
ra->preambleTransMax = 20;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
ra->preambleTransMax = 50;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
ra->preambleTransMax = 100;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
ra->preambleTransMax = 200;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nr_rach_ConfigCommon->ext1) {
|
||||||
|
if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){
|
||||||
|
LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon, fapi_nr_ul_config_prach_pdu *prach_pdu){
|
void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon, fapi_nr_ul_config_prach_pdu *prach_pdu){
|
||||||
|
|
||||||
// Determine the SSB to RACH mapping ratio
|
// Determine the SSB to RACH mapping ratio
|
||||||
// =======================================
|
// =======================================
|
||||||
if (prach_resources->RA_TYPE == RA_4STEP){
|
|
||||||
NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present;
|
|
||||||
boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB
|
|
||||||
uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB
|
|
||||||
int total_preambles_per_ssb;
|
|
||||||
uint8_t ssb_nb_in_ro;
|
|
||||||
int numberOfRA_Preambles = 64;
|
|
||||||
|
|
||||||
switch (ssb_perRACH_config){
|
NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present;
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
|
boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB
|
||||||
multiple_ssb_per_ro = false;
|
uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB
|
||||||
ssb_rach_ratio = 8;
|
int total_preambles_per_ssb;
|
||||||
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1);
|
uint8_t ssb_nb_in_ro;
|
||||||
break;
|
int numberOfRA_Preambles = 64;
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
|
|
||||||
multiple_ssb_per_ro = false;
|
|
||||||
ssb_rach_ratio = 4;
|
|
||||||
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1);
|
|
||||||
break;
|
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
|
|
||||||
multiple_ssb_per_ro = false;
|
|
||||||
ssb_rach_ratio = 2;
|
|
||||||
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1);
|
|
||||||
break;
|
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
|
|
||||||
multiple_ssb_per_ro = true;
|
|
||||||
ssb_rach_ratio = 1;
|
|
||||||
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1);
|
|
||||||
break;
|
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
|
|
||||||
multiple_ssb_per_ro = true;
|
|
||||||
ssb_rach_ratio = 2;
|
|
||||||
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1);
|
|
||||||
break;
|
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
|
|
||||||
multiple_ssb_per_ro = true;
|
|
||||||
ssb_rach_ratio = 4;
|
|
||||||
ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four;
|
|
||||||
break;
|
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
|
|
||||||
multiple_ssb_per_ro = true;
|
|
||||||
ssb_rach_ratio = 8;
|
|
||||||
ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight;
|
|
||||||
break;
|
|
||||||
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
|
|
||||||
multiple_ssb_per_ro = true;
|
|
||||||
ssb_rach_ratio = 16;
|
|
||||||
ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles)
|
switch (ssb_perRACH_config){
|
||||||
numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles);
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
|
||||||
|
multiple_ssb_per_ro = false;
|
||||||
|
ssb_rach_ratio = 8;
|
||||||
|
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1);
|
||||||
|
break;
|
||||||
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
|
||||||
|
multiple_ssb_per_ro = false;
|
||||||
|
ssb_rach_ratio = 4;
|
||||||
|
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1);
|
||||||
|
break;
|
||||||
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
|
||||||
|
multiple_ssb_per_ro = false;
|
||||||
|
ssb_rach_ratio = 2;
|
||||||
|
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1);
|
||||||
|
break;
|
||||||
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
|
||||||
|
multiple_ssb_per_ro = true;
|
||||||
|
ssb_rach_ratio = 1;
|
||||||
|
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1);
|
||||||
|
break;
|
||||||
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
|
||||||
|
multiple_ssb_per_ro = true;
|
||||||
|
ssb_rach_ratio = 2;
|
||||||
|
ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1);
|
||||||
|
break;
|
||||||
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
|
||||||
|
multiple_ssb_per_ro = true;
|
||||||
|
ssb_rach_ratio = 4;
|
||||||
|
ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four;
|
||||||
|
break;
|
||||||
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
|
||||||
|
multiple_ssb_per_ro = true;
|
||||||
|
ssb_rach_ratio = 8;
|
||||||
|
ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight;
|
||||||
|
break;
|
||||||
|
case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
|
||||||
|
multiple_ssb_per_ro = true;
|
||||||
|
ssb_rach_ratio = 16;
|
||||||
|
ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config);
|
||||||
|
}
|
||||||
|
|
||||||
// Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration
|
if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles)
|
||||||
if ((true == multiple_ssb_per_ro) &&
|
numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles);
|
||||||
(ssb_rach_ratio > 1)) {
|
|
||||||
total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio;
|
|
||||||
|
|
||||||
ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro;
|
// Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration
|
||||||
ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro;
|
if ((true == multiple_ssb_per_ro) && (ssb_rach_ratio > 1)) {
|
||||||
}
|
total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio;
|
||||||
else {
|
|
||||||
total_preambles_per_ssb = numberOfRA_Preambles;
|
ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro;
|
||||||
ra->starting_preamble_nb = 0;
|
ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__);
|
total_preambles_per_ssb = numberOfRA_Preambles;
|
||||||
|
ra->starting_preamble_nb = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This routine implements RA premable configuration according to
|
// This routine implements RA preamble configuration according to
|
||||||
// section 5.1 (Random Access procedure) of 3GPP TS 38.321 version 16.2.1 Release 16
|
// section 5.1 (Random Access procedure) of 3GPP TS 38.321 version 16.2.1 Release 16
|
||||||
void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac, int16_t dl_pathloss){
|
void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac, int16_t dl_pathloss){
|
||||||
|
|
||||||
int messageSizeGroupA = 0;
|
int messageSizeGroupA = 0;
|
||||||
int sizeOfRA_PreamblesGroupA = 0;
|
int sizeOfRA_PreamblesGroupA = 0;
|
||||||
int messagePowerOffsetGroupB = 0;
|
int messagePowerOffsetGroupB = 0;
|
||||||
int PLThreshold;
|
int PLThreshold = 0;
|
||||||
long deltaPreamble_Msg3 = 0;
|
long deltaPreamble_Msg3 = 0;
|
||||||
uint8_t noGroupB = 0;
|
uint8_t noGroupB = 0;
|
||||||
RA_config_t *ra = &mac->ra;
|
RA_config_t *ra = &mac->ra;
|
||||||
@@ -255,23 +248,21 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
|||||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric;
|
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric;
|
||||||
|
|
||||||
if (prach_resources->RA_TYPE == RA_4STEP){
|
if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){
|
||||||
|
deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB
|
||||||
|
LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3);
|
||||||
|
}
|
||||||
|
|
||||||
if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){
|
if (!nr_rach_ConfigCommon->groupBconfigured) {
|
||||||
deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB
|
noGroupB = 1;
|
||||||
LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3);
|
LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__);
|
||||||
}
|
} else {
|
||||||
|
// RA preambles group B is configured
|
||||||
if (!nr_rach_ConfigCommon->groupBconfigured) {
|
// - Random Access Preambles group B is configured for 4-step RA type
|
||||||
noGroupB = 1;
|
// - Defining the number of RA preambles in RA Preamble Group A for each SSB
|
||||||
LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__);
|
LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__);
|
||||||
} else {
|
sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA;
|
||||||
// RA preambles group B is configured
|
switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){
|
||||||
// - Random Access Preambles group B is configured for 4-step RA type
|
|
||||||
// - Defining the number of RA preambles in RA Preamble Group A for each SSB
|
|
||||||
LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__);
|
|
||||||
sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA;
|
|
||||||
switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){
|
|
||||||
/* - Threshold to determine the groups of RA preambles */
|
/* - Threshold to determine the groups of RA preambles */
|
||||||
case 0:
|
case 0:
|
||||||
messageSizeGroupA = 56;
|
messageSizeGroupA = 56;
|
||||||
@@ -337,44 +328,42 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB);
|
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB);
|
||||||
}
|
|
||||||
|
|
||||||
PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// todo:
|
PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB;
|
||||||
// - groupB-ConfiguredTwoStepRA
|
|
||||||
// - msgA-DeltaPreamble
|
|
||||||
LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Msg3 has not been transmitted yet */
|
/* Msg3 has not been transmitted yet */
|
||||||
if (ra->first_Msg3) {
|
if (ra->first_Msg3) {
|
||||||
if (noGroupB) {
|
if(ra->ra_PreambleIndex < 0 || ra->ra_PreambleIndex > 63) {
|
||||||
// use Group A preamble
|
if (noGroupB) {
|
||||||
prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
// use Group A preamble
|
||||||
ra->RA_usedGroupA = 1;
|
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
||||||
} else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) {
|
ra->RA_usedGroupA = 1;
|
||||||
// Group B is configured and RA preamble Group A is used
|
} else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) {
|
||||||
// - todo add condition on CCCH_sdu_size for initiation by CCCH
|
// Group B is configured and RA preamble Group A is used
|
||||||
prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
// - todo add condition on CCCH_sdu_size for initiation by CCCH
|
||||||
ra->RA_usedGroupA = 1;
|
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
||||||
} else {
|
ra->RA_usedGroupA = 1;
|
||||||
// Group B preamble is configured and used
|
} else {
|
||||||
// the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A
|
// Group B preamble is configured and used
|
||||||
// the remaining belong to RA Preambles Group B
|
// the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A
|
||||||
prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
// the remaining belong to RA Preambles Group B
|
||||||
ra->RA_usedGroupA = 0;
|
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||||
|
ra->RA_usedGroupA = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else { // Msg3 is being retransmitted
|
} else { // Msg3 is being retransmitted
|
||||||
if (ra->RA_usedGroupA && noGroupB) {
|
if (ra->RA_usedGroupA && noGroupB) {
|
||||||
prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
||||||
} else if (ra->RA_usedGroupA && !noGroupB){
|
} else if (ra->RA_usedGroupA && !noGroupB){
|
||||||
prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
||||||
} else {
|
} else {
|
||||||
prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
prach_resources->ra_PreambleIndex = ra->ra_PreambleIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RA-RNTI computation (associated to PRACH occasion in which the RA Preamble is transmitted)
|
// RA-RNTI computation (associated to PRACH occasion in which the RA Preamble is transmitted)
|
||||||
@@ -472,6 +461,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
|
|||||||
// start contention resolution timer
|
// start contention resolution timer
|
||||||
ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8;
|
ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8;
|
||||||
ra->RA_contention_resolution_timer_active = 1;
|
ra->RA_contention_resolution_timer_active = 1;
|
||||||
|
ra->ra_state = WAIT_CONTENTION_RESOLUTION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,7 +493,8 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||||
RA_config_t *ra = &mac->ra;
|
RA_config_t *ra = &mac->ra;
|
||||||
uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES];
|
uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES];
|
||||||
uint8_t lcid = UL_SCH_LCID_CCCH_MSG3, *payload;
|
uint8_t lcid = UL_SCH_LCID_CCCH;
|
||||||
|
uint8_t *payload;
|
||||||
uint16_t size_sdu = 0;
|
uint16_t size_sdu = 0;
|
||||||
unsigned short post_padding;
|
unsigned short post_padding;
|
||||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||||
@@ -527,7 +518,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prach_resources->init_msg1) {
|
if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) {
|
||||||
|
|
||||||
if (ra->RA_active == 0) {
|
if (ra->RA_active == 0) {
|
||||||
/* RA not active - checking if RRC is ready to initiate the RA procedure */
|
/* RA not active - checking if RRC is ready to initiate the RA procedure */
|
||||||
@@ -557,6 +548,11 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
|
|
||||||
if (size_sdu > 0) {
|
if (size_sdu > 0) {
|
||||||
|
|
||||||
|
// UE Contention Resolution Identity
|
||||||
|
// Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the
|
||||||
|
// Random Access Procedure has been successful after reception of Msg4
|
||||||
|
memcpy(ra->cont_res_id, mac_sdus, sizeof(uint8_t) * 6);
|
||||||
|
|
||||||
LOG_D(MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx);
|
LOG_D(MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx);
|
||||||
|
|
||||||
ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
|
ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||||
@@ -566,7 +562,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
nr_get_RA_window(mac);
|
nr_get_RA_window(mac);
|
||||||
|
|
||||||
// Fill in preamble and PRACH resources
|
// Fill in preamble and PRACH resources
|
||||||
if (ra->generate_nr_prach == 1)
|
if (ra->generate_nr_prach == GENERATE_PREAMBLE)
|
||||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||||
|
|
||||||
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
|
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
|
||||||
@@ -614,9 +610,13 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ra->RA_window_cnt >= 0 && ra->RA_RAPID_found == 1) {
|
if (ra->RA_window_cnt >= 0 && ra->RA_RAPID_found == 1) {
|
||||||
// Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213)
|
|
||||||
|
|
||||||
nr_ra_succeeded(mod_id, frame, nr_slot_tx);
|
if(ra->cfra) {
|
||||||
|
// Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213)
|
||||||
|
nr_ra_succeeded(mod_id, frame, nr_slot_tx);
|
||||||
|
} else {
|
||||||
|
ra->generate_nr_prach = GENERATE_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (ra->RA_window_cnt == 0 && !ra->RA_RAPID_found) {
|
} else if (ra->RA_window_cnt == 0 && !ra->RA_RAPID_found) {
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
|
|
||||||
ra->RA_backoff_cnt--;
|
ra->RA_backoff_cnt--;
|
||||||
|
|
||||||
if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == 1) || ra->RA_backoff_cnt == 0){
|
if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == GENERATE_PREAMBLE) || ra->RA_backoff_cnt == 0){
|
||||||
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,7 +650,11 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
|||||||
nr_ue_contention_resolution(mod_id, CC_id, frame, nr_slot_tx, prach_resources);
|
nr_ue_contention_resolution(mod_id, CC_id, frame, nr_slot_tx, prach_resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ra->generate_nr_prach;
|
if(ra->generate_nr_prach != GENERATE_IDLE) {
|
||||||
|
return ra->generate_nr_prach;
|
||||||
|
} else {
|
||||||
|
return ra->ra_state;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,6 +748,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){
|
|||||||
LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received.\n", mod_id, frame, slot);
|
LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received.\n", mod_id, frame, slot);
|
||||||
|
|
||||||
ra->RA_window_cnt = -1;
|
ra->RA_window_cnt = -1;
|
||||||
|
mac->crnti = ra->t_crnti;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -751,6 +756,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){
|
|||||||
|
|
||||||
ra->RA_contention_resolution_cnt = -1;
|
ra->RA_contention_resolution_cnt = -1;
|
||||||
ra->RA_contention_resolution_timer_active = 0;
|
ra->RA_contention_resolution_timer_active = 0;
|
||||||
|
mac->crnti = ra->t_crnti;
|
||||||
ra->t_crnti = 0;
|
ra->t_crnti = 0;
|
||||||
|
|
||||||
LOG_D(MAC, "In %s: [UE %d][%d.%d] CB-RA: cleared contention resolution timer...\n", __FUNCTION__, mod_id, frame, slot);
|
LOG_D(MAC, "In %s: [UE %d][%d.%d] CB-RA: cleared contention resolution timer...\n", __FUNCTION__, mod_id, frame, slot);
|
||||||
@@ -759,7 +765,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){
|
|||||||
|
|
||||||
LOG_D(MAC, "In %s: [UE %d] clearing RA_active flag...\n", __FUNCTION__, mod_id);
|
LOG_D(MAC, "In %s: [UE %d] clearing RA_active flag...\n", __FUNCTION__, mod_id);
|
||||||
ra->RA_active = 0;
|
ra->RA_active = 0;
|
||||||
ra->generate_nr_prach = 2;
|
ra->generate_nr_prach = GENERATE_IDLE;
|
||||||
ra->ra_state = RA_SUCCEEDED;
|
ra->ra_state = RA_SUCCEEDED;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -774,8 +780,9 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res
|
|||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||||
RA_config_t *ra = &mac->ra;
|
RA_config_t *ra = &mac->ra;
|
||||||
|
|
||||||
ra->first_Msg3 = 0;
|
ra->first_Msg3 = 1;
|
||||||
ra->generate_nr_prach = 3;
|
ra->ra_PreambleIndex = -1;
|
||||||
|
ra->generate_nr_prach = RA_FAILED;
|
||||||
ra->ra_state = RA_UE_IDLE;
|
ra->ra_state = RA_UE_IDLE;
|
||||||
|
|
||||||
prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER++;
|
prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER++;
|
||||||
|
|||||||
@@ -88,7 +88,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
|||||||
} else {
|
} else {
|
||||||
ss = mac->search_space_zero;
|
ss = mac->search_space_zero;
|
||||||
coreset = mac->coreset0;
|
coreset = mac->coreset0;
|
||||||
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
if(rnti_type == NR_RNTI_SI) {
|
||||||
|
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
||||||
|
} else {
|
||||||
|
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG_CSET_0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rel15->coreset.duration = coreset->duration;
|
rel15->coreset.duration = coreset->duration;
|
||||||
@@ -144,7 +148,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
|||||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||||
rel15->rnti = ra->ra_rnti;
|
rel15->rnti = ra->ra_rnti;
|
||||||
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
if (get_softmodem_params()->sa) {
|
||||||
|
rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
} else { // NSA mode is not using the Initial BWP
|
||||||
|
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
}
|
||||||
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||||
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id);
|
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id);
|
||||||
break;
|
break;
|
||||||
@@ -153,6 +161,14 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
|||||||
case NR_RNTI_CS:
|
case NR_RNTI_CS:
|
||||||
break;
|
break;
|
||||||
case NR_RNTI_TC:
|
case NR_RNTI_TC:
|
||||||
|
// we use the initial DL BWP
|
||||||
|
sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||||
|
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||||
|
rel15->rnti = ra->t_crnti;
|
||||||
|
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||||
|
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id);
|
||||||
break;
|
break;
|
||||||
case NR_RNTI_SP_CSI:
|
case NR_RNTI_SP_CSI:
|
||||||
break;
|
break;
|
||||||
@@ -245,14 +261,22 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
|||||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||||
switch(ra->ra_state){
|
switch(ra->ra_state){
|
||||||
case WAIT_RAR:
|
case WAIT_RAR:
|
||||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n");
|
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n");
|
||||||
rel15->num_dci_options = 1;
|
rel15->num_dci_options = 1;
|
||||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
if (get_softmodem_params()->sa) {
|
||||||
fill_dci_search_candidates(ss, rel15);
|
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, -1);
|
||||||
break;
|
} else {
|
||||||
|
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
||||||
|
}
|
||||||
|
fill_dci_search_candidates(ss, rel15);
|
||||||
|
break;
|
||||||
case WAIT_CONTENTION_RESOLUTION:
|
case WAIT_CONTENTION_RESOLUTION:
|
||||||
LOG_E(MAC, "In %s: CB-RA not implemented yet. Should not have fallen in this case.\n", __FUNCTION__);
|
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg4)\n");
|
||||||
|
rel15->num_dci_options = 1;
|
||||||
|
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||||
|
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, -1);
|
||||||
|
fill_dci_search_candidates(ss, rel15);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){
|
|||||||
|
|
||||||
if (rnti == ra->ra_rnti) {
|
if (rnti == ra->ra_rnti) {
|
||||||
rnti_type = NR_RNTI_RA;
|
rnti_type = NR_RNTI_RA;
|
||||||
|
} else if (rnti == ra->t_crnti && (ra->ra_state == WAIT_RAR || ra->ra_state == WAIT_CONTENTION_RESOLUTION) ) {
|
||||||
|
rnti_type = NR_RNTI_TC;
|
||||||
} else if (rnti == mac->crnti) {
|
} else if (rnti == mac->crnti) {
|
||||||
rnti_type = NR_RNTI_C;
|
rnti_type = NR_RNTI_C;
|
||||||
} else if (rnti == ra->t_crnti) {
|
|
||||||
rnti_type = NR_RNTI_TC;
|
|
||||||
} else if (rnti == 0xFFFE) {
|
} else if (rnti == 0xFFFE) {
|
||||||
rnti_type = NR_RNTI_P;
|
rnti_type = NR_RNTI_P;
|
||||||
} else if (rnti == 0xFFFF) {
|
} else if (rnti == 0xFFFF) {
|
||||||
@@ -106,7 +106,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
|||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||||
frequency_range_t frequency_range;
|
frequency_range_t frequency_range;
|
||||||
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU
|
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU
|
||||||
|
|
||||||
AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n");
|
AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n");
|
||||||
//if(mac->mib != NULL){
|
//if(mac->mib != NULL){
|
||||||
@@ -188,7 +188,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
|
|||||||
uint8_t *pduP,
|
uint8_t *pduP,
|
||||||
uint32_t pdu_len) {
|
uint32_t pdu_len) {
|
||||||
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
|
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
|
||||||
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
|
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,85 +264,15 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p
|
|||||||
int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
|
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
|
||||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
|
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
|
||||||
uint8_t time_domain_ind
|
uint8_t time_domain_ind,
|
||||||
){
|
bool use_default){
|
||||||
|
|
||||||
int dmrs_typeA_pos = mac->scc->dmrs_TypeA_Position;
|
int dmrs_typeA_pos = mac->scc->dmrs_TypeA_Position;
|
||||||
// uint8_t k_offset=0;
|
// uint8_t k_offset=0;
|
||||||
uint8_t sliv_S=0;
|
uint8_t sliv_S=0;
|
||||||
uint8_t sliv_L=0;
|
uint8_t sliv_L=0;
|
||||||
uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?12:11}, // row index 1
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?7:6}, // row index 4
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?5:4}, // row index 5
|
|
||||||
{0,(dmrs_typeA_pos == 0)?9:10,(dmrs_typeA_pos == 0)?4:4}, // row index 6
|
|
||||||
{0,(dmrs_typeA_pos == 0)?4:6, (dmrs_typeA_pos == 0)?4:4}, // row index 7
|
|
||||||
{0,5,7}, // row index 8
|
|
||||||
{0,5,2}, // row index 9
|
|
||||||
{0,9,2}, // row index 10
|
|
||||||
{0,12,2}, // row index 11
|
|
||||||
{0,1,13}, // row index 12
|
|
||||||
{0,1,6}, // row index 13
|
|
||||||
{0,2,4}, // row index 14
|
|
||||||
{0,4,7}, // row index 15
|
|
||||||
{0,8,4} // row index 16
|
|
||||||
};
|
|
||||||
/*uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?6:5}, // row index 1
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?7:6}, // row index 4
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?5:4}, // row index 5
|
|
||||||
{0,(dmrs_typeA_pos == 0)?6:8, (dmrs_typeA_pos == 0)?4:2}, // row index 6
|
|
||||||
{0,(dmrs_typeA_pos == 0)?4:6, (dmrs_typeA_pos == 0)?4:4}, // row index 7
|
|
||||||
{0,5,6}, // row index 8
|
|
||||||
{0,5,2}, // row index 9
|
|
||||||
{0,9,2}, // row index 10
|
|
||||||
{0,10,2}, // row index 11
|
|
||||||
{0,1,11}, // row index 12
|
|
||||||
{0,1,6}, // row index 13
|
|
||||||
{0,2,4}, // row index 14
|
|
||||||
{0,4,6}, // row index 15
|
|
||||||
{0,8,4} // row index 16
|
|
||||||
};*/
|
|
||||||
/*uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
|
||||||
{0,2,2}, // row index 1
|
|
||||||
{0,4,2}, // row index 2
|
|
||||||
{0,6,2}, // row index 3
|
|
||||||
{0,8,2}, // row index 4
|
|
||||||
{0,10,2}, // row index 5
|
|
||||||
{1,2,2}, // row index 6
|
|
||||||
{1,4,2}, // row index 7
|
|
||||||
{0,2,4}, // row index 8
|
|
||||||
{0,4,4}, // row index 9
|
|
||||||
{0,6,4}, // row index 10
|
|
||||||
{0,8,4}, // row index 11
|
|
||||||
{0,10,4}, // row index 12
|
|
||||||
{0,2,7}, // row index 13
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14
|
|
||||||
{1,2,4}, // row index 15
|
|
||||||
{0,0,0} // row index 16
|
|
||||||
};*/
|
|
||||||
/*uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
|
||||||
{0,2,2}, // row index 1
|
|
||||||
{0,4,2}, // row index 2
|
|
||||||
{0,6,2}, // row index 3
|
|
||||||
{0,8,2}, // row index 4
|
|
||||||
{0,10,2}, // row index 5
|
|
||||||
{0,0,0}, // row index 6
|
|
||||||
{0,0,0}, // row index 7
|
|
||||||
{0,2,4}, // row index 8
|
|
||||||
{0,4,4}, // row index 9
|
|
||||||
{0,6,4}, // row index 10
|
|
||||||
{0,8,4}, // row index 11
|
|
||||||
{0,10,4}, // row index 12
|
|
||||||
{0,2,7}, // row index 13
|
|
||||||
{0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14
|
|
||||||
{0,0,6}, // row index 15
|
|
||||||
{0,2,6} // row index 16
|
|
||||||
};*/
|
|
||||||
uint8_t mu_pusch = 1;
|
uint8_t mu_pusch = 1;
|
||||||
|
|
||||||
// definition table j Table 6.1.2.1.1-4
|
// definition table j Table 6.1.2.1.1-4
|
||||||
uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1;
|
uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1;
|
||||||
uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
||||||
@@ -391,7 +321,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
|||||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
|
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
|
||||||
else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
|
||||||
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||||
if (pdsch_TimeDomainAllocationList) {
|
if (pdsch_TimeDomainAllocationList && use_default==false) {
|
||||||
|
|
||||||
if (time_domain_ind >= pdsch_TimeDomainAllocationList->list.count) {
|
if (time_domain_ind >= pdsch_TimeDomainAllocationList->list.count) {
|
||||||
LOG_E(MAC, "time_domain_ind %d >= pdsch->TimeDomainAllocationList->list.count %d\n",
|
LOG_E(MAC, "time_domain_ind %d >= pdsch->TimeDomainAllocationList->list.count %d\n",
|
||||||
@@ -414,8 +344,15 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
|||||||
}
|
}
|
||||||
else {// Default configuration from tables
|
else {// Default configuration from tables
|
||||||
// k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0];
|
// k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0];
|
||||||
sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][1];
|
|
||||||
sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][2];
|
if(dmrs_typeA_pos == 0) {
|
||||||
|
sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][1];
|
||||||
|
sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][2];
|
||||||
|
} else {
|
||||||
|
sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][1];
|
||||||
|
sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][2];
|
||||||
|
}
|
||||||
|
|
||||||
// k_offset = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
|
// k_offset = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
|
||||||
// sliv_S = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
|
// sliv_S = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
|
||||||
// sliv_L = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
|
// sliv_L = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
|
||||||
@@ -440,7 +377,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
|||||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pusch_TimeDomainAllocationList) {
|
if (pusch_TimeDomainAllocationList && use_default==false) {
|
||||||
if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) {
|
if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) {
|
||||||
LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n",
|
LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n",
|
||||||
time_domain_ind, pusch_TimeDomainAllocationList->list.count);
|
time_domain_ind, pusch_TimeDomainAllocationList->list.count);
|
||||||
@@ -457,8 +394,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0];
|
// k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0];
|
||||||
sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][1];
|
sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][1];
|
||||||
sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][2];
|
sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][2];
|
||||||
// k_offset = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
|
// k_offset = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
|
||||||
// sliv_S = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
|
// sliv_S = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
|
||||||
// sliv_L = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
|
// sliv_L = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
|
||||||
@@ -497,7 +434,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
||||||
AssertFatal(mac->ULbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
AssertFatal(mac->ULbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n");
|
||||||
|
|
||||||
const uint16_t n_RB_DLBWP = (ra->ra_state == WAIT_RAR) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
const uint16_t n_RB_DLBWP = (ra->ra_state == WAIT_RAR || ra->ra_state == WAIT_CONTENTION_RESOLUTION) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
|
||||||
LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP);
|
LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP);
|
||||||
|
|
||||||
@@ -543,10 +480,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
// Config PUSCH PDU
|
// Config PUSCH PDU
|
||||||
ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format);
|
ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format);
|
||||||
|
|
||||||
if (ret != -1 && ra->RA_active && mac->crnti){
|
|
||||||
nr_ra_succeeded(module_id, frame, slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -606,10 +539,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
// Config PUSCH PDU
|
// Config PUSCH PDU
|
||||||
ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format);
|
ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format);
|
||||||
|
|
||||||
if (ret != -1 && ra->RA_active && mac->crnti){
|
|
||||||
nr_ra_succeeded(module_id, frame, slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -668,7 +597,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
|
|
||||||
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
|
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
|
||||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
||||||
NR_PDSCH_Config_t *pdsch_config=mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup;
|
NR_PDSCH_Config_t *pdsch_config = NULL;
|
||||||
uint16_t BWPSize = 0;
|
uint16_t BWPSize = 0;
|
||||||
|
|
||||||
if(rnti == SI_RNTI) {
|
if(rnti == SI_RNTI) {
|
||||||
@@ -676,7 +605,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
|
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||||
dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
|
dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
|
||||||
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
|
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
|
||||||
pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2'
|
|
||||||
BWPSize = dlsch_config_pdu_1_0->BWPSize;
|
BWPSize = dlsch_config_pdu_1_0->BWPSize;
|
||||||
} else {
|
} else {
|
||||||
if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){
|
if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){
|
||||||
@@ -684,9 +612,20 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
} else {
|
} else {
|
||||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
||||||
}
|
}
|
||||||
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
if( (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti) || (rnti == ra->t_crnti) ) {
|
||||||
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
if (get_softmodem_params()->sa) {
|
||||||
|
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
} else { // NSA mode is not using the Initial BWP
|
||||||
|
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
|
||||||
|
pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup;
|
||||||
|
}
|
||||||
BWPSize = n_RB_DLBWP;
|
BWPSize = n_RB_DLBWP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,15 +636,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
||||||
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) {
|
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val,rnti==SI_RNTI) < 0) {
|
||||||
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
|
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* dmrs symbol positions*/
|
/* dmrs symbol positions*/
|
||||||
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
||||||
mac->scc->dmrs_TypeA_Position,
|
mac->scc->dmrs_TypeA_Position,
|
||||||
dlsch_config_pdu_1_0->start_symbol+dlsch_config_pdu_1_0->number_symbols);
|
dlsch_config_pdu_1_0->number_symbols,
|
||||||
dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
dlsch_config_pdu_1_0->start_symbol);
|
||||||
|
dlsch_config_pdu_1_0->dmrsConfigType = (pdsch_config) ? (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0;
|
||||||
/* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
|
/* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
|
||||||
if (dlsch_config_pdu_1_0->number_symbols == 2)
|
if (dlsch_config_pdu_1_0->number_symbols == 2)
|
||||||
dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1;
|
dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1;
|
||||||
@@ -714,7 +654,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
/* VRB_TO_PRB_MAPPING */
|
/* VRB_TO_PRB_MAPPING */
|
||||||
dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved;
|
dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved;
|
||||||
/* MCS TABLE INDEX */
|
/* MCS TABLE INDEX */
|
||||||
dlsch_config_pdu_1_0->mcs_table = (pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0;
|
dlsch_config_pdu_1_0->mcs_table = (pdsch_config) ? ((pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0) : 0;
|
||||||
/* MCS */
|
/* MCS */
|
||||||
dlsch_config_pdu_1_0->mcs = dci->mcs;
|
dlsch_config_pdu_1_0->mcs = dci->mcs;
|
||||||
// Basic sanity check for MCS value to check for a false or erroneous DCI
|
// Basic sanity check for MCS value to check for a false or erroneous DCI
|
||||||
@@ -767,7 +707,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI)*/
|
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI)*/
|
||||||
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = dci->pdsch_to_harq_feedback_timing_indicator.val;
|
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0];
|
||||||
|
|
||||||
LOG_D(MAC,"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n",
|
LOG_D(MAC,"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n",
|
||||||
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti,
|
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti,
|
||||||
@@ -797,6 +737,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type);
|
LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type);
|
||||||
|
|
||||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -862,14 +803,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
||||||
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val) < 0) {
|
if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val,false) < 0) {
|
||||||
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
|
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* dmrs symbol positions*/
|
/* dmrs symbol positions*/
|
||||||
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
|
||||||
mac->scc->dmrs_TypeA_Position,
|
mac->scc->dmrs_TypeA_Position,
|
||||||
dlsch_config_pdu_1_1->number_symbols);
|
dlsch_config_pdu_1_1->number_symbols,
|
||||||
|
dlsch_config_pdu_1_1->start_symbol);
|
||||||
dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
||||||
/* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214,
|
/* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214,
|
||||||
using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */
|
using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */
|
||||||
@@ -1402,41 +1344,74 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RNTI_TC:
|
case NR_RNTI_TC:
|
||||||
// indicating a DL DCI format 1bit
|
|
||||||
|
// indicating a DL DCI format - 1 bit
|
||||||
pos++;
|
pos++;
|
||||||
dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1;
|
dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1;
|
||||||
|
|
||||||
if (dci_pdu_rel15->format_indicator == 0)
|
if (dci_pdu_rel15->format_indicator == 0)
|
||||||
return 1; // discard dci, format indicator not corresponding to dci_format
|
return 1; // discard dci, format indicator not corresponding to dci_format
|
||||||
// Freq domain assignment 0-16 bit
|
|
||||||
|
// Freq domain assignment 0-16 bit
|
||||||
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||||
pos+=fsize;
|
pos+=fsize;
|
||||||
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
||||||
// Time domain assignment 4 bit
|
|
||||||
|
// Time domain assignment - 4 bits
|
||||||
pos+=4;
|
pos+=4;
|
||||||
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||||
// VRB to PRB mapping 1 bit
|
|
||||||
|
// VRB to PRB mapping - 1 bit
|
||||||
|
pos++;
|
||||||
dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&1;
|
dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&1;
|
||||||
|
|
||||||
// MCS 5bit //bit over 32, so dci_pdu ++
|
// MCS 5bit //bit over 32, so dci_pdu ++
|
||||||
pos+=5;
|
pos+=5;
|
||||||
dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f;
|
dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f;
|
||||||
// New data indicator 1bit
|
|
||||||
|
// New data indicator - 1 bit
|
||||||
|
pos++;
|
||||||
dci_pdu_rel15->ndi = (*dci_pdu>>(dci_size-pos))&1;
|
dci_pdu_rel15->ndi = (*dci_pdu>>(dci_size-pos))&1;
|
||||||
// Redundancy version 2bit
|
|
||||||
|
// Redundancy version - 2 bits
|
||||||
pos+=2;
|
pos+=2;
|
||||||
dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3;
|
dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3;
|
||||||
// HARQ process number 4bit
|
|
||||||
|
// HARQ process number - 4 bits
|
||||||
pos+=4;
|
pos+=4;
|
||||||
dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf;
|
dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||||
// Downlink assignment index E2 bits
|
|
||||||
|
// Downlink assignment index - 2 bits
|
||||||
pos+=2;
|
pos+=2;
|
||||||
dci_pdu_rel15->dai[0].val = (*dci_pdu>>(dci_size-pos))&3;
|
dci_pdu_rel15->dai[0].val = (*dci_pdu>>(dci_size-pos))&3;
|
||||||
// TPC command for scheduled PUCCH E2 bits
|
|
||||||
|
// TPC command for scheduled PUCCH - 2 bits
|
||||||
pos+=2;
|
pos+=2;
|
||||||
dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3;
|
dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3;
|
||||||
// PDSCH-to-HARQ_feedback timing indicator E3 bits
|
|
||||||
|
// PUCCH resource indicator - 3 bits
|
||||||
|
pos+=3;
|
||||||
|
dci_pdu_rel15->pucch_resource_indicator = (*dci_pdu>>(dci_size-pos))&7;
|
||||||
|
|
||||||
|
// PDSCH-to-HARQ_feedback timing indicator - 3 bits
|
||||||
pos+=3;
|
pos+=3;
|
||||||
dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = (*dci_pdu>>(dci_size-pos))&7;
|
dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = (*dci_pdu>>(dci_size-pos))&7;
|
||||||
|
|
||||||
|
LOG_D(NR_MAC,"N_RB = %i\n", N_RB);
|
||||||
|
LOG_D(NR_MAC,"dci_size = %i\n", dci_size);
|
||||||
|
LOG_D(NR_MAC,"fsize = %i\n", fsize);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->format_indicator = %i\n", dci_pdu_rel15->format_indicator);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->harq_pid = %i\n", dci_pdu_rel15->harq_pid);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->dai[0].val = %i\n", dci_pdu_rel15->dai[0].val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->tpc = %i\n", dci_pdu_rel15->tpc);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->pucch_resource_indicator = %i\n", dci_pdu_rel15->pucch_resource_indicator);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = %i\n", dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1800,16 +1775,41 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
|||||||
// MAC CE
|
// MAC CE
|
||||||
|
|
||||||
case DL_SCH_LCID_CCCH:
|
case DL_SCH_LCID_CCCH:
|
||||||
// MSG4 RRC Connection Setup 38.331
|
// MSG4 RRC Setup 38.331
|
||||||
// varialbe length
|
// variable length
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
||||||
|
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8)
|
||||||
|
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
|
||||||
|
mac_subheader_len = 3;
|
||||||
|
} else {
|
||||||
|
mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L;
|
||||||
mac_subheader_len = 2;
|
mac_subheader_len = 2;
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
}
|
||||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Check if it is a valid CCCH message, we get all 00's messages very often
|
||||||
|
int i = 0;
|
||||||
|
for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) {
|
||||||
|
if(pduP[i] != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == (mac_subheader_len+mac_sdu_len)) {
|
||||||
|
LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len);
|
||||||
|
done = 1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mac_sdu_len > 0 ) {
|
||||||
|
LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_sdu_len);
|
||||||
|
for (int i = 0; i < mac_subheader_len; i++) {
|
||||||
|
LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < mac_sdu_len; i++) {
|
||||||
|
LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]);
|
||||||
|
}
|
||||||
|
nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_sdu_len);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
|
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
|
||||||
|
|
||||||
@@ -1916,17 +1916,34 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case DL_SCH_LCID_CON_RES_ID:
|
case DL_SCH_LCID_CON_RES_ID:
|
||||||
// Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16
|
// Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16
|
||||||
// WIP todo: handle CCCH_pdu
|
// MAC Header: 1 byte (R/R/LCID)
|
||||||
mac_ce_len = 6;
|
// MAC SDU: 6 bytes (UE Contention Resolution Identity)
|
||||||
|
mac_ce_len = 6;
|
||||||
|
|
||||||
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution msg: %x.%x.%x.%x.%x.%x, Terminating RA procedure\n", module_idP, frameP, pduP[0], pduP[1], pduP[2], pduP[3], pduP[4], pduP[5]);
|
if(ra->ra_state == WAIT_CONTENTION_RESOLUTION) {
|
||||||
|
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure\n",
|
||||||
|
module_idP, frameP, pduP[1], pduP[2], pduP[3], pduP[4], pduP[5], pduP[6]);
|
||||||
|
|
||||||
if (ra->RA_active == 1) {
|
bool ra_success = true;
|
||||||
nr_ra_succeeded(module_idP, frameP, slot);
|
for(int i = 0; i<mac_ce_len; i++) {
|
||||||
|
if(ra->cont_res_id[i] != pduP[i+1]) {
|
||||||
|
ra_success = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
if ( (ra->RA_active == 1) && ra_success) {
|
||||||
|
nr_ra_succeeded(module_idP, frameP, slot);
|
||||||
|
} else if (!ra_success){
|
||||||
|
// TODO: Handle failure of RA procedure @ MAC layer
|
||||||
|
// nr_ra_failed(module_idP, CC_id, prach_resources, frameP, slot); // prach_resources is a PHY structure
|
||||||
|
ra->ra_state = RA_UE_IDLE;
|
||||||
|
ra->RA_active = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
case DL_SCH_LCID_PADDING:
|
case DL_SCH_LCID_PADDING:
|
||||||
done = 1;
|
done = 1;
|
||||||
// end of MAC PDU, can ignore the rest.
|
// end of MAC PDU, can ignore the rest.
|
||||||
@@ -2044,8 +2061,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
|
|||||||
last_size = 3;
|
last_size = 3;
|
||||||
}
|
}
|
||||||
} else { // UL CCCH SDU
|
} else { // UL CCCH SDU
|
||||||
mac_pdu_ptr->R = 0;
|
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0;
|
||||||
mac_pdu_ptr->LCID = sdu_lcids[i];
|
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = sdu_lcids[i];
|
||||||
|
last_size = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mac_pdu_ptr += last_size;
|
mac_pdu_ptr += last_size;
|
||||||
@@ -2221,27 +2239,32 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
|
|||||||
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer
|
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer
|
||||||
uint8_t preamble_index = get_ra_PreambleIndex(mod_id, cc_id, gNB_id); //prach_resources->ra_PreambleIndex;
|
uint8_t preamble_index = get_ra_PreambleIndex(mod_id, cc_id, gNB_id); //prach_resources->ra_PreambleIndex;
|
||||||
|
|
||||||
LOG_D(MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index);
|
LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
n_subheaders++;
|
n_subheaders++;
|
||||||
if (rarh->T == 1) {
|
if (rarh->T == 1) {
|
||||||
n_subPDUs++;
|
n_subPDUs++;
|
||||||
LOG_D(MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mod_id);
|
LOG_I(NR_MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mod_id);
|
||||||
} else {
|
} else {
|
||||||
n_subPDUs++;
|
|
||||||
ra->RA_backoff_indicator = table_7_2_1[((NR_RA_HEADER_BI *)rarh)->BI];
|
ra->RA_backoff_indicator = table_7_2_1[((NR_RA_HEADER_BI *)rarh)->BI];
|
||||||
ra->RA_BI_found = 1;
|
ra->RA_BI_found = 1;
|
||||||
LOG_D(MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d\n", mod_id, ra->RA_backoff_indicator);
|
LOG_I(NR_MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d ms\n", mod_id, ra->RA_backoff_indicator);
|
||||||
|
if ( ((NR_RA_HEADER_BI *)rarh)->E == 1) {
|
||||||
|
rarh += sizeof(NR_RA_HEADER_BI);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (rarh->RAPID == preamble_index) {
|
if (rarh->RAPID == preamble_index) {
|
||||||
LOG_I(MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID);
|
LOG_I(NR_MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID);
|
||||||
rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR));
|
rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR));
|
||||||
ra->RA_RAPID_found = 1;
|
ra->RA_RAPID_found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (rarh->E == 0) {
|
if (rarh->E == 0) {
|
||||||
LOG_W(PHY,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match the intended RAPID...\n", mod_id, preamble_index);
|
LOG_W(NR_MAC,"[UE %d][RAPROC][%d.%d] Received RAR preamble (%d) doesn't match the intended RAPID (%d)\n", mod_id, frame, slot, rarh->RAPID, preamble_index);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
rarh += sizeof(NR_MAC_RAR) + 1;
|
rarh += sizeof(NR_MAC_RAR) + 1;
|
||||||
@@ -2317,21 +2340,37 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
|
|||||||
rnti = mac->crnti;
|
rnti = mac->crnti;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_RAR
|
#ifdef DEBUG_RAR
|
||||||
LOG_D(MAC, "In %s:[%d.%d]: [UE %d] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n",
|
LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E);
|
||||||
__FUNCTION__,
|
LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T);
|
||||||
frame,
|
LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID);
|
||||||
slot,
|
|
||||||
mod_id,
|
LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R);
|
||||||
rar_grant.Msg3_t_alloc,
|
LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1);
|
||||||
rar_grant.Msg3_f_alloc,
|
|
||||||
ul_time_alignment->ta_command,
|
LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2);
|
||||||
rar_grant.mcs,
|
LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1);
|
||||||
rar_grant.freq_hopping,
|
|
||||||
tpc_command,
|
LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2);
|
||||||
csi_req,
|
LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3);
|
||||||
ra->t_crnti);
|
LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4);
|
||||||
#endif
|
|
||||||
|
LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1);
|
||||||
|
LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2);
|
||||||
|
|
||||||
|
LOG_I(NR_MAC, "In %s:[%d.%d]: [UE %d] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d t_crnti %x \n",
|
||||||
|
__FUNCTION__,
|
||||||
|
frame,
|
||||||
|
slot,
|
||||||
|
mod_id,
|
||||||
|
rar_grant.Msg3_t_alloc,
|
||||||
|
rar_grant.Msg3_f_alloc,
|
||||||
|
ul_time_alignment->ta_command,
|
||||||
|
rar_grant.mcs,
|
||||||
|
rar_grant.freq_hopping,
|
||||||
|
tpc_command,
|
||||||
|
ra->t_crnti);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Schedule Msg3
|
// Schedule Msg3
|
||||||
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, rar_grant.Msg3_t_alloc);
|
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, rar_grant.Msg3_t_alloc);
|
||||||
|
|||||||
@@ -500,11 +500,13 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
|||||||
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
|
||||||
// BWP start selection according to 8.3 of TS 38.213
|
// BWP start selection according to 8.3 of TS 38.213
|
||||||
pusch_config_pdu->bwp_size = ibwp_size;
|
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size)) {
|
||||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
|
||||||
pusch_config_pdu->bwp_start = abwp_start;
|
pusch_config_pdu->bwp_start = abwp_start;
|
||||||
else
|
pusch_config_pdu->bwp_size = abwp_size;
|
||||||
|
} else {
|
||||||
pusch_config_pdu->bwp_start = ibwp_start;
|
pusch_config_pdu->bwp_start = ibwp_start;
|
||||||
|
pusch_config_pdu->bwp_size = ibwp_size;
|
||||||
|
}
|
||||||
|
|
||||||
//// Resource assignment from RAR
|
//// Resource assignment from RAR
|
||||||
// Frequency domain allocation according to 8.3 of TS 38.213
|
// Frequency domain allocation according to 8.3 of TS 38.213
|
||||||
@@ -518,7 +520,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// virtual resource block to physical resource mapping for Msg3 PUSCH (6.3.1.7 in 38.211)
|
// virtual resource block to physical resource mapping for Msg3 PUSCH (6.3.1.7 in 38.211)
|
||||||
pusch_config_pdu->rb_start += ibwp_start - abwp_start;
|
//pusch_config_pdu->rb_start += ibwp_start - abwp_start;
|
||||||
|
|
||||||
// Time domain allocation
|
// Time domain allocation
|
||||||
SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols);
|
SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols);
|
||||||
@@ -645,7 +647,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
||||||
if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val) < 0) {
|
if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val,false) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,7 +889,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
|
|
||||||
uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size;
|
uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size;
|
||||||
|
|
||||||
if (ra->ra_state == WAIT_RAR){
|
if (ra->ra_state == WAIT_RAR && !ra->cfra){
|
||||||
memcpy(ulsch_input_buffer, mac->ulsch_pdu.payload, TBS_bytes);
|
memcpy(ulsch_input_buffer, mac->ulsch_pdu.payload, TBS_bytes);
|
||||||
LOG_D(NR_MAC,"[RAPROC] Msg3 to be transmitted:\n");
|
LOG_D(NR_MAC,"[RAPROC] Msg3 to be transmitted:\n");
|
||||||
for (int k = 0; k < TBS_bytes; k++) {
|
for (int k = 0; k < TBS_bytes; k++) {
|
||||||
@@ -941,7 +943,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
|||||||
tx_req.tx_request_body[0].pdu_index = j;
|
tx_req.tx_request_body[0].pdu_index = j;
|
||||||
tx_req.tx_request_body[0].pdu = ulsch_input_buffer;
|
tx_req.tx_request_body[0].pdu = ulsch_input_buffer;
|
||||||
|
|
||||||
if (ra->ra_state != RA_SUCCEEDED && !ra->cfra){
|
if (ra->ra_state == WAIT_RAR && !ra->cfra){
|
||||||
|
LOG_I(NR_MAC,"[RAPROC] RA-Msg3 transmitted\n");
|
||||||
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index);
|
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1668,7 +1671,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
|||||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
||||||
|
|
||||||
ra->RA_offset = 2; // to compensate the rx frame offset at the gNB
|
ra->RA_offset = 2; // to compensate the rx frame offset at the gNB
|
||||||
ra->generate_nr_prach = 0; // Reset flag for PRACH generation
|
ra->generate_nr_prach = GENERATE_IDLE; // Reset flag for PRACH generation
|
||||||
|
|
||||||
if (is_nr_UL_slot(scc, slotP, mac->frame_type)) {
|
if (is_nr_UL_slot(scc, slotP, mac->frame_type)) {
|
||||||
|
|
||||||
@@ -1685,7 +1688,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
|||||||
if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) {
|
if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) {
|
||||||
AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n");
|
AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n");
|
||||||
|
|
||||||
ra->generate_nr_prach = 1;
|
ra->generate_nr_prach = GENERATE_PREAMBLE;
|
||||||
|
|
||||||
format = prach_occasion_info_p->format;
|
format = prach_occasion_info_p->format;
|
||||||
format0 = format & 0xff; // single PRACH format
|
format0 = format & 0xff; // single PRACH format
|
||||||
|
|||||||
@@ -208,8 +208,12 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
|
|||||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG;
|
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG;
|
||||||
cfg->num_tlv++;
|
cfg->num_tlv++;
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||||
//k1= msg1_FrequencyStart + 12 (no. of FDM)(RB for PRACH occasion);
|
if (get_softmodem_params()->sa) {
|
||||||
|
cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||||
|
} else {
|
||||||
|
cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i);
|
||||||
|
}
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG;
|
cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG;
|
||||||
cfg->num_tlv++;
|
cfg->num_tlv++;
|
||||||
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
|
||||||
@@ -449,6 +453,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ra->cfra = false;
|
||||||
|
ra->rnti = 0;
|
||||||
|
ra->preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES;
|
||||||
|
ra->preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t));
|
||||||
|
for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
|
||||||
|
ra->preambles.preamble_list[i] = i;
|
||||||
}
|
}
|
||||||
LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti);
|
LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti);
|
||||||
} else { // secondaryCellGroup has been updated
|
} else { // secondaryCellGroup has been updated
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -159,7 +159,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
|
|||||||
// get MIB every 8 frames
|
// get MIB every 8 frames
|
||||||
if((slotP == 0) && (frameP & 7) == 0) {
|
if((slotP == 0) && (frameP & 7) == 0) {
|
||||||
|
|
||||||
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]);
|
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 0, 1, &cc->MIB_pdu.payload[0]);
|
||||||
|
|
||||||
LOG_D(MAC,
|
LOG_D(MAC,
|
||||||
"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",
|
"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",
|
||||||
@@ -320,6 +320,7 @@ void schedule_control_sib1(module_id_t module_id,
|
|||||||
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
|
||||||
|
|
||||||
if (gNB_mac->sched_ctrlCommon == NULL){
|
if (gNB_mac->sched_ctrlCommon == NULL){
|
||||||
|
LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n");
|
||||||
gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon));
|
gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon));
|
||||||
gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space));
|
gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space));
|
||||||
gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset));
|
gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset));
|
||||||
@@ -327,7 +328,6 @@ void schedule_control_sib1(module_id_t module_id,
|
|||||||
fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon);
|
fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon);
|
||||||
fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon);
|
fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon);
|
||||||
}
|
}
|
||||||
gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL;
|
|
||||||
|
|
||||||
gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation;
|
gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation;
|
||||||
gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx;
|
gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx;
|
||||||
@@ -350,11 +350,15 @@ void schedule_control_sib1(module_id_t module_id,
|
|||||||
const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs;
|
const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs;
|
||||||
int rbStart = type0_PDCCH_CSS_config->cset_start_rb;
|
int rbStart = type0_PDCCH_CSS_config->cset_start_rb;
|
||||||
|
|
||||||
// Calculate number of symbols
|
int startSymbolIndex = 0;
|
||||||
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
int nrOfSymbols = 0;
|
||||||
const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength;
|
if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) {
|
||||||
int startSymbolIndex, nrOfSymbols;
|
startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][1];
|
||||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][2];
|
||||||
|
} else {
|
||||||
|
startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][1];
|
||||||
|
nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][2];
|
||||||
|
}
|
||||||
|
|
||||||
if (nrOfSymbols == 2) {
|
if (nrOfSymbols == 2) {
|
||||||
gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1;
|
gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1;
|
||||||
@@ -364,7 +368,7 @@ void schedule_control_sib1(module_id_t module_id,
|
|||||||
|
|
||||||
// Calculate number of PRB_DMRS
|
// Calculate number of PRB_DMRS
|
||||||
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6;
|
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6;
|
||||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols);
|
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex);
|
||||||
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
||||||
|
|
||||||
int rbSize = 0;
|
int rbSize = 0;
|
||||||
@@ -379,7 +383,6 @@ void schedule_control_sib1(module_id_t module_id,
|
|||||||
gNB_mac->sched_ctrlCommon->rbSize = rbSize;
|
gNB_mac->sched_ctrlCommon->rbSize = rbSize;
|
||||||
gNB_mac->sched_ctrlCommon->rbStart = 0;
|
gNB_mac->sched_ctrlCommon->rbStart = 0;
|
||||||
|
|
||||||
LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength);
|
|
||||||
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
|
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
|
||||||
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
|
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
|
||||||
LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize);
|
LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize);
|
||||||
@@ -453,7 +456,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
|||||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||||
pdsch_pdu_rel15->refPoint = 1;
|
pdsch_pdu_rel15->refPoint = 1;
|
||||||
pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
pdsch_pdu_rel15->dmrsConfigType = 0;
|
||||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||||
pdsch_pdu_rel15->SCID = 0;
|
pdsch_pdu_rel15->SCID = 0;
|
||||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData;
|
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData;
|
||||||
@@ -468,7 +471,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
|||||||
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
|
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
|
||||||
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
||||||
|
|
||||||
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->StartSymbolIndex+pdsch_pdu_rel15->NrOfSymbols);
|
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols, pdsch_pdu_rel15->StartSymbolIndex);
|
||||||
|
|
||||||
LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos);
|
LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos);
|
||||||
|
|
||||||
@@ -536,8 +539,6 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
|||||||
|
|
||||||
void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
|
void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
|
||||||
|
|
||||||
LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP);
|
|
||||||
|
|
||||||
// TODO: Get these values from RRC
|
// TODO: Get these values from RRC
|
||||||
const int CC_id = 0;
|
const int CC_id = 0;
|
||||||
int time_domain_allocation = 0;
|
int time_domain_allocation = 0;
|
||||||
@@ -573,29 +574,32 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
|||||||
(type0_PDCCH_CSS_config->num_rbs > 0) &&
|
(type0_PDCCH_CSS_config->num_rbs > 0) &&
|
||||||
(type0_PDCCH_CSS_config->active == true)) {
|
(type0_PDCCH_CSS_config->active == true)) {
|
||||||
|
|
||||||
LOG_D(MAC,"> SIB1 transmission\n");
|
LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index);
|
||||||
|
|
||||||
// Get SIB1
|
// Get SIB1
|
||||||
uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8];
|
uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8];
|
||||||
uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload);
|
uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, SI_RNTI, 1, sib1_payload);
|
||||||
LOG_D(MAC,"sib1_sdu_length = %i\n", sib1_sdu_length);
|
LOG_D(NR_MAC,"sib1_sdu_length = %i\n", sib1_sdu_length);
|
||||||
LOG_D(MAC,"SIB1: \n");
|
LOG_D(NR_MAC,"SIB1: \n");
|
||||||
for (int i=0;i<sib1_sdu_length;i++) LOG_D(MAC,"byte %d : %x\n",i,((uint8_t*)sib1_payload)[i]);
|
for (int k=0;k<sib1_sdu_length;k++) LOG_D(NR_MAC,"byte %d : %x\n",k,((uint8_t*)sib1_payload)[k]);
|
||||||
|
|
||||||
// Configure sched_ctrlCommon for SIB1
|
// Configure sched_ctrlCommon for SIB1
|
||||||
schedule_control_sib1(module_idP, CC_id, type0_PDCCH_CSS_config, time_domain_allocation, mcsTableIdx, mcs, candidate_idx, sib1_sdu_length);
|
schedule_control_sib1(module_idP, CC_id, type0_PDCCH_CSS_config, time_domain_allocation, mcsTableIdx, mcs, candidate_idx, sib1_sdu_length);
|
||||||
|
|
||||||
// Calculate number of symbols
|
int startSymbolIndex = 0;
|
||||||
int startSymbolIndex, nrOfSymbols;
|
int nrOfSymbols = 0;
|
||||||
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) {
|
||||||
const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength;
|
startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][1];
|
||||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->time_domain_allocation][2];
|
||||||
|
} else {
|
||||||
|
startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][1];
|
||||||
|
nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->time_domain_allocation][2];
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate number of PRB_DMRS
|
// Calculate number of PRB_DMRS
|
||||||
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6;
|
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6;
|
||||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex);
|
||||||
gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols);
|
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
||||||
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
|
||||||
|
|
||||||
const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
||||||
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda) {
|
void getStartNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda, int *startSymbol, int *nrOfSymbols) {
|
||||||
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList =
|
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList =
|
||||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||||
AssertFatal(tda < tdaList->list.count,
|
AssertFatal(tda < tdaList->list.count,
|
||||||
@@ -311,9 +311,7 @@ int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda) {
|
|||||||
tdaList->list.count);
|
tdaList->list.count);
|
||||||
|
|
||||||
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
||||||
int startSymbolIndex, nrOfSymbols;
|
SLIV2SL(startSymbolAndLength, startSymbol, nrOfSymbols);
|
||||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
|
||||||
return nrOfSymbols;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nfapi_nr_dmrs_type_e getDmrsConfigType(NR_BWP_Downlink_t *bwp) {
|
nfapi_nr_dmrs_type_e getDmrsConfigType(NR_BWP_Downlink_t *bwp) {
|
||||||
@@ -487,8 +485,12 @@ void pf_dl(module_id_t module_id,
|
|||||||
sched_ctrl->numDmrsCdmGrpsNoData = 1;
|
sched_ctrl->numDmrsCdmGrpsNoData = 1;
|
||||||
uint8_t N_PRB_DMRS =
|
uint8_t N_PRB_DMRS =
|
||||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||||
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
|
int startSymbol;
|
||||||
sched_ctrl->time_domain_allocation);
|
int nrOfSymbols;
|
||||||
|
getStartNrOfSymbols(sched_ctrl->active_bwp,
|
||||||
|
sched_ctrl->time_domain_allocation,
|
||||||
|
&startSymbol,
|
||||||
|
&nrOfSymbols);
|
||||||
uint32_t tbs = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
uint32_t tbs = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
||||||
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
|
||||||
1, // rbSize
|
1, // rbSize
|
||||||
@@ -574,13 +576,18 @@ void pf_dl(module_id_t module_id,
|
|||||||
|
|
||||||
const uint8_t N_PRB_DMRS =
|
const uint8_t N_PRB_DMRS =
|
||||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||||
const int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
|
int startSymbol;
|
||||||
sched_ctrl->time_domain_allocation);
|
int nrOfSymbols;
|
||||||
|
getStartNrOfSymbols(sched_ctrl->active_bwp,
|
||||||
|
sched_ctrl->time_domain_allocation,
|
||||||
|
&startSymbol,
|
||||||
|
&nrOfSymbols);
|
||||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon;
|
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon;
|
||||||
const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(
|
const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(
|
||||||
sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||||
scc->dmrs_TypeA_Position,
|
scc->dmrs_TypeA_Position,
|
||||||
nrOfSymbols);
|
nrOfSymbols,
|
||||||
|
startSymbol);
|
||||||
|
|
||||||
int rbSize = 0;
|
int rbSize = 0;
|
||||||
uint32_t TBS = 0;
|
uint32_t TBS = 0;
|
||||||
@@ -697,7 +704,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||||
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||||
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
|
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
|
||||||
nrOfSymbols);
|
nrOfSymbols,
|
||||||
|
startSymbolIndex);
|
||||||
const nfapi_nr_dmrs_type_e dmrsConfigType = getDmrsConfigType(sched_ctrl->active_bwp);
|
const nfapi_nr_dmrs_type_e dmrsConfigType = getDmrsConfigType(sched_ctrl->active_bwp);
|
||||||
const int nrOfLayers = 1;
|
const int nrOfLayers = 1;
|
||||||
const uint16_t R = nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx);
|
const uint16_t R = nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx);
|
||||||
@@ -819,7 +827,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
pdsch_pdu->dlDmrsSymbPos =
|
pdsch_pdu->dlDmrsSymbPos =
|
||||||
fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||||
scc->dmrs_TypeA_Position,
|
scc->dmrs_TypeA_Position,
|
||||||
nrOfSymbols);
|
nrOfSymbols,
|
||||||
|
startSymbolIndex);
|
||||||
pdsch_pdu->dmrsConfigType = dmrsConfigType;
|
pdsch_pdu->dmrsConfigType = dmrsConfigType;
|
||||||
pdsch_pdu->dlDmrsScramblingId = *scc->physCellId;
|
pdsch_pdu->dlDmrsScramblingId = *scc->physCellId;
|
||||||
pdsch_pdu->SCID = 0;
|
pdsch_pdu->SCID = 0;
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
|||||||
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
||||||
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL,
|
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL,
|
||||||
scc->dmrs_TypeA_Position,
|
scc->dmrs_TypeA_Position,
|
||||||
NrOfSymbols);
|
NrOfSymbols,
|
||||||
|
StartSymbolIndex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n");
|
AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n");
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
|||||||
int coreset_id = coreset->controlResourceSetId;
|
int coreset_id = coreset->controlResourceSetId;
|
||||||
|
|
||||||
int *cce_list;
|
int *cce_list;
|
||||||
if(bwp->bwp_Id == 0) {
|
if( bwp==NULL || bwp->bwp_Id == 0 ) {
|
||||||
cce_list = nr_mac->cce_list[1][0];
|
cce_list = nr_mac->cce_list[1][0];
|
||||||
} else {
|
} else {
|
||||||
cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id];
|
cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id];
|
||||||
@@ -563,6 +563,8 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
|||||||
NR_ServingCellConfigCommon_t *scc,
|
NR_ServingCellConfigCommon_t *scc,
|
||||||
NR_BWP_Downlink_t *bwp)
|
NR_BWP_Downlink_t *bwp)
|
||||||
{
|
{
|
||||||
|
int sps = 0;
|
||||||
|
|
||||||
if (bwp) { // This is not the InitialBWP
|
if (bwp) { // This is not the InitialBWP
|
||||||
pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
@@ -571,8 +573,18 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
|||||||
|
|
||||||
// first symbol
|
// first symbol
|
||||||
//AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored");
|
//AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored");
|
||||||
int sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||||
|
}
|
||||||
|
else { // this is for InitialBWP
|
||||||
|
pdcch_pdu->BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||||
|
pdcch_pdu->SubcarrierSpacing = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||||
|
pdcch_pdu->CyclicPrefix = (scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix==NULL) ? 0 : *scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix;
|
||||||
|
|
||||||
|
// first symbol
|
||||||
|
//AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored");
|
||||||
|
sps = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||||
|
}
|
||||||
AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n");
|
AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n");
|
||||||
AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n");
|
AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n");
|
||||||
|
|
||||||
@@ -617,10 +629,6 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
|||||||
|
|
||||||
//precoderGranularity
|
//precoderGranularity
|
||||||
pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
|
pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
|
||||||
}
|
|
||||||
else { // this is for InitialBWP
|
|
||||||
AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1134,6 +1142,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_RNTI_TC:
|
case NR_RNTI_TC:
|
||||||
|
pos = 1;
|
||||||
// indicating a DL DCI format 1bit
|
// indicating a DL DCI format 1bit
|
||||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos++);
|
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos++);
|
||||||
// Freq domain assignment 0-16 bit
|
// Freq domain assignment 0-16 bit
|
||||||
@@ -1162,9 +1171,27 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
|||||||
// TPC command for scheduled PUCCH – 2 bits
|
// TPC command for scheduled PUCCH – 2 bits
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->tpc >> (1 - i)) & 1) << (dci_size - pos++);
|
*dci_pdu |= (((uint64_t)dci_pdu_rel15->tpc >> (1 - i)) & 1) << (dci_size - pos++);
|
||||||
|
// PUCCH resource indicator – 3 bits
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
*dci_pdu |= (((uint64_t)dci_pdu_rel15->pucch_resource_indicator >> (2 - i)) & 1) << (dci_size - pos++);
|
||||||
// PDSCH-to-HARQ_feedback timing indicator – 3 bits
|
// PDSCH-to-HARQ_feedback timing indicator – 3 bits
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val >> (2 - i)) & 1) << (dci_size - pos++);
|
*dci_pdu |= (((uint64_t)dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val >> (2 - i)) & 1) << (dci_size - pos++);
|
||||||
|
|
||||||
|
LOG_D(NR_MAC,"N_RB = %i\n", N_RB);
|
||||||
|
LOG_D(NR_MAC,"dci_size = %i\n", dci_size);
|
||||||
|
LOG_D(NR_MAC,"fsize = %i\n", fsize);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->format_indicator = %i\n", dci_pdu_rel15->format_indicator);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->harq_pid = %i\n", dci_pdu_rel15->harq_pid);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->dai[0].val = %i\n", dci_pdu_rel15->dai[0].val);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->tpc = %i\n", dci_pdu_rel15->tpc);
|
||||||
|
LOG_D(NR_MAC,"dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = %i\n", dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1682,7 +1709,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon
|
|||||||
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq);
|
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq);
|
||||||
create_nr_list(&sched_ctrl->feedback_ul_harq, 16);
|
create_nr_list(&sched_ctrl->feedback_ul_harq, 16);
|
||||||
create_nr_list(&sched_ctrl->retrans_ul_harq, 16);
|
create_nr_list(&sched_ctrl->retrans_ul_harq, 16);
|
||||||
LOG_I(MAC, "gNB %d] Add NR UE_id %d : rnti %x\n",
|
LOG_I(MAC, "[gNB %d] Add NR UE_id %d : rnti %x\n",
|
||||||
mod_idP,
|
mod_idP,
|
||||||
UE_id,
|
UE_id,
|
||||||
rntiP);
|
rntiP);
|
||||||
@@ -1738,7 +1765,7 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti)
|
|||||||
if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1);
|
if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1);
|
||||||
if (rnti_to_remove_count == 10) exit(1);
|
if (rnti_to_remove_count == 10) exit(1);
|
||||||
rnti_to_remove[rnti_to_remove_count] = rnti;
|
rnti_to_remove[rnti_to_remove_count] = rnti;
|
||||||
LOG_W(MAC, "to remove in mac rnti_to_remove[%d]=%d\n", rnti_to_remove_count, rnti);
|
LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti);
|
||||||
rnti_to_remove_count++;
|
rnti_to_remove_count++;
|
||||||
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
|
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
|
||||||
}
|
}
|
||||||
@@ -1758,6 +1785,16 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti) {
|
||||||
|
// Hack to remove UE in the phy (following the same procedure as in function mac_remove_nr_ue)
|
||||||
|
if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1);
|
||||||
|
if (rnti_to_remove_count == 10) exit(1);
|
||||||
|
rnti_to_remove[rnti_to_remove_count] = rnti;
|
||||||
|
LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti);
|
||||||
|
rnti_to_remove_count++;
|
||||||
|
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) {
|
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) {
|
||||||
// al values passed to this function are x10
|
// al values passed to this function are x10
|
||||||
|
|
||||||
|
|||||||
@@ -237,13 +237,44 @@ void nr_process_mac_pdu(
|
|||||||
case UL_SCH_LCID_SRB3:
|
case UL_SCH_LCID_SRB3:
|
||||||
// todo
|
// todo
|
||||||
break;
|
break;
|
||||||
case UL_SCH_LCID_CCCH_MSG3:
|
|
||||||
// todo
|
|
||||||
break;
|
|
||||||
case UL_SCH_LCID_CCCH:
|
case UL_SCH_LCID_CCCH:
|
||||||
// todo
|
case UL_SCH_LCID_CCCH1:
|
||||||
mac_subheader_len = 2;
|
// fixed length
|
||||||
|
mac_subheader_len = 1;
|
||||||
|
|
||||||
|
if ( rx_lcid == UL_SCH_LCID_CCCH1 ) {
|
||||||
|
// RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes
|
||||||
|
mac_sdu_len = 8;
|
||||||
|
|
||||||
|
// Check if it is a valid CCCH1 message, we get all 00's messages very often
|
||||||
|
int i = 0;
|
||||||
|
for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) {
|
||||||
|
if(pdu_ptr[i] != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == (mac_subheader_len+mac_sdu_len)) {
|
||||||
|
LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len);
|
||||||
|
done = 1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// fixed length of 6 bytes
|
||||||
|
mac_sdu_len = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
nr_mac_rrc_data_ind(module_idP,
|
||||||
|
CC_id,
|
||||||
|
frameP,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
rnti,
|
||||||
|
CCCH,
|
||||||
|
pdu_ptr+mac_subheader_len,
|
||||||
|
mac_sdu_len,
|
||||||
|
0);
|
||||||
|
break;
|
||||||
|
|
||||||
case UL_SCH_LCID_DTCH:
|
case UL_SCH_LCID_DTCH:
|
||||||
// check if LCID is valid at current time.
|
// check if LCID is valid at current time.
|
||||||
@@ -329,8 +360,16 @@ void handle_nr_ul_harq(module_id_t mod_id,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
remove_front_nr_list(&sched_ctrl->feedback_ul_harq);
|
remove_front_nr_list(&sched_ctrl->feedback_ul_harq);
|
||||||
sched_ctrl->ul_harq_processes[harq_pid].round++;
|
sched_ctrl->ul_harq_processes[harq_pid].is_waiting = false;
|
||||||
add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid);
|
if(sched_ctrl->ul_harq_processes[harq_pid].round == MAX_HARQ_ROUNDS) {
|
||||||
|
sched_ctrl->ul_harq_processes[harq_pid].ndi ^= 1;
|
||||||
|
sched_ctrl->ul_harq_processes[harq_pid].round = 0;
|
||||||
|
UE_info->mac_stats[UE_id].ulsch_errors++;
|
||||||
|
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid);
|
||||||
|
} else {
|
||||||
|
sched_ctrl->ul_harq_processes[harq_pid].round++;
|
||||||
|
add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid);
|
||||||
|
}
|
||||||
harq_pid = sched_ctrl->feedback_ul_harq.head;
|
harq_pid = sched_ctrl->feedback_ul_harq.head;
|
||||||
}
|
}
|
||||||
remove_front_nr_list(&sched_ctrl->feedback_ul_harq);
|
remove_front_nr_list(&sched_ctrl->feedback_ul_harq);
|
||||||
@@ -452,9 +491,19 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
UE_scheduling_control->sched_ul_bytes = 0;
|
UE_scheduling_control->sched_ul_bytes = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if(sduP) {
|
||||||
if (!sduP) // check that CRC passed
|
|
||||||
return;
|
bool no_sig = true;
|
||||||
|
for (int k = 0; k < sdu_lenP; k++) {
|
||||||
|
if(sduP[k]!=0) {
|
||||||
|
no_sig = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(no_sig) {
|
||||||
|
LOG_W(NR_MAC, "No signal\n");
|
||||||
|
}
|
||||||
|
|
||||||
T(T_GNB_MAC_UL_PDU_WITH_DATA, T_INT(gnb_mod_idP), T_INT(CC_idP),
|
T(T_GNB_MAC_UL_PDU_WITH_DATA, T_INT(gnb_mod_idP), T_INT(CC_idP),
|
||||||
T_INT(rntiP), T_INT(frameP), T_INT(slotP), T_INT(-1) /* harq_pid */,
|
T_INT(rntiP), T_INT(frameP), T_INT(slotP), T_INT(-1) /* harq_pid */,
|
||||||
@@ -468,40 +517,88 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
if (ra->state != WAIT_Msg3)
|
if (ra->state != WAIT_Msg3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// random access pusch with TC-RNTI
|
if(no_sig) {
|
||||||
if (ra->rnti != current_rnti) {
|
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||||
LOG_W(NR_MAC,
|
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||||
"expected TC-RNTI %04x to match current RNTI %04x\n",
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// random access pusch with TC-RNTI
|
||||||
|
if (ra->rnti != current_rnti) {
|
||||||
|
LOG_W(NR_MAC,
|
||||||
|
"expected TC_RNTI %04x to match current RNTI %04x\n",
|
||||||
|
ra->rnti,
|
||||||
|
current_rnti);
|
||||||
|
|
||||||
|
if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) {
|
||||||
|
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||||
|
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||||
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup);
|
||||||
|
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
||||||
|
|
||||||
|
// re-initialize ta update variables after RA procedure completion
|
||||||
|
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
|
||||||
|
|
||||||
|
LOG_I(NR_MAC,
|
||||||
|
"reset RA state information for RA-RNTI %04x/index %d\n",
|
||||||
ra->rnti,
|
ra->rnti,
|
||||||
current_rnti);
|
i);
|
||||||
|
|
||||||
|
LOG_I(NR_MAC,
|
||||||
|
"[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, "
|
||||||
|
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
||||||
|
gnb_mod_idP,
|
||||||
|
current_rnti,
|
||||||
|
UE_id,
|
||||||
|
ra->rnti);
|
||||||
|
|
||||||
|
if(ra->cfra) {
|
||||||
|
|
||||||
|
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti);
|
||||||
|
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||||
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
|
UE_info->active[UE_id] = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP);
|
||||||
|
LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n");
|
||||||
|
for (int k = 0; k < sdu_lenP; k++) {
|
||||||
|
LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// UE Contention Resolution Identity
|
||||||
|
// Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4
|
||||||
|
// First byte corresponds to R/LCID MAC sub-header
|
||||||
|
memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6);
|
||||||
|
|
||||||
|
nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP);
|
||||||
|
|
||||||
|
ra->state = Msg4;
|
||||||
|
ra->Msg4_frame = ( frameP +2 ) % 1024;
|
||||||
|
ra->Msg4_slot = 1;
|
||||||
|
LOG_I(NR_MAC, "Scheduling RA-Msg4 for TC_RNTI %04x (state %d, frame %d, slot %d)\n", ra->rnti, ra->state, ra->Msg4_frame, ra->Msg4_slot);
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
|
||||||
|
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i];
|
||||||
|
if (ra->state != WAIT_Msg3)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup);
|
|
||||||
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
|
||||||
LOG_I(NR_MAC,
|
|
||||||
"[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, "
|
|
||||||
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
|
||||||
gnb_mod_idP,
|
|
||||||
current_rnti,
|
|
||||||
UE_id,
|
|
||||||
ra->rnti);
|
|
||||||
|
|
||||||
LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n");
|
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||||
for (int k = 0; k < sdu_lenP; k++) {
|
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
||||||
LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
}
|
|
||||||
|
|
||||||
// re-initialize ta update variables afrer RA procedure completion
|
|
||||||
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
|
|
||||||
|
|
||||||
free(ra->preambles.preamble_list);
|
|
||||||
ra->state = RA_IDLE;
|
|
||||||
LOG_I(NR_MAC,
|
|
||||||
"reset RA state information for RA-RNTI %04x/index %d\n",
|
|
||||||
ra->rnti,
|
|
||||||
i);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP);
|
|||||||
void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP,
|
void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP,
|
||||||
uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset);
|
uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset);
|
||||||
|
|
||||||
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP);
|
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra);
|
||||||
|
|
||||||
int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only);
|
int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only);
|
||||||
|
|
||||||
@@ -320,6 +320,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon
|
|||||||
|
|
||||||
void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti);
|
void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti);
|
||||||
|
|
||||||
|
void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti);
|
||||||
|
|
||||||
int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||||
NR_BWP_Downlink_t *bwp,
|
NR_BWP_Downlink_t *bwp,
|
||||||
NR_ControlResourceSet_t *coreset,
|
NR_ControlResourceSet_t *coreset,
|
||||||
@@ -355,8 +357,18 @@ void config_nr_mib(int Mod_idP,
|
|||||||
int cellBarred,
|
int cellBarred,
|
||||||
int intraFreqReselection);
|
int intraFreqReselection);
|
||||||
|
|
||||||
|
int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||||
|
const NR_UE_sched_ctrl_t *ue_sched_ctl,
|
||||||
|
unsigned char *mac_pdu,
|
||||||
|
unsigned char drx_cmd,
|
||||||
|
unsigned char *ue_cont_res_id);
|
||||||
|
|
||||||
void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra);
|
void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra);
|
||||||
|
|
||||||
|
void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra);
|
||||||
|
|
||||||
|
void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t slot, NR_RA_t *ra);
|
||||||
|
|
||||||
void nr_process_mac_pdu(
|
void nr_process_mac_pdu(
|
||||||
module_id_t module_idP,
|
module_id_t module_idP,
|
||||||
rnti_t rnti,
|
rnti_t rnti,
|
||||||
|
|||||||
@@ -805,7 +805,9 @@ void nr_DRB_preconfiguration(uint16_t crnti)
|
|||||||
rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse));
|
rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse));
|
||||||
*rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master;
|
*rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master;
|
||||||
|
|
||||||
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig);
|
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||||
|
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig);
|
||||||
|
}
|
||||||
|
|
||||||
NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig));
|
NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig));
|
||||||
nr_rlc_bearer_init(RLC_BearerConfig);
|
nr_rlc_bearer_init(RLC_BearerConfig);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ extern uint16_t sl_ahead;
|
|||||||
void handle_nr_rach(NR_UL_IND_t *UL_info) {
|
void handle_nr_rach(NR_UL_IND_t *UL_info) {
|
||||||
|
|
||||||
if (UL_info->rach_ind.number_of_pdus>0) {
|
if (UL_info->rach_ind.number_of_pdus>0) {
|
||||||
LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
|
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
|
||||||
int npdus = UL_info->rach_ind.number_of_pdus;
|
int npdus = UL_info->rach_ind.number_of_pdus;
|
||||||
for(int i = 0; i < npdus; i++) {
|
for(int i = 0; i < npdus; i++) {
|
||||||
UL_info->rach_ind.number_of_pdus--;
|
UL_info->rach_ind.number_of_pdus--;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include "NR_MIB.h"
|
#include "NR_MIB.h"
|
||||||
#include "NR_BCCH-BCH-Message.h"
|
#include "NR_BCCH-BCH-Message.h"
|
||||||
|
#include "rrc_gNB_UE_context.h"
|
||||||
|
|
||||||
extern RAN_CONTEXT_t RC;
|
extern RAN_CONTEXT_t RC;
|
||||||
|
|
||||||
@@ -217,29 +218,22 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
|||||||
const int CC_id,
|
const int CC_id,
|
||||||
const frame_t frameP,
|
const frame_t frameP,
|
||||||
const rb_id_t Srb_id,
|
const rb_id_t Srb_id,
|
||||||
|
const rnti_t rnti,
|
||||||
const uint8_t Nb_tb,
|
const uint8_t Nb_tb,
|
||||||
uint8_t *const buffer_pP ){
|
uint8_t *const buffer_pP ){
|
||||||
|
|
||||||
asn_enc_rval_t enc_rval;
|
|
||||||
uint8_t Sdu_size = 0;
|
|
||||||
uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f);
|
|
||||||
|
|
||||||
#ifdef DEBUG_RRC
|
#ifdef DEBUG_RRC
|
||||||
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
|
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rrc_gNB_carrier_data_t *carrier;
|
// MIBCH
|
||||||
NR_BCCH_BCH_Message_t *mib;
|
|
||||||
NR_SRB_INFO *srb_info;
|
|
||||||
char payload_size, *payload_pP;
|
|
||||||
|
|
||||||
carrier = &RC.nrrrc[Mod_idP]->carrier;
|
|
||||||
mib = &carrier->mib;
|
|
||||||
srb_info = &carrier->Srb0;
|
|
||||||
|
|
||||||
/* MIBCH */
|
|
||||||
if ((Srb_id & RAB_OFFSET) == MIBCH) {
|
if ((Srb_id & RAB_OFFSET) == MIBCH) {
|
||||||
|
|
||||||
|
asn_enc_rval_t enc_rval;
|
||||||
|
uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f);
|
||||||
|
rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[Mod_idP]->carrier;
|
||||||
|
NR_BCCH_BCH_Message_t *mib = &carrier->mib;
|
||||||
|
|
||||||
// Currently we are getting the pdcch_ConfigSIB1 from the configuration file.
|
// Currently we are getting the pdcch_ConfigSIB1 from the configuration file.
|
||||||
// Uncomment this function for a dynamic pdcch_ConfigSIB1.
|
// Uncomment this function for a dynamic pdcch_ConfigSIB1.
|
||||||
//channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1
|
//channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1
|
||||||
@@ -269,7 +263,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
|||||||
return (3);
|
return (3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO BCCH SIB1 SIBs */
|
// TODO BCCH SIB1 SIBs
|
||||||
if ((Srb_id & RAB_OFFSET ) == BCCH) {
|
if ((Srb_id & RAB_OFFSET ) == BCCH) {
|
||||||
memcpy(&buffer_pP[0],
|
memcpy(&buffer_pP[0],
|
||||||
RC.nrrrc[Mod_idP]->carrier.SIB1,
|
RC.nrrrc[Mod_idP]->carrier.SIB1,
|
||||||
@@ -278,25 +272,25 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
|||||||
return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1;
|
return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CCCH */
|
// CCCH
|
||||||
if( (Srb_id & RAB_OFFSET ) == CCCH) {
|
if( (Srb_id & RAB_OFFSET ) == CCCH) {
|
||||||
//struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti);
|
|
||||||
//if (ue_context_p == NULL) return(0);
|
|
||||||
//eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
|
|
||||||
LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id);
|
|
||||||
|
|
||||||
// srb_info=&ue_p->Srb0;
|
char *payload_pP;
|
||||||
|
uint8_t Sdu_size = 0;
|
||||||
|
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_idP], rnti);
|
||||||
|
|
||||||
payload_size = srb_info->Tx_buffer.payload_size;
|
LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id);
|
||||||
|
|
||||||
|
char payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size;
|
||||||
|
|
||||||
// check if data is there for MAC
|
// check if data is there for MAC
|
||||||
if (payload_size > 0) {
|
if (payload_size > 0) {
|
||||||
payload_pP = srb_info->Tx_buffer.Payload;
|
payload_pP = ue_context_p->ue_context.Srb0.Tx_buffer.Payload;
|
||||||
LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP);
|
LOG_D(NR_RRC,"[gNB %d] CCCH has %d bytes (dest: %p, src %p)\n", Mod_idP, payload_size, buffer_pP, payload_pP);
|
||||||
// Fill buffer
|
// Fill buffer
|
||||||
memcpy((void *)buffer_pP, (void*)payload_pP, payload_size);
|
memcpy((void *)buffer_pP, (void*)payload_pP, payload_size);
|
||||||
Sdu_size = payload_size;
|
Sdu_size = payload_size;
|
||||||
srb_info->Tx_buffer.payload_size = 0;
|
ue_context_p->ue_context.Srb0.Tx_buffer.payload_size = 0;
|
||||||
}
|
}
|
||||||
return Sdu_size;
|
return Sdu_size;
|
||||||
}
|
}
|
||||||
@@ -304,3 +298,28 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
|||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
|
||||||
|
const int CC_id,
|
||||||
|
const frame_t frameP,
|
||||||
|
const sub_frame_t sub_frameP,
|
||||||
|
const int UE_id,
|
||||||
|
const rnti_t rntiP,
|
||||||
|
const rb_id_t srb_idP,
|
||||||
|
const uint8_t *sduP,
|
||||||
|
const sdu_size_t sdu_lenP,
|
||||||
|
const boolean_t brOption) {
|
||||||
|
|
||||||
|
protocol_ctxt_t ctxt;
|
||||||
|
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0);
|
||||||
|
|
||||||
|
if((srb_idP & RAB_OFFSET) == CCCH) {
|
||||||
|
LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
|
||||||
|
ctxt.brOption = brOption;
|
||||||
|
if (sdu_lenP > 0) {
|
||||||
|
nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -326,7 +326,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
|
|
||||||
// cellSelectionInfo
|
// cellSelectionInfo
|
||||||
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
|
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
|
||||||
sib1->cellSelectionInfo->q_RxLevMin = -50;
|
sib1->cellSelectionInfo->q_RxLevMin = -65;
|
||||||
|
|
||||||
// cellAccessRelatedInfo
|
// cellAccessRelatedInfo
|
||||||
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
|
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
|
||||||
@@ -418,7 +418,8 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
|||||||
nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i];
|
nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i];
|
||||||
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo);
|
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo);
|
||||||
}
|
}
|
||||||
sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
//sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
||||||
|
sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 86;
|
||||||
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) {
|
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) {
|
||||||
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
|
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
|||||||
const int CC_id,
|
const int CC_id,
|
||||||
const frame_t frameP,
|
const frame_t frameP,
|
||||||
const rb_id_t Srb_id,
|
const rb_id_t Srb_id,
|
||||||
|
const rnti_t rnti,
|
||||||
const uint8_t Nb_tb,
|
const uint8_t Nb_tb,
|
||||||
uint8_t *const buffer_pP );
|
uint8_t *const buffer_pP );
|
||||||
|
|
||||||
@@ -158,6 +159,24 @@ int
|
|||||||
nr_rrc_mac_remove_ue(module_id_t mod_idP,
|
nr_rrc_mac_remove_ue(module_id_t mod_idP,
|
||||||
rnti_t rntiP);
|
rnti_t rntiP);
|
||||||
|
|
||||||
|
int8_t nr_mac_rrc_data_ind(
|
||||||
|
const module_id_t module_idP,
|
||||||
|
const int CC_id,
|
||||||
|
const frame_t frameP,
|
||||||
|
const sub_frame_t sub_frameP,
|
||||||
|
const int UE_id,
|
||||||
|
const rnti_t rntiP,
|
||||||
|
const rb_id_t srb_idP,
|
||||||
|
const uint8_t *sduP,
|
||||||
|
const sdu_size_t sdu_lenP,
|
||||||
|
const boolean_t brOption
|
||||||
|
);
|
||||||
|
|
||||||
|
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
||||||
|
const uint8_t *buffer,
|
||||||
|
int buffer_length,
|
||||||
|
const int CC_id);
|
||||||
|
|
||||||
void
|
void
|
||||||
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
|
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
|
||||||
const protocol_ctxt_t *const ctxt_pP,
|
const protocol_ctxt_t *const ctxt_pP,
|
||||||
|
|||||||
@@ -1388,7 +1388,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest:
|
case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest:
|
||||||
LOG_I(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %x)\n", ctxt_pP->rnti);
|
LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %x)\n", ctxt_pP->rnti);
|
||||||
ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti);
|
ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti);
|
||||||
if (ue_context_p != NULL) {
|
if (ue_context_p != NULL) {
|
||||||
rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p);
|
rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p);
|
||||||
@@ -1495,15 +1495,16 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
|
|||||||
CC_id);
|
CC_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ue_context_p != NULL) {
|
|
||||||
ue_context_p->ue_context.establishment_cause = rrcSetupRequest->establishmentCause;
|
ue_context_p->ue_context.establishment_cause = rrcSetupRequest->establishmentCause;
|
||||||
}
|
|
||||||
|
|
||||||
rrc_gNB_generate_RRCSetup(ctxt_pP,
|
rrc_gNB_generate_RRCSetup(ctxt_pP,
|
||||||
rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
|
rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
|
||||||
CC_id);
|
CC_id);
|
||||||
|
|
||||||
|
// FIXME: Check the best place to perform this DRB configuration
|
||||||
|
nr_DRB_preconfiguration(ctxt_pP->rnti);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_UL_CCCH_MessageType__c1_PR_rrcResumeRequest:
|
case NR_UL_CCCH_MessageType__c1_PR_rrcResumeRequest:
|
||||||
|
|||||||
@@ -228,33 +228,38 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
|||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000;
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000;
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL;
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL;
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL;
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL;
|
||||||
/* contention free ra */
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated));
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated));
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA));
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL;
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions));
|
|
||||||
memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric,
|
|
||||||
&servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t));
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long));
|
|
||||||
*secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one;
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb;
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb));
|
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0;
|
|
||||||
|
|
||||||
int n_ssb = 0;
|
// For 2-step contention-free random access procedure
|
||||||
struct NR_CFRA_SSB_Resource *ssbElem[64];
|
if(get_softmodem_params()->sa == 0) {
|
||||||
for (int i=0;i<64;i++) {
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated));
|
||||||
if ((bitmap>>(63-i))&0x01){
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
|
||||||
ssbElem[n_ssb] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource));
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated));
|
||||||
ssbElem[n_ssb]->ssb = i;
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA));
|
||||||
ssbElem[n_ssb]->ra_PreambleIndex = 63;
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL;
|
||||||
ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[n_ssb]);
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions));
|
||||||
n_ssb++;
|
memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric,
|
||||||
|
&servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t));
|
||||||
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long));
|
||||||
|
*secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one;
|
||||||
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb;
|
||||||
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb));
|
||||||
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0;
|
||||||
|
|
||||||
|
int n_ssb = 0;
|
||||||
|
struct NR_CFRA_SSB_Resource *ssbElem[64];
|
||||||
|
for (int i=0;i<64;i++) {
|
||||||
|
if ((bitmap>>(63-i))&0x01){
|
||||||
|
ssbElem[n_ssb] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource));
|
||||||
|
ssbElem[n_ssb]->ssb = i;
|
||||||
|
ssbElem[n_ssb]->ra_PreambleIndex = 63;
|
||||||
|
ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[n_ssb]);
|
||||||
|
n_ssb++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL;
|
||||||
}
|
}
|
||||||
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL;
|
|
||||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants));
|
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants));
|
||||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup;
|
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup;
|
||||||
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup));
|
secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup));
|
||||||
@@ -294,7 +299,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
|||||||
|
|
||||||
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList));
|
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList));
|
||||||
|
|
||||||
n_ssb = 0;
|
int n_ssb = 0;
|
||||||
NR_TCI_State_t *tcic[64];
|
NR_TCI_State_t *tcic[64];
|
||||||
for (int i=0;i<64;i++) {
|
for (int i=0;i<64;i++) {
|
||||||
if ((bitmap>>(63-i))&0x01){
|
if ((bitmap>>(63-i))&0x01){
|
||||||
|
|||||||
@@ -42,17 +42,71 @@ nr_mac_rrc_data_ind_ue(
|
|||||||
const module_id_t module_id,
|
const module_id_t module_id,
|
||||||
const int CC_id,
|
const int CC_id,
|
||||||
const uint8_t gNB_index,
|
const uint8_t gNB_index,
|
||||||
|
const frame_t frame,
|
||||||
|
const sub_frame_t sub_frame,
|
||||||
|
const rnti_t rnti,
|
||||||
const channel_t channel,
|
const channel_t channel,
|
||||||
const uint8_t* pduP,
|
const uint8_t* pduP,
|
||||||
const sdu_size_t pdu_len){
|
const sdu_size_t pdu_len){
|
||||||
|
sdu_size_t sdu_size = 0;
|
||||||
|
|
||||||
switch(channel){
|
switch(channel){
|
||||||
case NR_BCCH_BCH:
|
case NR_BCCH_BCH:
|
||||||
AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n");
|
AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NR_BCCH_DL_SCH:
|
case NR_BCCH_DL_SCH:
|
||||||
AssertFatal( nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len, 0, 0) == 0, "UE decode BCCH-DL-SCH error!\n");
|
if (pdu_len>0) {
|
||||||
|
LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET,
|
||||||
|
gNB_index);
|
||||||
|
|
||||||
|
MessageDef *message_p;
|
||||||
|
int msg_sdu_size = BCCH_SDU_SIZE;
|
||||||
|
|
||||||
|
if (pdu_len > msg_sdu_size) {
|
||||||
|
LOG_E(NR_RRC, "SDU larger than NR-BCCH-DL-SCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
|
||||||
|
sdu_size = msg_sdu_size;
|
||||||
|
} else {
|
||||||
|
sdu_size = pdu_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_BCCH_DATA_IND);
|
||||||
|
memset(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
|
||||||
|
memcpy(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||||
|
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
|
||||||
|
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CCCH:
|
||||||
|
if (pdu_len>0) {
|
||||||
|
LOG_T(NR_RRC,"[UE %d] Received SDU for CCCH on SRB %u from gNB %d\n",module_id,channel & RAB_OFFSET,gNB_index);
|
||||||
|
|
||||||
|
MessageDef *message_p;
|
||||||
|
int msg_sdu_size = CCCH_SDU_SIZE;
|
||||||
|
|
||||||
|
if (pdu_len > msg_sdu_size) {
|
||||||
|
LOG_E(NR_RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
|
||||||
|
sdu_size = msg_sdu_size;
|
||||||
|
} else {
|
||||||
|
sdu_size = pdu_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
message_p = itti_alloc_new_message (TASK_MAC_UE, 0, NR_RRC_MAC_CCCH_DATA_IND);
|
||||||
|
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||||
|
memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
|
||||||
|
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; //frameP
|
||||||
|
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP
|
||||||
|
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||||
|
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = gNB_index;
|
||||||
|
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP
|
||||||
|
itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1367,9 +1367,9 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
|
|||||||
(uint8_t *)Srb_info->Rx_buffer.Payload,
|
(uint8_t *)Srb_info->Rx_buffer.Payload,
|
||||||
100,0,0);
|
100,0,0);
|
||||||
|
|
||||||
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
|
||||||
xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg);
|
xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg);
|
||||||
// }
|
}
|
||||||
|
|
||||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) {
|
if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) {
|
||||||
LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed);
|
LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed);
|
||||||
@@ -2473,7 +2473,6 @@ void *rrc_nrue_task( void *args_p ) {
|
|||||||
case NR_RRC_MAC_BCCH_DATA_IND:
|
case NR_RRC_MAC_BCCH_DATA_IND:
|
||||||
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
|
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
||||||
// PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0);
|
|
||||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
|
||||||
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id,
|
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id,
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
|
||||||
@@ -2481,6 +2480,7 @@ void *rrc_nrue_task( void *args_p ) {
|
|||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
|
||||||
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
|
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
|
||||||
|
break;
|
||||||
|
|
||||||
case NR_RRC_MAC_CCCH_DATA_IND:
|
case NR_RRC_MAC_CCCH_DATA_IND:
|
||||||
LOG_D(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n",
|
LOG_D(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n",
|
||||||
@@ -2569,7 +2569,7 @@ void *rrc_nrue_task( void *args_p ) {
|
|||||||
LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
|
LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG_I(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, nr_rrc_get_state(ue_mod_id));
|
LOG_D(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, nr_rrc_get_state(ue_mod_id));
|
||||||
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
|
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
|
||||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||||
msg_p = NULL;
|
msg_p = NULL;
|
||||||
|
|||||||
@@ -109,7 +109,15 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui
|
|||||||
\param channel indicator for channel of the pdu
|
\param channel indicator for channel of the pdu
|
||||||
\param pduP pointer to pdu
|
\param pduP pointer to pdu
|
||||||
\param pdu_len data length of pdu*/
|
\param pdu_len data length of pdu*/
|
||||||
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len);
|
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
|
||||||
|
const int CC_id,
|
||||||
|
const uint8_t gNB_index,
|
||||||
|
const frame_t frame,
|
||||||
|
const sub_frame_t sub_frame,
|
||||||
|
const rnti_t rnti,
|
||||||
|
const channel_t channel,
|
||||||
|
const uint8_t* pduP,
|
||||||
|
const sdu_size_t pdu_len);
|
||||||
|
|
||||||
/**\brief
|
/**\brief
|
||||||
\param module_id module id
|
\param module_id module id
|
||||||
|
|||||||
@@ -68,8 +68,10 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_
|
|||||||
*recplay_conf=NULL;
|
*recplay_conf=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u_sf_replay == 1) return RECPLAY_REPLAYMODE;
|
if (u_sf_replay == 1)
|
||||||
else if (u_sf_record == 1) return RECPLAY_RECORDMODE;
|
return RECPLAY_REPLAYMODE;
|
||||||
|
else if (u_sf_record == 1)
|
||||||
|
return RECPLAY_RECORDMODE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -80,7 +82,7 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_
|
|||||||
*/
|
*/
|
||||||
void iqrecorder_end(openair0_device *device) {
|
void iqrecorder_end(openair0_device *device) {
|
||||||
if (device->recplay_state != NULL) { // subframes store
|
if (device->recplay_state != NULL) { // subframes store
|
||||||
iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,OAIIQFILE_ID};
|
iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID};
|
||||||
recplay_state_t *rs = device->recplay_state;
|
recplay_state_t *rs = device->recplay_state;
|
||||||
recplay_conf_t *rc = device->openair0_cfg[0].recplay_conf;
|
recplay_conf_t *rc = device->openair0_cfg[0].recplay_conf;
|
||||||
rs->pFile = fopen (rc->u_sf_filename,"wb+");
|
rs->pFile = fopen (rc->u_sf_filename,"wb+");
|
||||||
@@ -91,16 +93,20 @@ void iqrecorder_end(openair0_device *device) {
|
|||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
unsigned int modu = 0;
|
unsigned int modu = 0;
|
||||||
|
|
||||||
if ((modu = rs->nb_samples % 10) != 0) {
|
if ((modu = rs->nbSamplesBlocks % 10) != 0) {
|
||||||
rs->nb_samples -= modu; // store entire number of frames
|
rs->nbSamplesBlocks -= modu; // store entire number of frames
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fh.nbSamplesBlocks=rs->nbSamplesBlocks;
|
||||||
LOG_I(HW,"Writing file header to %s \n", rc->u_sf_filename );
|
LOG_I(HW,"Writing file header to %s \n", rc->u_sf_filename );
|
||||||
fwrite(&fh, sizeof(fh), 1, rs->pFile);
|
fwrite(&fh, sizeof(fh), 1, rs->pFile);
|
||||||
LOG_UI(HW,"Writing %u subframes to %s \n",rs->nb_samples, rc->u_sf_filename );
|
LOG_UI(HW,"Writing %u subframes to %s \n",rs->nbSamplesBlocks, rc->u_sf_filename );
|
||||||
|
uint8_t *ptr=(uint8_t *)rs->ms_sample;
|
||||||
|
|
||||||
for (i = 0; i < rs->nb_samples; i++) {
|
for (i = 0; i < rs->nbSamplesBlocks; i++) {
|
||||||
fwrite(rs->ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), rs->pFile);
|
int blockBytes=sizeof(iqrec_t)+((iqrec_t *)ptr)->nbBytes;
|
||||||
|
fwrite(ptr, sizeof(unsigned char), blockBytes, rs->pFile);
|
||||||
|
ptr+=blockBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (rs->pFile);
|
fclose (rs->pFile);
|
||||||
|
|||||||
@@ -46,21 +46,22 @@ extern "C"
|
|||||||
#define BELL_LABS_IQ_HEADER 0xabababababababab
|
#define BELL_LABS_IQ_HEADER 0xabababababababab
|
||||||
#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now
|
#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now
|
||||||
#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
|
#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
|
||||||
|
#define MAX_BELL_LABS_IQ_BYTES_PER_SF BELL_LABS_IQ_BYTES_PER_SF*10
|
||||||
|
|
||||||
#define OAIIQFILE_ID "OIQF"
|
#define OAIIQFILE_ID {'O', 'I','Q','F'}
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t devtype;
|
uint64_t devtype;
|
||||||
uint64_t tx_sample_advance;
|
uint64_t tx_sample_advance;
|
||||||
double bw;
|
double bw;
|
||||||
|
unsigned int nbSamplesBlocks;
|
||||||
char oaiid[4];
|
char oaiid[4];
|
||||||
} iqfile_header_t;
|
} iqfile_header_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t header;
|
int64_t header;
|
||||||
int64_t ts;
|
int64_t ts;
|
||||||
int64_t rfu1;
|
int64_t nbBytes;
|
||||||
int64_t rfu2; // pad for 256 bits alignement required by AVX2
|
int64_t rfu2; // pad for 256 bits alignement required by AVX2
|
||||||
unsigned char samples[BELL_LABS_IQ_BYTES_PER_SF]; // iq's for one subframe
|
|
||||||
} iqrec_t;
|
} iqrec_t;
|
||||||
#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz)
|
#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz)
|
||||||
#define DEF_SF_FILE "/tmp/iqfile" // default subframes file name
|
#define DEF_SF_FILE "/tmp/iqfile" // default subframes file name
|
||||||
@@ -114,14 +115,16 @@ typedef struct {
|
|||||||
int use_mmap; // default is to use mmap
|
int use_mmap; // default is to use mmap
|
||||||
size_t mapsize;
|
size_t mapsize;
|
||||||
FILE *pFile;
|
FILE *pFile;
|
||||||
int mmapfd;
|
int fd;
|
||||||
int iqfd;
|
|
||||||
iqrec_t *ms_sample; // memory for all subframes
|
iqrec_t *ms_sample; // memory for all subframes
|
||||||
unsigned int nb_samples;
|
unsigned int nbSamplesBlocks;
|
||||||
|
uint8_t *currentPtr;
|
||||||
|
uint64_t currentTs;
|
||||||
|
unsigned int curSamplesBlock;
|
||||||
|
int64_t wrap_count;
|
||||||
|
size_t maxSizeBytes;
|
||||||
} recplay_state_t;
|
} recplay_state_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -697,15 +697,23 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
|
|||||||
s->usrp->set_gpio_attr("FP0", "OUT", gpio789<<7, 0x380);
|
s->usrp->set_gpio_attr("FP0", "OUT", gpio789<<7, 0x380);
|
||||||
s->usrp->clear_command_time();
|
s->usrp->clear_command_time();
|
||||||
gpio789 = (gpio789+1)&7;*/
|
gpio789 = (gpio789+1)&7;*/
|
||||||
|
recplay_state_t *recPlay=device->recplay_state;
|
||||||
|
|
||||||
if (device->recplay_state != NULL) { // record mode
|
if ( recPlay != NULL) { // record mode
|
||||||
// Copy subframes to memory (later dump on a file)
|
// Copy subframes to memory (later dump on a file)
|
||||||
if (device->recplay_state->nb_samples < device->openair0_cfg->recplay_conf->u_sf_max) {
|
if (recPlay->nbSamplesBlocks < device->openair0_cfg->recplay_conf->u_sf_max &&
|
||||||
(device->recplay_state->ms_sample+device->recplay_state->nb_samples)->header = BELL_LABS_IQ_HEADER;
|
recPlay->maxSizeBytes > (recPlay->currentPtr-(uint8_t *)recPlay->ms_sample) +
|
||||||
(device->recplay_state->ms_sample+device->recplay_state->nb_samples)->ts = *ptimestamp;
|
sizeof(iqrec_t) + nsamps*4 ) {
|
||||||
memcpy((device->recplay_state->ms_sample+device->recplay_state->nb_samples)->samples, buff[0], nsamps*4);
|
iqrec_t *hdr=(iqrec_t *)recPlay->currentPtr;
|
||||||
device->recplay_state->nb_samples++;
|
hdr->header = BELL_LABS_IQ_HEADER;
|
||||||
} else exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n");
|
hdr->ts = *ptimestamp;
|
||||||
|
hdr->nbBytes=nsamps*4;
|
||||||
|
memcpy(hdr+1, buff[0], nsamps*4);
|
||||||
|
recPlay->currentPtr+=sizeof(iqrec_t)+nsamps*4;
|
||||||
|
recPlay->nbSamplesBlocks++;
|
||||||
|
LOG_D(HW,"recorded %d samples, for TS %lu, shift in buffer %ld\n", nsamps, hdr->ts, recPlay->currentPtr-(uint8_t *)recPlay->ms_sample);
|
||||||
|
} else
|
||||||
|
exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return samples_received;
|
return samples_received;
|
||||||
@@ -1110,7 +1118,7 @@ extern "C" {
|
|||||||
|
|
||||||
case 46080000:
|
case 46080000:
|
||||||
//openair0_cfg[0].samples_per_packet = 2048;
|
//openair0_cfg[0].samples_per_packet = 2048;
|
||||||
openair0_cfg[0].tx_sample_advance = 65;
|
openair0_cfg[0].tx_sample_advance = 15;
|
||||||
openair0_cfg[0].tx_bw = 40e6;
|
openair0_cfg[0].tx_bw = 40e6;
|
||||||
openair0_cfg[0].rx_bw = 40e6;
|
openair0_cfg[0].rx_bw = 40e6;
|
||||||
break;
|
break;
|
||||||
@@ -1125,7 +1133,7 @@ extern "C" {
|
|||||||
|
|
||||||
case 15360000:
|
case 15360000:
|
||||||
//openair0_cfg[0].samples_per_packet = 2048;
|
//openair0_cfg[0].samples_per_packet = 2048;
|
||||||
openair0_cfg[0].tx_sample_advance = 40;
|
openair0_cfg[0].tx_sample_advance = 45;
|
||||||
openair0_cfg[0].tx_bw = 10e6;
|
openair0_cfg[0].tx_bw = 10e6;
|
||||||
openair0_cfg[0].rx_bw = 10e6;
|
openair0_cfg[0].rx_bw = 10e6;
|
||||||
break;
|
break;
|
||||||
@@ -1329,16 +1337,18 @@ extern "C" {
|
|||||||
if(is_equal(s->sample_rate, (double)7.68e6))
|
if(is_equal(s->sample_rate, (double)7.68e6))
|
||||||
s->tx_forward_nsamps = 50;
|
s->tx_forward_nsamps = 50;
|
||||||
|
|
||||||
|
recplay_state_t *recPlay=device->recplay_state;
|
||||||
|
|
||||||
if (device->recplay_state != NULL) { // record mode
|
if (recPlay != NULL) { // record mode
|
||||||
device->recplay_state->ms_sample = (iqrec_t *) malloc(openair0_cfg[0].recplay_conf->u_sf_max * sizeof(iqrec_t));
|
recPlay->maxSizeBytes=openair0_cfg[0].recplay_conf->u_sf_max *
|
||||||
|
(sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF);
|
||||||
|
recPlay->ms_sample = (iqrec_t *) malloc(recPlay->maxSizeBytes);
|
||||||
|
recPlay->currentPtr= (uint8_t *)recPlay->ms_sample;
|
||||||
|
|
||||||
if (device->recplay_state->ms_sample == NULL) {
|
if (recPlay->ms_sample == NULL) {
|
||||||
std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl;
|
std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(device->recplay_state->ms_sample, 0, openair0_cfg[0].recplay_conf->u_sf_max * BELL_LABS_IQ_BYTES_PER_SF);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,18 +39,15 @@
|
|||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) {
|
static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) {
|
||||||
AssertFatal((memcmp(iq_fh->oaiid,OAIIQFILE_ID,sizeof(OAIIQFILE_ID)) == 0),
|
char tmp[4]=OAIIQFILE_ID;
|
||||||
"iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n",
|
AssertFatal((memcmp(iq_fh->oaiid,tmp,sizeof(iq_fh->oaiid)) == 0),
|
||||||
iq_fh->oaiid);
|
"iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n",
|
||||||
|
iq_fh->oaiid);
|
||||||
device->type = iq_fh->devtype;
|
device->type = iq_fh->devtype;
|
||||||
device->openair0_cfg[0].tx_sample_advance=iq_fh->tx_sample_advance;
|
device->openair0_cfg[0].tx_sample_advance=iq_fh->tx_sample_advance;
|
||||||
device->openair0_cfg[0].tx_bw = device->openair0_cfg[0].rx_bw = iq_fh->bw;
|
device->openair0_cfg[0].tx_bw = device->openair0_cfg[0].rx_bw = iq_fh->bw;
|
||||||
|
device->recplay_state->nbSamplesBlocks=iq_fh->nbSamplesBlocks;
|
||||||
LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw);
|
LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,89 +59,73 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair
|
|||||||
recplay_state_t *s = device->recplay_state;
|
recplay_state_t *s = device->recplay_state;
|
||||||
recplay_conf_t *c = openair0_cfg->recplay_conf;
|
recplay_conf_t *c = openair0_cfg->recplay_conf;
|
||||||
|
|
||||||
|
struct stat sb;
|
||||||
|
s->fd = open(c->u_sf_filename, O_RDONLY );
|
||||||
|
if (s->fd >= 0 ) {
|
||||||
|
fstat(s->fd, &sb);
|
||||||
|
} else {
|
||||||
|
LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename );
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (s->use_mmap) {
|
if (s->use_mmap) {
|
||||||
// use mmap
|
// use mmap
|
||||||
s->mmapfd = open(c->u_sf_filename, O_RDONLY );
|
|
||||||
|
|
||||||
if (s->mmapfd != 0) {
|
|
||||||
struct stat sb;
|
|
||||||
fstat(s->mmapfd, &sb);
|
|
||||||
s->mapsize=sb.st_size;
|
s->mapsize=sb.st_size;
|
||||||
LOG_I(HW,"Loading subframes using mmap() from %s size=%lu bytes ...\n",c->u_sf_filename, (uint64_t)sb.st_size );
|
LOG_I(HW,"Loading subframes using mmap() from %s size=%lu bytes ...\n",c->u_sf_filename, (uint64_t)sb.st_size );
|
||||||
void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) ;
|
void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) ;
|
||||||
s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) + sizeof(iqfile_header_t));
|
s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) + sizeof(iqfile_header_t));
|
||||||
|
|
||||||
if (mptr != MAP_FAILED) {
|
if (mptr != MAP_FAILED) {
|
||||||
parse_iqfile_header(device, (iqfile_header_t *)mptr);
|
parse_iqfile_header(device, (iqfile_header_t *)mptr);
|
||||||
s->ms_sample = (iqrec_t *)((char *)mptr + sizeof(iqfile_header_t));
|
s->ms_sample = (iqrec_t *)((char *)mptr + sizeof(iqfile_header_t));
|
||||||
s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t)) / sizeof(iqrec_t));
|
LOG_I(HW,"Loaded %u subframes.\n",s->nbSamplesBlocks );
|
||||||
int aligned = (((unsigned long)s->ms_sample & 31) == 0)? 1:0;
|
|
||||||
LOG_I(HW,"Loaded %u subframes.\n",s->nb_samples );
|
|
||||||
|
|
||||||
if (aligned == 0) {
|
|
||||||
LOG_E(HW, "mmap address is not 32 bytes aligned, exiting.\n" );
|
|
||||||
close(s->mmapfd);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LOG_E(HW,"Cannot mmap file, exiting.\n");
|
LOG_E(HW,"Cannot mmap file, exiting.\n");
|
||||||
close(s->mmapfd);
|
close(s->fd);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename );
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
s->iqfd = open(c->u_sf_filename, O_RDONLY);
|
iqfile_header_t fh;
|
||||||
|
size_t hs = read(s->fd,&fh,sizeof(fh));
|
||||||
|
|
||||||
if (s->iqfd != 0) {
|
if (hs == sizeof(fh)) {
|
||||||
struct stat sb;
|
parse_iqfile_header(device, &fh);
|
||||||
iqfile_header_t fh;
|
fstat(s->fd, &sb);
|
||||||
size_t hs = read(s->iqfd,&fh,sizeof(fh));
|
|
||||||
|
|
||||||
if (hs == sizeof(fh)) {
|
|
||||||
parse_iqfile_header(device, &fh);
|
|
||||||
fstat(s->iqfd, &sb);
|
|
||||||
s->mapsize=sb.st_size;
|
s->mapsize=sb.st_size;
|
||||||
s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t))/ sizeof(iqrec_t));
|
LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nbSamplesBlocks, c->u_sf_filename,(uint64_t)sb.st_size);
|
||||||
LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nb_samples, c->u_sf_filename,(uint64_t)sb.st_size);
|
|
||||||
// allocate buffer for 1 sample at a time
|
// allocate buffer for 1 sample at a time
|
||||||
s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t));
|
s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)+MAX_BELL_LABS_IQ_BYTES_PER_SF*4);
|
||||||
|
|
||||||
if (s->ms_sample == NULL) {
|
if (s->ms_sample == NULL) {
|
||||||
LOG_E(HW,"Memory allocation failed for individual subframe replay mode.\n" );
|
LOG_E(HW,"Memory allocation failed for individual subframe replay mode.\n" );
|
||||||
close(s->iqfd);
|
close(s->fd);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(s->ms_sample, 0, sizeof(iqrec_t));
|
memset(s->ms_sample, 0, sizeof(iqrec_t));
|
||||||
|
|
||||||
// point at beginning of iqs in file
|
// point at beginning of iqs in file
|
||||||
if (lseek(s->iqfd,sizeof(iqfile_header_t), SEEK_SET) == 0) {
|
if (lseek(s->fd,sizeof(iqfile_header_t), SEEK_SET) == 0) {
|
||||||
LOG_I(HW,"Initial seek at beginning of the file\n" );
|
LOG_I(HW,"Initial seek at beginning of the file\n" );
|
||||||
} else {
|
} else {
|
||||||
LOG_I(HW,"Problem initial seek at beginning of the file\n");
|
LOG_I(HW,"Problem initial seek at beginning of the file\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_E(HW,"Cannot read header in %s exiting.\n",c->u_sf_filename );
|
LOG_E(HW,"Cannot read header in %s exiting.\n",c->u_sf_filename );
|
||||||
close(s->iqfd);
|
close(s->fd);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
LOG_E(HW,"Cannot open %s exiting.\n",c->u_sf_filename );
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s->currentPtr=(uint8_t *)s->ms_sample;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief start the oai iq player
|
/*! \brief start the oai iq player
|
||||||
* \param device, the hardware used
|
* \param device, the hardware used
|
||||||
*/
|
*/
|
||||||
static int trx_iqplayer_start(openair0_device *device){
|
static int trx_iqplayer_start(openair0_device *device) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Terminate operation of the oai iq player
|
/*! \brief Terminate operation of the oai iq player
|
||||||
@@ -160,24 +141,18 @@ static void trx_iqplayer_end(openair0_device *device) {
|
|||||||
if (device->recplay_state->use_mmap) {
|
if (device->recplay_state->use_mmap) {
|
||||||
if (device->recplay_state->ms_sample != MAP_FAILED) {
|
if (device->recplay_state->ms_sample != MAP_FAILED) {
|
||||||
munmap(device->recplay_state->ms_sample, device->recplay_state->mapsize);
|
munmap(device->recplay_state->ms_sample, device->recplay_state->mapsize);
|
||||||
device->recplay_state->ms_sample = NULL;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (device->recplay_state->mmapfd != 0) {
|
|
||||||
close(device->recplay_state->mmapfd);
|
|
||||||
device->recplay_state->mmapfd = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (device->recplay_state->ms_sample != NULL) {
|
if (device->recplay_state->ms_sample != NULL) {
|
||||||
free(device->recplay_state->ms_sample);
|
free(device->recplay_state->ms_sample);
|
||||||
device->recplay_state->ms_sample = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device->recplay_state->iqfd != 0) {
|
|
||||||
close(device->recplay_state->iqfd);
|
|
||||||
device->recplay_state->iqfd = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
device->recplay_state->ms_sample = NULL;
|
||||||
|
if (device->recplay_state->fd >= 0) {
|
||||||
|
close(device->recplay_state->fd);
|
||||||
|
device->recplay_state->fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
|
/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
|
||||||
@param device pointer to the device structure specific to the RF hardware target
|
@param device pointer to the device structure specific to the RF hardware target
|
||||||
@@ -207,93 +182,68 @@ static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timest
|
|||||||
* \returns the number of sample read
|
* \returns the number of sample read
|
||||||
*/
|
*/
|
||||||
static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
||||||
int samples_received=0;
|
|
||||||
static unsigned int cur_samples;
|
|
||||||
static int64_t wrap_count;
|
|
||||||
static int64_t wrap_ts;
|
|
||||||
recplay_state_t *s = device->recplay_state;
|
recplay_state_t *s = device->recplay_state;
|
||||||
|
|
||||||
if (cur_samples == s->nb_samples) {
|
if (s->curSamplesBlock==0 && s->wrap_count==0 )
|
||||||
cur_samples = 0;
|
s->currentTs=s->ms_sample->ts;
|
||||||
wrap_count++;
|
|
||||||
|
|
||||||
if (wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) {
|
if (s->curSamplesBlock == s->nbSamplesBlocks) {
|
||||||
LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n",device->openair0_cfg->recplay_conf->u_sf_loops);
|
LOG_I(HW, "wrapping on iq file (%ld)\n", s->wrap_count);
|
||||||
|
s->curSamplesBlock = 0;
|
||||||
|
s->wrap_count++;
|
||||||
|
|
||||||
|
if (s->wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) {
|
||||||
|
LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n",
|
||||||
|
device->openair0_cfg->recplay_conf->u_sf_loops);
|
||||||
exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n");
|
exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
wrap_ts = wrap_count * (s->nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000));
|
LOG_I(HW,"go back at the beginning of IQ file");
|
||||||
|
device->recplay_state->currentPtr=(uint8_t *)device->recplay_state->ms_sample;
|
||||||
|
|
||||||
if (!device->recplay_state->use_mmap) {
|
if (!s->use_mmap) {
|
||||||
if (lseek(device->recplay_state->iqfd, 0, SEEK_SET) == 0) {
|
if (lseek(device->recplay_state->fd, 0, SEEK_SET) != 0) {
|
||||||
LOG_I(HW,"Seeking at the beginning of IQ file");
|
LOG_E(HW, "Problem seeking at the beginning of IQ file");
|
||||||
} else {
|
|
||||||
LOG_I(HW, "Problem seeking at the beginning of IQ file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->use_mmap) {
|
if (!s->use_mmap) {
|
||||||
if (cur_samples < s->nb_samples) {
|
|
||||||
*ptimestamp = (s->ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts;
|
|
||||||
|
|
||||||
if (cur_samples == 0) {
|
|
||||||
LOG_I(HW,"starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu\n", wrap_count,wrap_ts,*ptimestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(buff[0], &s->ms_sample[cur_samples].samples[0], nsamps*4);
|
|
||||||
cur_samples++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// read sample from file
|
// read sample from file
|
||||||
if (read(s->iqfd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) {
|
if (read(s->fd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) {
|
||||||
LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*cur_samples );
|
LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock );
|
||||||
close(s->iqfd);
|
|
||||||
free(s->ms_sample);
|
|
||||||
s->ms_sample = NULL;
|
|
||||||
s->iqfd = 0;
|
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
} else {
|
||||||
|
if (read(s->fd, s->ms_sample+1, s->ms_sample->nbBytes) != s->ms_sample->nbBytes) {
|
||||||
if (cur_samples < s->nb_samples) {
|
LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock );
|
||||||
static int64_t ts0 = 0;
|
|
||||||
|
|
||||||
if ((cur_samples == 0) && (wrap_count == 0)) {
|
|
||||||
ts0 = s->ms_sample->ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ptimestamp = ts0 + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)) + wrap_ts;
|
|
||||||
|
|
||||||
if (cur_samples == 0) {
|
|
||||||
LOG_I(HW, "starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu ",wrap_count,wrap_ts, *ptimestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(buff[0], &s->ms_sample->samples[0], nsamps*4);
|
|
||||||
cur_samples++;
|
|
||||||
// Prepare for next read
|
|
||||||
off_t where = lseek(s->iqfd, cur_samples * sizeof(iqrec_t), SEEK_SET);
|
|
||||||
|
|
||||||
if (where < 0) {
|
|
||||||
LOG_E(HW,"Cannot lseek in iqfile: %s\n",strerror(errno));
|
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iqrec_t *curHeader=(iqrec_t *)s->currentPtr;
|
||||||
|
AssertFatal(curHeader->header==BELL_LABS_IQ_HEADER,"" );
|
||||||
|
// the current timestamp is the stored timestamp until we wrap on input
|
||||||
|
// USRP shifts 1 sample time to time
|
||||||
|
AssertFatal(s->wrap_count !=0 || abs(curHeader->ts-s->currentTs) < 5 ,"");
|
||||||
|
AssertFatal(nsamps*4==curHeader->nbBytes,"");
|
||||||
|
*ptimestamp = s->currentTs;
|
||||||
|
memcpy(buff[0], curHeader+1, nsamps*4);
|
||||||
|
s->curSamplesBlock++;
|
||||||
|
// Prepare for next read
|
||||||
|
s->currentTs+=nsamps;
|
||||||
|
|
||||||
|
if (s->use_mmap)
|
||||||
|
s->currentPtr+=sizeof(iqrec_t)+s->ms_sample->nbBytes;
|
||||||
|
|
||||||
struct timespec req;
|
struct timespec req;
|
||||||
|
|
||||||
req.tv_sec = 0;
|
req.tv_sec = 0;
|
||||||
|
|
||||||
req.tv_nsec = (device->openair0_cfg[0].recplay_conf->u_sf_read_delay) * 1000;
|
req.tv_nsec = (device->openair0_cfg[0].recplay_conf->u_sf_read_delay) * 1000;
|
||||||
|
|
||||||
nanosleep(&req, NULL);
|
nanosleep(&req, NULL);
|
||||||
|
LOG_D(HW, "returning %d samples at ts %lu\n", nsamps, *ptimestamp);
|
||||||
return nsamps;
|
return nsamps;
|
||||||
|
|
||||||
return samples_received;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||||
device->openair0_cfg = openair0_cfg;
|
device->openair0_cfg = openair0_cfg;
|
||||||
device->trx_start_func = trx_iqplayer_start;
|
device->trx_start_func = trx_iqplayer_start;
|
||||||
@@ -312,5 +262,4 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
|||||||
LOG_UI(HW,"iqplayer device initialized, replay %s for %i iterations",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops);
|
LOG_UI(HW,"iqplayer device initialized, replay %s for %i iterations",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|||||||
@@ -186,14 +186,14 @@ int main(int argc, char *argv[]) {
|
|||||||
serviceSock=client_start(argv[2],atoi(argv[3]));
|
serviceSock=client_start(argv[2],atoi(argv[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t typeStamp=ENB_MAGICDL_FDD;
|
uint64_t typeStamp=ENB_MAGICDL;
|
||||||
boolean_t raw=false;
|
boolean_t raw=false;
|
||||||
|
|
||||||
if ( argc == 5 ) {
|
if ( argc == 5 ) {
|
||||||
raw=true;
|
raw=true;
|
||||||
|
|
||||||
if (strcmp(argv[4],"UL") == 0 )
|
if (strcmp(argv[4],"UL") == 0 )
|
||||||
typeStamp=UE_MAGICDL_FDD;
|
typeStamp=UE_MAGICDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
samplesBlockHeader_t header;
|
samplesBlockHeader_t header;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ gNBs =
|
|||||||
|
|
||||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||||
tracking_area_code = 1;
|
tracking_area_code = 1;
|
||||||
plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;});
|
plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;});
|
||||||
|
|
||||||
tr_s_preference = "local_mac"
|
tr_s_preference = "local_mac"
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@ gNBs =
|
|||||||
|
|
||||||
ssb_SubcarrierOffset = 0;
|
ssb_SubcarrierOffset = 0;
|
||||||
pdsch_AntennaPorts = 1;
|
pdsch_AntennaPorts = 1;
|
||||||
|
pusch_AntennaPorts = 1;
|
||||||
|
|
||||||
pdcch_ConfigSIB1 = (
|
pdcch_ConfigSIB1 = (
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,7 @@ gNBs =
|
|||||||
#initialDownlinkBWP
|
#initialDownlinkBWP
|
||||||
#genericParameters
|
#genericParameters
|
||||||
# this is RBstart=41,L=24 (275*(L-1))+RBstart
|
# this is RBstart=41,L=24 (275*(L-1))+RBstart
|
||||||
initialDLBWPlocationAndBandwidth = 6368;
|
initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875
|
||||||
# subcarrierSpacing
|
# subcarrierSpacing
|
||||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||||
initialDLBWPsubcarrierSpacing = 1;
|
initialDLBWPsubcarrierSpacing = 1;
|
||||||
@@ -64,28 +65,23 @@ gNBs =
|
|||||||
#initialULBWPmappingType
|
#initialULBWPmappingType
|
||||||
#0=typeA,1=typeB
|
#0=typeA,1=typeB
|
||||||
initialDLBWPmappingType_0 = 0;
|
initialDLBWPmappingType_0 = 0;
|
||||||
#this is SS=2,L=12
|
#this is SS=1,L=13
|
||||||
initialDLBWPstartSymbolAndLength_0 = 53;
|
initialDLBWPstartSymbolAndLength_0 = 40;
|
||||||
|
|
||||||
initialDLBWPk0_1 = 0;
|
initialDLBWPk0_1 = 0;
|
||||||
initialDLBWPmappingType_1 = 0;
|
initialDLBWPmappingType_1 = 0;
|
||||||
#this is SS=2,L=10
|
#this is SS=2,L=12
|
||||||
initialDLBWPstartSymbolAndLength_1 = 81;
|
initialDLBWPstartSymbolAndLength_1 = 53;
|
||||||
|
|
||||||
initialDLBWPk0_2 = 0;
|
initialDLBWPk0_2 = 0;
|
||||||
initialDLBWPmappingType_2 = 0;
|
initialDLBWPmappingType_2 = 0;
|
||||||
#this is SS=1,L=12
|
#this is SS=1,L=12
|
||||||
initialDLBWPstartSymbolAndLength_2 = 95;
|
initialDLBWPstartSymbolAndLength_2 = 54;
|
||||||
|
|
||||||
initialDLBWPk0_3 = 0;
|
initialDLBWPk0_3 = 0;
|
||||||
initialDLBWPmappingType_3 = 0;
|
initialDLBWPmappingType_3 = 0;
|
||||||
#this is SS=2,L=7
|
#this is SS=1,L=5
|
||||||
initialDLBWPstartSymbolAndLength_3 = 86;
|
initialDLBWPstartSymbolAndLength_3 = 57;
|
||||||
|
|
||||||
initialDLBWPk0_4 = 0;
|
|
||||||
initialDLBWPmappingType_4 = 0;
|
|
||||||
#this is SS=2,L=5
|
|
||||||
initialDLBWPstartSymbolAndLength_4 = 58;
|
|
||||||
|
|
||||||
#uplinkConfigCommon
|
#uplinkConfigCommon
|
||||||
#frequencyInfoUL
|
#frequencyInfoUL
|
||||||
@@ -99,7 +95,7 @@ gNBs =
|
|||||||
pMax = 20;
|
pMax = 20;
|
||||||
#initialUplinkBWP
|
#initialUplinkBWP
|
||||||
#genericParameters
|
#genericParameters
|
||||||
initialULBWPlocationAndBandwidth = 6368;
|
initialULBWPlocationAndBandwidth = 12952;
|
||||||
# subcarrierSpacing
|
# subcarrierSpacing
|
||||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||||
initialULBWPsubcarrierSpacing = 1;
|
initialULBWPsubcarrierSpacing = 1;
|
||||||
@@ -111,7 +107,7 @@ gNBs =
|
|||||||
prach_msg1_FDM = 0;
|
prach_msg1_FDM = 0;
|
||||||
prach_msg1_FrequencyStart = 0;
|
prach_msg1_FrequencyStart = 0;
|
||||||
zeroCorrelationZoneConfig = 13;
|
zeroCorrelationZoneConfig = 13;
|
||||||
preambleReceivedTargetPower = -100;
|
preambleReceivedTargetPower = -96;
|
||||||
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
||||||
preambleTransMax = 6;
|
preambleTransMax = 6;
|
||||||
#powerRampingStep
|
#powerRampingStep
|
||||||
@@ -196,7 +192,7 @@ gNBs =
|
|||||||
nrofUplinkSlots = 2;
|
nrofUplinkSlots = 2;
|
||||||
nrofUplinkSymbols = 4;
|
nrofUplinkSymbols = 4;
|
||||||
|
|
||||||
ssPBCH_BlockPower = 10;
|
ssPBCH_BlockPower = -25;
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
@@ -255,10 +251,11 @@ MACRLCs = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
L1s = (
|
L1s = (
|
||||||
{
|
{
|
||||||
num_cc = 1;
|
num_cc = 1;
|
||||||
tr_n_preference = "local_mac";
|
tr_n_preference = "local_mac";
|
||||||
}
|
pusch_proc_threads = 8;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
RUs = (
|
RUs = (
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ gNBs =
|
|||||||
|
|
||||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||||
tracking_area_code = 1;
|
tracking_area_code = 1;
|
||||||
plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;});
|
plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;});
|
||||||
|
|
||||||
tr_s_preference = "local_mac"
|
tr_s_preference = "local_mac"
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@ gNBs =
|
|||||||
|
|
||||||
ssb_SubcarrierOffset = 0;
|
ssb_SubcarrierOffset = 0;
|
||||||
pdsch_AntennaPorts = 1;
|
pdsch_AntennaPorts = 1;
|
||||||
|
pusch_AntennaPorts = 1;
|
||||||
|
|
||||||
pdcch_ConfigSIB1 = (
|
pdcch_ConfigSIB1 = (
|
||||||
{
|
{
|
||||||
@@ -50,8 +51,8 @@ gNBs =
|
|||||||
dl_carrierBandwidth = 106;
|
dl_carrierBandwidth = 106;
|
||||||
#initialDownlinkBWP
|
#initialDownlinkBWP
|
||||||
#genericParameters
|
#genericParameters
|
||||||
# this is RBstart=41,L=24 (275*(L-1))+RBstart
|
# this is RBstart=27,L=48 (275*(L-1))+RBstart
|
||||||
initialDLBWPlocationAndBandwidth = 6368;
|
initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952
|
||||||
# subcarrierSpacing
|
# subcarrierSpacing
|
||||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||||
initialDLBWPsubcarrierSpacing = 1;
|
initialDLBWPsubcarrierSpacing = 1;
|
||||||
@@ -64,13 +65,13 @@ gNBs =
|
|||||||
#initialULBWPmappingType
|
#initialULBWPmappingType
|
||||||
#0=typeA,1=typeB
|
#0=typeA,1=typeB
|
||||||
initialDLBWPmappingType_0 = 0;
|
initialDLBWPmappingType_0 = 0;
|
||||||
#this is SS=2,L=12
|
#this is SS=1,L=13
|
||||||
initialDLBWPstartSymbolAndLength_0 = 53;
|
initialDLBWPstartSymbolAndLength_0 = 40;
|
||||||
|
|
||||||
initialDLBWPk0_1 = 0;
|
initialDLBWPk0_1 = 0;
|
||||||
initialDLBWPmappingType_1 = 0;
|
initialDLBWPmappingType_1 = 0;
|
||||||
#this is SS=2,L=10
|
#this is SS=2,L=12
|
||||||
initialDLBWPstartSymbolAndLength_1 = 81;
|
initialDLBWPstartSymbolAndLength_1 = 53;
|
||||||
|
|
||||||
initialDLBWPk0_2 = 0;
|
initialDLBWPk0_2 = 0;
|
||||||
initialDLBWPmappingType_2 = 0;
|
initialDLBWPmappingType_2 = 0;
|
||||||
@@ -94,7 +95,7 @@ gNBs =
|
|||||||
pMax = 20;
|
pMax = 20;
|
||||||
#initialUplinkBWP
|
#initialUplinkBWP
|
||||||
#genericParameters
|
#genericParameters
|
||||||
initialULBWPlocationAndBandwidth = 6368;
|
initialULBWPlocationAndBandwidth = 12952;
|
||||||
# subcarrierSpacing
|
# subcarrierSpacing
|
||||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||||
initialULBWPsubcarrierSpacing = 1;
|
initialULBWPsubcarrierSpacing = 1;
|
||||||
@@ -106,7 +107,7 @@ gNBs =
|
|||||||
prach_msg1_FDM = 0;
|
prach_msg1_FDM = 0;
|
||||||
prach_msg1_FrequencyStart = 0;
|
prach_msg1_FrequencyStart = 0;
|
||||||
zeroCorrelationZoneConfig = 13;
|
zeroCorrelationZoneConfig = 13;
|
||||||
preambleReceivedTargetPower = -100;
|
preambleReceivedTargetPower = -96;
|
||||||
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
||||||
preambleTransMax = 6;
|
preambleTransMax = 6;
|
||||||
#powerRampingStep
|
#powerRampingStep
|
||||||
@@ -191,7 +192,7 @@ gNBs =
|
|||||||
nrofUplinkSlots = 2;
|
nrofUplinkSlots = 2;
|
||||||
nrofUplinkSymbols = 4;
|
nrofUplinkSymbols = 4;
|
||||||
|
|
||||||
ssPBCH_BlockPower = 10;
|
ssPBCH_BlockPower = -25;
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
@@ -250,10 +251,11 @@ MACRLCs = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
L1s = (
|
L1s = (
|
||||||
{
|
{
|
||||||
num_cc = 1;
|
num_cc = 1;
|
||||||
tr_n_preference = "local_mac";
|
tr_n_preference = "local_mac";
|
||||||
}
|
pusch_proc_threads = 8;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
RUs = (
|
RUs = (
|
||||||
|
|||||||
Reference in New Issue
Block a user