mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-19 15:40:30 +00:00
Compare commits
2 Commits
bugfix-sda
...
feature_co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cd9724f52 | ||
|
|
26ac3066ab |
@@ -1015,3 +1015,9 @@ void nr_timer_setup(NR_timer_t *timer, const uint32_t target, const uint32_t ste
|
||||
timer->step = step;
|
||||
nr_timer_stop(timer);
|
||||
}
|
||||
|
||||
void nr_timer_restart(NR_timer_t *timer)
|
||||
{
|
||||
nr_timer_stop(timer);
|
||||
nr_timer_start(timer);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#define NR_NB_SC_PER_RB 12
|
||||
#define NR_MAX_NUM_LCID 32
|
||||
#define NR_MAX_NUM_QFI 64
|
||||
#define NR_MAX_CG_BWP 12
|
||||
#define RNTI_NAMES /* see 38.321 Table 7.1-2 RNTI usage */ \
|
||||
R(TYPE_C_RNTI_) /* Cell RNTI */ \
|
||||
R(TYPE_CS_RNTI_) /* Configured Scheduling RNTI */ \
|
||||
@@ -103,6 +104,28 @@ typedef enum frequency_range_e {
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
|
||||
typedef enum nr_scheduling_type_e {
|
||||
CONFIGURED = 0,
|
||||
DYNAMIC
|
||||
} nr_scheduling_type_t;
|
||||
|
||||
typedef enum nr_configured_grant_state_e{
|
||||
TO_BE_SENT = 0,
|
||||
SENT,
|
||||
NOT_SEND,
|
||||
TO_BE_RECEIVED,
|
||||
RECEIVED,
|
||||
NOT_RECEIVED,
|
||||
VALID,
|
||||
NOT_VALID,
|
||||
CG_ACTIVE,
|
||||
CG_INACTIVE,
|
||||
RETRANSMISSION,
|
||||
NOT_RETRANSMISSION,
|
||||
STORED,
|
||||
NOT_STORED
|
||||
} nr_configured_grant_state_t;
|
||||
|
||||
typedef struct {
|
||||
/// Time shift in number of samples estimated based on DMRS-PDSCH/PUSCH
|
||||
int est_delay;
|
||||
@@ -124,6 +147,13 @@ typedef struct {
|
||||
* @param timer Timer to be started
|
||||
*/
|
||||
void nr_timer_start(NR_timer_t *timer);
|
||||
|
||||
/**
|
||||
* @brief To restart a timer
|
||||
* @param timer Timer to be restarted
|
||||
*/
|
||||
void nr_timer_restart(NR_timer_t *timer);
|
||||
|
||||
/**
|
||||
* @brief To stop a timer
|
||||
* @param timer Timer to stopped
|
||||
|
||||
@@ -110,6 +110,7 @@ extern "C"
|
||||
#define CONFIG_HLP_NOITTI "Do not start itti threads, call queue processing in place, inside the caller thread"
|
||||
#define CONFIG_HLP_LDPC_OFFLOAD "Enable LDPC offload to AMD Xilinx T2 telco card\n"
|
||||
#define CONFIG_HLP_SYNC_REF "UE acts a Sync Reference in Sidelink. 0-none 1-GNB 2-GNSS 4-localtiming\n"
|
||||
#define CONFIG_HLP_DOCG "Configured grant type 2 is activated if UE supports that\n"
|
||||
#define CONFIG_HLP_TADV \
|
||||
"Set RF board timing_advance to compensate fix delay inside the RF board between Rx and Tx timestamps (RF board internal " \
|
||||
"issues)\n"
|
||||
@@ -146,6 +147,7 @@ extern "C"
|
||||
#define CONTINUOUS_TX softmodem_params.continuous_tx
|
||||
#define SYNC_REF softmodem_params.sync_ref
|
||||
#define LDPC_OFFLOAD_FLAG softmodem_params.ldpc_offload_flag
|
||||
#define CG_ACTIVATE softmodem_params.cg_activate
|
||||
|
||||
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
|
||||
|
||||
@@ -194,6 +196,7 @@ extern int usrp_tx_thread;
|
||||
{"sync-ref", CONFIG_HLP_SYNC_REF, 0, .uptr=&SYNC_REF, .defintval=0, TYPE_UINT, 0}, \
|
||||
{"A" , CONFIG_HLP_TADV, 0, .iptr=&softmodem_params.command_line_sample_advance,.defintval=0, TYPE_INT, 0}, \
|
||||
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, .iptr=&softmodem_params.threequarter_fs, .defintval=0, TYPE_INT, 0}, \
|
||||
{"activate-cg", CONFIG_HLP_DOCG, PARAMFLAG_BOOL, .iptr=&CG_ACTIVATE, .defintval=0, TYPE_INT, 0}, \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
@@ -244,6 +247,7 @@ extern int usrp_tx_thread;
|
||||
{ .s5 = { NULL } }, \
|
||||
{ .s5 = { NULL } }, \
|
||||
{ .s5 = { NULL } }, \
|
||||
{ .s5 = { NULL } }, \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
@@ -354,6 +358,7 @@ typedef struct {
|
||||
uint32_t sync_ref;
|
||||
int no_itti;
|
||||
int ldpc_offload_flag;
|
||||
int cg_activate;
|
||||
int threequarter_fs;
|
||||
} softmodem_params_t;
|
||||
|
||||
|
||||
@@ -435,6 +435,7 @@ typedef struct {
|
||||
uint8_t dci_length_options[2];
|
||||
nfapi_nr_dci_formats_e dci_format_options[2];
|
||||
uint8_t ss_type_options[2];
|
||||
uint16_t *cs_rnti;
|
||||
} fapi_nr_dl_config_dci_dl_pdu_rel15_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -730,12 +730,16 @@ void nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
||||
|
||||
const uint32_t crc = polar_decoder_int16(tmp_e, dci_estimation, 1, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
|
||||
|
||||
rnti_t n_rnti = rel15->rnti;
|
||||
bool is_configured_scheduling = rel15->cs_rnti ? true : false;
|
||||
LOG_D(NR_PHY_DCI, "Debug: is configured sched: %d, cs rnti: %p\n", is_configured_scheduling, rel15->cs_rnti);
|
||||
rnti_t n_rnti = is_configured_scheduling ? *rel15->cs_rnti : rel15->rnti;
|
||||
|
||||
if (crc == n_rnti) {
|
||||
LOG_D(NR_PHY_DCI,
|
||||
"(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
LOG_E(NR_PHY_DCI,
|
||||
"(%i.%i) Received dci indication for %s scheduling (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
proc->frame_rx,
|
||||
proc->nr_slot_rx,
|
||||
is_configured_scheduling ? "configured" : "dynamic",
|
||||
n_rnti,
|
||||
rel15->dci_format_options[k],
|
||||
CCEind,
|
||||
|
||||
@@ -105,7 +105,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
nr_phy_data_tx_t *phy_data,
|
||||
c16_t **txdataF)
|
||||
{
|
||||
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
||||
LOG_E(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
||||
|
||||
int Wf[2], Wt[2];
|
||||
int l_prime[2], delta;
|
||||
@@ -147,7 +147,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data;
|
||||
|
||||
LOG_D(PHY,"ulsch TX %x : start_rb %d nb_rb %d mod_order %d Nl %d Tpmi %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n",
|
||||
LOG_E(PHY,"ulsch TX %x : start_rb %d nb_rb %d mod_order %d Nl %d Tpmi %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n",
|
||||
rnti,start_rb,nb_rb,mod_order,Nl,pusch_pdu->Tpmi,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb);
|
||||
// TbD num_of_mod_symbols is set but never used
|
||||
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
|
||||
|
||||
@@ -136,7 +136,27 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
|
||||
}
|
||||
|
||||
if (aa==0 && first_symbol==0) stop_meas(&ru->ofdm_mod_stats);
|
||||
|
||||
|
||||
#ifdef DEBUG_TX
|
||||
if (ru->proc.frame_tx == 100) {
|
||||
LOG_E(PHY, "The slot is %d\n", slot);
|
||||
LOG_E(PHY, "Number of samples per slot is %d\n", fp->samples_per_slot_wCP);
|
||||
LOG_E(PHY, "Number of samples per frame with CP is %d\n", fp->samples_per_frame_wCP);
|
||||
LOG_E(PHY, "OFDM symbol size is %d\n", fp->ofdm_symbol_size);
|
||||
LOG_E(PHY, "slot offset is %d\n", slot_offset);
|
||||
LOG_E(PHY, "slot offsetF is %d\n", slot_offsetF);
|
||||
char filename[100];
|
||||
sprintf(filename, "gNBdataT_frame%d_sl%d.m", ru->proc.frame_tx, slot);
|
||||
char filename_update1[300] = "/home/korada/work_oai_urllc/openairinterface5g/mat/";
|
||||
strcat(filename_update1, filename);
|
||||
LOG_M(filename_update1, "txdataT_frame", &ru->common.txdata[0][slot_offset], fp->get_samples_per_slot(slot, fp), 1, 1);
|
||||
|
||||
sprintf(filename, "gNBdataF_frame%d_sl%d.m", ru->proc.frame_tx, slot);
|
||||
char filename_update2[300] = "/home/korada/work_oai_urllc/openairinterface5g/mat/";
|
||||
strcat(filename_update2, filename);
|
||||
LOG_M(filename_update2, "txdataF_frame", &ru->common.txdataF[0][slot_offsetF], fp->samples_per_subframe, 1, 1);
|
||||
}
|
||||
#endif
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0), 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -735,7 +735,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
|
||||
const int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
|
||||
int offset = 10 * gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset;
|
||||
LOG_D(PHY,
|
||||
LOG_E(PHY,
|
||||
"frame %d, slot %d: UL signal energy %d\n",
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
@@ -814,7 +814,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
NR_UL_gNB_HARQ_t *ulsch_harq = ulsch->harq_process;
|
||||
AssertFatal(ulsch_harq != NULL, "harq_pid %d is not allocated\n", ulsch->harq_pid);
|
||||
if ((ulsch->active == true) && (ulsch->frame == frame_rx) && (ulsch->slot == slot_rx) && (ulsch->handled == 0)) {
|
||||
LOG_D(PHY, "PUSCH ID %d with RNTI %x detection started in frame %d slot %d\n", ULSCH_id, ulsch->rnti, frame_rx, slot_rx);
|
||||
LOG_E(PHY, "PUSCH ID %d with RNTI %x detection started in frame %d slot %d with harq id %d\n", ULSCH_id, ulsch->rnti, frame_rx, slot_rx, ulsch->harq_pid);
|
||||
|
||||
int num_dmrs = 0;
|
||||
for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++)
|
||||
@@ -871,7 +871,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
if (dB_fixed_x10(pusch_vars->ulsch_power_tot) < dB_fixed_x10(pusch_vars->ulsch_noise_power_tot) + gNB->pusch_thres) {
|
||||
NR_gNB_PHY_STATS_t *stats = get_phy_stats(gNB, ulsch->rnti);
|
||||
|
||||
LOG_D(PHY,
|
||||
LOG_E(PHY,
|
||||
"PUSCH not detected in %d.%d (%d,%d,%d)\n",
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
|
||||
@@ -455,14 +455,14 @@ static void nr_ue_scheduled_response_ul(PHY_VARS_NR_UE *phy, fapi_nr_ul_config_r
|
||||
int current_harq_pid = pdu->pusch_config_pdu.pusch_data.harq_process_id;
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = &phy->ul_harq_processes[current_harq_pid];
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &phy_data->ulsch.pusch_pdu;
|
||||
LOG_D(PHY,
|
||||
LOG_E(PHY,
|
||||
"copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n",
|
||||
pdu->pusch_config_pdu.nrOfLayers,
|
||||
pdu->pusch_config_pdu.num_dmrs_cdm_grps_no_data);
|
||||
|
||||
memcpy(pusch_pdu, &pdu->pusch_config_pdu, sizeof(*pusch_pdu));
|
||||
if (pdu->pusch_config_pdu.tx_request_body.pdu) {
|
||||
LOG_D(PHY,
|
||||
LOG_E(PHY,
|
||||
"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",
|
||||
ul_config->frame,
|
||||
ul_config->slot,
|
||||
|
||||
@@ -289,7 +289,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n
|
||||
for(int i=0; i< ue->frame_parms.nb_antennas_tx; ++i)
|
||||
txdataF[i] = &txdataF_buf[i * samplesF_per_slot];
|
||||
|
||||
LOG_D(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
|
||||
LOG_E(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
|
||||
|
||||
start_meas(&ue->phy_proc_tx);
|
||||
|
||||
@@ -303,12 +303,12 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n
|
||||
|
||||
pucch_procedures_ue_nr(ue, proc, phy_data, (c16_t **)&txdataF);
|
||||
|
||||
LOG_D(PHY, "Sending Uplink data \n");
|
||||
LOG_E(PHY, "Sending Uplink data \n");
|
||||
nr_ue_pusch_common_procedures(ue, proc->nr_slot_tx, &ue->frame_parms, ue->frame_parms.nb_antennas_tx, (c16_t **)txdataF);
|
||||
|
||||
nr_ue_prach_procedures(ue, proc);
|
||||
|
||||
LOG_D(PHY, "****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
|
||||
LOG_E(PHY, "****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
|
||||
stop_meas(&ue->phy_proc_tx);
|
||||
|
||||
@@ -559,7 +559,8 @@ typedef struct NR_UE_UL_BWP {
|
||||
uint16_t BWPStart;
|
||||
NR_RACH_ConfigCommon_t *rach_ConfigCommon;
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList_Common;
|
||||
NR_ConfiguredGrantConfig_t *configuredGrantConfig;
|
||||
NR_ConfiguredGrantConfig_t *configuredGrantConfig; // each BWP can have max of 12 CGs
|
||||
NR_ConfiguredGrantConfigToAddModList_r16_t *configuredGrantConfigList;
|
||||
NR_PUSCH_Config_t *pusch_Config;
|
||||
NR_PUCCH_Config_t *pucch_Config;
|
||||
NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon;
|
||||
@@ -614,5 +615,40 @@ typedef struct NR_tda_info {
|
||||
long k2;
|
||||
} NR_tda_info_t;
|
||||
|
||||
/*
|
||||
typedef struct nr_cg_ctrl {
|
||||
bool send_cg_activation;
|
||||
bool send_cg_deactivation;
|
||||
bool cg_active;
|
||||
bool avoid_cg_pdcch_pdu; // for cg once pdcch is received for activation, no need to receive any UL DCI for UL resources
|
||||
bool valid_activate_ind_rec;
|
||||
bool valid_deactivate_ind_rec;
|
||||
} nr_cg_ctrl_t;
|
||||
|
||||
typedef struct NR_Configured_Scheduling{
|
||||
nr_cg_ctrl_t cg;
|
||||
} NR_Configured_Scheduling_t;
|
||||
*/
|
||||
|
||||
typedef enum{
|
||||
NR_CG_TIMER_START = 0,
|
||||
NR_CG_TIMER_RESTART,
|
||||
NR_CG_TIMER_STOP,
|
||||
} nr_cgtimer_status_t;
|
||||
|
||||
typedef struct nr_cg_indication_status {
|
||||
nr_configured_grant_state_t status_cg_activation;
|
||||
nr_configured_grant_state_t status_cg_deactivation;
|
||||
} nr_cg_indication_status_t;
|
||||
|
||||
typedef struct nr_cg_start_info {
|
||||
int frame;
|
||||
int slot;
|
||||
NR_tda_info_t *tda_info;
|
||||
//int index;
|
||||
bool is_mixed_slot;
|
||||
//bool is_repetition;
|
||||
} nr_cg_start_info_t;
|
||||
|
||||
#endif /*__LAYER2_MAC_H__ */
|
||||
|
||||
|
||||
@@ -3477,6 +3477,88 @@ int ul_ant_bits(NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig, long transformPrec
|
||||
|
||||
static const int tdd_period_to_num[8] = {500, 625, 1000, 1250, 2000, 2500, 5000, 10000};
|
||||
|
||||
int nr_get_CG_alloc(frame_t frame,
|
||||
slot_t slot,
|
||||
const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const NR_ConfiguredGrantConfig_t *cg_config,
|
||||
int start_sym,
|
||||
nr_cg_start_info_t *cg_start_info,
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd,
|
||||
frame_type_t frame_type) {
|
||||
const int mu = ul_bwp->scs;
|
||||
const uint16_t num_slots_frame = nr_slots_per_frame[mu];
|
||||
const bool is_normal_cp = ul_bwp->cyclicprefix ? false : true;
|
||||
const bool is_ul_slot = is_nr_UL_slot(tdd, slot, frame_type);
|
||||
const uint8_t num_sym_slot = is_normal_cp ? 14 : 12;
|
||||
// const NR_ConfiguredGrantConfig_t *cg_config = ul_bwp->configuredGrantConfig;
|
||||
int alloc_cg = -1;
|
||||
bool is_alloc_cg = false;
|
||||
|
||||
if((!(cg_config && cg_start_info)) || (start_sym >= num_sym_slot))
|
||||
return alloc_cg;
|
||||
|
||||
if (!is_ul_slot){return alloc_cg;}
|
||||
|
||||
// Calculate initial TX slot and frame of CG transmission
|
||||
int initial_slot_tx = (cg_start_info->slot + cg_start_info->tda_info->k2) % nr_slots_per_frame[mu];
|
||||
int initial_frame_tx = ((cg_start_info->slot + cg_start_info->tda_info->k2) > (nr_slots_per_frame[mu]-1)) ? (cg_start_info->frame + 1) % 1024 : cg_start_info->frame;
|
||||
|
||||
LOG_D(NR_MAC, "Initial frame : %d, curr frame: %d, Initial slot: %d, curr slot: %d\n", initial_frame_tx, frame, initial_slot_tx, slot);
|
||||
if((frame < initial_frame_tx) || (frame == initial_frame_tx && slot < initial_slot_tx)){return alloc_cg;}
|
||||
|
||||
/* perodicity in symbols */
|
||||
int16_t period_symbols = nr_get_cg_periodicity(cg_config->periodicity, ul_bwp->scs);
|
||||
AssertFatal(period_symbols > 0, "The period between CG resource allocation must be positive\n");
|
||||
|
||||
for (int sym_index = start_sym; sym_index < num_sym_slot; sym_index++){
|
||||
int current_symbol = (num_slots_frame * frame * num_sym_slot + slot * num_sym_slot + sym_index) % (1024 * num_slots_frame * num_sym_slot);
|
||||
|
||||
int start_sym = (num_slots_frame * num_sym_slot * initial_frame_tx +
|
||||
initial_slot_tx * num_sym_slot + cg_start_info->tda_info->startSymbolIndex) % (1024 * num_slots_frame * num_sym_slot);
|
||||
|
||||
int sym_diff = (current_symbol - start_sym < 0) ? current_symbol - start_sym + (1024 * num_slots_frame * num_sym_slot) : current_symbol - start_sym;
|
||||
is_alloc_cg = (sym_diff % period_symbols) == 0;
|
||||
LOG_D(NR_MAC, "[CG Allocation]start symbol : %d, current symbol : %d \n", start_sym, current_symbol);
|
||||
LOG_D(NR_MAC, "[CG Allocation][%d.%d]Symbol %d is start of transmission occasion for UL grant with status %d(sym_diff: %d, per_sym: %d)\n", frame, slot, sym_index, is_alloc_cg, sym_diff, period_symbols);
|
||||
|
||||
if(is_alloc_cg){
|
||||
alloc_cg = sym_index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return alloc_cg;
|
||||
}
|
||||
|
||||
/*
|
||||
In the case of dynamic resource allocations, the HARQ process identity is specified within the DCI associated with each individual
|
||||
resource allocation. A UE does not receive DCI for each individual transmission when using configured grant scheduling so 3GPP
|
||||
(TS 38.321) has specified a calculation to determine the HARQ Process Identity
|
||||
*/
|
||||
int get_cg_harq_processid(frame_t frame, slot_t slot, uint16_t symbol, const NR_UE_UL_BWP_t *ul_bwp, NR_ConfiguredGrantConfig_t *cg_config) {
|
||||
const uint16_t num_slots_frame = nr_slots_per_frame[ul_bwp->scs];
|
||||
const bool is_normal_cp = ul_bwp->cyclicprefix ? false : true;
|
||||
const uint8_t num_sym_slot = is_normal_cp ? 14 : 12;
|
||||
// const NR_ConfiguredGrantConfig_t *cg_config = ul_bwp->configuredGrantConfig;
|
||||
int harq_processid = 0;
|
||||
|
||||
int current_symbol = (num_slots_frame * frame * num_sym_slot + slot * num_sym_slot + symbol) % (1024 * num_slots_frame * num_sym_slot);
|
||||
|
||||
/* perodicity in symbols */
|
||||
int16_t period_symbols = nr_get_cg_periodicity(cg_config->periodicity, ul_bwp->scs);
|
||||
AssertFatal(period_symbols > 0, "The period between CG resource allocation must be positive\n");
|
||||
|
||||
if (cg_config->ext1 == NULL)
|
||||
harq_processid = (int)floor(current_symbol/period_symbols) % (int)cg_config->nrofHARQ_Processes;
|
||||
else if (cg_config->ext1 && cg_config->ext1->harq_ProcID_Offset2_r16)
|
||||
harq_processid = (int)floor(current_symbol/period_symbols) % (int)cg_config->nrofHARQ_Processes + *cg_config->ext1->harq_ProcID_Offset2_r16;
|
||||
else if (cg_config->ext1 && cg_config->ext1->cg_RetransmissionTimer_r16)
|
||||
AssertFatal(1 == 0, "Retransmission timer in CG is still not implemented\n");
|
||||
|
||||
return harq_processid;
|
||||
}
|
||||
|
||||
|
||||
bool is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot)
|
||||
{
|
||||
if (tdd_UL_DL_ConfigurationCommon == NULL)
|
||||
@@ -5234,3 +5316,59 @@ rnti_t nr_get_ra_rnti(uint8_t s_id, uint8_t t_id, uint8_t f_id, uint8_t ul_carri
|
||||
|
||||
return ra_rnti;
|
||||
}
|
||||
|
||||
float nr_get_cg_periodicity(long periodicity, int scs) {
|
||||
/* return periodicity (in symbols) */
|
||||
if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym2)
|
||||
AssertFatal(1 == 0, "2 symbol periodicity is not supported\n");
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym7)
|
||||
AssertFatal(1 == 0, "7 symbol periodicity is not supported\n");
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym6)
|
||||
AssertFatal(1 == 0, "6 symbol periodicity is not supported\n");
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym1x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym1x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym1x14 ? 14 : 12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym2x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym2x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym2x14 ? 2*14 : 2*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym4x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym4x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym4x14 ? 4*14 : 4*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym5x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym5x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym5x14 ? 5*14 : 5*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym8x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym8x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym8x14 ? 8*14 : 8*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym10x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym10x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym10x14 ? 10*14 : 10*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym16x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym16x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym16x14 ? 16*14 : 16*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym20x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym20x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym20x14 ? 20*14 : 20*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym32x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym32x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym32x14 ? 32*14 : 32*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym40x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym40x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym40x14 ? 40*14 : 40*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym64x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym64x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym64x14 ? 64*14 : 64*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym80x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym80x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym80x14 ? 80*14 : 80*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym128x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym128x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym128x14 ? 128*14 : 128*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym160x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym160x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym160x14 ? 160*14 : 160*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym320x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym320x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym320x14 ? 320*14 : 320*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym640x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym640x12)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym640x14 ? 640*14 : 640*12;
|
||||
else if ((periodicity == NR_ConfiguredGrantConfig__periodicity_sym256x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym256x12) && scs != 0)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym256x14 ? 256*14 : 256*12;
|
||||
else if ((periodicity == NR_ConfiguredGrantConfig__periodicity_sym512x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym512x12) && scs != 0 && scs != 1)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym512x14 ? 512*14 : 512*12;
|
||||
else if ((periodicity == NR_ConfiguredGrantConfig__periodicity_sym1280x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym1280x12) && scs != 0)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym1280x14 ? 1280*14 : 1280*12;
|
||||
else if ((periodicity == NR_ConfiguredGrantConfig__periodicity_sym2560x14 || periodicity == NR_ConfiguredGrantConfig__periodicity_sym2560x12) && scs != 0 && scs != 1)
|
||||
return periodicity == NR_ConfiguredGrantConfig__periodicity_sym2560x14 ? 2560*14 : 2560*12;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym1024x14 && scs == 3)
|
||||
return 1024*14;
|
||||
else if (periodicity == NR_ConfiguredGrantConfig__periodicity_sym2560x14 && scs == 3)
|
||||
return 5120*14;
|
||||
else
|
||||
AssertFatal(1==0, "Undefined SPS Periodicity\n");
|
||||
}
|
||||
|
||||
@@ -68,6 +68,19 @@ bool is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, s
|
||||
|
||||
bool is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, frame_type_t frame_type);
|
||||
|
||||
float nr_get_cg_periodicity(long periodicity, int scs);
|
||||
|
||||
int nr_get_CG_alloc(frame_t frame,
|
||||
slot_t slot,
|
||||
const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const NR_ConfiguredGrantConfig_t *cg_config,
|
||||
int start_sym,
|
||||
nr_cg_start_info_t *cg_start_info,
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd,
|
||||
frame_type_t frame_type);
|
||||
|
||||
int get_cg_harq_processid(frame_t frame, slot_t slot, uint16_t symbol, const NR_UE_UL_BWP_t *ul_bwp, NR_ConfiguredGrantConfig_t *cg_config);
|
||||
|
||||
uint8_t compute_srs_resource_indicator(long *maxMIMO_Layers,
|
||||
NR_PUSCH_Config_t *pusch_Config,
|
||||
NR_SRS_Config_t *srs_config,
|
||||
|
||||
@@ -963,6 +963,62 @@ static void setup_puschconfig(NR_PUSCH_Config_t *source, NR_PUSCH_Config_t *targ
|
||||
}
|
||||
}
|
||||
|
||||
void setup_CGtimers(NR_UE_MAC_INST_t *mac, NR_UE_UL_BWP_t *bwp){
|
||||
NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info;
|
||||
int scs = mac->current_UL_BWP->scs;
|
||||
|
||||
//int slots_per_subframe = nr_slots_per_frame[scs] / 10;
|
||||
bool is_normal_cp = bwp->cyclicprefix ? false : true;
|
||||
uint8_t num_sym_slot = is_normal_cp ? 14 : 12;
|
||||
uint32_t periodic_symbols = nr_get_cg_periodicity(bwp->configuredGrantConfig->periodicity, scs);
|
||||
uint32_t cg_timer = *bwp->configuredGrantConfig->configuredGrantTimer * periodic_symbols;
|
||||
uint32_t target = periodic_symbols < UINT_MAX ? ceil(cg_timer / num_sym_slot) : periodic_symbols;
|
||||
for (int i = 0; i < NR_MAX_HARQ_PROCESSES; i++) {
|
||||
nr_timer_setup(&si->configuredGrant_Timer[i], target, 1); // 1 slot update rate
|
||||
}
|
||||
}
|
||||
|
||||
static void setup_CGconfig(NR_ConfiguredGrantConfig_t *source, NR_ConfiguredGrantConfig_t *target)
|
||||
{
|
||||
UPDATE_IE(target->frequencyHopping, source->frequencyHopping, long);
|
||||
UPDATE_IE(target->mcs_Table, source->mcs_Table, long);
|
||||
UPDATE_IE(target->mcs_TableTransformPrecoder, source->mcs_TableTransformPrecoder, long);
|
||||
UPDATE_IE(target->transformPrecoder, source->transformPrecoder, long);
|
||||
UPDATE_IE(target->rbg_Size, source->rbg_Size, long);
|
||||
UPDATE_IE(target->repK_RV, source->repK_RV, long);
|
||||
UPDATE_IE(target->configuredGrantTimer, source->configuredGrantTimer, long);
|
||||
|
||||
UPDATE_NP_IE(target->repK, source->repK, long);
|
||||
UPDATE_NP_IE(target->resourceAllocation, source->resourceAllocation, long);
|
||||
UPDATE_NP_IE(target->powerControlLoopToUse, source->powerControlLoopToUse, long);
|
||||
UPDATE_NP_IE(target->nrofHARQ_Processes, source->nrofHARQ_Processes, long);
|
||||
UPDATE_NP_IE(target->periodicity, source->periodicity, long);
|
||||
|
||||
/*
|
||||
if (source->uci_OnPUSCH) {
|
||||
if (source->uci_OnPUSCH->present == NR_SetupRelease_CG_UCI_OnPUSCH_PR_release)
|
||||
asn1cFreeStruc(asn_DEF_NR_UCI_OnPUSCH, target->uci_OnPUSCH);
|
||||
if (source->uci_OnPUSCH->present == NR_SetupRelease_CG_UCI_OnPUSCH_PR_setup) {
|
||||
if (target->uci_OnPUSCH) {
|
||||
if (source->uci_OnPUSCH->choice.setup->present == NR_CG_UCI_OnPUSCH_PR_dynamic){
|
||||
ADDMOD_IE_FROMLIST(target->uci_OnPUSCH->choice.setup->choice.dynamic,
|
||||
source->uci_OnPUSCH->choice.setup->choice.dynamic,
|
||||
betaOffsetACK_Index1,
|
||||
long);
|
||||
ADDMOD_IE_FROMLIST(target->uci_OnPUSCH->choice.setup->choice.dynamic,
|
||||
source->uci_OnPUSCH->choice.setup->choice.dynamic,
|
||||
betaOffsetACK_Index2,
|
||||
long);
|
||||
}
|
||||
else{
|
||||
LOG_E(NR_RRC, "Still not implemented\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static void setup_pdschconfig(NR_PDSCH_Config_t *source, NR_PDSCH_Config_t *target)
|
||||
{
|
||||
UPDATE_IE(target->dataScramblingIdentityPDSCH, source->dataScramblingIdentityPDSCH, long);
|
||||
@@ -1255,6 +1311,24 @@ static NR_UE_DL_BWP_t *get_dl_bwp_structure(NR_UE_MAC_INST_t *mac, int bwp_id, b
|
||||
return bwp;
|
||||
}
|
||||
|
||||
NR_UE_UL_CG_INFO_t *get_cg_info_default(NR_UE_UL_CG_INFO_t *info){
|
||||
|
||||
NR_UE_UL_CG_INFO_t *cg_info = NULL;
|
||||
if(!info)
|
||||
cg_info = calloc(1, sizeof(*cg_info));
|
||||
else
|
||||
cg_info = info;
|
||||
|
||||
cg_info->cg_act_deact_receive_status.status_cg_activation = NOT_RECEIVED;
|
||||
cg_info->cg_act_deact_receive_status.status_cg_deactivation = NOT_RECEIVED;
|
||||
cg_info->cg_act_deact_valid_status.status_cg_activation = NOT_VALID;
|
||||
cg_info->cg_act_deact_valid_status.status_cg_deactivation = NOT_VALID;
|
||||
cg_info->initial_ul_config_status = NOT_STORED;
|
||||
cg_info->cg_confirmation_apply = false;
|
||||
|
||||
return cg_info;
|
||||
}
|
||||
|
||||
static NR_UE_UL_BWP_t *get_ul_bwp_structure(NR_UE_MAC_INST_t *mac, int bwp_id, bool setup)
|
||||
{
|
||||
NR_UE_UL_BWP_t *bwp = NULL;
|
||||
@@ -1310,6 +1384,7 @@ static void configure_dedicated_BWP_dl(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP
|
||||
static void configure_dedicated_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_UplinkDedicated_t *ul_dedicated)
|
||||
{
|
||||
if (ul_dedicated) {
|
||||
//NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info;
|
||||
NR_UE_UL_BWP_t *bwp = get_ul_bwp_structure(mac, bwp_id, true);
|
||||
bwp->bwp_id = bwp_id;
|
||||
if(ul_dedicated->pucch_Config) {
|
||||
@@ -1339,7 +1414,34 @@ static void configure_dedicated_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP
|
||||
setup_srsconfig(ul_dedicated->srs_Config->choice.setup, bwp->srs_Config);
|
||||
}
|
||||
}
|
||||
AssertFatal(!ul_dedicated->configuredGrantConfig, "configuredGrantConfig not supported\n");
|
||||
|
||||
NR_UE_UL_CG_INFO_t *cg_info = NULL;
|
||||
if(ul_dedicated->configuredGrantConfig){
|
||||
if(ul_dedicated->configuredGrantConfig->present == NR_SetupRelease_ConfiguredGrantConfig_PR_release)
|
||||
asn1cFreeStruc(asn_DEF_NR_ConfiguredGrantConfig, bwp->configuredGrantConfig);
|
||||
if(ul_dedicated->configuredGrantConfig->present == NR_SetupRelease_ConfiguredGrantConfig_PR_setup){
|
||||
if(!bwp->configuredGrantConfig)
|
||||
bwp->configuredGrantConfig = calloc(1, sizeof(*bwp->configuredGrantConfig));
|
||||
setup_CGconfig(ul_dedicated->configuredGrantConfig->choice.setup, bwp->configuredGrantConfig);
|
||||
cg_info = get_cg_info_default(NULL);
|
||||
setup_CGtimers(mac, bwp);
|
||||
ASN_SEQUENCE_ADD(&mac->configured_sched, cg_info);
|
||||
LOG_E(NR_RRC, "Setting up the configured grant at UE\n");
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(ul_dedicated->ext1 && ul_dedicated->ext1->configuredGrantConfigToAddModList_r16){
|
||||
NR_ConfiguredGrantConfigToAddModList_r16_t *cg_config_list = ul_dedicated->ext1->configuredGrantConfigToAddModList_r16;
|
||||
if(!bwp->configuredGrantConfigList)
|
||||
bwp->configuredGrantConfigList = calloc(cg_config_list->list.count, sizeof(*bwp->configuredGrantConfigList));
|
||||
for(int i = 0; i < NR_MAX_CG_BWP; i++){
|
||||
setup_CGconfig(cg_config_list->list.array[i], bwp->configuredGrantConfigList->list.array[i]);
|
||||
cg_info = get_cg_info_default(NULL);
|
||||
setup_CGtimers(mac, bwp);
|
||||
ASN_SEQUENCE_ADD(&mac->configured_sched, cg_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1543,6 +1645,7 @@ static void configure_physicalcellgroup(NR_UE_MAC_INST_t *mac,
|
||||
mac->pdsch_HARQ_ACK_Codebook = phyConfig->pdsch_HARQ_ACK_Codebook;
|
||||
mac->harq_ACK_SpatialBundlingPUCCH = phyConfig->harq_ACK_SpatialBundlingPUCCH ? true : false;
|
||||
mac->harq_ACK_SpatialBundlingPUSCH = phyConfig->harq_ACK_SpatialBundlingPUSCH ? true : false;
|
||||
mac->CS_RNTI_present = phyConfig->cs_RNTI ? true : false;
|
||||
|
||||
NR_P_Max_t *p_NR_FR1 = phyConfig->p_NR_FR1;
|
||||
NR_P_Max_t *p_UE_FR1 = phyConfig->ext1 ?
|
||||
@@ -1554,6 +1657,8 @@ static void configure_physicalcellgroup(NR_UE_MAC_INST_t *mac,
|
||||
mac->p_Max_alt = p_UE_FR1 == NULL ? *p_NR_FR1 :
|
||||
(*p_UE_FR1 < *p_NR_FR1 ?
|
||||
*p_UE_FR1 : *p_NR_FR1);
|
||||
|
||||
mac->cs_rnti = mac->CS_RNTI_present ? phyConfig->cs_RNTI->choice.setup : -1;
|
||||
}
|
||||
|
||||
static uint32_t get_sr_DelayTimer(long logicalChannelSR_DelayTimer)
|
||||
|
||||
@@ -244,6 +244,8 @@ typedef struct {
|
||||
uint16_t periodicPHR_Timer;
|
||||
///timer before triggering a prohibit PHR
|
||||
uint16_t prohibitPHR_Timer;
|
||||
// configured grant timer
|
||||
NR_timer_t configuredGrant_Timer[NR_MAX_HARQ_PROCESSES];
|
||||
///DL Pathloss change value
|
||||
uint16_t PathlossChange;
|
||||
///number of subframe before triggering a periodic PHR
|
||||
@@ -370,10 +372,19 @@ typedef struct {
|
||||
int last_ndi;
|
||||
} NR_UE_HARQ_STATUS_t;
|
||||
|
||||
typedef struct {
|
||||
bool is_first_cg_ocassion;
|
||||
nr_cgtimer_status_t cg_timer;
|
||||
bool is_cg_ocassion_retx; //DCI received for retransmission
|
||||
uint32_t cg_config_index;
|
||||
bool active;
|
||||
} NR_UL_CG_HARQ_INFO_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t R;
|
||||
uint32_t TBS;
|
||||
int last_ndi;
|
||||
NR_UL_CG_HARQ_INFO_t cg_harq_info;
|
||||
} NR_UL_HARQ_INFO_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -482,6 +493,32 @@ typedef struct {
|
||||
A_SEQUENCE_OF(NR_SearchSpace_t) list_SS;
|
||||
} NR_BWP_PDCCH_t;
|
||||
|
||||
typedef struct nr_sps_dci_params {
|
||||
uint8_t dai[2];
|
||||
uint8_t dci_format;
|
||||
int n_CCE;
|
||||
int N_CCE;
|
||||
|
||||
/* DL DCI */
|
||||
uint8_t pdsch_to_harq_feedback_timing_indicator;
|
||||
uint8_t pucch_resource_indicator;
|
||||
} nr_cs_dci_params_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t config_index;
|
||||
bool cg_confirmation_apply;
|
||||
nr_cg_indication_status_t cg_act_deact_receive_status;
|
||||
nr_cg_indication_status_t cg_act_deact_valid_status;
|
||||
bool cg_to_retrx; // retransmission of previous CG TO
|
||||
nr_cg_start_info_t allocation_info;
|
||||
nr_configured_grant_state_t initial_ul_config_status;
|
||||
fapi_nr_ul_config_request_pdu_t *inital_ul_config;
|
||||
dci_pdu_rel15_t *initial_dci_pdu;
|
||||
fapi_nr_dci_indication_pdu_t *initial_dci_indication;
|
||||
nr_configured_grant_state_t cg_status;
|
||||
uint64_t cg_occasion_counter; // this counts the TO occasions(PUSCH durations) without retransmissions once the configured grant is activated
|
||||
} NR_UE_UL_CG_INFO_t;
|
||||
|
||||
/*!\brief Top level UE MAC structure */
|
||||
typedef struct NR_UE_MAC_INST_s {
|
||||
module_id_t ue_id;
|
||||
@@ -579,6 +616,10 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
//SIDELINK MAC PARAMETERS
|
||||
sl_nr_ue_mac_params_t *SL_MAC_PARAMS;
|
||||
|
||||
A_SEQUENCE_OF(NR_UE_UL_CG_INFO_t) configured_sched;
|
||||
long cs_rnti;
|
||||
bool CS_RNTI_present;
|
||||
|
||||
} NR_UE_MAC_INST_t;
|
||||
|
||||
/*@}*/
|
||||
|
||||
@@ -85,6 +85,8 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
|
||||
NR_MIB_t *mibP,
|
||||
int sched_sib1);
|
||||
|
||||
void setup_CGtimers(NR_UE_MAC_INST_t *mac, NR_UE_UL_BWP_t *bwp);
|
||||
|
||||
void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
int cc_idP,
|
||||
NR_SI_SchedulingInfo_t *si_SchedulingInfo,
|
||||
@@ -370,7 +372,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
RAR_grant_t *rar_grant,
|
||||
uint16_t rnti,
|
||||
int ss_type,
|
||||
const nr_dci_format_t dci_format);
|
||||
const nr_dci_format_t dci_format,
|
||||
NR_UL_CG_HARQ_INFO_t *cg_harq_info);
|
||||
|
||||
NR_UE_UL_CG_INFO_t *get_cg_info_default(NR_UE_UL_CG_INFO_t *info);
|
||||
|
||||
int get_cg_occasion_index(NR_UE_MAC_INST_t *mac, int cg_config_index);
|
||||
|
||||
int nr_rrc_mac_config_req_sl_preconfig(module_id_t module_id,
|
||||
NR_SL_PreconfigurationNR_r16_t *sl_preconfiguration,
|
||||
|
||||
@@ -93,6 +93,9 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
||||
int subframes_per_slot = nr_slots_per_frame[mu] / 10;
|
||||
nr_timer_setup(&mac->scheduling_info.retxBSR_Timer, 80 * subframes_per_slot, 1); // 1 slot update rate
|
||||
nr_timer_setup(&mac->scheduling_info.periodicBSR_Timer, 10 * subframes_per_slot, 1); // 1 slot update rate
|
||||
for(int i = 0; i < 16; i++){
|
||||
nr_timer_setup(&mac->scheduling_info.configuredGrant_Timer[i], 10 * subframes_per_slot, 1);
|
||||
}
|
||||
|
||||
mac->scheduling_info.periodicPHR_Timer = NR_PHR_Config__phr_PeriodicTimer_sf10;
|
||||
mac->scheduling_info.prohibitPHR_Timer = NR_PHR_Config__phr_ProhibitTimer_sf10;
|
||||
@@ -132,8 +135,10 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst)
|
||||
mac->ue_id = j;
|
||||
nr_ue_init_mac(mac);
|
||||
nr_ue_mac_default_configs(mac);
|
||||
if (get_softmodem_params()->sa)
|
||||
if (get_softmodem_params()->sa){
|
||||
ue_init_config_request(mac, get_softmodem_params()->numerology);
|
||||
LOG_E(NR_MAC, "Test\n");
|
||||
}
|
||||
}
|
||||
|
||||
int rc = rlc_module_init(0);
|
||||
@@ -178,6 +183,9 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
||||
for (int i = 0; i < NR_MAX_SR_ID; i++)
|
||||
nr_timer_stop(&nr_mac->scheduling_info.sr_info[i].prohibitTimer);
|
||||
|
||||
for (int i = 0; i < NR_MAX_HARQ_PROCESSES; i++)
|
||||
nr_timer_stop(&nr_mac->scheduling_info.configuredGrant_Timer[i]);
|
||||
|
||||
// consider all timeAlignmentTimers as expired and perform the corresponding actions in clause 5.2
|
||||
// TODO
|
||||
|
||||
@@ -235,6 +243,8 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac,
|
||||
asn1cFreeStruc(asn_DEF_NR_TDD_UL_DL_ConfigCommon, mac->tdd_UL_DL_ConfigurationCommon);
|
||||
for (int i = mac->lc_ordered_list.count; i > 0 ; i--)
|
||||
asn_sequence_del(&mac->lc_ordered_list, i - 1, 1);
|
||||
for (int i = mac->configured_sched.count; i > 0 ; i--)
|
||||
asn_sequence_del(&mac->configured_sched, i - 1, 1);
|
||||
}
|
||||
|
||||
asn1cFreeStruc(asn_DEF_NR_CrossCarrierSchedulingConfig, sc->crossCarrierSchedulingConfig);
|
||||
|
||||
@@ -269,6 +269,14 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac,
|
||||
case TYPE_P_RNTI_:
|
||||
break;
|
||||
case TYPE_CS_RNTI_:
|
||||
// we use DL BWP dedicated
|
||||
sps = current_DL_BWP->cyclicprefix ? 12 : 14;
|
||||
// for SPS=14 8 MSBs in positions 13 down to 6
|
||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
rel15->cs_rnti = calloc(1, sizeof(*rel15->cs_rnti));
|
||||
rel15->cs_rnti = (uint16_t*)&mac->cs_rnti;
|
||||
rel15->rnti = mac->crnti;
|
||||
rel15->SubcarrierSpacing = current_DL_BWP->scs;
|
||||
break;
|
||||
case TYPE_TC_RNTI_:
|
||||
// we use the initial DL BWP
|
||||
@@ -524,13 +532,21 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
// if RA is ongoing use RA search space
|
||||
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, pdcch_config->ra_SS)) {
|
||||
int rnti_type = mac->ra.ra_state == nrRA_WAIT_RAR ? TYPE_RA_RNTI_ : TYPE_TC_RNTI_;
|
||||
LOG_D(NR_MAC_DCI, "Monitoring DCI for RA in frame %d slot %d\n", frame, slot);
|
||||
config_dci_pdu(mac, dl_config, rnti_type, slot, pdcch_config->ra_SS);
|
||||
}
|
||||
} else if (mac->state == UE_CONNECTED) {
|
||||
for (int i = 0; i < pdcch_config->list_SS.count; i++) {
|
||||
NR_SearchSpace_t *ss = pdcch_config->list_SS.array[i];
|
||||
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ss))
|
||||
config_dci_pdu(mac, dl_config, TYPE_C_RNTI_, slot, ss);
|
||||
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ss)) {
|
||||
LOG_D(NR_MAC, "(%d.%d)Configuring DCI with C-RNTI %x\n", frame, slot, mac->crnti);
|
||||
config_dci_pdu(mac, dl_config, TYPE_C_RNTI_, slot, ss);
|
||||
|
||||
if (mac->CS_RNTI_present) {
|
||||
LOG_D(NR_MAC, "(%d.%d)Configuring DCI for CG with CS-RNTI %x\n", frame, slot, (uint16_t)mac->cs_rnti);
|
||||
config_dci_pdu(mac, dl_config, TYPE_CS_RNTI_, slot, ss);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pdcch_config->list_SS.count == 0 && pdcch_config->ra_SS) {
|
||||
// If the UE has not been provided a Type3-PDCCH CSS set or a USS set and
|
||||
|
||||
@@ -171,6 +171,14 @@ static nr_dci_format_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
const uint8_t *dci_pdu,
|
||||
const int slot);
|
||||
|
||||
static void nr_validate_configured_scheduling_indication(dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
fapi_nr_dci_indication_pdu_t *dci,
|
||||
NR_UE_UL_CG_INFO_t *cg_info,
|
||||
int frame,
|
||||
int slot,
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd,
|
||||
frame_type_t frame_type);
|
||||
|
||||
int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti)
|
||||
{
|
||||
const RA_config_t *ra = &mac->ra;
|
||||
@@ -182,6 +190,8 @@ int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti)
|
||||
rnti_type = TYPE_TC_RNTI_;
|
||||
} else if (rnti == mac->crnti) {
|
||||
rnti_type = TYPE_C_RNTI_;
|
||||
} else if(mac->CS_RNTI_present && rnti == mac->cs_rnti) {
|
||||
rnti_type = TYPE_CS_RNTI_;
|
||||
} else if (rnti == 0xFFFE) {
|
||||
rnti_type = TYPE_P_RNTI_;
|
||||
} else if (rnti == 0xFFFF) {
|
||||
@@ -428,8 +438,24 @@ static int nr_ue_process_dci_ul_00(NR_UE_MAC_INST_t *mac,
|
||||
fapi_nr_ul_config_request_pdu_t *pdu = lockGet_ul_config(mac, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
|
||||
if (!pdu)
|
||||
return -1;
|
||||
|
||||
NR_UL_CG_HARQ_INFO_t *cg_harq_info = NULL;
|
||||
if(get_rnti_type(mac, dci_ind->rnti) == TYPE_CS_RNTI_ && dci->ndi == 0){
|
||||
cg_harq_info = calloc(1, sizeof(*cg_harq_info));
|
||||
uint8_t cg_config_index = dci->harq_pid;
|
||||
if(mac->configured_sched.count > 0 &&
|
||||
mac->configured_sched.array[dci->harq_pid]->cg_act_deact_receive_status.status_cg_activation == RECEIVED &&
|
||||
mac->configured_sched.array[dci->harq_pid]->cg_act_deact_valid_status.status_cg_activation == VALID &&
|
||||
mac->configured_sched.array[dci->harq_pid]->initial_ul_config_status == NOT_STORED)
|
||||
{
|
||||
NR_ConfiguredGrantConfig_t *cg_resource = mac->current_UL_BWP ? (mac->current_UL_BWP->configuredGrantConfig ? mac->current_UL_BWP->configuredGrantConfig : mac->current_UL_BWP->configuredGrantConfigList->list.array[dci->harq_pid]) : NULL;
|
||||
int harq_pid = get_cg_harq_processid(frame_tx, slot_tx, tda_info.startSymbolIndex, mac->current_UL_BWP, cg_resource);
|
||||
dci->harq_pid = harq_pid;
|
||||
}
|
||||
cg_harq_info->cg_config_index = cg_config_index;
|
||||
}
|
||||
|
||||
int ret = nr_config_pusch_pdu(mac, &tda_info, &pdu->pusch_config_pdu, dci, NULL, dci_ind->rnti, dci_ind->ss_type, NR_UL_DCI_FORMAT_0_0);
|
||||
int ret = nr_config_pusch_pdu(mac, &tda_info, &pdu->pusch_config_pdu, dci, NULL, dci_ind->rnti, dci_ind->ss_type, NR_UL_DCI_FORMAT_0_0, cg_harq_info);
|
||||
if (ret != 0)
|
||||
remove_ul_config_last_item(pdu);
|
||||
release_ul_config(pdu, false);
|
||||
@@ -501,7 +527,24 @@ static int nr_ue_process_dci_ul_01(NR_UE_MAC_INST_t *mac,
|
||||
fapi_nr_ul_config_request_pdu_t *pdu = lockGet_ul_config(mac, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
|
||||
if (!pdu)
|
||||
return -1;
|
||||
int ret = nr_config_pusch_pdu(mac, &tda_info, &pdu->pusch_config_pdu, dci, NULL, dci_ind->rnti, dci_ind->ss_type, NR_UL_DCI_FORMAT_0_1);
|
||||
|
||||
NR_UL_CG_HARQ_INFO_t *cg_harq_info = NULL;
|
||||
if(get_rnti_type(mac, dci_ind->rnti) == TYPE_CS_RNTI_ && dci->ndi == 0){
|
||||
cg_harq_info = calloc(1, sizeof(*cg_harq_info));
|
||||
uint8_t cg_config_index = dci->harq_pid;
|
||||
if(mac->configured_sched.count > 0 &&
|
||||
mac->configured_sched.array[dci->harq_pid]->cg_act_deact_receive_status.status_cg_activation == RECEIVED &&
|
||||
mac->configured_sched.array[dci->harq_pid]->cg_act_deact_valid_status.status_cg_activation == VALID &&
|
||||
mac->configured_sched.array[dci->harq_pid]->initial_ul_config_status == NOT_STORED)
|
||||
{
|
||||
NR_ConfiguredGrantConfig_t *cg_resource = mac->current_UL_BWP ? (mac->current_UL_BWP->configuredGrantConfig ? mac->current_UL_BWP->configuredGrantConfig : mac->current_UL_BWP->configuredGrantConfigList->list.array[dci->harq_pid]) : NULL;
|
||||
int harq_pid = get_cg_harq_processid(frame_tx, slot_tx, tda_info.startSymbolIndex, mac->current_UL_BWP, cg_resource);
|
||||
dci->harq_pid = harq_pid;
|
||||
}
|
||||
cg_harq_info->cg_config_index = cg_config_index;
|
||||
}
|
||||
|
||||
int ret = nr_config_pusch_pdu(mac, &tda_info, &pdu->pusch_config_pdu, dci, NULL, dci_ind->rnti, dci_ind->ss_type, NR_UL_DCI_FORMAT_0_1, cg_harq_info);
|
||||
if (ret != 0)
|
||||
remove_ul_config_last_item(pdu);
|
||||
release_ul_config(pdu, false);
|
||||
@@ -1263,9 +1306,12 @@ static int8_t nr_ue_process_dci(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
nr_dci_format_t nr_ue_process_dci_indication_pdu(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci)
|
||||
{
|
||||
LOG_D(NR_MAC,
|
||||
"Received dci indication (rnti %x, dci format %d, n_CCE %d, payloadSize %d, payload %llx)\n",
|
||||
{
|
||||
int rnti_type = get_rnti_type(mac, dci->rnti);
|
||||
bool is_configured_scheduling = rnti_type == TYPE_CS_RNTI_ ? true : false;
|
||||
LOG_E(NR_MAC,
|
||||
"Received dci indication for %s scheduling(rnti %x, dci format %d, n_CCE %d, payloadSize %d, payload %llx)\n",
|
||||
is_configured_scheduling ? "configured" : "dynamic",
|
||||
dci->rnti,
|
||||
dci->dci_format,
|
||||
dci->n_CCE,
|
||||
@@ -1276,6 +1322,30 @@ nr_dci_format_t nr_ue_process_dci_indication_pdu(NR_UE_MAC_INST_t *mac, frame_t
|
||||
if (format == NR_DCI_NONE)
|
||||
return NR_DCI_NONE;
|
||||
dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][format];
|
||||
|
||||
/*
|
||||
If validation is achieved for configured scheduling, the UE considers the information in the DCI format
|
||||
as a valid activation or valid release of DL SPS or configured UL grant Type 2. This is valid only for new transmissions
|
||||
because for retransmissions a valid DCI information is sent
|
||||
If validation is not achieved, the UE discards all the information in the DCI format.
|
||||
*/
|
||||
if(rnti_type == TYPE_CS_RNTI_ && def_dci_pdu_rel15->ndi == 0){
|
||||
nr_validate_configured_scheduling_indication(def_dci_pdu_rel15,
|
||||
dci,
|
||||
mac->configured_sched.array[def_dci_pdu_rel15->harq_pid],
|
||||
frame,
|
||||
slot,
|
||||
mac->tdd_UL_DL_ConfigurationCommon,
|
||||
mac->frame_type
|
||||
);
|
||||
}
|
||||
else if (rnti_type == TYPE_CS_RNTI_ && def_dci_pdu_rel15->ndi == 1) {
|
||||
NR_UL_HARQ_INFO_t *harq = &mac->ul_harq_info[def_dci_pdu_rel15->harq_pid];
|
||||
NR_UL_CG_HARQ_INFO_t *cg_harq_info = &harq->cg_harq_info;
|
||||
mac->configured_sched.array[cg_harq_info->cg_config_index]->cg_to_retrx = true;
|
||||
}
|
||||
|
||||
|
||||
int ret = nr_ue_process_dci(mac, frame, slot, def_dci_pdu_rel15, dci, format);
|
||||
if (ret < 0)
|
||||
return NR_DCI_NONE;
|
||||
@@ -3004,7 +3074,34 @@ static void extract_10_c_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci
|
||||
|
||||
static void extract_00_c_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci_pdu, int pos)
|
||||
{
|
||||
LOG_D(NR_MAC_DCI, "Received dci 0_0 C rnti\n");
|
||||
LOG_E(NR_MAC_DCI, "Received dci 0_0 CS rnti\n");
|
||||
|
||||
// Frequency domain assignment
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->frequency_domain_assignment.val, dci_pdu_rel15->frequency_domain_assignment.nbits);
|
||||
// Time domain assignment 4bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->time_domain_assignment.val, 4);
|
||||
// Frequency hopping flag E1 bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->frequency_hopping_flag.val, 1);
|
||||
// MCS 5 bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->mcs, 5);
|
||||
// New data indicator 1bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->ndi, 1);
|
||||
// Redundancy version 2bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->rv, 2);
|
||||
// HARQ process number 4bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->harq_pid, 4);
|
||||
// TPC command for scheduled PUSCH E2 bits
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->tpc, 2);
|
||||
// UL/SUL indicator E1 bit
|
||||
/* commented for now (RK): need to get this from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
dci_pdu->= ((uint64_t)readBits(dci_pdu,>>(dci_size-pos)ul_sul_indicator&1)<<(dci_size-pos++);
|
||||
*/
|
||||
}
|
||||
|
||||
static void extract_00_cs_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci_pdu, int pos)
|
||||
{
|
||||
LOG_D(NR_MAC_DCI, "Received dci 0_0 CS rnti\n");
|
||||
|
||||
// Frequency domain assignment
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->frequency_domain_assignment.val, dci_pdu_rel15->frequency_domain_assignment.nbits);
|
||||
@@ -3197,6 +3294,64 @@ static void extract_01_c_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci
|
||||
*/
|
||||
}
|
||||
|
||||
static void extract_01_cs_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci_pdu, int pos, const int N_RB)
|
||||
{
|
||||
LOG_E(NR_MAC_DCI, "Received dci 0_1 CS rnti\n");
|
||||
|
||||
// Carrier indicator
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->carrier_indicator.val, dci_pdu_rel15->carrier_indicator.nbits);
|
||||
// UL/SUL Indicator
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->ul_sul_indicator.val, dci_pdu_rel15->ul_sul_indicator.nbits);
|
||||
// BWP Indicator
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->bwp_indicator.val, dci_pdu_rel15->bwp_indicator.nbits);
|
||||
// Freq domain assignment max 16 bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->frequency_domain_assignment.val, (int)ceil(log2((N_RB * (N_RB + 1)) >> 1)));
|
||||
// Time domain assignment
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->time_domain_assignment.val, dci_pdu_rel15->time_domain_assignment.nbits);
|
||||
// Not supported yet - skip for now
|
||||
// Frequency hopping flag – 1 bit
|
||||
// EXTRACT_DCI_ITEM(dci_pdu_rel15->frequency_hopping_flag.val, 1);
|
||||
// MCS 5 bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->mcs, 5);
|
||||
// New data indicator 1bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->ndi, 1);
|
||||
// Redundancy version 2bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->rv, 2);
|
||||
// HARQ process number 4bit
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->harq_pid, 4);
|
||||
// 1st Downlink assignment index
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->dai[0].val, dci_pdu_rel15->dai[0].nbits);
|
||||
// 2nd Downlink assignment index
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->dai[1].val, dci_pdu_rel15->dai[1].nbits);
|
||||
// TPC command for scheduled PUSCH – 2 bits
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->tpc, 2);
|
||||
// SRS resource indicator
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->srs_resource_indicator.val, dci_pdu_rel15->srs_resource_indicator.nbits);
|
||||
// Precoding info and n. of layers
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->precoding_information.val, dci_pdu_rel15->precoding_information.nbits);
|
||||
// Antenna ports
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->antenna_ports.val, dci_pdu_rel15->antenna_ports.nbits);
|
||||
// SRS request
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->srs_request.val, dci_pdu_rel15->srs_request.nbits);
|
||||
// CSI request
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->csi_request.val, dci_pdu_rel15->csi_request.nbits);
|
||||
// CBG transmission information
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->cbgti.val, dci_pdu_rel15->cbgti.nbits);
|
||||
// PTRS DMRS association
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->ptrs_dmrs_association.val, dci_pdu_rel15->ptrs_dmrs_association.nbits);
|
||||
// Beta offset indicator
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->beta_offset_indicator.val, dci_pdu_rel15->beta_offset_indicator.nbits);
|
||||
// DMRS sequence initialization
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->dmrs_sequence_initialization.val, dci_pdu_rel15->dmrs_sequence_initialization.nbits);
|
||||
// UL-SCH indicator
|
||||
EXTRACT_DCI_ITEM(dci_pdu_rel15->ulsch_indicator, 1);
|
||||
// UL/SUL indicator – 1 bit
|
||||
/* commented for now (RK): need to get this from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
dci_pdu->= ((uint64_t)*dci_pdu>>(dci_size-pos)ul_sul_indicator&1)<<(dci_size-pos++);
|
||||
*/
|
||||
}
|
||||
|
||||
static int get_nrb_for_dci(NR_UE_MAC_INST_t *mac, nr_dci_format_t dci_format, int ss_type)
|
||||
{
|
||||
NR_UE_DL_BWP_t *current_DL_BWP = mac->current_DL_BWP;
|
||||
@@ -3252,6 +3407,7 @@ static nr_dci_format_t nr_extract_dci_00_10(NR_UE_MAC_INST_t *mac,
|
||||
extract_10_si_rnti(dci_pdu_rel15, dci_pdu, pos, n_RB);
|
||||
break;
|
||||
case TYPE_C_RNTI_ :
|
||||
case TYPE_CS_RNTI_:
|
||||
// Identifier for DCI formats
|
||||
EXTRACT_DCI_ITEM(format_indicator, 1);
|
||||
if (format_indicator == 1) {
|
||||
@@ -3265,7 +3421,12 @@ static nr_dci_format_t nr_extract_dci_00_10(NR_UE_MAC_INST_t *mac,
|
||||
else {
|
||||
format = NR_UL_DCI_FORMAT_0_0;
|
||||
dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][format];
|
||||
extract_00_c_rnti(dci_pdu_rel15, dci_pdu, pos);
|
||||
if(rnti_type == TYPE_CS_RNTI_){
|
||||
extract_00_cs_rnti(dci_pdu_rel15, dci_pdu, pos);
|
||||
}
|
||||
else{
|
||||
extract_00_c_rnti(dci_pdu_rel15, dci_pdu, pos);
|
||||
}
|
||||
}
|
||||
dci_pdu_rel15->format_indicator = format_indicator;
|
||||
break;
|
||||
@@ -3293,6 +3454,63 @@ static nr_dci_format_t nr_extract_dci_00_10(NR_UE_MAC_INST_t *mac,
|
||||
return format;
|
||||
}
|
||||
|
||||
static void nr_validate_configured_scheduling_indication(dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
fapi_nr_dci_indication_pdu_t *dci,
|
||||
NR_UE_UL_CG_INFO_t *cg_info,
|
||||
int frame,
|
||||
int slot,
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd,
|
||||
frame_type_t frame_type)
|
||||
{
|
||||
uint8_t ndi = dci_pdu_rel15->ndi;
|
||||
uint8_t harq_pid = dci_pdu_rel15->harq_pid;
|
||||
uint8_t rv = dci_pdu_rel15->rv;
|
||||
uint32_t fda = dci_pdu_rel15->frequency_domain_assignment.val;
|
||||
uint8_t mcs = dci_pdu_rel15->mcs;
|
||||
|
||||
if (cg_info->cg_act_deact_receive_status.status_cg_activation == NOT_RECEIVED) {
|
||||
cg_info->cg_act_deact_receive_status.status_cg_activation = RECEIVED;
|
||||
if (rv == 0 && ndi == 0 && harq_pid <= NR_MAX_CG_BWP && harq_pid >= 0) {
|
||||
LOG_E(NR_MAC, "Received valid DCI indication for CG activation\n");
|
||||
if(cg_info->cg_status == CG_ACTIVE){
|
||||
LOG_E(NR_MAC, "Reinitialize the CG activation by updating a new configuration\n");
|
||||
memset(cg_info, 0, sizeof(*cg_info));
|
||||
get_cg_info_default(cg_info);
|
||||
}
|
||||
cg_info->inital_ul_config = calloc(1, sizeof(*cg_info->inital_ul_config));
|
||||
cg_info->initial_dci_indication = calloc(1, sizeof(*cg_info->initial_dci_indication));
|
||||
cg_info->initial_dci_pdu = calloc(1, sizeof(*cg_info->initial_dci_pdu));
|
||||
cg_info->cg_act_deact_valid_status.status_cg_activation = VALID;
|
||||
cg_info->cg_status = CG_ACTIVE;
|
||||
cg_info->allocation_info.frame = frame;
|
||||
cg_info->allocation_info.slot = slot;
|
||||
cg_info->cg_confirmation_apply = true;
|
||||
cg_info->config_index = harq_pid;
|
||||
memcpy(cg_info->initial_dci_indication, dci, sizeof(*cg_info->initial_dci_indication));
|
||||
memcpy(cg_info->initial_dci_pdu, dci_pdu_rel15, sizeof(*cg_info->initial_dci_pdu));
|
||||
}
|
||||
else {
|
||||
LOG_E(NR_MAC, "Received non-valid DCI indication for CG activation\n");
|
||||
cg_info->cg_act_deact_valid_status.status_cg_activation = NOT_VALID;
|
||||
memset(cg_info->inital_ul_config, 0, sizeof(*cg_info->inital_ul_config));
|
||||
}
|
||||
} else if (cg_info->cg_act_deact_receive_status.status_cg_deactivation == NOT_RECEIVED) {
|
||||
cg_info->cg_act_deact_receive_status.status_cg_deactivation = RECEIVED;
|
||||
if (rv == 0 && ndi == 0 && mcs == 31 && fda == (1 << dci_pdu_rel15->frequency_domain_assignment.nbits) - 1
|
||||
&& harq_pid <= NR_MAX_CG_BWP && harq_pid >= 0) {
|
||||
LOG_E(NR_MAC, "Received DCI indication for CG deactivation\n");
|
||||
cg_info->cg_act_deact_valid_status.status_cg_deactivation = VALID;
|
||||
cg_info->cg_status = CG_INACTIVE;
|
||||
memset(cg_info->inital_ul_config, 0, sizeof(*cg_info->inital_ul_config));
|
||||
memset(cg_info->initial_dci_indication, 0, sizeof(*cg_info->initial_dci_indication));
|
||||
memset(cg_info->initial_dci_pdu, 0, sizeof(*cg_info->initial_dci_pdu));
|
||||
} else {
|
||||
LOG_I(NR_MAC, "Received non-valid DCI indication for CG deactivation\n");
|
||||
cg_info->cg_act_deact_valid_status.status_cg_deactivation = NOT_VALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static nr_dci_format_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
const nfapi_nr_dci_formats_e dci_format,
|
||||
const uint8_t dci_size,
|
||||
@@ -3311,7 +3529,7 @@ static nr_dci_format_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
format = nr_extract_dci_00_10(mac, pos, rnti_type, dci_pdu, slot, ss_type);
|
||||
break;
|
||||
case NFAPI_NR_FORMAT_0_1_AND_1_1 :
|
||||
if (rnti_type == TYPE_C_RNTI_) {
|
||||
if (rnti_type == TYPE_C_RNTI_ || rnti_type == TYPE_CS_RNTI_) {
|
||||
// Identifier for DCI formats
|
||||
int format_indicator = 0;
|
||||
EXTRACT_DCI_ITEM(format_indicator, 1);
|
||||
@@ -3328,7 +3546,12 @@ static nr_dci_format_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
int n_RB = get_nrb_for_dci(mac, format, ss_type);
|
||||
if (n_RB == 0)
|
||||
return NR_DCI_NONE;
|
||||
extract_01_c_rnti(def_dci_pdu_rel15, dci_pdu, pos, n_RB);
|
||||
if(rnti_type == TYPE_C_RNTI_){
|
||||
extract_01_c_rnti(def_dci_pdu_rel15, dci_pdu, pos, n_RB);
|
||||
}
|
||||
else{
|
||||
extract_01_cs_rnti(def_dci_pdu_rel15, dci_pdu, pos, n_RB);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3607,6 +3830,21 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
int mac_ce_len = 0;
|
||||
uint8_t mac_ce_size = 0;
|
||||
uint8_t *pdu = mac_ce;
|
||||
|
||||
if(mac->configured_sched.count > 0 && mac->configured_sched.array[0]->cg_confirmation_apply) {
|
||||
// MAC CE fixed subheader
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->R = 0;
|
||||
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->LCID = UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION;
|
||||
mac_ce++;
|
||||
//mac_ce_len += sizeof(NR_MAC_SUBHEADER_FIXED);
|
||||
|
||||
mac->configured_sched.array[0]->cg_confirmation_apply = false;
|
||||
//(MAC CE size 0)
|
||||
|
||||
LOG_E(NR_MAC, "[UE] Generating ULSCH PDU : CG Confirmation pdu %p mac_ce %p b\n",
|
||||
pdu, mac_ce);
|
||||
}
|
||||
|
||||
if (power_headroom) {
|
||||
|
||||
// MAC CE fixed subheader
|
||||
@@ -3678,7 +3916,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
mac_ce_size = sizeof(NR_BSR_SHORT);
|
||||
mac_ce += mac_ce_size;
|
||||
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
|
||||
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : short_bsr Buffer_size %d LcgID %d pdu %p mac_ce %p\n",
|
||||
LOG_I(NR_MAC, "[UE] Generating ULSCH PDU : short_bsr Buffer_size %d LcgID %d pdu %p mac_ce %p\n",
|
||||
short_bsr->Buffer_size, short_bsr->LcgID, pdu, mac_ce);
|
||||
} else if (long_bsr) {
|
||||
|
||||
@@ -3743,12 +3981,15 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
*Buffer_size_ptr++ = long_bsr->Buffer_size7;
|
||||
}
|
||||
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_subheader_ptr)->L = mac_ce_size = (uint8_t*) Buffer_size_ptr - (uint8_t*) mac_ce;
|
||||
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : long_bsr size %d Lcgbit 0x%02x Buffer_size %d %d %d %d %d %d %d %d\n", mac_ce_size, *((uint8_t*) mac_ce),
|
||||
LOG_I(NR_MAC, "[UE] Generating ULSCH PDU : long_bsr size %d Lcgbit 0x%02x Buffer_size %d %d %d %d %d %d %d %d\n", mac_ce_size, *((uint8_t*) mac_ce),
|
||||
((NR_BSR_LONG *) mac_ce)->Buffer_size0, ((NR_BSR_LONG *) mac_ce)->Buffer_size1, ((NR_BSR_LONG *) mac_ce)->Buffer_size2, ((NR_BSR_LONG *) mac_ce)->Buffer_size3,
|
||||
((NR_BSR_LONG *) mac_ce)->Buffer_size4, ((NR_BSR_LONG *) mac_ce)->Buffer_size5, ((NR_BSR_LONG *) mac_ce)->Buffer_size6, ((NR_BSR_LONG *) mac_ce)->Buffer_size7);
|
||||
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||
}
|
||||
|
||||
|
||||
if (mac->configured_sched.count > 0) {
|
||||
LOG_D(NR_MAC, "Just for test\n");
|
||||
}
|
||||
return mac_ce_len;
|
||||
}
|
||||
|
||||
@@ -4005,7 +4246,8 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
|
||||
&rar_grant,
|
||||
rnti,
|
||||
NR_SearchSpace__searchSpaceType_PR_common,
|
||||
NR_DCI_NONE);
|
||||
NR_DCI_NONE,
|
||||
NULL);
|
||||
if (ret != 0)
|
||||
remove_ul_config_last_item(pdu);
|
||||
release_ul_config(pdu, false);
|
||||
|
||||
@@ -98,7 +98,7 @@ fapi_nr_ul_config_request_pdu_t *lockGet_ul_config(NR_UE_MAC_INST_t *mac, frame_
|
||||
AssertFatal(!pdu->lock, "no lock in fapi_nr_ul_config_request_pdu_t, aborting");
|
||||
pdu->lock = &ul_config->mutex_ul_config;
|
||||
pdu->privateNBpdus = &ul_config->number_pdus;
|
||||
LOG_D(NR_MAC, "Added ul pdu for %d.%d, type %d\n", frame_tx, slot_tx, pdu_type);
|
||||
LOG_E(NR_MAC, "Added ul pdu for %d.%d, type %d\n", frame_tx, slot_tx, pdu_type);
|
||||
return pdu;
|
||||
}
|
||||
|
||||
@@ -172,6 +172,16 @@ void update_mac_timers(NR_UE_MAC_INST_t *mac)
|
||||
AssertFatal(!nr_timer_tick(&mac->scheduling_info.lc_sched_info[i].Bj_timer),
|
||||
"Bj timer for LCID %d expired! That should never happen\n",
|
||||
i);
|
||||
|
||||
for(int k = 0; k < NR_MAX_HARQ_PROCESSES; k++){
|
||||
bool retxtimer_expired = nr_timer_tick(&mac->scheduling_info.configuredGrant_Timer[k]);
|
||||
|
||||
if(retxtimer_expired) {
|
||||
NR_UL_HARQ_INFO_t *harq = &mac->ul_harq_info[k];
|
||||
memset(harq, 0, sizeof(*harq));
|
||||
harq->last_ndi = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void remove_ul_config_last_item(fapi_nr_ul_config_request_pdu_t *pdu)
|
||||
@@ -501,6 +511,21 @@ void ul_ports_config(NR_UE_MAC_INST_t *mac, int *n_front_load_symb, nfapi_nr_ue_
|
||||
LOG_D(NR_MAC,"num_dmrs_cdm_grps_no_data %d, dmrs_ports %d\n",pusch_config_pdu->num_dmrs_cdm_grps_no_data,pusch_config_pdu->dmrs_ports);
|
||||
}
|
||||
|
||||
int get_cg_occasion_index(NR_UE_MAC_INST_t *mac, int cg_config_index) {
|
||||
//NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP;
|
||||
int count = mac->configured_sched.count;
|
||||
int occasion_index = -1;
|
||||
|
||||
for(int i = 0; i < count; i++){
|
||||
NR_UE_UL_CG_INFO_t *ue_cg_info = mac->configured_sched.array[i];
|
||||
if(ue_cg_info->cg_status && ue_cg_info->config_index == cg_config_index){
|
||||
occasion_index = ue_cg_info->cg_occasion_counter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return occasion_index;
|
||||
}
|
||||
|
||||
// Configuration of Msg3 PDU according to clauses:
|
||||
// - 8.3 of 3GPP TS 38.213 version 16.3.0 Release 16
|
||||
// - 6.1.2.2 of TS 38.214
|
||||
@@ -516,7 +541,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
RAR_grant_t *rar_grant,
|
||||
uint16_t rnti,
|
||||
int ss_type,
|
||||
const nr_dci_format_t dci_format)
|
||||
const nr_dci_format_t dci_format,
|
||||
NR_UL_CG_HARQ_INFO_t *cg_harq_info)
|
||||
{
|
||||
uint16_t l_prime_mask = 0;
|
||||
int N_PRB_oh = 0;
|
||||
@@ -666,7 +692,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->data_scrambling_id = mac->physCellId;
|
||||
if (pusch_Config
|
||||
&& pusch_Config->dataScramblingIdentityPUSCH
|
||||
&& rnti_type == TYPE_C_RNTI_
|
||||
&& (rnti_type == TYPE_C_RNTI_ || rnti_type == TYPE_CS_RNTI_)
|
||||
&& !(dci_format == NR_UL_DCI_FORMAT_0_0 && ss_type == NR_SearchSpace__searchSpaceType_PR_common))
|
||||
pusch_config_pdu->data_scrambling_id = *pusch_Config->dataScramblingIdentityPUSCH;
|
||||
|
||||
@@ -741,16 +767,55 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
rnti_type,
|
||||
ss_type,
|
||||
false);
|
||||
|
||||
|
||||
/* HARQ ID Selection */
|
||||
/* NDI */
|
||||
NR_UL_HARQ_INFO_t *harq = &mac->ul_harq_info[dci->harq_pid];
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = false;
|
||||
if (dci->ndi != harq->last_ndi) {
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = true;
|
||||
// if new data reset harq structure
|
||||
memset(harq, 0, sizeof(*harq));
|
||||
|
||||
if(rnti_type == TYPE_CS_RNTI_){
|
||||
NR_UL_CG_HARQ_INFO_t *cg_hinfo = &harq->cg_harq_info;
|
||||
LOG_E(NR_MAC, "The harq process id for CG Occasion is %d\n", dci->harq_pid);
|
||||
if(dci->ndi == 0){ // new transmissions
|
||||
int cg_to_index = get_cg_occasion_index(mac, cg_harq_info->cg_config_index);
|
||||
if(cg_to_index == -1)
|
||||
AssertFatal(NR_MAC, "No Configured Grant TO in the current time\n");
|
||||
|
||||
int prev_ndi = harq->last_ndi;
|
||||
memset(harq, 0, sizeof(*harq));
|
||||
if(cg_to_index == 0) { // first PUSCH occasion after receiving activation signal
|
||||
if(prev_ndi != -1) // HARQ PROCESS in use
|
||||
cg_hinfo->cg_timer = NR_CG_TIMER_RESTART;
|
||||
cg_hinfo->is_first_cg_ocassion = true;
|
||||
}
|
||||
else { // recurring PUSCH transmissons as per CG periodicity
|
||||
if(prev_ndi != -1) // HARQ process in use, so stop the current pusch occasions for tx
|
||||
return -1;
|
||||
cg_hinfo->is_first_cg_ocassion = false;
|
||||
cg_hinfo->cg_timer = NR_CG_TIMER_START;
|
||||
}
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = true;
|
||||
|
||||
cg_hinfo->cg_config_index = cg_harq_info->cg_config_index;
|
||||
cg_hinfo->active = true;
|
||||
harq->last_ndi = dci->ndi;
|
||||
}
|
||||
else{ //retransmissions
|
||||
cg_hinfo->cg_timer = NR_CG_TIMER_RESTART;
|
||||
cg_hinfo->is_first_cg_ocassion = false;
|
||||
cg_hinfo->is_cg_ocassion_retx = true;
|
||||
harq->last_ndi = dci->ndi;
|
||||
cg_hinfo->active = true;
|
||||
}
|
||||
} else {
|
||||
if (dci->ndi != harq->last_ndi) {
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = true;
|
||||
// if new data reset harq structure
|
||||
memset(harq, 0, sizeof(*harq));
|
||||
}
|
||||
harq->last_ndi = dci->ndi;
|
||||
}
|
||||
harq->last_ndi = dci->ndi;
|
||||
|
||||
/* RV */
|
||||
pusch_config_pdu->pusch_data.rv_index = dci->rv;
|
||||
/* HARQ_PROCESS_NUMBER */
|
||||
@@ -885,7 +950,25 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
LOG_E(MAC, "Invalid TBS = 0. Probably caused by missed detection of DCI\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Store the PUSCH resource allocations that is received by DCI activation at start and
|
||||
use the same resources at periodic CG TO as per the periodicity
|
||||
TODO: check if there are any value selection as per rnti type
|
||||
*/
|
||||
if(rnti_type == TYPE_CS_RNTI_ &&
|
||||
mac->configured_sched.count > 0 &&
|
||||
mac->configured_sched.array[cg_harq_info->cg_config_index]->cg_act_deact_receive_status.status_cg_activation == RECEIVED &&
|
||||
mac->configured_sched.array[cg_harq_info->cg_config_index]->cg_act_deact_valid_status.status_cg_activation == VALID &&
|
||||
mac->configured_sched.array[cg_harq_info->cg_config_index]->initial_ul_config_status == NOT_STORED
|
||||
) {
|
||||
NR_UE_UL_CG_INFO_t* cg_sched = mac->configured_sched.array[cg_harq_info->cg_config_index];
|
||||
memcpy(&cg_sched->inital_ul_config->pusch_config_pdu,
|
||||
pusch_config_pdu,
|
||||
sizeof(*pusch_config_pdu));
|
||||
cg_sched->allocation_info.tda_info = tda_info;
|
||||
mac->configured_sched.array[cg_harq_info->cg_config_index]->initial_ul_config_status = STORED;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1082,6 +1165,141 @@ static bool nr_ue_periodic_srs_scheduling(NR_UE_MAC_INST_t *mac, frame_t frame,
|
||||
return srs_scheduled;
|
||||
}
|
||||
|
||||
int get_configured_grant_config_index(NR_UE_MAC_INST_t *mac,
|
||||
const NR_UE_UL_BWP_t *ul_bwp,
|
||||
NR_UE_UL_CG_INFO_t *ue_cg_info,
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd,
|
||||
frame_type_t frame_type,
|
||||
int frame,
|
||||
int slot,
|
||||
int symbol,
|
||||
bool is_dci_received)
|
||||
{
|
||||
const int mu = ul_bwp->scs;
|
||||
const uint16_t num_slots_frame = nr_slots_per_frame[mu];
|
||||
const bool is_normal_cp = ul_bwp->cyclicprefix ? false : true;
|
||||
//const bool is_ul_slot = is_nr_UL_slot(tdd, slot, frame_type);
|
||||
const uint8_t num_sym_slot = is_normal_cp ? 14 : 12;
|
||||
int index = -1;
|
||||
const NR_ConfiguredGrantConfig_t *cg_config = NULL;
|
||||
int count = 1;
|
||||
|
||||
if(is_dci_received){return index;}
|
||||
|
||||
int current_symbol =
|
||||
(num_slots_frame * frame * num_sym_slot + slot * num_sym_slot + symbol) % (1024 * num_slots_frame * num_sym_slot);
|
||||
|
||||
if (ul_bwp->configuredGrantConfig) {
|
||||
cg_config = ul_bwp->configuredGrantConfig;
|
||||
} else {
|
||||
cg_config = ul_bwp->configuredGrantConfigList->list.array[0];
|
||||
count = ul_bwp->configuredGrantConfigList->list.count;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
NR_UE_UL_CG_INFO_t *ue_cg_info = mac->configured_sched.array[i];
|
||||
nr_cg_start_info_t *cg_start_info = &ue_cg_info->allocation_info;
|
||||
|
||||
if (ue_cg_info->cg_act_deact_receive_status.status_cg_activation == NOT_RECEIVED)
|
||||
continue;
|
||||
|
||||
int16_t period_symbols = nr_get_cg_periodicity(cg_config->periodicity, ul_bwp->scs);
|
||||
AssertFatal(period_symbols > 0, "The period between CG resource allocation must be positive\n");
|
||||
|
||||
int start_sym = (num_slots_frame * num_sym_slot * cg_start_info->frame + cg_start_info->slot * num_sym_slot
|
||||
+ cg_start_info->tda_info->startSymbolIndex)
|
||||
% (1024 * num_slots_frame * num_sym_slot);
|
||||
|
||||
int sym_diff = current_symbol - start_sym < 0 ? current_symbol - start_sym + (1024 * num_slots_frame * num_sym_slot)
|
||||
: current_symbol - start_sym;
|
||||
|
||||
if (sym_diff % period_symbols == 0) {
|
||||
index = ue_cg_info->config_index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
// Periodic configured grant scheduling
|
||||
static bool nr_ue_periodic_cg_scheduling(NR_UE_MAC_INST_t *mac, frame_t frame, slot_t slot)
|
||||
{
|
||||
bool cg_scheduled = false;
|
||||
|
||||
NR_UE_UL_BWP_t *current_UL_BWP = mac->current_UL_BWP;
|
||||
NR_ConfiguredGrantConfig_t *cg_resource = NULL;
|
||||
//bool is_normal_cp = current_UL_BWP->cyclicprefix ? false : true;
|
||||
//uint8_t num_sym_slot = is_normal_cp ? 14 : 12;
|
||||
|
||||
for (int i = 0; i < mac->configured_sched.count; i++) {
|
||||
NR_UE_UL_CG_INFO_t *ue_cg_info = mac->configured_sched.array[i];
|
||||
|
||||
if (ue_cg_info->cg_occasion_counter == 0)
|
||||
continue;
|
||||
|
||||
if (ue_cg_info->cg_to_retrx) {
|
||||
ue_cg_info->cg_to_retrx = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
cg_resource = current_UL_BWP ? (current_UL_BWP->configuredGrantConfig ? current_UL_BWP->configuredGrantConfig : current_UL_BWP->configuredGrantConfigList->list.array[i]) : NULL;
|
||||
AssertFatal(cg_resource != NULL, "Configuration index of CG IE is not received by UE for the activated CG\n");
|
||||
|
||||
/* check if UE should transmit PUSCH in this slot*/
|
||||
int period = nr_get_cg_periodicity(cg_resource->periodicity, current_UL_BWP->scs);
|
||||
AssertFatal(period > 0, "The period between CG resource allocation must be positive\n");
|
||||
|
||||
int cg_start = ue_cg_info->allocation_info.tda_info->startSymbolIndex;
|
||||
|
||||
cg_start = nr_get_CG_alloc(frame,
|
||||
slot,
|
||||
current_UL_BWP,
|
||||
cg_resource,
|
||||
0, // ue_cg_info->allocation_info.tda_info->startSymbolIndex + period,
|
||||
&ue_cg_info->allocation_info,
|
||||
mac->tdd_UL_DL_ConfigurationCommon,
|
||||
mac->frame_type);
|
||||
|
||||
if (cg_start != -1) {
|
||||
fapi_nr_ul_config_request_pdu_t *pdu = lockGet_ul_config(mac, frame, slot, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
|
||||
|
||||
if (!pdu)
|
||||
return cg_scheduled;
|
||||
|
||||
// update the harq id for the cg
|
||||
int harq_pid = get_cg_harq_processid(frame, slot, cg_start, current_UL_BWP, cg_resource);
|
||||
ue_cg_info->initial_dci_pdu->harq_pid = harq_pid;
|
||||
|
||||
/* time domain allocation for CG TO*/
|
||||
NR_tda_info_t *cg_tda_info = calloc(1, sizeof(NR_tda_info_t));
|
||||
memcpy(cg_tda_info, &ue_cg_info->allocation_info.tda_info, sizeof(NR_tda_info_t));
|
||||
cg_tda_info->startSymbolIndex = cg_start;
|
||||
|
||||
NR_UL_CG_HARQ_INFO_t *cg_harq_info = NULL;
|
||||
cg_harq_info->cg_config_index = i;
|
||||
|
||||
int ret = nr_config_pusch_pdu(mac,
|
||||
cg_tda_info,
|
||||
&pdu->pusch_config_pdu,
|
||||
ue_cg_info->initial_dci_pdu,
|
||||
NULL,
|
||||
ue_cg_info->initial_dci_indication->rnti,
|
||||
ue_cg_info->initial_dci_indication->ss_type,
|
||||
ue_cg_info->initial_dci_indication->dci_format ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0,
|
||||
cg_harq_info);
|
||||
if (ret != 0)
|
||||
remove_ul_config_last_item(pdu);
|
||||
else {
|
||||
cg_scheduled = true;
|
||||
ue_cg_info->cg_occasion_counter++;
|
||||
}
|
||||
|
||||
release_ul_config(pdu, false);
|
||||
}
|
||||
}
|
||||
return cg_scheduled;
|
||||
}
|
||||
|
||||
// Performs :
|
||||
// 1. TODO: Call RRC for link status return to PHY
|
||||
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
|
||||
@@ -1283,6 +1501,10 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
|
||||
if(mac->state == UE_CONNECTED)
|
||||
nr_ue_periodic_srs_scheduling(mac, frame_tx, slot_tx);
|
||||
|
||||
/* Periodic Configured grant scheduling with out DCI except for indication in Type2 */
|
||||
if (mac->configured_sched.count > 0)
|
||||
nr_ue_periodic_cg_scheduling(mac, frame_tx, slot_tx);
|
||||
|
||||
// Call BSR procedure as described in Section 5.4.5 in 38.321
|
||||
// Check whether BSR is triggered before scheduling ULSCH
|
||||
if(mac->state == UE_CONNECTED)
|
||||
@@ -1296,7 +1518,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
|
||||
fapi_nr_ul_config_request_pdu_t *ulcfg_pdu = lockGet_ul_iterator(mac, frame_tx, slot_tx);
|
||||
if (!ulcfg_pdu)
|
||||
return;
|
||||
LOG_D(NR_MAC, "number of UL PDUs: %d with UL transmission in sfn [%d.%d]\n", *ulcfg_pdu->privateNBpdus, frame_tx, slot_tx);
|
||||
LOG_E(NR_MAC, "number of UL PDUs: %d with UL transmission in sfn [%d.%d]\n", *ulcfg_pdu->privateNBpdus, frame_tx, slot_tx);
|
||||
|
||||
while (ulcfg_pdu->pdu_type != FAPI_NR_END) {
|
||||
uint8_t *ulsch_input_buffer = ulsch_input_buffer_array[number_of_pdus];
|
||||
@@ -2491,6 +2713,9 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_fra
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint8_t cg_len;
|
||||
uint8_t cg_ce_len;
|
||||
uint8_t cg_header_len;
|
||||
uint8_t bsr_len;
|
||||
uint8_t bsr_ce_len;
|
||||
uint8_t bsr_header_len;
|
||||
@@ -2530,6 +2755,7 @@ static int nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac,
|
||||
// Preparing the MAC CEs sub-PDUs and get the total size
|
||||
mac_ce_p->bsr_header_len = 0;
|
||||
mac_ce_p->phr_header_len = 0; //sizeof(SCH_SUBHEADER_FIXED);
|
||||
mac_ce_p->cg_header_len = 0;
|
||||
int lcg_id = 0;
|
||||
while (lcg_id != NR_INVALID_LCGID) {
|
||||
if (mac->scheduling_info.lcg_sched_info[lcg_id].BSR_bytes) {
|
||||
@@ -2538,6 +2764,17 @@ static int nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac,
|
||||
lcg_id++;
|
||||
}
|
||||
|
||||
/* Update Configured grant confirmation MAC CE if confirmation mac ce is activated */
|
||||
if(mac->configured_sched.count > 0 && mac->configured_sched.array[0]->cg_confirmation_apply) {
|
||||
LOG_E(NR_MAC, "Send MAC CE for confirmation of configured grant from UE\n");
|
||||
mac_ce_p->cg_ce_len = 0; // fixed size of zero bytes
|
||||
if(buflen >= sizeof(NR_MAC_SUBHEADER_FIXED))
|
||||
mac_ce_p->cg_header_len = sizeof(NR_MAC_SUBHEADER_FIXED); // 1 byte
|
||||
mac_ce_p->cg_len = mac_ce_p->cg_ce_len + mac_ce_p->cg_header_len;
|
||||
buflen = buflen - mac_ce_p->cg_len;
|
||||
LOG_E(NR_MAC, "The MAC CG header length is %d and CE length is %d and total length is %d\n", mac_ce_p->cg_header_len, mac_ce_p->cg_ce_len, mac_ce_p->cg_len);
|
||||
}
|
||||
|
||||
// Compute BSR Length if Regular or Periodic BSR is triggered
|
||||
// WARNING: if BSR long is computed, it may be changed to BSR short during or after multiplexing
|
||||
// if there remains less than 1 LCGROUP with data after Tx
|
||||
@@ -2562,7 +2799,7 @@ static int nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
mac_ce_p->bsr_len = mac_ce_p->bsr_ce_len + mac_ce_p->bsr_header_len;
|
||||
return (mac_ce_p->bsr_len + mac_ce_p->phr_len);
|
||||
return (mac_ce_p->cg_len + mac_ce_p->bsr_len + mac_ce_p->phr_len);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2755,6 +2992,21 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
|
||||
sched_info->BSR_reporting_active = NR_BSR_TRIGGER_NONE;
|
||||
sched_info->regularBSR_trigger_lcid = 0;
|
||||
}
|
||||
|
||||
/*Actions for configured grant timers */
|
||||
NR_UL_HARQ_INFO_t *harq = mac->ul_harq_info;
|
||||
for (int i = 0; i < NR_MAX_HARQ_PROCESSES; i++){
|
||||
NR_UL_CG_HARQ_INFO_t *cg_harq = &(harq + i)->cg_harq_info;
|
||||
if(!cg_harq->active)
|
||||
continue;
|
||||
|
||||
if(cg_harq->cg_timer == NR_CG_TIMER_STOP)
|
||||
nr_timer_stop(&sched_info->configuredGrant_Timer[i]);
|
||||
else if(cg_harq->cg_timer == NR_CG_TIMER_RESTART)
|
||||
nr_timer_restart(&sched_info->configuredGrant_Timer[i]);
|
||||
else if(cg_harq->cg_timer == NR_CG_TIMER_START)
|
||||
nr_timer_start(&sched_info->configuredGrant_Timer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t get_count_lcids_same_priority(uint8_t start, uint8_t total_active_lcids, nr_lcordered_info_t *lcid_ordered_array)
|
||||
@@ -3146,10 +3398,10 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
|
||||
LOG_E(NR_MAC, "MAC CE size computed by nr_write_ce_ulsch_pdu is %d while the one assumed before is %d\n", size, mac_ce_p->tot_mac_ce_len);
|
||||
pdu += (unsigned char) mac_ce_p->tot_mac_ce_len;
|
||||
|
||||
#ifdef ENABLE_MAC_PAYLOAD_DEBUG
|
||||
LOG_I(NR_MAC, "In %s: dumping MAC CE with length tot_mac_ce_len %d: \n", __FUNCTION__, mac_ce_p->tot_mac_ce_len);
|
||||
log_dump(NR_MAC, mac_header_control_elements, mac_ce_p->tot_mac_ce_len, LOG_DUMP_CHAR, "\n");
|
||||
#endif
|
||||
//#ifdef ENABLE_MAC_PAYLOAD_DEBUG
|
||||
LOG_I(NR_MAC, "In %s: dumping MAC CE with length tot_mac_ce_len %d: \n", __FUNCTION__, mac_ce_p->tot_mac_ce_len);
|
||||
//log_dump(NR_MAC, mac_header_control_elements, mac_ce_p->tot_mac_ce_len, LOG_DUMP_CHAR, "\n");
|
||||
//#endif
|
||||
}
|
||||
|
||||
buflen_remain = buflen - (mac_ce_p->total_mac_pdu_header_len + mac_ce_p->sdu_length_total);
|
||||
|
||||
@@ -716,7 +716,9 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP,
|
||||
ss,
|
||||
coreset,
|
||||
0, // parameter not needed for DCI 0_0
|
||||
nr_mac->cset0_bwp_size);
|
||||
nr_mac->cset0_bwp_size,
|
||||
NULL,
|
||||
-1);
|
||||
|
||||
// Mark the corresponding RBs as used
|
||||
|
||||
@@ -1450,7 +1452,9 @@ static void nr_generate_Msg2(module_id_t module_idP,
|
||||
ss,
|
||||
coreset,
|
||||
0, // parameter not needed for DCI 1_0
|
||||
nr_mac->cset0_bwp_size);
|
||||
nr_mac->cset0_bwp_size,
|
||||
NULL,
|
||||
-1);
|
||||
|
||||
// DL TX request
|
||||
nfapi_nr_pdu_t *tx_req = &TX_req->pdu_list[TX_req->Number_of_PDUs];
|
||||
@@ -1687,7 +1691,9 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac,
|
||||
ss,
|
||||
coreset,
|
||||
0, // parameter not needed for DCI 1_0
|
||||
nr_mac->cset0_bwp_size);
|
||||
nr_mac->cset0_bwp_size,
|
||||
NULL,
|
||||
-1);
|
||||
|
||||
LOG_D(NR_MAC, "BWPSize: %i\n", pdcch_pdu_rel15->BWPSize);
|
||||
LOG_D(NR_MAC, "BWPStart: %i\n", pdcch_pdu_rel15->BWPStart);
|
||||
|
||||
@@ -523,7 +523,9 @@ static void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
gNB_mac->sched_ctrlCommon->search_space,
|
||||
gNB_mac->sched_ctrlCommon->coreset,
|
||||
0, // parameter not needed for DCI 1_0
|
||||
gNB_mac->cset0_bwp_size);
|
||||
gNB_mac->cset0_bwp_size,
|
||||
NULL,
|
||||
-1);
|
||||
|
||||
LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize);
|
||||
LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart);
|
||||
|
||||
@@ -1229,7 +1229,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
sched_ctrl->search_space,
|
||||
sched_ctrl->coreset,
|
||||
UE->pdsch_HARQ_ACK_Codebook,
|
||||
gNB_mac->cset0_bwp_size);
|
||||
gNB_mac->cset0_bwp_size,
|
||||
NULL,
|
||||
-1);
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
|
||||
|
||||
@@ -1161,6 +1161,44 @@ void set_r_pucch_parms(int rsetindex,
|
||||
*start_symbol_index = default_pucch_firstsymb[rsetindex];
|
||||
}
|
||||
|
||||
static bool nr_prepare_cg_dci(dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
const NR_UE_UL_BWP_t *current_UL_BWP,
|
||||
NR_UE_CG_t *config_sched,
|
||||
int round) {
|
||||
nr_cg_indication_status_t *cg_ind_status = &config_sched->cg_act_deact_transmit_status;
|
||||
NR_ConfiguredGrantConfig_t *cg_config = NULL;
|
||||
uint8_t cg_id = 0;
|
||||
bool cg_status = false;
|
||||
|
||||
cg_config = current_UL_BWP->configuredGrantConfig ? current_UL_BWP->configuredGrantConfig : current_UL_BWP->configuredGrantConfigList->list.array[cg_id];
|
||||
|
||||
if (cg_config) { // cg is configured by RRC
|
||||
cg_status = true;
|
||||
if (cg_ind_status->status_cg_activation == TO_BE_SENT && round == 0) {
|
||||
LOG_E(NR_MAC, "[CG Type 2]Configure the pdcch dci with CS-RNTI to send CG Type2 activation\n");
|
||||
dci_pdu_rel15->ndi = 0;
|
||||
dci_pdu_rel15->harq_pid = cg_id;
|
||||
dci_pdu_rel15->rv = 0;
|
||||
cg_ind_status->status_cg_activation = SENT;
|
||||
}
|
||||
|
||||
if (cg_ind_status->status_cg_deactivation == TO_BE_SENT) {
|
||||
if (cg_ind_status->status_cg_activation == NOT_SEND)
|
||||
AssertFatal(0, "[CG Type2]CG Deactivation is not possible with out an CG activation\n");
|
||||
LOG_E(NR_MAC, "[CG Type2]Configure the pdcch dci with CS-RNTI to send CG de-activation\n");
|
||||
memset(dci_pdu_rel15, 0, sizeof(*dci_pdu_rel15));
|
||||
dci_pdu_rel15->ndi = 0;
|
||||
dci_pdu_rel15->harq_pid = 0;
|
||||
dci_pdu_rel15->rv = 0;
|
||||
dci_pdu_rel15->frequency_domain_assignment.val = (1 << dci_pdu_rel15->frequency_domain_assignment.nbits)-1;
|
||||
dci_pdu_rel15->mcs = (1<<5) - 1;
|
||||
cg_ind_status->status_cg_deactivation = SENT;
|
||||
}
|
||||
}
|
||||
return cg_status;
|
||||
}
|
||||
|
||||
|
||||
void prepare_dci(const NR_UE_ServingCell_Info_t *servingCellInfo,
|
||||
const NR_UE_DL_BWP_t *current_BWP,
|
||||
const NR_ControlResourceSet_t *coreset,
|
||||
@@ -1245,7 +1283,9 @@ void fill_dci_pdu_rel15(const NR_UE_ServingCell_Info_t *servingCellInfo,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ControlResourceSet_t *coreset,
|
||||
long pdsch_HARQ_ACK_Codebook,
|
||||
uint16_t cset0_bwp_size)
|
||||
uint16_t cset0_bwp_size,
|
||||
NR_UE_CG_t *config_sched,
|
||||
int harq_round)
|
||||
{
|
||||
uint8_t fsize = 0, pos = 0;
|
||||
uint64_t *dci_pdu = (uint64_t *)pdcch_dci_pdu->Payload;
|
||||
@@ -1575,8 +1615,13 @@ void fill_dci_pdu_rel15(const NR_UE_ServingCell_Info_t *servingCellInfo,
|
||||
case NR_UL_DCI_FORMAT_0_0:
|
||||
switch (rnti_type) {
|
||||
case TYPE_C_RNTI_:
|
||||
case TYPE_CS_RNTI_:
|
||||
// modify the dci fields for sending cg activation or release, scrambled with cs-rnti, if it is supported and activated
|
||||
bool cg_status = rnti_type == TYPE_CS_RNTI_? nr_prepare_cg_dci(dci_pdu_rel15, current_UL_BWP, config_sched, harq_round) : false;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"Filling format 0_0 DCI for CRNTI (size %d bits, format ind %d)\n",
|
||||
"Filling format 0_0 DCI for %s (size %d bits, format ind %d)\n",
|
||||
cg_status ? "CS-RNTI" : "C-RNTI",
|
||||
dci_size,
|
||||
dci_pdu_rel15->format_indicator);
|
||||
// indicating a UL DCI format 1bit
|
||||
@@ -1686,7 +1731,14 @@ void fill_dci_pdu_rel15(const NR_UE_ServingCell_Info_t *servingCellInfo,
|
||||
case NR_UL_DCI_FORMAT_0_1:
|
||||
switch (rnti_type) {
|
||||
case TYPE_C_RNTI_:
|
||||
LOG_D(NR_MAC, "Filling NR_UL_DCI_FORMAT_0_1 size %d format indicator %d\n", dci_size, dci_pdu_rel15->format_indicator);
|
||||
case TYPE_CS_RNTI_:
|
||||
// modify the dci fields for sending cg activation or release, scrambled with cs-rnti, if it is supported and activated
|
||||
bool cg_status = rnti_type == TYPE_CS_RNTI_? nr_prepare_cg_dci(dci_pdu_rel15, current_UL_BWP, config_sched, harq_round) : false;
|
||||
|
||||
LOG_D(NR_MAC, "Filling NR_UL_DCI_FORMAT_0_1 for %s (size %d format indicator %d)\n",
|
||||
cg_status ? "CS-RNTI" : "C-RNTI",
|
||||
dci_size,
|
||||
dci_pdu_rel15->format_indicator);
|
||||
// Indicating a DL DCI format 1bit
|
||||
pos = 1;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 0x1) << (dci_size - pos);
|
||||
@@ -2067,6 +2119,12 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
|
||||
LOG_D(NR_MAC,"Search and found rnti: %04x\n", rntiP);
|
||||
return UE;
|
||||
}
|
||||
else if (UE->cs_rnti && *UE->cs_rnti == rntiP)
|
||||
{
|
||||
LOG_E(NR_MAC,"Search and found rnti: %04x\n", rntiP);
|
||||
return UE;
|
||||
}
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -2266,6 +2324,25 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac,
|
||||
UL_BWP->pusch_Config = ubwpd->pusch_Config->choice.setup;
|
||||
UL_BWP->pucch_Config = ubwpd->pucch_Config->choice.setup;
|
||||
UL_BWP->srs_Config = ubwpd->srs_Config->choice.setup;
|
||||
|
||||
// configured scheduling
|
||||
bool cs_RNTI_Config = CellGroup && CellGroup->physicalCellGroupConfig && CellGroup->physicalCellGroupConfig->cs_RNTI ? true : false;
|
||||
LOG_E(NR_MAC, "Configured grant is %s\n", cs_RNTI_Config ? "activated" : "not-activated");
|
||||
if(ubwpd->configuredGrantConfig){
|
||||
NR_UE_CG_t *cg_sched = calloc(1, sizeof(*cg_sched));
|
||||
cg_sched->cg_act_deact_transmit_status.status_cg_activation = ubwpd->configuredGrantConfig && cs_RNTI_Config && get_softmodem_params()->cg_activate ? TO_BE_SENT : NOT_SEND;
|
||||
cg_sched->cg_act_deact_transmit_status.status_cg_deactivation = NOT_SEND;
|
||||
ASN_SEQUENCE_ADD(&sched_ctrl->configured_sched, cg_sched);
|
||||
}
|
||||
else if (ubwpd->ext1 && ubwpd->ext1->configuredGrantConfigToAddModList_r16){
|
||||
NR_ConfiguredGrantConfigToAddModList_r16_t *cg_list = ubwpd->ext1->configuredGrantConfigToAddModList_r16;
|
||||
for(int i = 0; i < cg_list->list.count; i++){
|
||||
NR_UE_CG_t *cg_sched = calloc(1, sizeof(*cg_sched));
|
||||
cg_sched->cg_act_deact_transmit_status.status_cg_activation = cg_list->list.array[i] && cs_RNTI_Config && get_softmodem_params()->cg_activate ? TO_BE_SENT : NOT_SEND;
|
||||
cg_sched->cg_act_deact_transmit_status.status_cg_deactivation = NOT_SEND;
|
||||
ASN_SEQUENCE_ADD(&sched_ctrl->configured_sched, cg_sched);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
DL_BWP->bwp_id = 0;
|
||||
@@ -2275,6 +2352,7 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac,
|
||||
UL_BWP->pusch_Config = NULL;
|
||||
UL_BWP->pucch_Config = NULL;
|
||||
UL_BWP->configuredGrantConfig = NULL;
|
||||
UL_BWP->configuredGrantConfigList = NULL;
|
||||
}
|
||||
|
||||
if (old_dl_bwp_id != DL_BWP->bwp_id)
|
||||
@@ -2365,8 +2443,13 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac,
|
||||
}
|
||||
}
|
||||
|
||||
if (CellGroup && CellGroup->physicalCellGroupConfig)
|
||||
if (CellGroup && CellGroup->physicalCellGroupConfig) {
|
||||
UE->pdsch_HARQ_ACK_Codebook = CellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook;
|
||||
if (CellGroup->physicalCellGroupConfig->cs_RNTI) {
|
||||
LOG_E(NR_MAC, "Added CS_RNTI\n");
|
||||
UE->cs_rnti = (rnti_t*)&CellGroup->physicalCellGroupConfig->cs_RNTI->choice.setup;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset required fields in sched_ctrl (e.g. ul_ri and tpmi)
|
||||
reset_sched_ctrl(sched_ctrl);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -234,7 +234,9 @@ void fill_dci_pdu_rel15(const NR_UE_ServingCell_Info_t *servingCellInfo,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ControlResourceSet_t *coreset,
|
||||
long pdsch_HARQ_ACK_Codebook,
|
||||
uint16_t cset0_bwp_size);
|
||||
uint16_t cset0_bwp_size,
|
||||
NR_UE_CG_t *config_sched,
|
||||
int harq_round);
|
||||
|
||||
void prepare_dci(const NR_UE_ServingCell_Info_t *servingCellInfo,
|
||||
const NR_UE_DL_BWP_t *current_BWP,
|
||||
|
||||
@@ -509,6 +509,7 @@ typedef struct NR_UE_ul_harq {
|
||||
uint8_t ndi;
|
||||
uint8_t round;
|
||||
uint16_t feedback_slot;
|
||||
bool is_ul_semistatic_transmission;
|
||||
|
||||
/// sched_pusch keeps information on MCS etc used for the initial transmission
|
||||
NR_sched_pusch_t sched_pusch;
|
||||
@@ -519,6 +520,14 @@ typedef struct NR_QoS_config_s {
|
||||
uint64_t priority;
|
||||
} NR_QoS_config_t;
|
||||
|
||||
typedef struct NR_UE_CG_s {
|
||||
nr_cg_indication_status_t cg_act_deact_transmit_status;
|
||||
nr_cg_start_info_t allocation_info;
|
||||
NR_sched_pusch_t *initial_sched_pusch;
|
||||
NR_sched_pucch_t *initial_pucch;
|
||||
bool is_cg_conrec; // status of whether MAC CE that specifies whether UE received activation signal or not ?
|
||||
} NR_UE_CG_t;
|
||||
|
||||
/*! \brief scheduling control information set through an API */
|
||||
#define MAX_CSI_REPORTS 48
|
||||
typedef struct {
|
||||
@@ -619,6 +628,9 @@ typedef struct {
|
||||
nr_srs_feedback_t srs_feedback;
|
||||
nssai_t dl_lc_nssai[NR_MAX_NUM_LCID];
|
||||
|
||||
// configured scheduling
|
||||
A_SEQUENCE_OF(NR_UE_CG_t) configured_sched;
|
||||
|
||||
// Information about the QoS configuration for each LCID/DRB
|
||||
NR_QoS_config_t qos_config[NR_MAX_NUM_LCID - 4][NR_MAX_NUM_QFI]; // 0 -CCCH and 1- 3 SRBs(0,1,2)
|
||||
} NR_UE_sched_ctrl_t;
|
||||
@@ -672,6 +684,7 @@ typedef struct nr_mac_rrc_ul_if_s {
|
||||
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
|
||||
typedef struct {
|
||||
rnti_t rnti;
|
||||
rnti_t* cs_rnti;
|
||||
uid_t uid; // unique ID of this UE
|
||||
/// scheduling control info
|
||||
nr_csi_report_t csi_report_template[MAX_CSI_REPORTCONFIG];
|
||||
|
||||
@@ -185,14 +185,17 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
|
||||
for (int i = 0; i < UL_info->rx_ind.number_of_pdus; i++) {
|
||||
const nfapi_nr_rx_data_pdu_t *rx = &UL_info->rx_ind.pdu_list[i];
|
||||
const nfapi_nr_crc_t *crc = &UL_info->crc_ind.crc_list[i];
|
||||
LOG_D(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x "
|
||||
LOG_I(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x "
|
||||
"UL_info->rx_ind.pdu_list[%d].rnti:%04x\n",
|
||||
i, crc->rnti, i, rx->rnti);
|
||||
|
||||
AssertFatal(crc->rnti == rx->rnti, "mis-match between CRC RNTI %04x and RX RNTI %04x\n",
|
||||
crc->rnti, rx->rnti);
|
||||
if (crc->rnti == 0x3456) {
|
||||
LOG_E(NR_MAC, "Debugging currently\n");
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
LOG_I(NR_MAC,
|
||||
"%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n",
|
||||
UL_info->frame,
|
||||
UL_info->slot,
|
||||
@@ -427,7 +430,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
|
||||
module_id_t module_id = UL_info->module_id;
|
||||
int CC_id = UL_info->CC_id;
|
||||
|
||||
LOG_D(NR_PHY,"SFN/SLOT:%d.%d module_id:%d CC_id:%d UL_info[rach_pdus:%zu rx_ind:%zu crcs:%zu]\n",
|
||||
LOG_E(NR_PHY,"SFN/SLOT:%d.%d module_id:%d CC_id:%d UL_info[rach_pdus:%zu rx_ind:%zu crcs:%zu]\n",
|
||||
UL_info->frame, UL_info->slot,
|
||||
module_id, CC_id,
|
||||
gnb_rach_ind_queue.num_items,
|
||||
|
||||
@@ -645,6 +645,63 @@ static struct NR_SRS_Resource__resourceType__periodic *configure_periodic_srs(co
|
||||
return periodic_srs;
|
||||
}
|
||||
|
||||
static NR_SetupRelease_ConfiguredGrantConfig_t *get_config_CG(void){
|
||||
NR_SetupRelease_ConfiguredGrantConfig_t *setup_release_CG_Config = calloc(1, sizeof(*setup_release_CG_Config));
|
||||
setup_release_CG_Config->present = NR_SetupRelease_ConfiguredGrantConfig_PR_setup;
|
||||
setup_release_CG_Config->choice.setup = calloc(1, sizeof(*setup_release_CG_Config->choice.setup));
|
||||
|
||||
NR_ConfiguredGrantConfig_t* cg_Config = setup_release_CG_Config->choice.setup;
|
||||
cg_Config->frequencyHopping = calloc(1,sizeof(*cg_Config->frequencyHopping));
|
||||
*cg_Config->frequencyHopping = NR_ConfiguredGrantConfig__frequencyHopping_interSlot;
|
||||
|
||||
NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = &cg_Config->cg_DMRS_Configuration;
|
||||
NR_DMRS_UplinkConfig->dmrs_Type = NULL;
|
||||
NR_DMRS_UplinkConfig->dmrs_AdditionalPosition = NULL;
|
||||
NR_DMRS_UplinkConfig->phaseTrackingRS = NULL;
|
||||
NR_DMRS_UplinkConfig->maxLength = NULL;
|
||||
if (!NR_DMRS_UplinkConfig->transformPrecodingDisabled)
|
||||
NR_DMRS_UplinkConfig->transformPrecodingDisabled = calloc(1, sizeof(*NR_DMRS_UplinkConfig->transformPrecodingDisabled));
|
||||
NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0 = NULL;
|
||||
NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1 = NULL;
|
||||
if (!NR_DMRS_UplinkConfig->transformPrecodingEnabled)
|
||||
NR_DMRS_UplinkConfig->transformPrecodingEnabled = calloc(1, sizeof(*NR_DMRS_UplinkConfig->transformPrecodingEnabled));
|
||||
NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity = NULL;
|
||||
NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping = NULL;
|
||||
NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping = NULL;
|
||||
|
||||
cg_Config->uci_OnPUSCH = NULL;
|
||||
|
||||
cg_Config->mcs_Table = calloc(1,sizeof(*cg_Config->mcs_Table));
|
||||
*cg_Config->mcs_Table = NR_ConfiguredGrantConfig__mcs_Table_qam256;
|
||||
|
||||
cg_Config->mcs_TableTransformPrecoder = calloc(1,sizeof(*cg_Config->mcs_TableTransformPrecoder));
|
||||
*cg_Config->mcs_TableTransformPrecoder = NR_ConfiguredGrantConfig__mcs_TableTransformPrecoder_qam256;
|
||||
|
||||
cg_Config->rbg_Size = calloc(1,sizeof(*cg_Config->rbg_Size));
|
||||
*cg_Config->rbg_Size = NR_ConfiguredGrantConfig__rbg_Size_config2;
|
||||
|
||||
cg_Config->transformPrecoder = calloc(1,sizeof(*cg_Config->transformPrecoder));
|
||||
*cg_Config->transformPrecoder = NR_ConfiguredGrantConfig__transformPrecoder_enabled;
|
||||
|
||||
cg_Config->repK_RV = calloc(1,sizeof(*cg_Config->repK_RV));
|
||||
*cg_Config->repK_RV= NR_ConfiguredGrantConfig__repK_RV_s1_0231;
|
||||
|
||||
cg_Config->configuredGrantTimer = calloc(1,sizeof(*cg_Config->configuredGrantTimer));
|
||||
*cg_Config->configuredGrantTimer = 10;
|
||||
|
||||
cg_Config->resourceAllocation = NR_ConfiguredGrantConfig__resourceAllocation_resourceAllocationType0;
|
||||
|
||||
cg_Config->powerControlLoopToUse = NR_ConfiguredGrantConfig__powerControlLoopToUse_n0;
|
||||
|
||||
cg_Config->nrofHARQ_Processes = 5;
|
||||
|
||||
cg_Config->repK = NR_ConfiguredGrantConfig__repK_n1;
|
||||
|
||||
cg_Config->periodicity = NR_ConfiguredGrantConfig__periodicity_sym10x14;
|
||||
|
||||
return setup_release_CG_Config;
|
||||
}
|
||||
|
||||
static NR_SetupRelease_SRS_Config_t *get_config_srs(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_UE_NR_Capability_t *uecap,
|
||||
const int curr_bwp,
|
||||
@@ -1114,11 +1171,13 @@ static void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc, N
|
||||
|
||||
static void set_ul_mcs_table(const NR_UE_NR_Capability_t *cap,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
NR_PUSCH_Config_t *pusch_Config)
|
||||
NR_PUSCH_Config_t *pusch_Config,
|
||||
NR_ConfiguredGrantConfig_t *cg_Config)
|
||||
{
|
||||
|
||||
if (cap == NULL){
|
||||
pusch_Config->mcs_Table = NULL;
|
||||
if(pusch_Config){pusch_Config->mcs_Table = NULL;}
|
||||
if(cg_Config){cg_Config->mcs_Table = NULL;}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1135,22 +1194,45 @@ static void set_ul_mcs_table(const NR_UE_NR_Capability_t *cap,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (supported) {
|
||||
if(pusch_Config->transformPrecoder == NULL ||
|
||||
*pusch_Config->transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) {
|
||||
if(pusch_Config->mcs_Table == NULL)
|
||||
pusch_Config->mcs_Table = calloc(1, sizeof(*pusch_Config->mcs_Table));
|
||||
*pusch_Config->mcs_Table = NR_PUSCH_Config__mcs_Table_qam256;
|
||||
}
|
||||
|
||||
if (pusch_Config) {
|
||||
if (supported) {
|
||||
if (pusch_Config->transformPrecoder == NULL
|
||||
|| *pusch_Config->transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) {
|
||||
if (pusch_Config->mcs_Table == NULL)
|
||||
pusch_Config->mcs_Table = calloc(1, sizeof(*pusch_Config->mcs_Table));
|
||||
*pusch_Config->mcs_Table = NR_PUSCH_Config__mcs_Table_qam256;
|
||||
}
|
||||
else {
|
||||
if (pusch_Config->mcs_TableTransformPrecoder == NULL)
|
||||
pusch_Config->mcs_TableTransformPrecoder = calloc(1, sizeof(*pusch_Config->mcs_TableTransformPrecoder));
|
||||
*pusch_Config->mcs_TableTransformPrecoder = NR_PUSCH_Config__mcs_TableTransformPrecoder_qam256;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(pusch_Config->mcs_TableTransformPrecoder == NULL)
|
||||
pusch_Config->mcs_TableTransformPrecoder = calloc(1, sizeof(*pusch_Config->mcs_TableTransformPrecoder));
|
||||
*pusch_Config->mcs_TableTransformPrecoder = NR_PUSCH_Config__mcs_TableTransformPrecoder_qam256;
|
||||
pusch_Config->mcs_Table = NULL;
|
||||
pusch_Config->mcs_TableTransformPrecoder = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pusch_Config->mcs_Table = NULL;
|
||||
pusch_Config->mcs_TableTransformPrecoder = NULL;
|
||||
|
||||
if(cg_Config){
|
||||
if(supported){
|
||||
if (cg_Config->transformPrecoder == NULL
|
||||
|| *cg_Config->transformPrecoder == NR_ConfiguredGrantConfig__transformPrecoder_disabled) {
|
||||
if (cg_Config->mcs_Table == NULL)
|
||||
cg_Config->mcs_Table = calloc(1, sizeof(*cg_Config->mcs_Table));
|
||||
*cg_Config->mcs_Table = NR_ConfiguredGrantConfig__mcs_Table_qam256;
|
||||
}
|
||||
else {
|
||||
if (cg_Config->mcs_TableTransformPrecoder == NULL)
|
||||
cg_Config->mcs_TableTransformPrecoder = calloc(1, sizeof(*cg_Config->mcs_TableTransformPrecoder));
|
||||
*cg_Config->mcs_TableTransformPrecoder = NR_ConfiguredGrantConfig__mcs_TableTransformPrecoder_qam256;
|
||||
}
|
||||
}
|
||||
else{
|
||||
cg_Config->mcs_Table = NULL;
|
||||
cg_Config->mcs_TableTransformPrecoder = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1266,7 +1348,7 @@ static struct NR_SetupRelease_PUSCH_Config *config_pusch(NR_PUSCH_Config_t *pusc
|
||||
pusch_Config->resourceAllocation = NR_PUSCH_Config__resourceAllocation_resourceAllocationType1;
|
||||
pusch_Config->pusch_TimeDomainAllocationList = NULL;
|
||||
pusch_Config->pusch_AggregationFactor = NULL;
|
||||
set_ul_mcs_table(uecap, scc, pusch_Config);
|
||||
set_ul_mcs_table(uecap, scc, pusch_Config, NULL);
|
||||
pusch_Config->transformPrecoder = NULL;
|
||||
if (!pusch_Config->codebookSubset)
|
||||
pusch_Config->codebookSubset = calloc(1, sizeof(*pusch_Config->codebookSubset));
|
||||
@@ -1480,7 +1562,6 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp,
|
||||
*servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers : 1;
|
||||
|
||||
ubwp->bwp_Dedicated->srs_Config = get_config_srs(scc, NULL, curr_bwp, uid, bwp_loop + 1, maxMIMO_Layers, configuration->do_SRS);
|
||||
|
||||
ubwp->bwp_Dedicated->configuredGrantConfig = NULL;
|
||||
ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL;
|
||||
}
|
||||
@@ -2270,11 +2351,28 @@ int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buff
|
||||
return (enc_rval.encoded + 7) / 8;
|
||||
}
|
||||
|
||||
static NR_PhysicalCellGroupConfig_t *configure_phy_cellgroup(void)
|
||||
static NR_PhysicalCellGroupConfig_t *configure_phy_cellgroup(NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig, const NR_UE_NR_Capability_t *uecap)
|
||||
{
|
||||
NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig = calloc(1, sizeof(*physicalCellGroupConfig));
|
||||
AssertFatal(physicalCellGroupConfig != NULL, "Couldn't allocate physicalCellGroupConfig. Out of memory!\n");
|
||||
physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic;
|
||||
if (physicalCellGroupConfig == NULL) {
|
||||
LOG_E(NR_RRC, "Configuring physical cell group\n");
|
||||
physicalCellGroupConfig = calloc(1, sizeof(*physicalCellGroupConfig));
|
||||
AssertFatal(physicalCellGroupConfig != NULL, "Couldn't allocate physicalCellGroupConfig. Out of memory!\n");
|
||||
physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic;
|
||||
}
|
||||
|
||||
if(uecap){
|
||||
LOG_E(NR_RRC, "UE capabilities file present\n");
|
||||
if(uecap->phy_Parameters.phy_ParametersCommon &&
|
||||
((uecap->phy_Parameters.phy_ParametersCommon->configuredUL_GrantType2 && *uecap->phy_Parameters.phy_ParametersCommon->configuredUL_GrantType2==0) ||
|
||||
(uecap->phy_Parameters.phy_ParametersCommon->downlinkSPS && *uecap->phy_Parameters.phy_ParametersCommon->downlinkSPS==0)) &&
|
||||
!physicalCellGroupConfig->cs_RNTI) {
|
||||
LOG_E(NR_RRC, "Configured CS-RNTI\n");
|
||||
physicalCellGroupConfig->cs_RNTI = calloc(1, sizeof(*physicalCellGroupConfig->cs_RNTI));
|
||||
physicalCellGroupConfig->cs_RNTI->present = NR_SetupRelease_RNTI_Value_PR_setup;
|
||||
physicalCellGroupConfig->cs_RNTI->choice.setup = get_softmodem_params()->phy_test == 1 ? 0x3456 : (0x3456); //(taus() & 0xffff)
|
||||
}
|
||||
}
|
||||
|
||||
return physicalCellGroupConfig;
|
||||
}
|
||||
|
||||
@@ -2351,6 +2449,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid,
|
||||
|
||||
// We are using do_srs = 0 here because the periodic SRS will only be enabled in update_cellGroupConfig() if do_srs == 1
|
||||
initialUplinkBWP->srs_Config = get_config_srs(scc, NULL, curr_bwp, uid, 0, maxMIMO_Layers, 0);
|
||||
initialUplinkBWP->configuredGrantConfig = NULL;
|
||||
|
||||
scheduling_request_config(scc, pucch_Config, scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing);
|
||||
|
||||
@@ -2571,7 +2670,7 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid,
|
||||
/* mac CellGroup Config */
|
||||
cellGroupConfig->mac_CellGroupConfig = configure_mac_cellgroup();
|
||||
|
||||
cellGroupConfig->physicalCellGroupConfig = configure_phy_cellgroup();
|
||||
cellGroupConfig->physicalCellGroupConfig = configure_phy_cellgroup(cellGroupConfig->physicalCellGroupConfig, NULL);
|
||||
|
||||
cellGroupConfig->spCellConfig = get_initial_SpCellConfig(uid, scc, servingcellconfigdedicated, configuration);
|
||||
|
||||
@@ -2594,6 +2693,7 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
DevAssert(scc != NULL);
|
||||
|
||||
NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig;
|
||||
cellGroupConfig->physicalCellGroupConfig = configure_phy_cellgroup(cellGroupConfig->physicalCellGroupConfig, uecap);
|
||||
|
||||
NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = SpCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup;
|
||||
set_dl_maxmimolayers(pdsch_servingcellconfig, scc, uecap);
|
||||
@@ -2657,6 +2757,13 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
uplinkConfig->initialUplinkBWP->srs_Config = get_config_srs(scc, uecap, curr_bwp, uid, 0, maxMIMO_Layers, configuration->do_SRS);
|
||||
}
|
||||
|
||||
// Configured grant Configuration
|
||||
if(uecap->phy_Parameters.phy_ParametersCommon->configuredUL_GrantType2){
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_SetupRelease_ConfiguredGrantConfig, uplinkConfig->initialUplinkBWP->configuredGrantConfig);
|
||||
uplinkConfig->initialUplinkBWP->configuredGrantConfig = get_config_CG();
|
||||
LOG_E(NR_RRC, "Updating the configured grant in CellGroupConfig\n");
|
||||
}
|
||||
|
||||
// Set DL MCS table
|
||||
NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP;
|
||||
set_dl_mcs_table(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing,
|
||||
@@ -2665,7 +2772,8 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
scc);
|
||||
|
||||
NR_BWP_UplinkDedicated_t *ul_bwp_Dedicated = SpCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
|
||||
set_ul_mcs_table(configuration->force_256qam_off ? NULL : uecap, scc, ul_bwp_Dedicated->pusch_Config->choice.setup);
|
||||
NR_ConfiguredGrantConfig_t *cg_Config_initial = ul_bwp_Dedicated->configuredGrantConfig ? ul_bwp_Dedicated->configuredGrantConfig->choice.setup : NULL;
|
||||
set_ul_mcs_table(configuration->force_256qam_off ? NULL : uecap, scc, ul_bwp_Dedicated->pusch_Config->choice.setup, cg_Config_initial);
|
||||
|
||||
struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list =
|
||||
SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList;
|
||||
@@ -2683,7 +2791,8 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
|
||||
int bwp_size = NRRIV2BW(ul_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
if (ul_bwp->bwp_Dedicated->pusch_Config) {
|
||||
NR_PUSCH_Config_t *pusch_Config = ul_bwp->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
set_ul_mcs_table(configuration->force_256qam_off ? NULL : uecap, scc, pusch_Config);
|
||||
NR_ConfiguredGrantConfig_t *cg_Config_dedicated = ul_bwp->bwp_Dedicated->configuredGrantConfig ? ul_bwp->bwp_Dedicated->configuredGrantConfig->choice.setup : NULL;
|
||||
set_ul_mcs_table(configuration->force_256qam_off ? NULL : uecap, scc, pusch_Config, cg_Config_dedicated);
|
||||
if (pusch_Config->maxRank == NULL) {
|
||||
pusch_Config->maxRank = calloc(1, sizeof(*pusch_Config->maxRank));
|
||||
}
|
||||
@@ -2784,7 +2893,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC
|
||||
asn1cSeqAdd(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig);
|
||||
|
||||
secondaryCellGroup->mac_CellGroupConfig = configure_mac_cellgroup();
|
||||
secondaryCellGroup->physicalCellGroupConfig = configure_phy_cellgroup();
|
||||
secondaryCellGroup->physicalCellGroupConfig = configure_phy_cellgroup(NULL, uecap);
|
||||
secondaryCellGroup->spCellConfig = calloc(1, sizeof(*secondaryCellGroup->spCellConfig));
|
||||
secondaryCellGroup->spCellConfig->servCellIndex = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->servCellIndex));
|
||||
*secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#define RRC_UE
|
||||
#define RRC_UE_C
|
||||
#define RRC_CG_TYPE2
|
||||
|
||||
#include "NR_DL-DCCH-Message.h" //asn_DEF_NR_DL_DCCH_Message
|
||||
#include "NR_DL-CCCH-Message.h" //asn_DEF_NR_DL_CCCH_Message
|
||||
@@ -1856,9 +1857,23 @@ static void nr_rrc_ue_process_ueCapabilityEnquiry(NR_UE_RRC_INST_t *rrc, NR_UECa
|
||||
rrc->UECap.UE_NR_Capability = CALLOC(1, sizeof(NR_UE_NR_Capability_t));
|
||||
asn1cSequenceAdd(rrc->UECap.UE_NR_Capability->rf_Parameters.supportedBandListNR.list, NR_BandNR_t, nr_bandnr);
|
||||
nr_bandnr->bandNR = 1;
|
||||
|
||||
rrc->UECap.UE_NR_Capability->phy_Parameters.phy_ParametersCommon = calloc(1, sizeof(NR_Phy_ParametersCommon_t));
|
||||
rrc->UECap.UE_NR_Capability->phy_Parameters.phy_ParametersCommon->configuredUL_GrantType2 =
|
||||
calloc(1, sizeof(*rrc->UECap.UE_NR_Capability->phy_Parameters.phy_ParametersCommon->configuredUL_GrantType2));
|
||||
}
|
||||
xer_fprint(stdout, &asn_DEF_NR_UE_NR_Capability, (void *)rrc->UECap.UE_NR_Capability);
|
||||
|
||||
#ifdef RRC_CG_TYPE2
|
||||
if(rrc->UECap.UE_NR_Capability->phy_Parameters.phy_ParametersCommon &&
|
||||
rrc->UECap.UE_NR_Capability->phy_Parameters.phy_ParametersCommon->configuredUL_GrantType2){
|
||||
LOG_E(NR_RRC, "Configured Grant Type 2 is supported by UE\n");
|
||||
}
|
||||
else{
|
||||
LOG_E(NR_RRC, "Configured Grant Type 2 is not supported by UE\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_NR_Capability,
|
||||
NULL,
|
||||
(void *)rrc->UECap.UE_NR_Capability,
|
||||
|
||||
@@ -11,7 +11,7 @@ gNBs =
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }) });
|
||||
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; sd = 0xffffff}) });
|
||||
|
||||
nr_cellid = 12345678L;
|
||||
|
||||
@@ -159,13 +159,19 @@ gNBs =
|
||||
|
||||
|
||||
////////// AMF parameters:
|
||||
amf_ip_address = ({ ipv4 = "192.168.70.132"; });
|
||||
|
||||
amf_ip_address = ( { ipv4 = "172.22.0.10";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24";
|
||||
GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24";
|
||||
GNB_INTERFACE_NAME_FOR_NG_AMF = "internet";
|
||||
GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.22.0.1/24";
|
||||
GNB_INTERFACE_NAME_FOR_NGU = "internet";
|
||||
GNB_IPV4_ADDRESS_FOR_NGU = "172.22.0.1/24";
|
||||
GNB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<dynamicHARQ-ACK-Codebook><supported/></dynamicHARQ-ACK-Codebook>
|
||||
<semiStaticHARQ-ACK-Codebook><supported/></semiStaticHARQ-ACK-Codebook>
|
||||
<pdsch-MappingTypeA><supported/></pdsch-MappingTypeA>
|
||||
<configuredUL-GrantType2><supported/></configuredUL-GrantType2>
|
||||
<rateMatchingResrcSetSemi-Static><supported/></rateMatchingResrcSetSemi-Static>
|
||||
<ext2>
|
||||
<maxLayersMIMO-Indication><supported/></maxLayersMIMO-Indication>
|
||||
|
||||
Reference in New Issue
Block a user