Merge remote-tracking branch 'origin/sib19-ue-utilization' into integration_2024_w50 (!3019)
SIB19 utilization on UE Following SIB19 initialization and scheduling on gNB (!2899 - merged) and Receive SIB19 on nrUE (!2920 - merged), this merge request aims to introduce the actual use of the SIB19 provided parameters by gNB in UE. Changes needed for utilization include: initialization of position coordinates parameters for UE (which are needed to calculate propagation delay between UE and SAT), propagation delay calculations and timing advance adjusts. Moreover, this change removes the now unused arguments for ntn_koffset, ntn_ta_common and ntn_ta_commondrift
This commit is contained in:
@@ -31,8 +31,9 @@
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#define SPEED_OF_LIGHT 299792458
|
||||
|
||||
//#include "mac_defs.h"
|
||||
#include "mac_defs.h"
|
||||
#include <NR_MAC_gNB/mac_proto.h>
|
||||
#include "NR_MAC_UE/mac_proto.h"
|
||||
#include "NR_MAC-CellGroupConfig.h"
|
||||
@@ -41,6 +42,7 @@
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
#include "oai_asn1.h"
|
||||
#include "executables/position_interface.h"
|
||||
|
||||
void set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table,
|
||||
int mu,
|
||||
@@ -252,7 +254,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
mac->phy_config.Mod_id = mac->ue_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
|
||||
|
||||
// carrier config
|
||||
LOG_D(MAC, "[UE %d] Entering UE Config Common\n", mac->ue_id);
|
||||
|
||||
@@ -1746,15 +1748,61 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
AssertFatal(!ret, "mutex failed %d\n", ret);
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id,
|
||||
NR_SIB19_r17_t *sib19_r17)
|
||||
// computes delay between ue and sat based on SIB19 ephemeris data
|
||||
static double calculate_ue_sat_ta(const position_t *position_params, struct NR_PositionVelocity_r17 *sat_pos)
|
||||
{
|
||||
// get UE position coordinates
|
||||
double posx = position_params->positionX;
|
||||
double posy = position_params->positionY;
|
||||
double posz = position_params->positionZ;
|
||||
|
||||
// get sat position coordinates
|
||||
double posx_0 = (double)sat_pos->positionX_r17 * 1.3;
|
||||
double posy_0 = (double)sat_pos->positionY_r17 * 1.3;
|
||||
double posz_0 = (double)sat_pos->positionZ_r17 * 1.3;
|
||||
|
||||
double distance = sqrt(pow(posx - posx_0, 2) + pow(posy - posy_0, 2) + pow(posz - posz_0, 2));
|
||||
// this computation will ensure 3 decimal precision
|
||||
double ta_ms = round(((distance / SPEED_OF_LIGHT) * 1000) * 1000.0) / 1000.0;
|
||||
|
||||
return ta_ms;
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, const position_t *pos, NR_SIB19_r17_t *sib19_r17)
|
||||
{
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
int ret = pthread_mutex_lock(&mac->if_mutex);
|
||||
AssertFatal(!ret, "mutex failed %d\n", ret);
|
||||
|
||||
// update ntn_Config_r17 with received values
|
||||
struct NR_NTN_Config_r17 *ntn_Config_r17 = mac->sc_info.ntn_Config_r17;
|
||||
UPDATE_IE(ntn_Config_r17, sib19_r17->ntn_Config_r17, NR_NTN_Config_r17_t);
|
||||
|
||||
// ntn-Config-r17
|
||||
UPDATE_IE(mac->sc_info.ntn_Config_r17, sib19_r17->ntn_Config_r17, NR_NTN_Config_r17_t);
|
||||
|
||||
// TODO handle other SIB19 elements
|
||||
// populate ntn_ta structure from mac
|
||||
// if ephemerisInfo_r17 present in SIB19
|
||||
struct NR_EphemerisInfo_r17 *ephemeris_info = ntn_Config_r17->ephemerisInfo_r17;
|
||||
if (ephemeris_info) {
|
||||
struct NR_PositionVelocity_r17 *position_velocity = ephemeris_info->choice.positionVelocity_r17;
|
||||
if (position_velocity
|
||||
&& (position_velocity->positionX_r17 != 0 || position_velocity->positionY_r17 != 0
|
||||
|| position_velocity->positionZ_r17 != 0)) {
|
||||
mac->ntn_ta.N_UE_TA_adj = calculate_ue_sat_ta(pos, position_velocity);
|
||||
}
|
||||
}
|
||||
// if cellSpecificKoffset_r17 is present
|
||||
if (ntn_Config_r17->cellSpecificKoffset_r17) {
|
||||
mac->ntn_ta.cell_specific_k_offset = *ntn_Config_r17->cellSpecificKoffset_r17;
|
||||
}
|
||||
// Check if ta_Info_r17 is present and convert directly ta_Common_r17 (is in units of 4.072e-3 µs)
|
||||
if (ntn_Config_r17->ta_Info_r17) {
|
||||
mac->ntn_ta.N_common_ta_adj = ntn_Config_r17->ta_Info_r17->ta_Common_r17 * 4.072e-6;
|
||||
// ta_CommonDrift_r17 (is in units of 0.2e-3 µs/s)
|
||||
if (ntn_Config_r17->ta_Info_r17->ta_CommonDrift_r17)
|
||||
mac->ntn_ta.ntn_ta_commondrift = *ntn_Config_r17->ta_Info_r17->ta_CommonDrift_r17 * 0.2e-3;
|
||||
}
|
||||
mac->ntn_ta.ntn_params_changed = true;
|
||||
ret = pthread_mutex_unlock(&mac->if_mutex);
|
||||
AssertFatal(!ret, "mutex failed %d\n", ret);
|
||||
}
|
||||
|
||||
static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
@@ -485,7 +485,6 @@ typedef struct nr_lcordered_info_s {
|
||||
bool lc_SRMask;
|
||||
} nr_lcordered_info_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t payload[NR_CCCH_PAYLOAD_SIZE_MAX];
|
||||
} __attribute__ ((__packed__)) NR_CCCH_PDU;
|
||||
@@ -554,6 +553,19 @@ typedef struct {
|
||||
A_SEQUENCE_OF(si_schedinfo_config_t) si_SchedInfo_list;
|
||||
} si_schedInfo_t;
|
||||
|
||||
typedef struct ntn_timing_advance_components {
|
||||
// N_common_ta_adj represents common propagation delay received in SIB19 (ms)
|
||||
double N_common_ta_adj;
|
||||
// N_UE_TA_adj calculated propagation delay from UE and SAT (ms)
|
||||
double N_UE_TA_adj;
|
||||
// drift rate of common ta in µs/s
|
||||
double ntn_ta_commondrift;
|
||||
// cell scheduling offset expressed in terms of 15kHz SCS
|
||||
long cell_specific_k_offset;
|
||||
|
||||
bool ntn_params_changed;
|
||||
} ntn_timing_advance_componets_t;
|
||||
|
||||
/*!\brief Top level UE MAC structure */
|
||||
typedef struct NR_UE_MAC_INST_s {
|
||||
module_id_t ue_id;
|
||||
@@ -623,6 +635,8 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
int p_Max_alt;
|
||||
int n_ta_offset; // -1 not present, otherwise value to be applied
|
||||
|
||||
ntn_timing_advance_componets_t ntn_ta;
|
||||
|
||||
long pdsch_HARQ_ACK_Codebook;
|
||||
|
||||
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config;
|
||||
@@ -661,5 +675,20 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
ue_mac_stats_t stats;
|
||||
} NR_UE_MAC_INST_t;
|
||||
|
||||
static inline int GET_NTN_UE_K_OFFSET(const ntn_timing_advance_componets_t *ntn_ta, int scs)
|
||||
{
|
||||
return (int)ntn_ta->cell_specific_k_offset << scs;
|
||||
}
|
||||
|
||||
static inline double GET_COMPLETE_TIME_ADVANCE_MS(const ntn_timing_advance_componets_t *ntn_ta)
|
||||
{
|
||||
return (ntn_ta->N_common_ta_adj + ntn_ta->N_UE_TA_adj) * 2;
|
||||
}
|
||||
|
||||
static inline long GET_DURATION_RX_TO_TX(const ntn_timing_advance_componets_t *ntn_ta)
|
||||
{
|
||||
return NR_UE_CAPABILITY_SLOT_RX_TO_TX + ntn_ta->cell_specific_k_offset;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
|
||||
@@ -91,8 +91,8 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
NR_SI_SchedulingInfo_v1700_t *si_SchedulingInfo_v1700,
|
||||
NR_ServingCellConfigCommonSIB_t *scc);
|
||||
|
||||
void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id,
|
||||
NR_SIB19_r17_t *sib19_r17);
|
||||
struct position; /* forward declaration */
|
||||
void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, const struct position *pos, NR_SIB19_r17_t *sib19_r17);
|
||||
|
||||
void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause);
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
|
||||
mac->p_Max = INT_MIN;
|
||||
mac->p_Max_alt = INT_MIN;
|
||||
mac->n_ta_offset = -1;
|
||||
mac->ntn_ta.ntn_params_changed = false;
|
||||
pthread_mutex_init(&mac->if_mutex, NULL);
|
||||
reset_mac_inst(mac);
|
||||
|
||||
@@ -86,29 +87,6 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
|
||||
|
||||
mac->pucch_power_control_initialized = false;
|
||||
mac->pusch_power_control_initialized = false;
|
||||
|
||||
// Fake SIB19 reception for NTN
|
||||
// TODO: remove this and implement the actual SIB19 reception instead!
|
||||
if (get_nrUE_params()->ntn_koffset || get_nrUE_params()->ntn_ta_common || get_nrUE_params()->ntn_ta_commondrift) {
|
||||
NR_SIB19_r17_t *sib19_r17 = calloc(1, sizeof(*sib19_r17));
|
||||
sib19_r17->ntn_Config_r17 = calloc(1, sizeof(*sib19_r17->ntn_Config_r17));
|
||||
|
||||
// NTN cellSpecificKoffset-r17
|
||||
if (get_nrUE_params()->ntn_koffset) {
|
||||
asn1cCallocOne(sib19_r17->ntn_Config_r17->cellSpecificKoffset_r17, get_nrUE_params()->ntn_koffset);
|
||||
}
|
||||
|
||||
// NTN ta-Common-r17
|
||||
if (get_nrUE_params()->ntn_ta_common || get_nrUE_params()->ntn_ta_commondrift) {
|
||||
sib19_r17->ntn_Config_r17->ta_Info_r17 = calloc(1, sizeof(*sib19_r17->ntn_Config_r17->ta_Info_r17));
|
||||
sib19_r17->ntn_Config_r17->ta_Info_r17->ta_Common_r17 = get_nrUE_params()->ntn_ta_common / 4.072e-6; // ta-Common-r17 is in units of 4.072e-3 µs, ntn_ta_common is in ms
|
||||
if (get_nrUE_params()->ntn_ta_commondrift)
|
||||
asn1cCallocOne(sib19_r17->ntn_Config_r17->ta_Info_r17->ta_CommonDrift_r17, get_nrUE_params()->ntn_ta_commondrift / 0.2e-3); // is in units of 0.2e-3 µs/s, ntn_ta_commondrift is in µs/s
|
||||
}
|
||||
|
||||
nr_rrc_mac_config_req_sib19_r17(mac->ue_id, sib19_r17);
|
||||
asn1cFreeStruc(asn_DEF_NR_SIB19_r17, sib19_r17);
|
||||
}
|
||||
}
|
||||
|
||||
void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
||||
|
||||
@@ -40,13 +40,8 @@
|
||||
|
||||
#include <executables/softmodem-common.h>
|
||||
#include "openair2/LAYER2/RLC/rlc.h"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_defs.h"
|
||||
|
||||
static double get_ta_Common_ms(NR_NTN_Config_r17_t *ntn_Config_r17)
|
||||
{
|
||||
if (ntn_Config_r17 && ntn_Config_r17->ta_Info_r17)
|
||||
return ntn_Config_r17->ta_Info_r17->ta_Common_r17 * 4.072e-6; // ta_Common_r17 is in units of 4.072e-3 µs
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
int16_t get_prach_tx_power(NR_UE_MAC_INST_t *mac)
|
||||
{
|
||||
@@ -621,7 +616,7 @@ void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, s
|
||||
{
|
||||
RA_config_t *ra = &mac->ra;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP->rach_ConfigCommon;
|
||||
const double ta_Common_ms = get_ta_Common_ms(mac->sc_info.ntn_Config_r17);
|
||||
const double ta_Common_ms = GET_COMPLETE_TIME_ADVANCE_MS(&mac->ntn_ta);
|
||||
const int mu = mac->current_UL_BWP->scs;
|
||||
const int slots_per_ms = nr_slots_per_frame[mu] / 10;
|
||||
|
||||
@@ -922,7 +917,7 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac)
|
||||
|
||||
NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP->rach_ConfigCommon;
|
||||
AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__);
|
||||
const double ta_Common_ms = get_ta_Common_ms(mac->sc_info.ntn_Config_r17);
|
||||
const double ta_Common_ms = GET_COMPLETE_TIME_ADVANCE_MS(&mac->ntn_ta);
|
||||
const int mu = mac->current_DL_BWP->scs;
|
||||
const int slots_per_ms = nr_slots_per_frame[mu] / 10;
|
||||
|
||||
|
||||
@@ -147,13 +147,6 @@ static nr_dci_format_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
const uint8_t *dci_pdu,
|
||||
const int slot);
|
||||
|
||||
static int get_NTN_UE_Koffset(NR_NTN_Config_r17_t *ntn_Config_r17, int scs)
|
||||
{
|
||||
if (ntn_Config_r17 && ntn_Config_r17->cellSpecificKoffset_r17)
|
||||
return *ntn_Config_r17->cellSpecificKoffset_r17 << scs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti)
|
||||
{
|
||||
const RA_config_t *ra = &mac->ra;
|
||||
@@ -506,7 +499,7 @@ static int nr_ue_process_dci_ul_00(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
frame_t frame_tx;
|
||||
int slot_tx;
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, mac->current_UL_BWP->scs);
|
||||
if (-1 == nr_ue_pusch_scheduler(mac, 0, frame, slot, &frame_tx, &slot_tx, tda_info.k2 + ntn_ue_koffset)) {
|
||||
LOG_E(MAC, "Cannot schedule PUSCH\n");
|
||||
return -1;
|
||||
@@ -604,7 +597,7 @@ static int nr_ue_process_dci_ul_01(NR_UE_MAC_INST_t *mac,
|
||||
tda_info.k2 = csi_K2;
|
||||
}
|
||||
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, mac->current_UL_BWP->scs);
|
||||
if (-1 == nr_ue_pusch_scheduler(mac, 0, frame, slot, &frame_tx, &slot_tx, tda_info.k2 + ntn_ue_koffset)) {
|
||||
LOG_E(MAC, "Cannot schedule PUSCH\n");
|
||||
return -1;
|
||||
@@ -921,14 +914,14 @@ static int nr_ue_process_dci_dl_10(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND */
|
||||
// according to TS 38.213 9.2.3
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, dlsch_pdu->SubcarrierSpacing);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, dlsch_pdu->SubcarrierSpacing);
|
||||
const uint16_t feedback_ti = 1 + dci->pdsch_to_harq_feedback_timing_indicator.val + ntn_ue_koffset;
|
||||
|
||||
if (rnti_type != TYPE_RA_RNTI_ && rnti_type != TYPE_SI_RNTI_) {
|
||||
AssertFatal(feedback_ti > DURATION_RX_TO_TX,
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d).\n",
|
||||
AssertFatal(feedback_ti > GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%ld).\n",
|
||||
feedback_ti,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta));
|
||||
// set the harq status at MAC for feedback
|
||||
const int tpc[] = {-1, 0, 1, 3};
|
||||
set_harq_status(mac,
|
||||
@@ -1266,14 +1259,14 @@ static int nr_ue_process_dci_dl_11(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND */
|
||||
// according to TS 38.213 Table 9.2.3-1
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, dlsch_pdu->SubcarrierSpacing);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, dlsch_pdu->SubcarrierSpacing);
|
||||
const uint16_t feedback_ti = pucch_Config->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0] + ntn_ue_koffset;
|
||||
|
||||
AssertFatal(feedback_ti > DURATION_RX_TO_TX,
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d). Min feedback time set in config "
|
||||
AssertFatal(feedback_ti > GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%ld). Min feedback time set in config "
|
||||
"file (min_rxtxtime).\n",
|
||||
feedback_ti,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta));
|
||||
|
||||
// set the harq status at MAC for feedback
|
||||
const int tpc[] = {-1, 0, 1, 3};
|
||||
@@ -3453,7 +3446,7 @@ static void set_time_alignment(NR_UE_MAC_INST_t *mac, int ta, ta_type_t type, in
|
||||
ul_time_alignment->ta_command = ta;
|
||||
ul_time_alignment->ta_apply = type;
|
||||
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, mac->current_UL_BWP->scs);
|
||||
const int n_slots_frame = nr_slots_per_frame[mac->current_UL_BWP->scs];
|
||||
ul_time_alignment->frame = (frame + (slot + ntn_ue_koffset) / n_slots_frame) % MAX_FRAME_NUMBER;
|
||||
ul_time_alignment->slot = (slot + ntn_ue_koffset) % n_slots_frame;
|
||||
@@ -4108,7 +4101,7 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
|
||||
LOG_E(MAC, "Cannot schedule Msg3. Something wrong in TDA information\n");
|
||||
return;
|
||||
}
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, mac->current_UL_BWP->scs);
|
||||
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, tda_info.k2 + ntn_ue_koffset);
|
||||
|
||||
// TA command
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
|
||||
static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_frame_t slotP);
|
||||
static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UE_MAC_INST_t *mac);
|
||||
static void schedule_ntn_config_command(fapi_nr_dl_config_request_t *dl_config, NR_UE_MAC_INST_t *mac);
|
||||
|
||||
static void nr_ue_fill_phr(NR_UE_MAC_INST_t *mac,
|
||||
NR_SINGLE_ENTRY_PHR_MAC_CE *phr,
|
||||
float P_CMAX,
|
||||
@@ -1266,9 +1268,9 @@ void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger
|
||||
return;
|
||||
}
|
||||
|
||||
AssertFatal(slot_offset > DURATION_RX_TO_TX,
|
||||
"Slot offset between DCI and aperiodic SRS (%d) needs to be higher than DURATION_RX_TO_TX (%d)\n",
|
||||
slot_offset, DURATION_RX_TO_TX);
|
||||
AssertFatal(slot_offset > GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
"Slot offset between DCI and aperiodic SRS (%d) needs to be higher than DURATION_RX_TO_TX (%ld)\n",
|
||||
slot_offset, GET_DURATION_RX_TO_TX(&mac->ntn_ta));
|
||||
int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs];
|
||||
int sched_slot = (slot + slot_offset) % n_slots_frame;
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->tdd_UL_DL_ConfigurationCommon;
|
||||
@@ -1368,6 +1370,11 @@ void nr_ue_dl_scheduler(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info
|
||||
|
||||
if (mac->ul_time_alignment.ta_apply != no_ta)
|
||||
schedule_ta_command(dl_config, mac);
|
||||
|
||||
if (mac->ntn_ta.ntn_params_changed) {
|
||||
mac->ntn_ta.ntn_params_changed = false;
|
||||
schedule_ntn_config_command(dl_config, mac);
|
||||
}
|
||||
|
||||
nr_scheduled_response_t scheduled_response = {.dl_config = dl_config,
|
||||
.module_id = mac->ue_id,
|
||||
@@ -1732,7 +1739,7 @@ static uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size, i
|
||||
// PUSCH scheduler:
|
||||
// - Calculate the slot in which ULSCH should be scheduled. This is current slot + K2,
|
||||
// - where K2 is the offset between the slot in which UL DCI is received and the slot
|
||||
// - in which ULSCH should be scheduled. K2 is configured in RRC configuration.
|
||||
// - in which ULSCH should be scheduled. K2 is configured in RRC configuration.
|
||||
// PUSCH Msg3 scheduler:
|
||||
// - scheduled by RAR UL grant according to 8.3 of TS 38.213
|
||||
// Note: Msg3 tx in the uplink symbols of mixed slot
|
||||
@@ -1772,24 +1779,24 @@ int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac,
|
||||
AssertFatal(1 == 0, "Invalid numerology %i\n", mu);
|
||||
}
|
||||
|
||||
AssertFatal((k2 + delta) > DURATION_RX_TO_TX,
|
||||
"Slot offset (%ld) for Msg3 needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
|
||||
AssertFatal((k2 + delta) > GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
"Slot offset (%ld) for Msg3 needs to be higher than DURATION_RX_TO_TX (%ld). Please set min_rxtxtime at least to %ld in gNB config file or gNBs.[0].min_rxtxtime=%ld via command line.\n",
|
||||
k2,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta));
|
||||
|
||||
*slot_tx = (current_slot + k2 + delta) % nr_slots_per_frame[mu];
|
||||
*frame_tx = (current_frame + (current_slot + k2 + delta) / nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER;
|
||||
|
||||
} else {
|
||||
|
||||
AssertFatal(k2 > DURATION_RX_TO_TX,
|
||||
"Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
|
||||
AssertFatal(k2 > GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
"Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%ld). Please set min_rxtxtime at least to %ld in gNB config file or gNBs.[0].min_rxtxtime=%ld via command line.\n",
|
||||
k2,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta),
|
||||
GET_DURATION_RX_TO_TX(&mac->ntn_ta));
|
||||
|
||||
if (k2 < 0) { // This can happen when a false DCI is received
|
||||
LOG_W(PHY, "%d.%d. Received k2 %ld\n", current_frame, current_slot, k2);
|
||||
@@ -3591,6 +3598,17 @@ static uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
|
||||
return mac_ce_info.num_sdus > 0; // success if we got at least one sdu
|
||||
}
|
||||
|
||||
static void schedule_ntn_config_command(fapi_nr_dl_config_request_t *dl_config, NR_UE_MAC_INST_t *mac)
|
||||
{
|
||||
fapi_nr_dl_ntn_config_command_pdu *ntn_config_command_pdu = &dl_config->dl_config_list[dl_config->number_pdus].ntn_config_command_pdu;
|
||||
ntn_config_command_pdu->cell_specific_k_offset = mac->ntn_ta.cell_specific_k_offset;
|
||||
ntn_config_command_pdu->N_common_ta_adj = mac->ntn_ta.N_common_ta_adj;
|
||||
ntn_config_command_pdu->N_UE_TA_adj = mac->ntn_ta.N_UE_TA_adj;
|
||||
ntn_config_command_pdu->ntn_total_time_advance_ms = (mac->ntn_ta.N_common_ta_adj + mac->ntn_ta.N_UE_TA_adj) * 2;
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_NTN_CONFIG_PARAMS;
|
||||
dl_config->number_pdus += 1;
|
||||
}
|
||||
|
||||
static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UE_MAC_INST_t *mac)
|
||||
{
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->ul_time_alignment;
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "executables/position_interface.h"
|
||||
|
||||
#ifndef CELLULAR
|
||||
#include "RRC/NR/MESSAGES/asn1_msg.h"
|
||||
@@ -165,7 +166,7 @@ static void set_DRB_status(NR_UE_RRC_INST_t *rrc, NR_DRB_Identity_t drb_id, NR_R
|
||||
rrc->status_DRBs[drb_id - 1] = status;
|
||||
}
|
||||
|
||||
static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si)
|
||||
static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, instance_t ue_id, position_t *position)
|
||||
{
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN);
|
||||
|
||||
@@ -241,6 +242,14 @@ static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si)
|
||||
SI_info->SInfo_r17.sib19_validity = true;
|
||||
if (g_log->log_component[NR_RRC].level >= OAILOG_DEBUG)
|
||||
xer_fprint(stdout, &asn_DEF_NR_SIB19_r17, (const void *)typeandinfo->choice.sib19_v1700);
|
||||
|
||||
// allocate memory for position coordinates
|
||||
if (!position)
|
||||
position = CALLOC(1, sizeof(*position));
|
||||
// populate position with position from config file
|
||||
get_position_coordinates(ue_id, position);
|
||||
|
||||
nr_rrc_mac_config_req_sib19_r17(ue_id, position, typeandinfo->choice.sib19_v1700);
|
||||
nr_timer_start(&SI_info->SInfo_r17.sib19_timer);
|
||||
break;
|
||||
default:
|
||||
@@ -386,7 +395,7 @@ static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCRe
|
||||
SEQUENCE_free(&asn_DEF_NR_SystemInformation, si, 1);
|
||||
} else {
|
||||
LOG_I(NR_RRC, "[UE %ld] Decoding dedicatedSystemInformationDelivery\n", rrc->ue_id);
|
||||
nr_decode_SI(SI_info, si);
|
||||
nr_decode_SI(SI_info, si, rrc->ue_id, rrc->position_coordinates);
|
||||
}
|
||||
}
|
||||
if (rec_1530->otherConfig) {
|
||||
@@ -895,7 +904,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc,
|
||||
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
|
||||
LOG_I(NR_RRC, "[UE %ld] Decoding SI\n", rrc->ue_id);
|
||||
NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation;
|
||||
nr_decode_SI(SI_info, si);
|
||||
nr_decode_SI(SI_info, si, rrc->ue_id, rrc->position_coordinates);
|
||||
break;
|
||||
case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
|
||||
default:
|
||||
|
||||
@@ -196,6 +196,8 @@ typedef struct rrcPerNB {
|
||||
NR_RSRP_Range_t s_measure;
|
||||
} rrcPerNB_t;
|
||||
|
||||
/* forward declaration */
|
||||
struct position;
|
||||
typedef struct NR_UE_RRC_INST_s {
|
||||
instance_t ue_id;
|
||||
rrcPerNB_t perNB[NB_CNX_UE];
|
||||
@@ -236,6 +238,8 @@ typedef struct NR_UE_RRC_INST_s {
|
||||
//Sidelink params
|
||||
NR_SL_PreconfigurationNR_r16_t *sl_preconfig;
|
||||
|
||||
struct position *position_coordinates;
|
||||
|
||||
} NR_UE_RRC_INST_t;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user