Commit 45ec6a9d authored by francescomani's avatar francescomani

get SSB ARFCN at RRC UE

parent 4b7bfae5
...@@ -376,6 +376,115 @@ int get_nb_periods_per_frame(uint8_t tdd_period) ...@@ -376,6 +376,115 @@ int get_nb_periods_per_frame(uint8_t tdd_period)
return nb_periods_per_frame; 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) 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 ) { ...@@ -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 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 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 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); int get_SLIV(uint8_t S, uint8_t L);
......
...@@ -132,6 +132,7 @@ typedef struct { ...@@ -132,6 +132,7 @@ typedef struct {
uint16_t cell_id; uint16_t cell_id;
uint16_t ssb_start_subcarrier; uint16_t ssb_start_subcarrier;
short rsrp_dBm; short rsrp_dBm;
long arfcn;
rlm_t radiolink_monitoring; // -1 no monitoring, 0 out_of_sync, 1 in_sync rlm_t radiolink_monitoring; // -1 no monitoring, 0 out_of_sync, 1 in_sync
} fapi_nr_ssb_pdu_t; } fapi_nr_ssb_pdu_t;
......
...@@ -158,15 +158,7 @@ int nr_pbch_detection(const UE_nr_rxtx_proc_t *proc, ...@@ -158,15 +158,7 @@ int nr_pbch_detection(const UE_nr_rxtx_proc_t *proc,
stop_meas(&ue->dlsch_channel_estimation_stats); stop_meas(&ue->dlsch_channel_estimation_stats);
fapiPbch_t result = {0}; fapiPbch_t result = {0};
ret = nr_rx_pbch(ue, ret = nr_rx_pbch(ue, proc, estimateSz, dl_ch_estimates, frame_parms, temp_ptr->i_ssb, &result, rxdataF);
proc,
estimateSz,
dl_ch_estimates,
frame_parms,
temp_ptr->i_ssb,
SISO,
&result,
rxdataF);
if (DUMP_PBCH_CH_ESTIMATES && (ret == 0)) { if (DUMP_PBCH_CH_ESTIMATES && (ret == 0)) {
write_output("pbch_ch_estimates.m", "pbch_ch_estimates", dl_ch_estimates, frame_parms->nb_antennas_rx*estimateSz, 1, 1); write_output("pbch_ch_estimates.m", "pbch_ch_estimates", dl_ch_estimates, frame_parms->nb_antennas_rx*estimateSz, 1, 1);
......
...@@ -361,7 +361,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -361,7 +361,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
struct complex16 dl_ch_estimates[][estimateSz], struct complex16 dl_ch_estimates[][estimateSz],
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
uint8_t i_ssb, uint8_t i_ssb,
MIMO_mode_t mimo_mode,
fapiPbch_t *result, fapiPbch_t *result,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
{ {
...@@ -414,7 +413,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -414,7 +413,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
symbol_offset, symbol_offset,
frame_parms); frame_parms);
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
LOG_I(PHY,"[PHY] PBCH Symbol %d ofdm size %d\n",symbol, frame_parms->ofdm_symbol_size ); LOG_I(PHY,"[PHY] PBCH Symbol %d ofdm size %d\n",symbol, frame_parms->ofdm_symbol_size);
LOG_I(PHY,"[PHY] PBCH starting channel_level\n"); LOG_I(PHY,"[PHY] PBCH starting channel_level\n");
#endif #endif
...@@ -441,14 +440,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -441,14 +440,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
rxdataF_comp, rxdataF_comp,
symbol);*/ symbol);*/
/*
if (mimo_mode == ALAMOUTI) {
nr_pbch_alamouti(frame_parms,rxdataF_comp,symbol);
} else if (mimo_mode != SISO) {
LOG_I(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
return(-1);
}
*/
int nb=symbol==2 ? 144 : 360; int nb=symbol==2 ? 144 : 360;
nr_pbch_quantize(pbch_e_rx+pbch_e_rx_idx, nr_pbch_quantize(pbch_e_rx+pbch_e_rx_idx,
(short *)rxdataF_comp[0], (short *)rxdataF_comp[0],
......
...@@ -293,7 +293,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -293,7 +293,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
struct complex16 dl_ch_estimates[][estimateSz], struct complex16 dl_ch_estimates[][estimateSz],
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
uint8_t i_ssb, uint8_t i_ssb,
MIMO_mode_t mimo_mode,
fapiPbch_t *result, fapiPbch_t *result,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]); c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
......
...@@ -108,6 +108,14 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, ...@@ -108,6 +108,14 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
} }
} }
static uint32_t get_ssb_arfcn(NR_DL_FRAME_PARMS *frame_parms)
{
uint32_t band_size_hz = frame_parms->N_RB_DL * 12 * frame_parms->subcarrier_spacing;
int ssb_center_sc = frame_parms->ssb_start_subcarrier + 120; // ssb is 20 PRBs -> 240 sub-carriers
uint64_t ssb_freq = frame_parms->dl_CarrierFreq - (band_size_hz / 2) + frame_parms->subcarrier_spacing * ssb_center_sc;
return to_nrarfcn(frame_parms->nr_band, ssb_freq, frame_parms->numerology_index, band_size_hz);
}
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
uint8_t pdu_type, uint8_t pdu_type,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
...@@ -167,6 +175,7 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, ...@@ -167,6 +175,7 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
ssb_pdu->cell_id = frame_parms->Nid_cell; ssb_pdu->cell_id = frame_parms->Nid_cell;
ssb_pdu->ssb_start_subcarrier = frame_parms->ssb_start_subcarrier; ssb_pdu->ssb_start_subcarrier = frame_parms->ssb_start_subcarrier;
ssb_pdu->rsrp_dBm = ue->measurements.ssb_rsrp_dBm[frame_parms->ssb_index]; ssb_pdu->rsrp_dBm = ue->measurements.ssb_rsrp_dBm[frame_parms->ssb_index];
ssb_pdu->arfcn = get_ssb_arfcn(frame_parms);
ssb_pdu->radiolink_monitoring = RLM_in_sync; // TODO to be removed from here ssb_pdu->radiolink_monitoring = RLM_in_sync; // TODO to be removed from here
ssb_pdu->decoded_pdu = true; ssb_pdu->decoded_pdu = true;
} }
...@@ -383,7 +392,6 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue, ...@@ -383,7 +392,6 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
dl_ch_estimates, dl_ch_estimates,
&ue->frame_parms, &ue->frame_parms,
(ue->frame_parms.ssb_index)&7, (ue->frame_parms.ssb_index)&7,
SISO,
&result, &result,
rxdataF); rxdataF);
......
...@@ -49,6 +49,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, ...@@ -49,6 +49,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
const uint32_t cellid, const uint32_t cellid,
const long arfcn,
const channel_t channel, const channel_t channel,
const uint8_t* pduP, const uint8_t* pduP,
const sdu_size_t pdu_len) { return 0; } const sdu_size_t pdu_len) { return 0; }
......
...@@ -796,15 +796,7 @@ int main(int argc, char **argv) ...@@ -796,15 +796,7 @@ int main(int argc, char **argv)
} }
fapiPbch_t result; fapiPbch_t result;
ret = nr_rx_pbch(UE, ret = nr_rx_pbch(UE, &proc, estimateSz, dl_ch_estimates, frame_parms, ssb_index % 8, &result, rxdataF);
&proc,
estimateSz,
dl_ch_estimates,
frame_parms,
ssb_index%8,
SISO,
&result,
rxdataF);
if (ret==0) { if (ret==0) {
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically //UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
......
...@@ -120,6 +120,7 @@ typedef struct NRRrcMacBcchDataInd_s { ...@@ -120,6 +120,7 @@ typedef struct NRRrcMacBcchDataInd_s {
uint8_t rsrq; uint8_t rsrq;
uint8_t rsrp; uint8_t rsrp;
uint32_t phycellid; uint32_t phycellid;
long ssb_arfcn;
} NRRrcMacBcchDataInd; } NRRrcMacBcchDataInd;
typedef struct NRRrcMacSBcchDataInd_s { typedef struct NRRrcMacSBcchDataInd_s {
......
...@@ -2248,118 +2248,6 @@ static const uint16_t table_7_3_1_1_2_32[3][15] = { ...@@ -2248,118 +2248,6 @@ static const uint16_t table_7_3_1_1_2_32[3][15] = {
{0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}; };
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;
}
void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
int x_overhead, int x_overhead,
uint8_t numdmrscdmgroupnodata, uint8_t numdmrscdmgroupnodata,
......
...@@ -55,10 +55,6 @@ uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti); ...@@ -55,10 +55,6 @@ uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti);
uint8_t get_BG(uint32_t A, uint16_t R); uint8_t get_BG(uint32_t A, uint16_t R);
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);
int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config, int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,
int dci_format, int dci_format,
int dmrs_TypeA_Position, int dmrs_TypeA_Position,
......
...@@ -267,7 +267,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac, ...@@ -267,7 +267,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac,
{ {
if(ack_nack) { if(ack_nack) {
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, mac->physCellId, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
mac->get_sib1 = false; mac->get_sib1 = false;
mac->get_otherSI = false; mac->get_otherSI = false;
} }
......
...@@ -1039,6 +1039,7 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac, ...@@ -1039,6 +1039,7 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac,
uint32_t ssb_index, uint32_t ssb_index,
uint32_t ssb_length, uint32_t ssb_length,
uint16_t ssb_start_subcarrier, uint16_t ssb_start_subcarrier,
long ssb_arfcn,
uint16_t cell_id) uint16_t cell_id)
{ {
mac->mib_ssb = ssb_index; mac->mib_ssb = ssb_index;
...@@ -1049,7 +1050,7 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac, ...@@ -1049,7 +1050,7 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac,
else else
mac->frequency_range = FR1; mac->frequency_range = FR1;
// fixed 3 bytes MIB PDU // fixed 3 bytes MIB PDU
nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, cell_id, NR_BCCH_BCH, (uint8_t *) pduP, 3); nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, cell_id, ssb_arfcn, NR_BCCH_BCH, (uint8_t *) pduP, 3);
return 0; return 0;
} }
...@@ -1228,6 +1229,7 @@ static uint32_t nr_ue_dl_processing(nr_downlink_indication_t *dl_info) ...@@ -1228,6 +1229,7 @@ static uint32_t nr_ue_dl_processing(nr_downlink_indication_t *dl_info)
rx_indication_body.ssb_pdu.ssb_index, rx_indication_body.ssb_pdu.ssb_index,
rx_indication_body.ssb_pdu.ssb_length, rx_indication_body.ssb_pdu.ssb_length,
rx_indication_body.ssb_pdu.ssb_start_subcarrier, rx_indication_body.ssb_pdu.ssb_start_subcarrier,
rx_indication_body.ssb_pdu.arfcn,
rx_indication_body.ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB; rx_indication_body.ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB;
} }
break; break;
......
...@@ -56,6 +56,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, ...@@ -56,6 +56,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
const uint32_t cellid, const uint32_t cellid,
const long arfcn,
const channel_t channel, const channel_t channel,
const uint8_t* pduP, const uint8_t* pduP,
const sdu_size_t pdu_len) const sdu_size_t pdu_len)
...@@ -87,6 +88,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, ...@@ -87,6 +88,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index; NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
NR_RRC_MAC_BCCH_DATA_IND (message_p).phycellid = cellid; NR_RRC_MAC_BCCH_DATA_IND (message_p).phycellid = cellid;
NR_RRC_MAC_BCCH_DATA_IND (message_p).ssb_arfcn = arfcn;
NR_RRC_MAC_BCCH_DATA_IND (message_p).is_bch = (channel == NR_BCCH_BCH); NR_RRC_MAC_BCCH_DATA_IND (message_p).is_bch = (channel == NR_BCCH_BCH);
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
} }
......
...@@ -406,11 +406,13 @@ int check_si_status(NR_UE_RRC_SI_INFO *SI_info) ...@@ -406,11 +406,13 @@ int check_si_status(NR_UE_RRC_SI_INFO *SI_info)
static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc, static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc,
const uint8_t gNB_index, const uint8_t gNB_index,
const uint32_t phycellid, const uint32_t phycellid,
const long ssb_arfcn,
uint8_t *const bufferP, uint8_t *const bufferP,
const uint8_t buffer_len) const uint8_t buffer_len)
{ {
NR_BCCH_BCH_Message_t *bcch_message = NULL; NR_BCCH_BCH_Message_t *bcch_message = NULL;
rrc->phyCellID = phycellid; rrc->phyCellID = phycellid;
rrc->arfcn_ssb = ssb_arfcn;
asn_dec_rval_t dec_rval = uper_decode_complete(NULL, asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_BCH_Message, &asn_DEF_NR_BCCH_BCH_Message,
...@@ -776,6 +778,11 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, NR_UE_RRC_INST_t *rrc, NR ...@@ -776,6 +778,11 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, NR_UE_RRC_INST_t *rrc, NR
if(spCellConfig != NULL) { if(spCellConfig != NULL) {
if (spCellConfig->reconfigurationWithSync != NULL) { if (spCellConfig->reconfigurationWithSync != NULL) {
NR_ReconfigurationWithSync_t *reconfigurationWithSync = spCellConfig->reconfigurationWithSync; NR_ReconfigurationWithSync_t *reconfigurationWithSync = spCellConfig->reconfigurationWithSync;
if (reconfigurationWithSync->spCellConfigCommon &&
reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon &&
reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL &&
reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB)
rrc->arfcn_ssb = *reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB;
// perform Reconfiguration with sync according to 5.3.5.5.2 // perform Reconfiguration with sync according to 5.3.5.5.2
if (!rrc->as_security_activated && rrc->nrRrcState != RRC_STATE_IDLE_NR) { if (!rrc->as_security_activated && rrc->nrRrcState != RRC_STATE_IDLE_NR) {
// perform the actions upon going to RRC_IDLE as specified in 5.3.11 // perform the actions upon going to RRC_IDLE as specified in 5.3.11
...@@ -1361,9 +1368,7 @@ static void nr_rrc_ue_process_rrcReestablishment(NR_UE_RRC_INST_t *rrc, ...@@ -1361,9 +1368,7 @@ static void nr_rrc_ue_process_rrcReestablishment(NR_UE_RRC_INST_t *rrc,
// int nh = rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount; // int nh = rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount;
// update the K gNB key based on the current K gNB key or the NH, using the stored nextHopChainingCount value // update the K gNB key based on the current K gNB key or the NH, using the stored nextHopChainingCount value
/* TODO: retrieve absoluteFrequencySSB correctly */ nr_derive_key_ng_ran_star(rrc->phyCellID, rrc->arfcn_ssb, rrc->kgnb, rrc->kgnb);
int absoluteFrequencySSB = 621312;
nr_derive_key_ng_ran_star(rrc->phyCellID, absoluteFrequencySSB, rrc->kgnb, rrc->kgnb);
// derive the K RRCenc and K UPenc keys associated with the previously configured cipheringAlgorithm // derive the K RRCenc and K UPenc keys associated with the previously configured cipheringAlgorithm
// derive the K RRCint and K UPint keys associated with the previously configured integrityProtAlgorithm // derive the K RRCint and K UPint keys associated with the previously configured integrityProtAlgorithm
...@@ -1567,7 +1572,7 @@ void *rrc_nrue(void *notUsed) ...@@ -1567,7 +1572,7 @@ void *rrc_nrue(void *notUsed)
LOG_D(NR_RRC, "[UE %ld] Received %s: gNB %d\n", rrc->ue_id, ITTI_MSG_NAME(msg_p), NR_RRC_MAC_BCCH_DATA_IND(msg_p).gnb_index); LOG_D(NR_RRC, "[UE %ld] Received %s: gNB %d\n", rrc->ue_id, ITTI_MSG_NAME(msg_p), NR_RRC_MAC_BCCH_DATA_IND(msg_p).gnb_index);
NRRrcMacBcchDataInd *bcch = &NR_RRC_MAC_BCCH_DATA_IND(msg_p); NRRrcMacBcchDataInd *bcch = &NR_RRC_MAC_BCCH_DATA_IND(msg_p);
if (bcch->is_bch) if (bcch->is_bch)
nr_rrc_ue_decode_NR_BCCH_BCH_Message(rrc, bcch->gnb_index, bcch->phycellid, bcch->sdu, bcch->sdu_size); nr_rrc_ue_decode_NR_BCCH_BCH_Message(rrc, bcch->gnb_index, bcch->phycellid, bcch->ssb_arfcn, bcch->sdu, bcch->sdu_size);
else else
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(rrc, bcch->gnb_index, bcch->sdu, bcch->sdu_size, bcch->rsrq, bcch->rsrp); nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(rrc, bcch->gnb_index, bcch->sdu, bcch->sdu_size, bcch->rsrq, bcch->rsrp);
break; break;
......
...@@ -192,6 +192,7 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -192,6 +192,7 @@ typedef struct NR_UE_RRC_INST_s {
char *uecap_file; char *uecap_file;
rnti_t rnti; rnti_t rnti;
uint32_t phyCellID; uint32_t phyCellID;
long arfcn_ssb;
OAI_NR_UECapability_t UECap; OAI_NR_UECapability_t UECap;
NR_UE_Timers_Constants_t timers_and_constants; NR_UE_Timers_Constants_t timers_and_constants;
......
...@@ -74,6 +74,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, ...@@ -74,6 +74,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
const uint32_t cellid, const uint32_t cellid,
const long arfcn,
const channel_t channel, const channel_t channel,
const uint8_t* pduP, const uint8_t* pduP,
const sdu_size_t pdu_len); const sdu_size_t pdu_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment