Merge remote-tracking branch 'origin/NR_UE_RRC_Reestablishment' into integration_2024_w11
This commit is contained in:
@@ -376,6 +376,115 @@ int get_nb_periods_per_frame(uint8_t tdd_period)
|
||||
return nb_periods_per_frame;
|
||||
}
|
||||
|
||||
void get_delta_arfcn(int i, uint32_t nrarfcn, uint64_t N_OFFs)
|
||||
{
|
||||
uint32_t delta_arfcn = nrarfcn - N_OFFs;
|
||||
|
||||
if(delta_arfcn % (nr_bandtable[i].step_size) != 0)
|
||||
LOG_E(NR_MAC, "nrarfcn %u is not on the channel raster for step size %lu\n", nrarfcn, nr_bandtable[i].step_size);
|
||||
}
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw)
|
||||
{
|
||||
uint64_t dl_CarrierFreq_by_1k = dl_CarrierFreq / 1000;
|
||||
int bw_kHz = bw / 1000;
|
||||
uint32_t nrarfcn;
|
||||
int i = get_nr_table_idx(nr_bandP, scs_index);
|
||||
|
||||
LOG_I(NR_MAC,"Searching for nr band %d DL Carrier frequency %llu bw %u\n", nr_bandP, (long long unsigned int)dl_CarrierFreq,bw);
|
||||
|
||||
AssertFatal(dl_CarrierFreq_by_1k >= nr_bandtable[i].dl_min,
|
||||
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
|
||||
nr_bandP, bw, (long long unsigned int)dl_CarrierFreq_by_1k,
|
||||
(long long unsigned int)nr_bandtable[i].dl_min);
|
||||
AssertFatal(dl_CarrierFreq_by_1k <= (nr_bandtable[i].dl_max - bw_kHz/2),
|
||||
"Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu\n",
|
||||
nr_bandP, (long long unsigned int)dl_CarrierFreq,bw, (long long unsigned int)dl_CarrierFreq_by_1k,
|
||||
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz/2));
|
||||
|
||||
int deltaFglobal = 60;
|
||||
uint32_t N_REF_Offs = 2016667;
|
||||
uint64_t F_REF_Offs_khz = 24250080;
|
||||
|
||||
if (dl_CarrierFreq < 24.25e9) {
|
||||
deltaFglobal = 15;
|
||||
N_REF_Offs = 600000;
|
||||
F_REF_Offs_khz = 3000000;
|
||||
}
|
||||
if (dl_CarrierFreq < 3e9) {
|
||||
deltaFglobal = 5;
|
||||
N_REF_Offs = 0;
|
||||
F_REF_Offs_khz = 0;
|
||||
}
|
||||
|
||||
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
|
||||
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
|
||||
nrarfcn = (((dl_CarrierFreq_by_1k - F_REF_Offs_khz) / deltaFglobal) + N_REF_Offs);
|
||||
//get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
|
||||
|
||||
return nrarfcn;
|
||||
}
|
||||
|
||||
// This function computes the RF reference frequency from the NR-ARFCN according to 5.4.2.1 of 3GPP TS 38.104
|
||||
// this function applies to both DL and UL
|
||||
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t nrarfcn)
|
||||
{
|
||||
int deltaFglobal = 5;
|
||||
uint32_t N_REF_Offs = 0;
|
||||
uint64_t F_REF_Offs_khz = 0;
|
||||
uint64_t N_OFFs, frequency, freq_min;
|
||||
int i = get_nr_table_idx(nr_bandP, scs_index);
|
||||
|
||||
if (nrarfcn > 599999 && nrarfcn < 2016667) {
|
||||
deltaFglobal = 15;
|
||||
N_REF_Offs = 600000;
|
||||
F_REF_Offs_khz = 3000000;
|
||||
}
|
||||
if (nrarfcn > 2016666 && nrarfcn < 3279166) {
|
||||
deltaFglobal = 60;
|
||||
N_REF_Offs = 2016667;
|
||||
F_REF_Offs_khz = 24250080;
|
||||
}
|
||||
|
||||
int32_t delta_duplex = get_delta_duplex(nr_bandP, scs_index);
|
||||
|
||||
if (delta_duplex <= 0){ // DL band >= UL band
|
||||
if (nrarfcn >= nr_bandtable[i].N_OFFs_DL){ // is TDD of FDD DL
|
||||
N_OFFs = nr_bandtable[i].N_OFFs_DL;
|
||||
freq_min = nr_bandtable[i].dl_min;
|
||||
} else {// is FDD UL
|
||||
N_OFFs = nr_bandtable[i].N_OFFs_DL + delta_duplex/deltaFglobal;
|
||||
freq_min = nr_bandtable[i].ul_min;
|
||||
}
|
||||
} else { // UL band > DL band
|
||||
if (nrarfcn >= nr_bandtable[i].N_OFFs_DL + delta_duplex / deltaFglobal){ // is FDD UL
|
||||
N_OFFs = nr_bandtable[i].N_OFFs_DL + delta_duplex / deltaFglobal;
|
||||
freq_min = nr_bandtable[i].ul_min;
|
||||
} else { // is FDD DL
|
||||
N_OFFs = nr_bandtable[i].N_OFFs_DL;
|
||||
freq_min = nr_bandtable[i].dl_min;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC, "Frequency from NR-ARFCN for N_OFFs %lu, duplex spacing %d KHz, deltaFglobal %d KHz\n",
|
||||
N_OFFs,
|
||||
delta_duplex,
|
||||
deltaFglobal);
|
||||
|
||||
AssertFatal(nrarfcn >= N_OFFs,"nrarfcn %u < N_OFFs[%d] %llu\n", nrarfcn, nr_bandtable[i].band, (long long unsigned int)N_OFFs);
|
||||
get_delta_arfcn(i, nrarfcn, N_OFFs);
|
||||
|
||||
frequency = 1000 * (F_REF_Offs_khz + (nrarfcn - N_REF_Offs) * deltaFglobal);
|
||||
|
||||
LOG_D(NR_MAC, "Computing frequency (nrarfcn %llu => %llu KHz (freq_min %llu KHz, NR band %d N_OFFs %llu))\n",
|
||||
(unsigned long long)nrarfcn,
|
||||
(unsigned long long)frequency/1000,
|
||||
(unsigned long long)freq_min,
|
||||
nr_bandP,
|
||||
(unsigned long long)N_OFFs);
|
||||
|
||||
return frequency;
|
||||
}
|
||||
|
||||
int get_first_ul_slot(int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSymbols)
|
||||
{
|
||||
|
||||
@@ -168,7 +168,8 @@ static inline int get_num_dmrs(uint16_t dmrs_mask ) {
|
||||
}
|
||||
|
||||
uint64_t reverse_bits(uint64_t in, int n_bits);
|
||||
|
||||
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
|
||||
int get_first_ul_slot(int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUplinkSymbols);
|
||||
int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs);
|
||||
int get_SLIV(uint8_t S, uint8_t L);
|
||||
|
||||
Reference in New Issue
Block a user