Commit c8b6f4c8 authored by magounak's avatar magounak

interdigital beam selection

parent bc982616
......@@ -738,6 +738,8 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
else if (slot==1)
flags=3;
flags |= (3+slot)<<8;
/*
if (SF_type == SF_S) {
siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0);
......
......@@ -401,8 +401,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED;
gNB->mac_enabled = 1;
fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
fp->dl_CarrierFreq = 3500000000L;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = 3500000000L;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
fp->threequarter_fs= 0;
nr_init_frame_parms(gNB_config, fp);
gNB->configured = 1;
......@@ -439,7 +439,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
get_band(fp->dl_CarrierFreq, &gNB_config->nfapi_config.rf_bands.rf_band[0], &uplink_frequency_offset[CC_id][0], &fp->frame_type);
fp->ul_CarrierFreq = fp->dl_CarrierFreq + uplink_frequency_offset[CC_id][0];
fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,DL freq %u, UL freq %u)\n",
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,DL freq %"PRIu64", UL freq %"PRIu64")\n",
Mod_id,
CC_id,
gNB_config->nfapi_config.rf_bands.rf_band[0],
......
......@@ -314,8 +314,8 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp)
LOG_I(PHY,"fp->samples_per_frame_wCP=%d\n",fp->samples_per_frame_wCP);
LOG_I(PHY,"fp->samples_per_subframe=%d\n",fp->samples_per_subframe);
LOG_I(PHY,"fp->samples_per_frame=%d\n",fp->samples_per_frame);
LOG_I(PHY,"fp->dl_CarrierFreq=%u\n",fp->dl_CarrierFreq);
LOG_I(PHY,"fp->ul_CarrierFreq=%u\n",fp->ul_CarrierFreq);
LOG_I(PHY,"fp->dl_CarrierFreq=%"PRIu64"\n",fp->dl_CarrierFreq);
LOG_I(PHY,"fp->ul_CarrierFreq=%"PRIu64"\n",fp->ul_CarrierFreq);
}
......
......@@ -221,7 +221,7 @@ typedef struct NR_DL_FRAME_PARMS {
nfapi_nr_sch_config_t sch_config;
/// Number of resource blocks (RB) in DL
int N_RB_DL;
/// Number of resource blocks (RB) in UL
/// Number of resource 1blocks (RB) in UL
int N_RB_UL;
/// total Number of Resource Block Groups: this is ceil(N_PRB/P)
uint8_t N_RBG;
......@@ -230,9 +230,9 @@ typedef struct NR_DL_FRAME_PARMS {
/// EUTRA Band
uint16_t eutra_band;
/// DL carrier frequency
uint32_t dl_CarrierFreq;
uint64_t dl_CarrierFreq;
/// UL carrier frequency
uint32_t ul_CarrierFreq;
uint64_t ul_CarrierFreq;
/// TX attenuation
uint32_t att_tx;
/// RX attenuation
......
......@@ -121,7 +121,7 @@ int to_absslot(nfapi_nr_config_request_t *cfg,int frame,int slot);
int get_symbolsperslot(nfapi_nr_config_request_t *cfg);
void get_band(uint32_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);
......
......@@ -58,7 +58,9 @@ nr_bandentry_t nr_bandtable[] = {
{76, 000, 000, 1427000, 1432000, 20, 285400},
{77, 3300000, 4200000, 3300000, 4200000, 1, 620000},
{78, 3300000, 3800000, 3300000, 3800000, 1, 620000},
{79, 4400000, 5000000, 4400000, 5000000, 2, 693334},
//{79, 4400000, 5000000, 4400000, 5000000, 2, 693334},
// small-change to allow IF frequencies between 5-6 GHz for FR2
{79, 4400000, 6000000, 4400000, 6000000, 2, 693334},
{80, 1710000, 1785000, 000, 000, 20, 342000},
{81, 860000, 915000, 000, 000, 20, 176000},
{82, 832000, 862000, 000, 000, 20, 166400},
......@@ -69,7 +71,7 @@ nr_bandentry_t nr_bandtable[] = {
#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t))
void get_band(uint32_t downlink_frequency,
void get_band(uint64_t downlink_frequency,
uint16_t *current_band,
int32_t *current_offset,
lte_frame_type_t *current_type)
......@@ -86,7 +88,7 @@ void get_band(uint32_t downlink_frequency,
ind < sizeof(nr_bandtable) / sizeof(nr_bandtable[0]);
ind++) {
LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min);
LOG_I(PHY, "Scanning band %d for %"PRIu64", dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, dl_freq_khz,nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min);
if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) {
......@@ -110,7 +112,7 @@ void get_band(uint32_t downlink_frequency,
downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset);
AssertFatal(*current_band != 0,
"Can't find EUTRA band for frequency %u\n", downlink_frequency);
"Can't find NR band for frequency %u\n", downlink_frequency);
}
uint32_t to_nrarfcn(int nr_bandP,
......
......@@ -316,11 +316,14 @@ static int trx_usrp_start(openair0_device *device) {
usrp_state_t *s = (usrp_state_t *)device->priv;
// setup GPIO for TDD, GPIO(4) = ATR_RX
//set data direction register (DDR) to output
s->usrp->set_gpio_attr("FP0", "DDR", 0x7f, 0x7f);
s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff);
//set control register to ATR
s->usrp->set_gpio_attr("FP0", "CTRL", 0x7f,0x7f);
s->usrp->set_gpio_attr("FP0", "CTRL", (1<<4),0xfff);
//set ATR register
s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4)|(1<<6), 0x7f);
s->usrp->set_gpio_attr("FP0", "ATR_XX", (1<<4), 0xfff);
s->usrp->set_gpio_attr("FP0", "OUT", 3<<7, 0xfff);
// init recv and send streaming
uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
LOG_I(HW,"Time in secs now: %llu \n", s->usrp->get_time_now().to_ticks(s->sample_rate));
......@@ -442,7 +445,12 @@ static void trx_usrp_end(openair0_device *device) {
@param antenna_id index of the antenna if the device has multiple antennas
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/
static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
static int trx_usrp_write(openair0_device *device,
openair0_timestamp timestamp,
void **buff,
int nsamps,
int cc,
int flags) {
int ret=0;
#if defined(USRP_REC_PLAY)
......@@ -452,6 +460,9 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
int nsamps2; // aligned to upper 32 or 16 byte boundary
int flags_lsb = flags&0xff;
int flags_msb = (flags>>8)&0xff;
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2 = (nsamps+7)>>3;
......@@ -484,28 +495,28 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
boolean_t first_packet_state=false,last_packet_state=false;
if (flags == 2) { // start of burst
if (flags_lsb == 2) { // start of burst
// s->tx_md.start_of_burst = true;
// s->tx_md.end_of_burst = false;
first_packet_state = true;
last_packet_state = false;
} else if (flags == 3) { // end of burst
} else if (flags_lsb == 3) { // end of burst
//s->tx_md.start_of_burst = false;
//s->tx_md.end_of_burst = true;
first_packet_state = false;
last_packet_state = true;
} else if (flags == 4) { // start and end
} else if (flags_lsb == 4) { // start and end
// s->tx_md.start_of_burst = true;
// s->tx_md.end_of_burst = true;
first_packet_state = true;
last_packet_state = true;
} else if (flags==1) { // middle of burst
} else if (flags_lsb==1) { // middle of burst
// s->tx_md.start_of_burst = false;
// s->tx_md.end_of_burst = false;
first_packet_state = false;
last_packet_state = false;
}
else if (flags==10) { // fail safe mode
else if (flags_lsb==10) { // fail safe mode
// s->tx_md.has_time_spec = false;
// s->tx_md.start_of_burst = false;
// s->tx_md.end_of_burst = true;
......@@ -513,6 +524,9 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
last_packet_state = true;
}
// push GPIO bits 9-11 from flags_msb
int gpio789=(flags_msb&7)<<7;
s->tx_md.has_time_spec = true;
s->tx_md.start_of_burst = (s->tx_count==0) ? true : first_packet_state;
s->tx_md.end_of_burst = last_packet_state;
......@@ -520,6 +534,10 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
s->tx_count++;
s->usrp->set_command_time(s->tx_md.time_spec);
s->usrp->set_gpio_attr("FP0", "OUT", gpio789, 0xfff);
s->usrp->clear_command_time();
if (cc>1) {
std::vector<void *> buff_ptrs;
......
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