Commit 0f04910f authored by Florian Kaltenberger's avatar Florian Kaltenberger

moving get_band to separate function

parent ae02c9a6
...@@ -300,3 +300,66 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp) ...@@ -300,3 +300,66 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp)
LOG_I(PHY,"fp->initial_bwp_dl.location=%d\n",fp->initial_bwp_dl.location); LOG_I(PHY,"fp->initial_bwp_dl.location=%d\n",fp->initial_bwp_dl.location);
LOG_I(PHY,"fp->initial_bwp_dl.ofdm_symbol_size=%d\n",fp->initial_bwp_dl.ofdm_symbol_size); LOG_I(PHY,"fp->initial_bwp_dl.ofdm_symbol_size=%d\n",fp->initial_bwp_dl.ofdm_symbol_size);
} }
static const eutra_band_t eutra_bands[] = {
{1, 1920000, 1980000, 2110000, 2170000, FDD},
{2, 1850000, 1910000, 1930000, 1990000, FDD},
{3, 1710000, 1785000, 1805000, 1880000, FDD},
{5, 824000, 849000, 869000, 894000, FDD},
{7, 2500000, 2570000, 2620000, 2690000, FDD},
{8, 880000, 915000, 925000, 960000, FDD},
{12, 698000, 716000, 728000, 746000, FDD},
{20, 832000, 862000, 791000, 821000, FDD},
{25, 1850000, 1915000, 1930000, 1995000, FDD},
{28, 703000, 758000, 758000, 813000, FDD},
{34, 2010000, 2025000, 2010000, 2025000, TDD},
{38, 2570000, 2620000, 2570000, 2630000, TDD},
{39, 1880000, 1920000, 1880000, 1920000, TDD},
{40, 2300000, 2400000, 2300000, 2400000, TDD},
{41, 2496000, 2690000, 2496000, 2690000, TDD},
{50, 1432000, 1517000, 1432000, 1517000, TDD},
{51, 1427000, 1432000, 1427000, 1432000, TDD},
{66, 1710000, 1780000, 2110000, 2200000, FDD},
{70, 1695000, 1710000, 1995000, 2020000, FDD},
{71, 663000, 698000, 617000, 652000, FDD},
{74, 1427000, 1470000, 1475000, 1518000, FDD},
{75, 000, 000, 1432000, 1517000, FDD},
{76, 000, 000, 1427000, 1432000, FDD},
{77, 3300000, 4200000, 3300000, 4200000, TDD},
{78, 3300000, 3800000, 3300000, 3800000, TDD},
{79, 4400000, 5000000, 4400000, 5000000, TDD},
{80, 1710000, 1785000, 000, 000, FDD},
{81, 860000, 915000, 000, 000, FDD},
{82, 832000, 862000, 000, 000, FDD},
{83, 703000, 748000, 000, 000, FDD},
{84, 1920000, 1980000, 000, 000, FDD},
{86, 1710000, 1785000, 000, 000, FDD}
};
int get_band(uint32_t downlink_frequency, uint8_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type) {
int ind;
int64_t dl_freq_khz = downlink_frequency/1000;
for ( ind=0;
ind < sizeof(eutra_bands) / sizeof(eutra_bands[0]);
ind++) {
*current_band = eutra_bands[ind].band;
*current_type = eutra_bands[ind].frame_type;
LOG_I(PHY, "Scanning band %d, dl_min %"PRIu32", ul_min %"PRIu32"\n", ind, eutra_bands[ind].dl_min,eutra_bands[ind].ul_min);
if ( eutra_bands[ind].dl_min <= dl_freq_khz && eutra_bands[ind].dl_max >= dl_freq_khz ) {
*current_offset = (eutra_bands[ind].ul_min - eutra_bands[ind].dl_min)*1000;
LOG_I( PHY, "DL frequency %"PRIu32": band %d, frame_type %d, UL frequency %"PRIu32"\n",
downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset);
break;
}
}
if( ind == sizeof(eutra_bands) / sizeof(eutra_bands[0])) {
LOG_E(PHY,"Can't find EUTRA band for frequency %d\n", downlink_frequency);
return(-1);
}
}
...@@ -391,6 +391,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB); ...@@ -391,6 +391,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB);
void init_dfts(void); void init_dfts(void);
int get_band(uint32_t downlink_frequency, uint8_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
/** @} */ /** @} */
#endif #endif
...@@ -321,4 +321,21 @@ typedef struct NR_DL_FRAME_PARMS { ...@@ -321,4 +321,21 @@ typedef struct NR_DL_FRAME_PARMS {
} NR_DL_FRAME_PARMS; } NR_DL_FRAME_PARMS;
#define KHz (1000UL)
#define MHz (1000*KHz)
typedef struct eutra_band_s {
int16_t band;
uint32_t ul_min;
uint32_t ul_max;
uint32_t dl_min;
uint32_t dl_max;
lte_frame_type_t frame_type;
} eutra_band_t;
typedef struct band_info_s {
int nbands;
eutra_band_t band_info[100];
} band_info_t;
#endif #endif
...@@ -150,27 +150,12 @@ void init_UE(int nb_inst); ...@@ -150,27 +150,12 @@ void init_UE(int nb_inst);
int32_t **rxdata; int32_t **rxdata;
int32_t **txdata; int32_t **txdata;
#define KHz (1000UL)
#define MHz (1000*KHz)
#define SAIF_ENABLED #define SAIF_ENABLED
#ifdef SAIF_ENABLED #ifdef SAIF_ENABLED
uint64_t g_ue_rx_thread_busy = 0; uint64_t g_ue_rx_thread_busy = 0;
#endif #endif
typedef struct eutra_band_s {
int16_t band;
uint32_t ul_min;
uint32_t ul_max;
uint32_t dl_min;
uint32_t dl_max;
lte_frame_type_t frame_type;
} eutra_band_t;
typedef struct band_info_s {
int nbands;
eutra_band_t band_info[100];
} band_info_t;
band_info_t bands_to_scan; band_info_t bands_to_scan;
...@@ -354,29 +339,11 @@ static void *UE_thread_synch(void *arg) { ...@@ -354,29 +339,11 @@ static void *UE_thread_synch(void *arg) {
init_thread(100000, 500000, FIFO_PRIORITY-1, &cpuset, threadname); init_thread(100000, 500000, FIFO_PRIORITY-1, &cpuset, threadname);
UE->is_synchronized = 0; UE->is_synchronized = 0;
if (UE->UE_scan == 0) { printf("UE_scan %d\n",UE->UE_scan);
int ind;
int64_t dl_freq_khz = downlink_frequency[0][0]/1000;
for ( ind=0;
ind < sizeof(eutra_bands) / sizeof(eutra_bands[0]);
ind++) {
current_band = eutra_bands[ind].band;
current_type = eutra_bands[ind].frame_type;
LOG_D(PHY, "Scanning band %d, dl_min %"PRIu32", ul_min %"PRIu32"\n", current_band, eutra_bands[ind].dl_min,eutra_bands[ind].ul_min);
if ( eutra_bands[ind].dl_min <= dl_freq_khz && eutra_bands[ind].dl_max >= dl_freq_khz ) {
for (i=0; i<4; i++)
uplink_frequency_offset[CC_id][i] = (eutra_bands[ind].ul_min - eutra_bands[ind].dl_min)*1000;
break;
}
}
AssertFatal( ind < sizeof(eutra_bands) / sizeof(eutra_bands[0]), "Can't find EUTRA band for frequency"); if (UE->UE_scan == 0) {
UE->frame_parms.eutra_band = current_band; get_band(downlink_frequency[CC_id][0], &UE->frame_parms.eutra_band, &uplink_frequency_offset[CC_id][0], &UE->frame_parms.frame_type);
UE->frame_parms.frame_type = current_type;
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu32", UL %"PRIu32" (oai_exit %d, rx_num_channels %d)\n", LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu32", UL %"PRIu32" (oai_exit %d, rx_num_channels %d)\n",
downlink_frequency[0][0], downlink_frequency[0][0]+uplink_frequency_offset[0][0], downlink_frequency[0][0], downlink_frequency[0][0]+uplink_frequency_offset[0][0],
......
...@@ -932,14 +932,14 @@ int main( int argc, char **argv ) { ...@@ -932,14 +932,14 @@ int main( int argc, char **argv ) {
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx); LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
//init_ul_hopping(frame_parms[CC_id]); get_band(downlink_frequency[CC_id][0], &frame_parms[CC_id]->eutra_band, &uplink_frequency_offset[CC_id][0], &frame_parms[CC_id]->frame_type);
//phy_init_nr_top(frame_parms[CC_id]);
}
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { //init_ul_hopping(frame_parms[CC_id]);
//init prach for openair1 test //phy_init_nr_top(frame_parms[CC_id]);
// prach_fmt = get_prach_fmt(frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, frame_parms->frame_type);
// N_ZC = (prach_fmt <4)?839:139; //init prach for openair1 test
// prach_fmt = get_prach_fmt(frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, frame_parms->frame_type);
// N_ZC = (prach_fmt <4)?839:139;
} }
NB_UE_INST=1; NB_UE_INST=1;
......
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