Commit 2b85c360 authored by Fang-WANG's avatar Fang-WANG

change center freq

parent dc5993be
......@@ -951,6 +951,7 @@ typedef struct
{
uint16_t dl_bandwidth;//Carrier bandwidth for DL in MHz [38.104, sec 5.3.2] Values: 5, 10, 15, 20, 25, 30, 40,50, 60, 70, 80,90,100,200,400
uint32_t dl_frequency; //Absolute frequency of DL point A in KHz [38.104, sec5.2 and 38.211 sec 4.4.4.2] Value: 450000 -> 52600000
uint32_t halfbw; //Absolute frequency of DL point A in KHz [38.104, sec5.2 and 38.211 sec 4.4.4.2] Value: 450000 -> 52600000
uint16_t dl_k0[5];//𝑘_{0}^{𝜇} for each of the numerologies [38.211, sec 5.3.1] Value: 0 ->23699
uint16_t dl_grid_size[5];//Grid size 𝑁_{𝑔𝑟𝑖𝑑}^{𝑠𝑖𝑧𝑒,𝜇} for each of the numerologies [38.211, sec 4.4.2] Value: 0->275 0 = this numerology not used
uint16_t num_tx_ant;//Number of Tx antennas
......
......@@ -94,12 +94,12 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
* in time: by its first slot and its first symbol*/
const nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[d];
LOG_I(PHY,"DCI pdu %d, rnti %x, aggregation %d CCE %d Scrambling_Id %x ScramblingRNTI %x PayloadSizeBits %d\n",d,dci_pdu->RNTI,dci_pdu->AggregationLevel,dci_pdu->CceIndex,dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits);
LOG_D(PHY,"DCI pdu %d, rnti %x, aggregation %d CCE %d Scrambling_Id %x ScramblingRNTI %x PayloadSizeBits %d\n",d,dci_pdu->RNTI,dci_pdu->AggregationLevel,dci_pdu->CceIndex,dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits);
cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
dci_idx = 0;
LOG_I(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart);
LOG_I(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart);
LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
// DMRS length is per OFDM symbol
uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE)
uint32_t encoded_length = dci_pdu->AggregationLevel*108; //2(QPSK)*9(per RB)*6(REG per CCE)
......
......@@ -645,7 +645,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
return((1 + dlsch->max_ldpc_iterations));
} else {
LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for frame nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for frame nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
harq_process->status = SCH_IDLE;
......
......@@ -1467,6 +1467,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp,
uint64_t *dl_Carrier,
uint64_t *ul_Carrier);
void nr_set_carrier_frequencies(NR_DL_FRAME_PARMS *fp, uint64_t dl_carrier);
/*!
\brief This function sets the OAI RF card rx/tx params
......
......@@ -33,6 +33,8 @@
#include "nr_transport_proto_ue.h"
#include "executables/softmodem-common.h"
extern openair0_config_t openair0_cfg[];
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp, uint64_t *dl_carrier, uint64_t *ul_carrier){
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1 || !downlink_frequency[0][0]) {
......@@ -48,6 +50,54 @@ void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp, uint64_t *dl_carrier, uin
}
void nr_set_carrier_frequencies(NR_DL_FRAME_PARMS *fp, uint64_t dl_carrier){
uint8_t mod_id = 0;
uint8_t cc_id = 0;
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[mod_id][cc_id];
int rf_chain = ue->rf_map.chain;
uint64_t ul_carrier;
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1 || !downlink_frequency[0][0]) {
fp->dl_CarrierFreq = dl_carrier;
} else {
downlink_frequency[0][0] = dl_carrier;
}
LOG_I(PHY, "downlink_frequency %ld, dl_carrier %ld\n", downlink_frequency[0][0], dl_carrier);
if (uplink_frequency_offset[0][0])
ul_carrier = dl_carrier + uplink_frequency_offset[0][0];
else
ul_carrier = dl_carrier + fp->ul_CarrierFreq - fp->dl_CarrierFreq;
for (int i = rf_chain; i < rf_chain + 4; i++) {
if (i < openair0_cfg->rx_num_channels)
openair0_cfg->rx_freq[i + rf_chain] = dl_carrier + ue->common_vars.freq_offset;
else
openair0_cfg->rx_freq[i] = 0.0;
if (i < openair0_cfg->tx_num_channels)
openair0_cfg->tx_freq[i] = ul_carrier + ue->common_vars.freq_offset;
else
openair0_cfg->tx_freq[i] = 0.0;
if (i < openair0_cfg->rx_num_channels) {
LOG_I(PHY, "new HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n",
i,
rf_chain,
openair0_cfg->tx_gain[i],
openair0_cfg->rx_gain[i],
openair0_cfg->tx_freq[i],
openair0_cfg->rx_freq[i]);
}
ue->rfdevice.trx_set_freq_func(&ue->rfdevice,&openair0_cfg[0],0);
}
}
void nr_rf_card_config(openair0_config_t *openair0_cfg,
double rx_gain_offset,
uint64_t ul_carrier,
......
......@@ -40,6 +40,8 @@
#include "PHY/defs_nr_UE.h"
#include "PHY/impl_defs_nr.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH", "SI_DLSCH", "P_DLSCH"};
......@@ -269,12 +271,45 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){
NR_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[0][0]->frame_parms;
uint64_t centreFreq;
uint8_t kssb;
fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config;
int freq_changed = 0;
//if (phy_config->config_req.ssb_table.ssb_subcarrier_offset != nrUE_config->ssb_table.ssb_subcarrier_offset)
{
kssb = nrUE_config->ssb_table.ssb_subcarrier_offset;
LOG_I(PHY, "save the kssb %d\n", kssb);
}
//else
{
// kssb = phy_config->config_req.ssb_table.ssb_subcarrier_offset;
}
if (phy_config->config_req.ssb_table.ssb_offset_point_a != nrUE_config->ssb_table.ssb_offset_point_a)
{
freq_changed = 1;
LOG_I(PHY, "dlfrequency %ld %ld, pointA %d %d, ssb offset %d %d\n",
phy_config->config_req.carrier_config.dl_frequency, nrUE_config->carrier_config.dl_frequency,
phy_config->config_req.ssb_table.ssb_offset_point_a, nrUE_config->ssb_table.ssb_offset_point_a,
phy_config->config_req.ssb_table.ssb_subcarrier_offset, nrUE_config->ssb_table.ssb_subcarrier_offset);
}
if(phy_config != NULL) {
memcpy(nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t));
if (PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->UE_mode[0] == NOT_SYNCHED)
PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->UE_mode[0] = PRACH;
}
if (freq_changed)
{
nrUE_config->ssb_table.ssb_subcarrier_offset = kssb;
centreFreq = phy_config->config_req.carrier_config.dl_frequency + phy_config->config_req.carrier_config.halfbw + nrUE_config->ssb_table.ssb_subcarrier_offset * 15;
nr_set_carrier_frequencies(fp, centreFreq);
}
return 0;
}
......
......@@ -363,7 +363,7 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
if (ret==0) {
LOG_I(PHY,"[UE %d] frame %d, nr_slot_rx %d, OK decoding PBCH!\n",
LOG_D(PHY,"[UE %d] frame %d, nr_slot_rx %d, OK decoding PBCH!\n",
ue->Mod_id,frame_rx, nr_slot_rx);
ue->pbch_vars[gNB_id]->pdu_errors_conseq = 0;
......
......@@ -3396,7 +3396,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
break;
}
LOG_I(MAC,"Coreset0: index_4msb=%d, num_rbs=%d, num_symb=%d, rb_offset=%d\n",
LOG_D(MAC,"Coreset0: index_4msb=%d, num_rbs=%d, num_symb=%d, rb_offset=%d\n",
index_4msb,type0_PDCCH_CSS_config->num_rbs,type0_PDCCH_CSS_config->num_symbols,type0_PDCCH_CSS_config->rb_offset );
AssertFatal(type0_PDCCH_CSS_config->num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined");
......
......@@ -337,8 +337,18 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
*scc_SIB->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR);
cfg->carrier_config.dl_frequency = downlink_frequency[0][0] - (10+scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA)*(15<<scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing);
cfg->carrier_config.dl_frequency = downlink_frequency[0][0] -
(10+scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA/2)*(15<<scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing)*12;
LOG_I(PHY, "downlink_frequency old : %ld, new : %ld\n", downlink_frequency[0][0], cfg->carrier_config.dl_frequency);
cfg->carrier_config.halfbw = (15<<scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing)
* scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth
* 6;
cfg->ssb_table.ssb_subcarrier_offset = 0;
// shoule take consider the ssb offset at the end.
for (i=0; i<5; i++) {
if (i==scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
cfg->carrier_config.dl_grid_size[i] = scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
......@@ -390,11 +400,18 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
// SSB Table config
cfg->ssb_table.ssb_offset_point_a = scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA;
cfg->ssb_table.ssb_offset_point_a = scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA / 2;
cfg->ssb_table.ssb_period = scc_SIB->ssb_PeriodicityServingCell;
//cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
LOG_I(PHY, "in SIB, ssb_offset_point_a %d, ssb_subcarrier_offset %d\n", cfg->ssb_table.ssb_offset_point_a, cfg->ssb_table.ssb_subcarrier_offset);
LOG_I(PHY, "in SIB, addr %p ssb_offset_point_a %d, ssb_subcarrier_offset %d, bw %d, sibscs %d, freqPointA %ld, bw %d\n", cfg,
cfg->ssb_table.ssb_offset_point_a, cfg->ssb_table.ssb_subcarrier_offset,
scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
cfg->carrier_config.dl_frequency,
scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth
);
AssertFatal(scc_SIB->ssb_PositionsInBurst.groupPresence==NULL, "Cannot handle more than 8 SSBs for now (%x.%x.%x.%x.%x.%x.%x.%x)\n",
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[0],
scc_SIB->ssb_PositionsInBurst.groupPresence->buf[1],
......@@ -699,9 +716,9 @@ int nr_rrc_mac_config_req_ue(
mac->mib = mibP; // update by every reception
mac->phy_config.Mod_id = module_id;
mac->phy_config.CC_id = cc_idP;
mac->phy_config.config_req.ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
// mac->phy_config.config_req.ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
mac->phy_config.config_req.tdd_table.tdd_period_in_slots=5<<get_softmodem_params()->numerology;
mac->phy_config.config_req.ssb_table.ssb_offset_point_a = (N_RB_DL-20)>>1;
//mac->phy_config.config_req.ssb_table.ssb_offset_point_a = (N_RB_DL-20)>>1;
}
AssertFatal(scell_group_config == NULL || cell_group_config == NULL,
"both scell_group_config and cell_group_config cannot be non-NULL\n");
......@@ -711,12 +728,15 @@ int nr_rrc_mac_config_req_ue(
mac->scc_SIB=sccP;
LOG_I(MAC,"Keeping ServingCellConfigCommonSIB\n");
config_common_ue(mac,module_id,cc_idP);
int num_slots_ul = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
if (mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols>0) num_slots_ul++;
LOG_I(MAC, "Initializing ul_config_request. num_slots_ul = %d\n", num_slots_ul);
mac->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t));
// Setup the SSB to Rach Occasions mapping according to the config
build_ssb_to_ro_map(mac);//->scc, mac->phy_config.config_req.cell_config.frame_duplex_type);
mac->if_module->phy_config_request(&mac->phy_config);
mac->common_configuration_complete = 1;
}
......
......@@ -173,7 +173,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
ssb_index,
ssb_offset_point_a);
LOG_I(MAC,"in mib : ssb_start_subcarrier %d, ssb_subcarrier_offset %d, ssb_offset_point_a %d\n",
LOG_D(MAC,"in mib : ssb_start_subcarrier %d, ssb_subcarrier_offset %d, ssb_offset_point_a %d\n",
ssb_start_subcarrier, ssb_subcarrier_offset, ssb_offset_point_a );
mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c;
......
......@@ -353,7 +353,7 @@ void schedule_control_sib1(module_id_t module_id,
const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs;
int rbStart = 0; //type0_PDCCH_CSS_config->cset_start_rb;
LOG_I(PHY, "cset_start_rb is %d, ccdindex %d\n", type0_PDCCH_CSS_config->cset_start_rb, gNB_mac->sched_ctrlCommon->cce_index);
LOG_D(PHY, "cset_start_rb is %d, ccdindex %d\n", type0_PDCCH_CSS_config->cset_start_rb, gNB_mac->sched_ctrlCommon->cce_index);
int startSymbolIndex = 0;
int nrOfSymbols = 0;
......@@ -394,8 +394,8 @@ void schedule_control_sib1(module_id_t module_id,
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
LOG_I(MAC, "rbSize = %i, %d, bwp %d %d\n", rbStart, gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize, type0_PDCCH_CSS_config->cset_start_rb, bwpSize);
LOG_I(MAC,"TBS = %i, totalbyte %d\n", TBS, gNB_mac->sched_ctrlCommon->num_total_bytes);
LOG_D(MAC, "rbSize = %i, %d, bwp %d %d\n", rbStart, gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize, type0_PDCCH_CSS_config->cset_start_rb, bwpSize);
LOG_D(MAC,"TBS = %i, totalbyte %d\n", TBS, gNB_mac->sched_ctrlCommon->num_total_bytes);
LOG_D(MAC,"dmrs_length %d\n",dmrs_length);
LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS);
LOG_D(MAC,"mappingtype = %d\n", mappingtype);
......@@ -537,7 +537,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix);
LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex);
LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols);
for(int n=0;n<6;n++) LOG_I(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]);
for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]);
LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType);
LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize);
LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize);
......@@ -585,7 +585,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
(type0_PDCCH_CSS_config->num_rbs > 0) &&
(type0_PDCCH_CSS_config->active == true)) {
LOG_I(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index);
LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index);
// Get SIB1
uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8];
......
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