NR UE: move openair0_config_t and openair0_device_t out of PHY_VARS_NR_UE and consistently use UE->rf_map.card
This commit is contained in:
+45
-33
@@ -201,18 +201,24 @@ typedef struct {
|
|||||||
int rx_offset;
|
int rx_offset;
|
||||||
} syncData_t;
|
} syncData_t;
|
||||||
|
|
||||||
static int nr_ue_adjust_rx_gain(PHY_VARS_NR_UE *UE, openair0_config_t *cfg0, int gain_change)
|
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
extern openair0_device_t openair0_dev[MAX_CARDS];
|
||||||
|
|
||||||
|
static int nr_ue_adjust_rx_gain(PHY_VARS_NR_UE *UE, int gain_change)
|
||||||
{
|
{
|
||||||
|
openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card];
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
|
|
||||||
// Increase the RX gain by the value determined by adjust_rxgain
|
// Increase the RX gain by the value determined by adjust_rxgain
|
||||||
cfg0->rx_gain[0] += gain_change;
|
cfg0->rx_gain[0] += gain_change;
|
||||||
|
|
||||||
// Set new RX gain.
|
// Set new RX gain.
|
||||||
int ret_gain = UE->rfdevice.trx_set_gains_func(&UE->rfdevice, cfg0);
|
int ret_gain = dev0->trx_set_gains_func(dev0, cfg0);
|
||||||
// APPLY RX gain again if crossed the MAX RX gain threshold
|
// APPLY RX gain again if crossed the MAX RX gain threshold
|
||||||
if (ret_gain < 0) {
|
if (ret_gain < 0) {
|
||||||
gain_change += ret_gain;
|
gain_change += ret_gain;
|
||||||
cfg0->rx_gain[0] += ret_gain;
|
cfg0->rx_gain[0] += ret_gain;
|
||||||
ret_gain = UE->rfdevice.trx_set_gains_func(&UE->rfdevice, cfg0);
|
ret_gain = dev0->trx_set_gains_func(dev0, cfg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int applied_rxgain = cfg0->rx_gain[0] - cfg0->rx_gain_offset[0];
|
int applied_rxgain = cfg0->rx_gain[0] - cfg0->rx_gain_offset[0];
|
||||||
@@ -225,7 +231,8 @@ static void UE_synch(void *arg) {
|
|||||||
syncData_t *syncD = (syncData_t *)arg;
|
syncData_t *syncD = (syncData_t *)arg;
|
||||||
PHY_VARS_NR_UE *UE = syncD->UE;
|
PHY_VARS_NR_UE *UE = syncD->UE;
|
||||||
UE->is_synchronized = 0;
|
UE->is_synchronized = 0;
|
||||||
openair0_config_t *cfg0 = &UE->openair0_cfg[UE->rf_map.card];
|
openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card];
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
|
|
||||||
if (UE->target_Nid_cell != -1) {
|
if (UE->target_Nid_cell != -1) {
|
||||||
LOG_W(NR_PHY, "Starting re-sync detection for target Nid_cell %i\n", UE->target_Nid_cell);
|
LOG_W(NR_PHY, "Starting re-sync detection for target Nid_cell %i\n", UE->target_Nid_cell);
|
||||||
@@ -260,11 +267,11 @@ static void UE_synch(void *arg) {
|
|||||||
} else {
|
} else {
|
||||||
// rerun with new cell parameters and frequency-offset
|
// rerun with new cell parameters and frequency-offset
|
||||||
nr_rf_card_config_freq(cfg0, ul_carrier, dl_carrier, freq_offset);
|
nr_rf_card_config_freq(cfg0, ul_carrier, dl_carrier, freq_offset);
|
||||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice, cfg0);
|
dev0->trx_set_freq_func(dev0, cfg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_nrUE_params()->agc) {
|
if (get_nrUE_params()->agc) {
|
||||||
nr_ue_adjust_rx_gain(UE, cfg0, UE->adjust_rxgain);
|
nr_ue_adjust_rx_gain(UE, UE->adjust_rxgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_I(PHY,
|
LOG_I(PHY,
|
||||||
@@ -279,7 +286,7 @@ static void UE_synch(void *arg) {
|
|||||||
} else {
|
} else {
|
||||||
int gain_change = 0;
|
int gain_change = 0;
|
||||||
if (get_nrUE_params()->agc)
|
if (get_nrUE_params()->agc)
|
||||||
gain_change = nr_ue_adjust_rx_gain(UE, cfg0, INCREASE_IN_RXGAIN);
|
gain_change = nr_ue_adjust_rx_gain(UE, INCREASE_IN_RXGAIN);
|
||||||
if (gain_change)
|
if (gain_change)
|
||||||
LOG_I(PHY, "synch retry: Rx gain increased \n");
|
LOG_I(PHY, "synch retry: Rx gain increased \n");
|
||||||
else
|
else
|
||||||
@@ -324,6 +331,8 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx
|
|||||||
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
PHY_VARS_NR_UE *UE = rxtxD->UE;
|
||||||
const fapi_nr_config_request_t *cfg = &UE->nrUE_config;
|
const fapi_nr_config_request_t *cfg = &UE->nrUE_config;
|
||||||
const UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
const UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
||||||
|
openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card];
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||||
if (UE->sl_mode == 2)
|
if (UE->sl_mode == 2)
|
||||||
@@ -334,7 +343,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx
|
|||||||
radio_tx_burst_flag_t flags = TX_BURST_INVALID;
|
radio_tx_burst_flag_t flags = TX_BURST_INVALID;
|
||||||
|
|
||||||
if (UE->received_config_request) {
|
if (UE->received_config_request) {
|
||||||
if (UE->openair0_cfg[0].duplex_mode == duplex_mode_FDD || get_softmodem_params()->continuous_tx) {
|
if (cfg0->duplex_mode == duplex_mode_FDD || get_softmodem_params()->continuous_tx) {
|
||||||
flags = TX_BURST_MIDDLE;
|
flags = TX_BURST_MIDDLE;
|
||||||
// In case of Sidelink, USRP write needed only in case transmission
|
// In case of Sidelink, USRP write needed only in case transmission
|
||||||
// needs to be done in this slot and not based on tdd ULDL configuration.
|
// needs to be done in this slot and not based on tdd ULDL configuration.
|
||||||
@@ -385,7 +394,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx
|
|||||||
const int maxWriteBlockSize = get_samples_per_slot(proc->nr_slot_tx, fp);
|
const int maxWriteBlockSize = get_samples_per_slot(proc->nr_slot_tx, fp);
|
||||||
while (writeBlockSize > maxWriteBlockSize) {
|
while (writeBlockSize > maxWriteBlockSize) {
|
||||||
const int dummyBlockSize = min(writeBlockSize - maxWriteBlockSize, maxWriteBlockSize);
|
const int dummyBlockSize = min(writeBlockSize - maxWriteBlockSize, maxWriteBlockSize);
|
||||||
int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, (void **)txp, dummyBlockSize, fp->nb_antennas_tx, flags);
|
int tmp = openair0_write_reorder(dev0, writeTimestamp, (void **)txp, dummyBlockSize, fp->nb_antennas_tx, flags);
|
||||||
AssertFatal(tmp == dummyBlockSize, "");
|
AssertFatal(tmp == dummyBlockSize, "");
|
||||||
|
|
||||||
writeTimestamp += dummyBlockSize;
|
writeTimestamp += dummyBlockSize;
|
||||||
@@ -408,7 +417,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action, c16_t **tx
|
|||||||
writeBlockSize);
|
writeBlockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, (void **)txp, writeBlockSize, fp->nb_antennas_tx, flags);
|
int tmp = openair0_write_reorder(dev0, writeTimestamp, (void **)txp, writeBlockSize, fp->nb_antennas_tx, flags);
|
||||||
AssertFatal(tmp == writeBlockSize, "");
|
AssertFatal(tmp == writeBlockSize, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,10 +532,12 @@ static int handle_sync_req_from_mac(PHY_VARS_NR_UE *UE)
|
|||||||
ul_CarrierFreq,
|
ul_CarrierFreq,
|
||||||
cfg->dl_frequency,
|
cfg->dl_frequency,
|
||||||
UE->target_Nid_cell);
|
UE->target_Nid_cell);
|
||||||
|
openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card];
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
fp->dl_CarrierFreq = dl_CarrierFreq;
|
fp->dl_CarrierFreq = dl_CarrierFreq;
|
||||||
fp->ul_CarrierFreq = ul_CarrierFreq;
|
fp->ul_CarrierFreq = ul_CarrierFreq;
|
||||||
nr_rf_card_config_freq(&UE->openair0_cfg[UE->rf_map.card], ul_CarrierFreq, dl_CarrierFreq, 0);
|
nr_rf_card_config_freq(cfg0, ul_CarrierFreq, dl_CarrierFreq, 0);
|
||||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice, &UE->openair0_cfg[UE->rf_map.card]);
|
dev0->trx_set_freq_func(dev0, cfg0);
|
||||||
init_symbol_rotation(fp);
|
init_symbol_rotation(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,6 +661,7 @@ void UE_dl_processing(void *arg) {
|
|||||||
void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlockSize)
|
void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlockSize)
|
||||||
{
|
{
|
||||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
if (UE->sl_mode == 2)
|
if (UE->sl_mode == 2)
|
||||||
fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params;
|
fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params;
|
||||||
|
|
||||||
@@ -660,13 +672,14 @@ void dummyWrite(PHY_VARS_NR_UE *UE, openair0_timestamp_t timestamp, int writeBlo
|
|||||||
for (int i = 0; i < fp->nb_antennas_tx; i++)
|
for (int i = 0; i < fp->nb_antennas_tx; i++)
|
||||||
dummy_tx[i]=dummy_tx_data[i];
|
dummy_tx[i]=dummy_tx_data[i];
|
||||||
|
|
||||||
int tmp = UE->rfdevice.trx_write_func(&UE->rfdevice, timestamp, dummy_tx, writeBlockSize, fp->nb_antennas_tx, 4);
|
int tmp = dev0->trx_write_func(dev0, timestamp, dummy_tx, writeBlockSize, fp->nb_antennas_tx, 4);
|
||||||
AssertFatal(writeBlockSize == tmp, "");
|
AssertFatal(writeBlockSize == tmp, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, bool toTrash)
|
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, bool toTrash)
|
||||||
{
|
{
|
||||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
// two frames for initial sync
|
// two frames for initial sync
|
||||||
int num_frames = 2;
|
int num_frames = 2;
|
||||||
// In Sidelink worst case SL-SSB can be sent once in 16 frames
|
// In Sidelink worst case SL-SSB can be sent once in 16 frames
|
||||||
@@ -688,7 +701,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration
|
|||||||
((void *)&UE->common_vars.rxdata[i][0]) + 4 * ((x * fp->samples_per_subframe) + get_samples_slot_timestamp(fp, slot));
|
((void *)&UE->common_vars.rxdata[i][0]) + 4 * ((x * fp->samples_per_subframe) + get_samples_slot_timestamp(fp, slot));
|
||||||
|
|
||||||
int read_block_size = get_samples_per_slot(slot, fp);
|
int read_block_size = get_samples_per_slot(slot, fp);
|
||||||
int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, timestamp, rxp, read_block_size, fp->nb_antennas_rx);
|
int tmp = dev0->trx_read_func(dev0, timestamp, rxp, read_block_size, fp->nb_antennas_rx);
|
||||||
UEscopeCopy(UE, ueTimeDomainSamplesBeforeSync, rxp[0], sizeof(c16_t), 1, read_block_size, 0);
|
UEscopeCopy(UE, ueTimeDomainSamplesBeforeSync, rxp[0], sizeof(c16_t), 1, read_block_size, 0);
|
||||||
AssertFatal(read_block_size == tmp, "");
|
AssertFatal(read_block_size == tmp, "");
|
||||||
|
|
||||||
@@ -709,6 +722,7 @@ void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration
|
|||||||
static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, openair0_timestamp_t rx_offset)
|
static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int duration_rx_to_tx, openair0_timestamp_t rx_offset)
|
||||||
{
|
{
|
||||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
if (UE->sl_mode == 2)
|
if (UE->sl_mode == 2)
|
||||||
fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params;
|
fp = &UE->SL_UE_PHY_PARAMS.sl_frame_params;
|
||||||
|
|
||||||
@@ -718,7 +732,7 @@ static void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp_t *timestamp, int
|
|||||||
int size = rx_offset;
|
int size = rx_offset;
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
const int unitTransfer = min(get_samples_per_slot(slot, fp), size);
|
const int unitTransfer = min(get_samples_per_slot(slot, fp), size);
|
||||||
const int res = UE->rfdevice.trx_read_func(&UE->rfdevice, timestamp, (void **)UE->common_vars.rxdata, unitTransfer, fp->nb_antennas_rx);
|
const int res = dev0->trx_read_func(dev0, timestamp, (void **)UE->common_vars.rxdata, unitTransfer, fp->nb_antennas_rx);
|
||||||
DevAssert(unitTransfer == res);
|
DevAssert(unitTransfer == res);
|
||||||
if (IS_SOFTMODEM_RFSIM) {
|
if (IS_SOFTMODEM_RFSIM) {
|
||||||
int ta = UE->timing_advance + UE->timing_advance_ntn;
|
int ta = UE->timing_advance + UE->timing_advance_ntn;
|
||||||
@@ -747,11 +761,13 @@ void *UE_thread(void *arg)
|
|||||||
{
|
{
|
||||||
//this thread should be over the processing thread to keep in real time
|
//this thread should be over the processing thread to keep in real time
|
||||||
PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg;
|
PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg;
|
||||||
|
openair0_config_t *cfg0 = &openair0_cfg[UE->rf_map.card];
|
||||||
|
openair0_device_t *dev0 = &openair0_dev[UE->rf_map.card];
|
||||||
// int tx_enabled = 0;
|
// int tx_enabled = 0;
|
||||||
void *rxp[NB_ANTENNAS_RX];
|
void *rxp[NB_ANTENNAS_RX];
|
||||||
enum stream_status_e stream_status = STREAM_STATUS_UNSYNC;
|
enum stream_status_e stream_status = STREAM_STATUS_UNSYNC;
|
||||||
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
|
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
|
||||||
int tmp = openair0_device_load(&(UE->rfdevice), &UE->openair0_cfg[0]);
|
int tmp = openair0_device_load(dev0, cfg0);
|
||||||
AssertFatal(tmp == 0, "Could not load the device\n");
|
AssertFatal(tmp == 0, "Could not load the device\n");
|
||||||
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
|
||||||
sl_nr_phy_config_request_t *sl_cfg = NULL;
|
sl_nr_phy_config_request_t *sl_cfg = NULL;
|
||||||
@@ -760,12 +776,12 @@ void *UE_thread(void *arg)
|
|||||||
sl_cfg = &UE->SL_UE_PHY_PARAMS.sl_config;
|
sl_cfg = &UE->SL_UE_PHY_PARAMS.sl_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
UE->rfdevice.host_type = RAU_HOST;
|
dev0->host_type = RAU_HOST;
|
||||||
UE->is_synchronized = 0;
|
UE->is_synchronized = 0;
|
||||||
int tmp2 = UE->rfdevice.trx_start_func(&UE->rfdevice);
|
int tmp2 = dev0->trx_start_func(dev0);
|
||||||
AssertFatal(tmp2 == 0, "Could not start the device\n");
|
AssertFatal(tmp2 == 0, "Could not start the device\n");
|
||||||
if (usrp_tx_thread == 1)
|
if (usrp_tx_thread == 1)
|
||||||
UE->rfdevice.trx_write_init(&UE->rfdevice);
|
dev0->trx_write_init(dev0);
|
||||||
|
|
||||||
InitSinLUT();
|
InitSinLUT();
|
||||||
|
|
||||||
@@ -846,7 +862,7 @@ void *UE_thread(void *arg)
|
|||||||
/* For IQ recorder-player we force synchronization to happen in a fixed duration so that
|
/* For IQ recorder-player we force synchronization to happen in a fixed duration so that
|
||||||
the replay runs in sync with recorded samples.
|
the replay runs in sync with recorded samples.
|
||||||
*/
|
*/
|
||||||
const unsigned int sync_in_frames = UE->rfdevice.openair0_cfg->recplay_conf->u_f_sync;
|
const unsigned int sync_in_frames = cfg0->recplay_conf->u_f_sync;
|
||||||
while (trashed_frames != sync_in_frames) {
|
while (trashed_frames != sync_in_frames) {
|
||||||
readFrame(UE, &sync_timestamp, duration_rx_to_tx, true);
|
readFrame(UE, &sync_timestamp, duration_rx_to_tx, true);
|
||||||
trashed_frames += 2;
|
trashed_frames += 2;
|
||||||
@@ -887,16 +903,16 @@ void *UE_thread(void *arg)
|
|||||||
if (stream_status == STREAM_STATUS_UNSYNC) {
|
if (stream_status == STREAM_STATUS_UNSYNC) {
|
||||||
stream_status = STREAM_STATUS_SYNCING;
|
stream_status = STREAM_STATUS_SYNCING;
|
||||||
syncInFrame(UE, &sync_timestamp, duration_rx_to_tx, intialSyncOffset);
|
syncInFrame(UE, &sync_timestamp, duration_rx_to_tx, intialSyncOffset);
|
||||||
openair0_write_reorder_clear_context(&UE->rfdevice);
|
openair0_write_reorder_clear_context(dev0);
|
||||||
shiftForNextFrame = -(UE->init_sync_frame + trashed_frames + 2) * UE->max_pos_acc * get_nrUE_params()->time_sync_I; // compensate for the time drift that happened during initial sync
|
shiftForNextFrame = -(UE->init_sync_frame + trashed_frames + 2) * UE->max_pos_acc * get_nrUE_params()->time_sync_I; // compensate for the time drift that happened during initial sync
|
||||||
LOG_I(PHY, "max_pos_acc = %d, shiftForNextFrame = %d\n", UE->max_pos_acc, shiftForNextFrame);
|
LOG_I(PHY, "max_pos_acc = %d, shiftForNextFrame = %d\n", UE->max_pos_acc, shiftForNextFrame);
|
||||||
// read in first symbol
|
// read in first symbol
|
||||||
AssertFatal(fp->ofdm_symbol_size + fp->nb_prefix_samples0
|
AssertFatal(fp->ofdm_symbol_size + fp->nb_prefix_samples0
|
||||||
== UE->rfdevice.trx_read_func(&UE->rfdevice,
|
== dev0->trx_read_func(dev0,
|
||||||
&sync_timestamp,
|
&sync_timestamp,
|
||||||
(void **)UE->common_vars.rxdata,
|
(void **)UE->common_vars.rxdata,
|
||||||
fp->ofdm_symbol_size + fp->nb_prefix_samples0,
|
fp->ofdm_symbol_size + fp->nb_prefix_samples0,
|
||||||
fp->nb_antennas_rx),
|
fp->nb_antennas_rx),
|
||||||
"");
|
"");
|
||||||
// we have the decoded frame index in the return of the synch process
|
// we have the decoded frame index in the return of the synch process
|
||||||
// and we shifted above to the first slot of next frame
|
// and we shifted above to the first slot of next frame
|
||||||
@@ -997,7 +1013,7 @@ void *UE_thread(void *arg)
|
|||||||
|
|
||||||
const int readBlockSize = get_readBlockSize(slot_nr, fp) - iq_shift_to_apply;
|
const int readBlockSize = get_readBlockSize(slot_nr, fp) - iq_shift_to_apply;
|
||||||
openair0_timestamp_t rx_timestamp;
|
openair0_timestamp_t rx_timestamp;
|
||||||
int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx);
|
int tmp = dev0->trx_read_func(dev0, &rx_timestamp, rxp, readBlockSize, fp->nb_antennas_rx);
|
||||||
metadata meta = {.slot = curMsg.proc.nr_slot_rx, .frame = curMsg.proc.frame_rx};
|
metadata meta = {.slot = curMsg.proc.nr_slot_rx, .frame = curMsg.proc.frame_rx};
|
||||||
UEscopeCopyWithMetadata(UE, ueTimeDomainSamples, rxp[0] - firstSymSamp * sizeof(c16_t), sizeof(c16_t), 1, readBlockSize, 0, &meta);
|
UEscopeCopyWithMetadata(UE, ueTimeDomainSamples, rxp[0] - firstSymSamp * sizeof(c16_t), sizeof(c16_t), 1, readBlockSize, 0, &meta);
|
||||||
AssertFatal(readBlockSize == tmp, "");
|
AssertFatal(readBlockSize == tmp, "");
|
||||||
@@ -1012,11 +1028,7 @@ void *UE_thread(void *arg)
|
|||||||
|
|
||||||
if (first_symbols > 0) {
|
if (first_symbols > 0) {
|
||||||
openair0_timestamp_t ignore_timestamp;
|
openair0_timestamp_t ignore_timestamp;
|
||||||
int tmp = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
int tmp = dev0->trx_read_func(dev0, &ignore_timestamp, (void **)UE->common_vars.rxdata, first_symbols, fp->nb_antennas_rx);
|
||||||
&ignore_timestamp,
|
|
||||||
(void **)UE->common_vars.rxdata,
|
|
||||||
first_symbols,
|
|
||||||
fp->nb_antennas_rx);
|
|
||||||
AssertFatal(first_symbols == tmp, "");
|
AssertFatal(first_symbols == tmp, "");
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -1029,7 +1041,7 @@ void *UE_thread(void *arg)
|
|||||||
|
|
||||||
// Calculate TX deadline, approximately 1 symbol before the first sample should be written
|
// Calculate TX deadline, approximately 1 symbol before the first sample should be written
|
||||||
const uint64_t samples_diff = writeTimestamp - rx_timestamp - fp->ofdm_symbol_size;
|
const uint64_t samples_diff = writeTimestamp - rx_timestamp - fp->ofdm_symbol_size;
|
||||||
const float deadline_us = samples_diff / UE->rfdevice.openair0_cfg->sample_rate * 1e6;
|
const float deadline_us = samples_diff / cfg0->sample_rate * 1e6;
|
||||||
const uint64_t absolute_deadline_us = current_time.tv_sec * 1e6 + current_time.tv_nsec / 1e3 + deadline_us;
|
const uint64_t absolute_deadline_us = current_time.tv_sec * 1e6 + current_time.tv_nsec / 1e3 + deadline_us;
|
||||||
|
|
||||||
// but use current UE->timing_advance value to compute writeBlockSize
|
// but use current UE->timing_advance value to compute writeBlockSize
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
|||||||
uint64_t sidelink_frequency[MAX_NUM_CCs][4];
|
uint64_t sidelink_frequency[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
// UE and OAI config variables
|
// UE and OAI config variables
|
||||||
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
openair0_device_t openair0_dev[MAX_CARDS];
|
||||||
double cpuf;
|
double cpuf;
|
||||||
|
|
||||||
int create_tasks_nrue(uint32_t ue_nb) {
|
int create_tasks_nrue(uint32_t ue_nb) {
|
||||||
@@ -138,19 +140,16 @@ int create_tasks_nrue(uint32_t ue_nb) {
|
|||||||
|
|
||||||
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
|
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
|
||||||
{
|
{
|
||||||
int CC_id;
|
|
||||||
LOG_W(NR_PHY, "called by: %s:%d %s() Exiting OAI softmodem: %s\n", file, line, function, s ? s : "no msg");
|
LOG_W(NR_PHY, "called by: %s:%d %s() Exiting OAI softmodem: %s\n", file, line, function, s ? s : "no msg");
|
||||||
|
|
||||||
oai_exit = 1;
|
oai_exit = 1;
|
||||||
|
|
||||||
if (PHY_vars_UE_g && PHY_vars_UE_g[0]) {
|
for (int card = 0; card < MAX_CARDS; card++) {
|
||||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
if (openair0_dev[card].trx_end_func) {
|
||||||
if (PHY_vars_UE_g[0][CC_id] && PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func) {
|
if (openair0_dev[card].trx_get_stats_func) {
|
||||||
if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_get_stats_func) {
|
openair0_dev[card].trx_get_stats_func(&openair0_dev[card]);
|
||||||
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_get_stats_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
|
|
||||||
}
|
|
||||||
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
|
|
||||||
}
|
}
|
||||||
|
openair0_dev[card].trx_end_func(&openair0_dev[card]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,15 +225,14 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
|||||||
|
|
||||||
void init_openair0(PHY_VARS_NR_UE *ue)
|
void init_openair0(PHY_VARS_NR_UE *ue)
|
||||||
{
|
{
|
||||||
int card;
|
|
||||||
int freq_off = 0;
|
int freq_off = 0;
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||||
bool is_sidelink = (get_softmodem_params()->sl_mode) ? true : false;
|
bool is_sidelink = (get_softmodem_params()->sl_mode) ? true : false;
|
||||||
if (is_sidelink)
|
if (is_sidelink)
|
||||||
frame_parms = &ue->SL_UE_PHY_PARAMS.sl_frame_params;
|
frame_parms = &ue->SL_UE_PHY_PARAMS.sl_frame_params;
|
||||||
|
|
||||||
for (card=0; card<MAX_CARDS; card++) {
|
for (int card = 0; card < MAX_CARDS; card++) {
|
||||||
openair0_config_t *cfg = &ue->openair0_cfg[card];
|
openair0_config_t *cfg = &openair0_cfg[card];
|
||||||
uint64_t dl_carrier, ul_carrier;
|
uint64_t dl_carrier, ul_carrier;
|
||||||
cfg->configFilename = NULL;
|
cfg->configFilename = NULL;
|
||||||
cfg->sample_rate = frame_parms->samples_per_subframe * 1e3;
|
cfg->sample_rate = frame_parms->samples_per_subframe * 1e3;
|
||||||
@@ -324,7 +322,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
//set_softmodem_sighandler();
|
//set_softmodem_sighandler();
|
||||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||||
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
|
memset(openair0_cfg, 0, sizeof(openair0_config_t) * MAX_CARDS);
|
||||||
|
memset(openair0_dev, 0, sizeof(openair0_device_t) * MAX_CARDS);
|
||||||
|
memset(tx_max_power, 0, sizeof(int) * MAX_NUM_CCs);
|
||||||
// initialize logging
|
// initialize logging
|
||||||
logInit();
|
logInit();
|
||||||
// get options and fill parameters from configuration file
|
// get options and fill parameters from configuration file
|
||||||
@@ -514,14 +514,17 @@ int main(int argc, char **argv)
|
|||||||
ret = pthread_join(phy_vars->stat_thread, NULL);
|
ret = pthread_join(phy_vars->stat_thread, NULL);
|
||||||
AssertFatal(ret == 0, "pthread_join error %d, errno %d (%s)\n", ret, errno, strerror(errno));
|
AssertFatal(ret == 0, "pthread_join error %d, errno %d (%s)\n", ret, errno, strerror(errno));
|
||||||
}
|
}
|
||||||
if (phy_vars->rfdevice.trx_get_stats_func)
|
|
||||||
phy_vars->rfdevice.trx_get_stats_func(&phy_vars->rfdevice);
|
|
||||||
if (phy_vars->rfdevice.trx_end_func)
|
|
||||||
phy_vars->rfdevice.trx_end_func(&phy_vars->rfdevice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int card = 0; card < MAX_CARDS; card++) {
|
||||||
|
if (openair0_dev[card].trx_get_stats_func)
|
||||||
|
openair0_dev[card].trx_get_stats_func(&openair0_dev[card]);
|
||||||
|
if (openair0_dev[card].trx_end_func)
|
||||||
|
openair0_dev[card].trx_end_func(&openair0_dev[card]);
|
||||||
|
}
|
||||||
|
|
||||||
free_nrLDPC_coding_interface(&nrLDPC_coding_interface);
|
free_nrLDPC_coding_interface(&nrLDPC_coding_interface);
|
||||||
|
|
||||||
time_manager_finish();
|
time_manager_finish();
|
||||||
|
|||||||
@@ -46,6 +46,8 @@
|
|||||||
#define CH_INTERP 0
|
#define CH_INTERP 0
|
||||||
#define NO_INTERP 1
|
#define NO_INTERP 1
|
||||||
|
|
||||||
|
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
|
||||||
/* Generic function to find the peak of channel estimation buffer */
|
/* Generic function to find the peak of channel estimation buffer */
|
||||||
void peak_estimator(c16_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val, int32_t mean_val)
|
void peak_estimator(c16_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val, int32_t mean_val)
|
||||||
{
|
{
|
||||||
@@ -461,12 +463,13 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
|
|||||||
|
|
||||||
// adjusting the rx_gains for channel peak power
|
// adjusting the rx_gains for channel peak power
|
||||||
ch_pwr_dbm = 10 * log10(ch_pwr) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
ch_pwr_dbm = 10 * log10(ch_pwr) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||||
- ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0])
|
- ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0])
|
||||||
- dB_fixed(frame_params->ofdm_symbol_size);
|
- dB_fixed(frame_params->ofdm_symbol_size);
|
||||||
|
|
||||||
prs_meas[rxAnt]->rsrp_dBm = 10 * log10(prs_meas[rxAnt]->rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
prs_meas[rxAnt]->rsrp_dBm =
|
||||||
- ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0])
|
10 * log10(prs_meas[rxAnt]->rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||||
- dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
- ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0])
|
||||||
|
- dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||||
|
|
||||||
// prs measurements
|
// prs measurements
|
||||||
prs_meas[rxAnt]->gNB_id = gNB_id;
|
prs_meas[rxAnt]->gNB_id = gNB_id;
|
||||||
|
|||||||
@@ -154,10 +154,10 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
|
|||||||
uint16_t rnti,
|
uint16_t rnti,
|
||||||
NR_UE_DLSCH_t dlsch[2]);
|
NR_UE_DLSCH_t dlsch[2]);
|
||||||
|
|
||||||
int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params,
|
int nr_sl_psbch_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||||
|
sl_nr_ue_phy_params_t *sl_phy_params,
|
||||||
NR_DL_FRAME_PARMS *fp,
|
NR_DL_FRAME_PARMS *fp,
|
||||||
c16_t rxdataF[][fp->samples_per_slot_wCP],
|
c16_t rxdataF[][fp->samples_per_slot_wCP],
|
||||||
bool use_SSS,
|
bool use_SSS);
|
||||||
openair0_config_t *openair0_cfg);
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -51,6 +51,8 @@
|
|||||||
//#define DEBUG_MEAS_UE
|
//#define DEBUG_MEAS_UE
|
||||||
//#define DEBUG_RANK_EST
|
//#define DEBUG_RANK_EST
|
||||||
|
|
||||||
|
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
|
||||||
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||||
const UE_nr_rxtx_proc_t *proc,
|
const UE_nr_rxtx_proc_t *proc,
|
||||||
int number_rbs,
|
int number_rbs,
|
||||||
@@ -133,9 +135,10 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
ue->measurements.n0_power_avg_dB = dB_fixed(ue->measurements.n0_power_avg);
|
ue->measurements.n0_power_avg_dB = dB_fixed(ue->measurements.n0_power_avg);
|
||||||
ue->measurements.wideband_cqi_tot[gNB_id] = ue->measurements.rx_power_tot_dB[gNB_id] - ue->measurements.n0_power_tot_dB;
|
ue->measurements.wideband_cqi_tot[gNB_id] = ue->measurements.rx_power_tot_dB[gNB_id] - ue->measurements.n0_power_tot_dB;
|
||||||
ue->measurements.wideband_cqi_avg[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] - ue->measurements.n0_power_avg_dB;
|
ue->measurements.wideband_cqi_avg[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] - ue->measurements.n0_power_avg_dB;
|
||||||
ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
ue->measurements.rx_rssi_dBm[gNB_id] =
|
||||||
- ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0])
|
ue->measurements.rx_power_avg_dB[gNB_id] + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||||
- dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
- ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0])
|
||||||
|
- dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||||
|
|
||||||
LOG_D(PHY, "[gNB %d] Slot %d, RSSI %d dB (%d dBm/RE), WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
|
LOG_D(PHY, "[gNB %d] Slot %d, RSSI %d dB (%d dBm/RE), WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
|
||||||
gNB_id,
|
gNB_id,
|
||||||
@@ -242,7 +245,7 @@ void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
uint32_t rsrp_avg = nr_ue_calculate_ssb_rsrp(fp, proc, rxdataF, symbol_offset, fp->ssb_start_subcarrier);
|
uint32_t rsrp_avg = nr_ue_calculate_ssb_rsrp(fp, proc, rxdataF, symbol_offset, fp->ssb_start_subcarrier);
|
||||||
float rsrp_db_per_re = 10 * log10(rsrp_avg);
|
float rsrp_db_per_re = 10 * log10(rsrp_avg);
|
||||||
|
|
||||||
openair0_config_t *cfg0 = &ue->openair0_cfg[0];
|
openair0_config_t *cfg0 = &openair0_cfg[ue->rf_map.card];
|
||||||
|
|
||||||
ue->measurements.ssb_rsrp_dBm[ssb_index] = rsrp_db_per_re + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
ue->measurements.ssb_rsrp_dBm[ssb_index] = rsrp_db_per_re + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||||
- ((int)cfg0->rx_gain[0] - (int)cfg0->rx_gain_offset[0])
|
- ((int)cfg0->rx_gain[0] - (int)cfg0->rx_gain_offset[0])
|
||||||
@@ -485,9 +488,10 @@ void do_neighboring_cell_measurements(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *u
|
|||||||
// RSRP measurements
|
// RSRP measurements
|
||||||
neighboring_cell_info->ssb_rsrp = nr_ue_calculate_ssb_rsrp(frame_parms, proc, rxdataF, 0, frame_parms->ssb_start_subcarrier);
|
neighboring_cell_info->ssb_rsrp = nr_ue_calculate_ssb_rsrp(frame_parms, proc, rxdataF, 0, frame_parms->ssb_start_subcarrier);
|
||||||
|
|
||||||
neighboring_cell_info->ssb_rsrp_dBm = 10 * log10(neighboring_cell_info->ssb_rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
neighboring_cell_info->ssb_rsrp_dBm =
|
||||||
- ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0])
|
10 * log10(neighboring_cell_info->ssb_rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||||
- dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
- ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0])
|
||||||
|
- dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||||
|
|
||||||
// Send SS measurements to MAC
|
// Send SS measurements to MAC
|
||||||
send_ssb_rsrp_meas(ue, proc, neighbor_cell->Nid_cell, neighboring_cell_info->ssb_rsrp_dBm, true, -1, 0.0);
|
send_ssb_rsrp_meas(ue, proc, neighbor_cell->Nid_cell, neighboring_cell_info->ssb_rsrp_dBm, true, -1, 0.0);
|
||||||
@@ -519,8 +523,8 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
const uint8_t k_length = 8;
|
const uint8_t k_length = 8;
|
||||||
uint8_t l_sss = (ue->symbol_offset + 2) % ue->frame_parms.symbols_per_slot;
|
uint8_t l_sss = (ue->symbol_offset + 2) % ue->frame_parms.symbols_per_slot;
|
||||||
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
||||||
double rx_gain = ue->openair0_cfg[0].rx_gain[0];
|
double rx_gain = openair0_cfg[ue->rf_map.card].rx_gain[0];
|
||||||
double rx_gain_offset = ue->openair0_cfg[0].rx_gain_offset[0];
|
double rx_gain_offset = openair0_cfg[ue->rf_map.card].rx_gain_offset[0];
|
||||||
|
|
||||||
ue->measurements.n0_power_tot = 0;
|
ue->measurements.n0_power_tot = 0;
|
||||||
|
|
||||||
@@ -589,11 +593,11 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
|
|||||||
// Measurement units:
|
// Measurement units:
|
||||||
// - RSRP: W (dBW)
|
// - RSRP: W (dBW)
|
||||||
// returns RXgain to be adjusted based on target rx power (50db) - received digital power in db/RE
|
// returns RXgain to be adjusted based on target rx power (50db) - received digital power in db/RE
|
||||||
int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params,
|
int nr_sl_psbch_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||||
|
sl_nr_ue_phy_params_t *sl_phy_params,
|
||||||
NR_DL_FRAME_PARMS *fp,
|
NR_DL_FRAME_PARMS *fp,
|
||||||
c16_t rxdataF[][fp->samples_per_slot_wCP],
|
c16_t rxdataF[][fp->samples_per_slot_wCP],
|
||||||
bool use_SSS,
|
bool use_SSS)
|
||||||
openair0_config_t *openair0_cfg)
|
|
||||||
{
|
{
|
||||||
SL_NR_UE_PSBCH_t *psbch_rx = &sl_phy_params->psbch;
|
SL_NR_UE_PSBCH_t *psbch_rx = &sl_phy_params->psbch;
|
||||||
uint8_t numsym = (fp->Ncp) ? SL_NR_NUM_SYMBOLS_SSB_EXT_CP : SL_NR_NUM_SYMBOLS_SSB_NORMAL_CP;
|
uint8_t numsym = (fp->Ncp) ? SL_NR_NUM_SYMBOLS_SSB_EXT_CP : SL_NR_NUM_SYMBOLS_SSB_NORMAL_CP;
|
||||||
@@ -626,9 +630,10 @@ int nr_sl_psbch_rsrp_measurements(sl_nr_ue_phy_params_t *sl_phy_params,
|
|||||||
}
|
}
|
||||||
|
|
||||||
psbch_rx->rsrp_dB_per_RE = 10 * log10(rsrp / num_re);
|
psbch_rx->rsrp_dB_per_RE = 10 * log10(rsrp / num_re);
|
||||||
psbch_rx->rsrp_dBm_per_RE = psbch_rx->rsrp_dB_per_RE + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
psbch_rx->rsrp_dBm_per_RE =
|
||||||
- ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0])
|
psbch_rx->rsrp_dB_per_RE + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||||
- dB_fixed(fp->ofdm_symbol_size);
|
- ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0])
|
||||||
|
- dB_fixed(fp->ofdm_symbol_size);
|
||||||
|
|
||||||
int adjust_rxgain = TARGET_RX_POWER - psbch_rx->rsrp_dB_per_RE;
|
int adjust_rxgain = TARGET_RX_POWER - psbch_rx->rsrp_dB_per_RE;
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
//#define NR_CSIRS_DEBUG
|
//#define NR_CSIRS_DEBUG
|
||||||
//#define NR_CSIIM_DEBUG
|
//#define NR_CSIIM_DEBUG
|
||||||
|
|
||||||
|
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
|
||||||
void nr_det_A_MF_2x2(int32_t *a_mf_00,
|
void nr_det_A_MF_2x2(int32_t *a_mf_00,
|
||||||
int32_t *a_mf_01,
|
int32_t *a_mf_01,
|
||||||
int32_t *a_mf_10,
|
int32_t *a_mf_10,
|
||||||
@@ -237,7 +239,8 @@ static int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
*rsrp = rsrp_sum/meas_count;
|
*rsrp = rsrp_sum/meas_count;
|
||||||
*rsrp_dBm = dB_fixed(*rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
*rsrp_dBm = dB_fixed(*rsrp) + 30 - SQ15_SQUARED_NORM_FACTOR_DB
|
||||||
- ((int)ue->openair0_cfg[0].rx_gain[0] - (int)ue->openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
- ((int)openair0_cfg[ue->rf_map.card].rx_gain[0] - (int)openair0_cfg[ue->rf_map.card].rx_gain_offset[0])
|
||||||
|
- dB_fixed(ue->frame_parms.ofdm_symbol_size);
|
||||||
|
|
||||||
#ifdef NR_CSIRS_DEBUG
|
#ifdef NR_CSIRS_DEBUG
|
||||||
LOG_I(NR_PHY, "RSRP = %i (%i dBm)\n", *rsrp, *rsrp_dBm);
|
LOG_I(NR_PHY, "RSRP = %i (%i dBm)\n", *rsrp, *rsrp_dBm);
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ nr_initial_sync_t sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc,
|
|||||||
sync_params->DFN,
|
sync_params->DFN,
|
||||||
sync_params->slot_offset);
|
sync_params->slot_offset);
|
||||||
|
|
||||||
UE->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_ue, frame_parms, rxdataF, false, UE->openair0_cfg);
|
UE->adjust_rxgain = nr_sl_psbch_rsrp_measurements(UE, sl_ue, frame_parms, rxdataF, false);
|
||||||
|
|
||||||
UE->init_sync_frame = sync_params->remaining_frames;
|
UE->init_sync_frame = sync_params->remaining_frames;
|
||||||
result.rx_offset = sync_params->rx_offset;
|
result.rx_offset = sync_params->rx_offset;
|
||||||
|
|||||||
@@ -344,7 +344,6 @@ typedef struct UE_NR_SCAN_INFO_s {
|
|||||||
|
|
||||||
/// Top-level PHY Data Structure for UE
|
/// Top-level PHY Data Structure for UE
|
||||||
typedef struct PHY_VARS_NR_UE_s {
|
typedef struct PHY_VARS_NR_UE_s {
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
|
||||||
/// \brief Module ID indicator for this instance
|
/// \brief Module ID indicator for this instance
|
||||||
uint8_t Mod_id;
|
uint8_t Mod_id;
|
||||||
/// \brief Component carrier ID for this PHY instance
|
/// \brief Component carrier ID for this PHY instance
|
||||||
@@ -507,9 +506,6 @@ typedef struct PHY_VARS_NR_UE_s {
|
|||||||
time_stats_t ue_ul_indication_stats;
|
time_stats_t ue_ul_indication_stats;
|
||||||
nr_ue_phy_cpu_stat_t phy_cpu_stats;
|
nr_ue_phy_cpu_stat_t phy_cpu_stats;
|
||||||
|
|
||||||
/// RF and Interface devices per CC
|
|
||||||
openair0_device_t rfdevice;
|
|
||||||
|
|
||||||
/// Phase precompensation flag
|
/// Phase precompensation flag
|
||||||
bool no_phase_pre_comp;
|
bool no_phase_pre_comp;
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr
|
|||||||
sym = (sym == 0) ? 5 : sym + 1;
|
sym = (sym == 0) ? 5 : sym + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ue->adjust_rxgain = nr_sl_psbch_rsrp_measurements(sl_phy_params, fp, rxdataF, false, ue->openair0_cfg);
|
ue->adjust_rxgain = nr_sl_psbch_rsrp_measurements(ue, sl_phy_params, fp, rxdataF, false);
|
||||||
|
|
||||||
LOG_D(NR_PHY, " ------ Decode SL-MIB: frame.slot %d.%d ------ \n", frame_rx % 1024, nr_slot_rx);
|
LOG_D(NR_PHY, " ------ Decode SL-MIB: frame.slot %d.%d ------ \n", frame_rx % 1024, nr_slot_rx);
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1};
|
|||||||
// needed for some functions
|
// needed for some functions
|
||||||
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
|
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
|
||||||
uint16_t n_rnti = 0x1234;
|
uint16_t n_rnti = 0x1234;
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
|
||||||
static softmodem_params_t softmodem_params;
|
static softmodem_params_t softmodem_params;
|
||||||
softmodem_params_t *get_softmodem_params(void) {
|
softmodem_params_t *get_softmodem_params(void) {
|
||||||
return &softmodem_params;
|
return &softmodem_params;
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ PHY_VARS_NR_UE *UE;
|
|||||||
RAN_CONTEXT_t RC;
|
RAN_CONTEXT_t RC;
|
||||||
RU_t *ru;
|
RU_t *ru;
|
||||||
double cpuf;
|
double cpuf;
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
|
||||||
//uint8_t nfapi_mode=0;
|
//uint8_t nfapi_mode=0;
|
||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ THREAD_STRUCT thread_struct;
|
|||||||
PHY_VARS_gNB *gNB;
|
PHY_VARS_gNB *gNB;
|
||||||
PHY_VARS_NR_UE *UE;
|
PHY_VARS_NR_UE *UE;
|
||||||
RAN_CONTEXT_t RC;
|
RAN_CONTEXT_t RC;
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
|
||||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ double cpuf;
|
|||||||
// needed for some functions
|
// needed for some functions
|
||||||
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
|
PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
|
||||||
uint16_t n_rnti = 0x1234;
|
uint16_t n_rnti = 0x1234;
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
|
||||||
|
|
||||||
void inc_ref_sched_response(int _)
|
void inc_ref_sched_response(int _)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user