Commit da324694 authored by Fang-WANG's avatar Fang-WANG

add 100M changes -- not ok

parent 157e247e
......@@ -125,7 +125,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) {
/* TS 38.214 ch. 6.1.2.2.2 - Resource allocation type 1 for DL and UL */
int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) {
AssertFatal(NPRB>0 && (NPRB + RBstart <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d) for BWPsize %d\n",NPRB,RBstart,BWPsize);
AssertFatal(NPRB>0 && (NPRB <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d) for BWPsize %d\n",NPRB,RBstart,BWPsize);
if (NPRB <= 1+(BWPsize>>1)) return(BWPsize*(NPRB-1)+RBstart);
else return(BWPsize*(BWPsize+1-NPRB) + (BWPsize-1-RBstart));
......
......@@ -139,6 +139,9 @@ extern int sync_var;
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern int point_a_15khz;
extern int kssb_15khz;
extern int rx_input_level_dBm;
extern uint64_t num_missed_slots; // counter for the number of missed slots
......
......@@ -112,6 +112,9 @@ int8_t threequarter_fs=0;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int point_a_15khz;
int kssb_15khz;
//Temp fix for inexistent NR upper layer
unsigned char NB_gNB_INST = 1;
......
......@@ -128,6 +128,9 @@ int dumpframe = 0;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int rx_input_level_dBm;
int point_a_15khz;
int kssb_15khz;
#if MAX_NUM_CCs == 1
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
......@@ -492,7 +495,10 @@ int main( int argc, char **argv ) {
nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000;
nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000;
nrUE_config->cell_config.frame_duplex_type = TDD;
nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1;
nrUE_config->ssb_table.ssb_offset_point_a = point_a_15khz>>1; // used as 30kHZ //(UE[CC_id]->frame_parms.N_RB_DL - 20)>>1;
nrUE_config->ssb_table.ssb_subcarrier_offset = kssb_15khz; // used as 15kHZ
LOG_I(PHY, "freq %d %d\n", downlink_frequency[0][0]/1000, nrUE_config->carrier_config.dl_frequency);
}
......
......@@ -138,6 +138,8 @@ extern int usrp_tx_thread;
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:3619200000, TYPE_UINT64, 0}, \
{"pointA" , CONFIG_HLP_DLF, 0, iptr:&point_a_15khz, defintval:86, TYPE_INT, 0}, \
{"kssb" , CONFIG_HLP_DLF, 0, iptr:&kssb_15khz, defintval:0, TYPE_INT, 0}, \
{"CO" , CONFIG_HLP_ULF, 0, iptr:&(uplink_frequency_offset[0][0]), defintval:0, TYPE_INT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
......@@ -259,6 +261,8 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
extern void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern int point_a_15khz;
extern int kssb_15khz;
extern int usrp_tx_thread;
extern uint16_t sl_ahead;
extern uint16_t sf_ahead;
......
......@@ -954,6 +954,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;
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
......
......@@ -314,9 +314,16 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
uint8_t sco = 0;
if (((fp->freq_range == nr_FR1) && (config->ssb_table.ssb_subcarrier_offset<24)) ||
((fp->freq_range == nr_FR2) && (config->ssb_table.ssb_subcarrier_offset<12)) )
sco = config->ssb_table.ssb_subcarrier_offset;
sco = config->ssb_table.ssb_subcarrier_offset; // counted by 15khz
fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco);
fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco/2);
LOG_I(PHY, "ue init sco %d, ssb_subcarrier_offset %d, ssb_offset_point_a %d, ssb_start_subcarrier %d, ofdmsize %d\n",
sco, // sco is 15khz
config->ssb_table.ssb_subcarrier_offset,
config->ssb_table.ssb_offset_point_a,
fp->ssb_start_subcarrier,
fp->ofdm_symbol_size);
// definition of Lmax according to ts 38.213 section 4.1
if (fp->dl_CarrierFreq < 6e9) {
......
......@@ -1468,6 +1468,8 @@ 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
@param openair0_cfg Pointer OAI config for a specific card
......
......@@ -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]) {
......@@ -91,4 +93,50 @@ void nr_rf_card_config(openair0_config_t *openair0_cfg,
}
}
}
\ No newline at end of file
}
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);
}
......@@ -40,6 +40,10 @@ extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern int point_a_15khz;
extern int kssb_15khz;
extern const short conjugate[8],conjugate2[8];
extern int number_of_cards;
......
......@@ -63,7 +63,7 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME
((fp->freq_range == nr_FR2) && (cfg->ssb_table.ssb_subcarrier_offset.value<12)) )
sco = cfg->ssb_table.ssb_subcarrier_offset.value;
fp->ssb_start_subcarrier = (12 * cfg->ssb_table.ssb_offset_point_a.value + sco);
fp->ssb_start_subcarrier = (12 * cfg->ssb_table.ssb_offset_point_a.value + sco / 2); // sco is 15khz
LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier,cfg->ssb_table.ssb_offset_point_a.value,sco);
}
......
......@@ -39,6 +39,7 @@
#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;
......@@ -273,14 +274,41 @@ 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;
{
kssb = nrUE_config->ssb_table.ssb_subcarrier_offset;
LOG_I(PHY, "save the kssb %d\n", kssb);
}
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;
}
......@@ -335,7 +335,15 @@ 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(ssb center) : %ld, new (point A): %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;
for (i=0; i<5; i++) {
if (i==scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
......@@ -390,7 +398,15 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
cfg->ssb_table.ssb_offset_point_a = scc_SIB->downlinkConfigCommon.frequencyInfoDL.offsetToPointA;
cfg->ssb_table.ssb_period = scc_SIB->ssb_PeriodicityServingCell;
cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
//cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC?
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],
......
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