Cleanup RF HW configuration at UE side
- removed redundant initialisation of variables - introduced two "RF helpers" function that are replacing shared code in the sync routines - added a new .c file and updated the cmakelists and .h files
This commit is contained in:
@@ -1452,6 +1452,31 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||
runmode_t mode,
|
||||
int n_frames);
|
||||
|
||||
/*!
|
||||
\brief This function gets the carrier frequencies either from FP or command-line-set global variables, depending on the availability of the latter
|
||||
@param fp Pointer to frame params
|
||||
@param dl_Carrier Pointer to DL carrier to be set
|
||||
@param ul_Carrier Pointer to UL carrier to be set
|
||||
*/
|
||||
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp,
|
||||
uint64_t *dl_Carrier,
|
||||
uint64_t *ul_Carrier);
|
||||
|
||||
/*!
|
||||
\brief This function sets the OAI RF card rx/tx params
|
||||
@param openair0_cfg Pointer OAI config for a specific card
|
||||
@param tx_gain_off Tx gain offset
|
||||
@param rx_gain_off Rx gain offset
|
||||
@param ul_Carrier UL carrier to be set
|
||||
@param dl_Carrier DL carrier to be set
|
||||
@param freq_offset Freq offset to be set
|
||||
*/
|
||||
void nr_rf_card_config(openair0_config_t *openair0_cfg,
|
||||
double rx_gain_off,
|
||||
uint64_t ul_Carrier,
|
||||
uint64_t dl_Carrier,
|
||||
int freq_offset);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Encoding of PUSCH/ACK/RI/ACK from 36-212.
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file PHY/NR_UE_TRANSPORT/nr_ue_rf_config.c
|
||||
* \brief Functional helpers to configure the RF boards at UE side
|
||||
* \author Guido Casati
|
||||
* \date 2020
|
||||
* \version 0.1
|
||||
* \company Fraunhofer IIS
|
||||
* \email: guido.casati@iis.fraunhofer.de
|
||||
*/
|
||||
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "PHY/phy_extern_nr_ue.h"
|
||||
#include "nr_transport_proto_ue.h"
|
||||
|
||||
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp, uint64_t *dl_carrier, uint64_t *ul_carrier){
|
||||
|
||||
if (downlink_frequency[0][0])
|
||||
*dl_carrier = downlink_frequency[0][0];
|
||||
else
|
||||
*dl_carrier = fp->dl_CarrierFreq;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
void nr_rf_card_config(openair0_config_t *openair0_cfg,
|
||||
double rx_gain_offset,
|
||||
uint64_t ul_carrier,
|
||||
uint64_t dl_carrier,
|
||||
int freq_offset){
|
||||
|
||||
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;
|
||||
double rx_gain = ue->rx_total_gain_dB;
|
||||
double tx_gain = ue->tx_total_gain_dB;
|
||||
|
||||
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 + freq_offset;
|
||||
else
|
||||
openair0_cfg->rx_freq[i] = 0.0;
|
||||
|
||||
if (i<openair0_cfg->tx_num_channels)
|
||||
openair0_cfg->tx_freq[i] = ul_carrier + freq_offset;
|
||||
else
|
||||
openair0_cfg->tx_freq[i] = 0.0;
|
||||
|
||||
if (tx_gain)
|
||||
openair0_cfg->tx_gain[i] = tx_gain;
|
||||
if (rx_gain)
|
||||
openair0_cfg->rx_gain[i] = rx_gain - rx_gain_offset;
|
||||
|
||||
openair0_cfg->autocal[i] = 1;
|
||||
|
||||
LOG_I(PHY, "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]);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user