Commit efb2eb37 authored by rubuntun's avatar rubuntun

added frequency set thread

parents 42702a0e 588e976f
......@@ -524,7 +524,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
phich_string[ue->frame_parms.phich_config_common.phich_resource],
ue->frame_parms.nb_antenna_ports_eNB);
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_IRIS)
LOG_I(PHY,"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
......@@ -577,23 +577,27 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",ue->Mod_id,ue->measurements.rx_power_avg_dB[0] );
#endif
#ifndef OAI_IRIS
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0);
#endif
#endif
#endif
#endif
}
else {
#ifndef OAI_IRIS
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0);
#endif
#endif
#endif
#endif
}
......
......@@ -87,6 +87,7 @@ static int trx_iris_start(openair0_device *device)
*/
static void trx_iris_end(openair0_device *device)
{
LOG_I(HW,"Closing Iris device.\n");
iris_state_t *s = (iris_state_t*)device->priv;
s->iris->closeStream(s->txStream);
s->iris->closeStream(s->rxStream);
......@@ -172,7 +173,9 @@ static int trx_iris_read(openair0_device *device, openair0_timestamp *ptimestamp
long long timeNs = 0;
int flags = 0;
int samples_received = 0;
uint32_t **samps = (uint32_t **)buff;
uint32_t *samps[2] = {(uint32_t *)buff[0], (uint32_t *)buff[1]}; //cws: it seems another thread can clobber these, so we need to save them locally.
//printf("Reading %d samples from Iris...\n", nsamps);
//fflush(stdout);
while (samples_received < nsamps)
{
flags = 0;
......@@ -418,44 +421,42 @@ extern "C" {
// Initialize Iris device
device->openair0_cfg = openair0_cfg;
char* remote_addr = device->openair0_cfg->remote_addr;
LOG_I(HW,"Attempting to open Iris device: %s\n", remote_addr);
std::string args = "driver=remote,serial="+std::string(remote_addr);
s->iris = SoapySDR::Device::make(args);
device->type=IRIS_DEV;
s->iris->setMasterClockRate(8*openair0_cfg[0].sample_rate); // sample*8=clock_rate for Soapy
printf("tx_sample_advance %d\n", openair0_cfg[0].tx_sample_advance);
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
s->iris->setMasterClockRate(8*30.72e6);
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 115;
//openair0_cfg[0].tx_sample_advance = 115;
openair0_cfg[0].tx_bw = 30e6;
openair0_cfg[0].rx_bw = 30e6;
break;
case 23040000:
s->iris->setMasterClockRate(8*23.04e6);
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 113;
//openair0_cfg[0].tx_sample_advance = 113;
openair0_cfg[0].tx_bw = 30e6;
openair0_cfg[0].rx_bw = 30e6;
break;
case 15360000:
s->iris->setMasterClockRate(8*15.36e6);
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 103;
//openair0_cfg[0].tx_sample_advance = 103;
openair0_cfg[0].tx_bw = 30e6;
openair0_cfg[0].rx_bw = 30e6;
break;
case 7680000:
s->iris->setMasterClockRate(8*7.68e6); // sample*8=clock_rate for Soapy
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 80;
//openair0_cfg[0].tx_sample_advance = 80;
openair0_cfg[0].tx_bw = 30e6;
openair0_cfg[0].rx_bw = 30e6;
break;
case 1920000:
s->iris->setMasterClockRate(8*1.92e6);
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 40;
//openair0_cfg[0].tx_sample_advance = 40;
openair0_cfg[0].tx_bw = 30e6;
openair0_cfg[0].rx_bw = 30e6;
break;
......@@ -568,6 +569,8 @@ extern "C" {
s->tx_forward_nsamps = 90;
if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50;
LOG_I(HW,"Finished initializing Iris device. %d %f \n");
return 0;
}
}
......
......@@ -37,10 +37,10 @@ eNBs =
N_RB_DL = 6;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 2;
nb_antennas_rx = 2;
tx_gain = 52;
rx_gain = 40;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 65;
rx_gain = 35;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
......@@ -147,7 +147,7 @@ eNBs =
rrh_gw_config = (
{
local_if_name = "eth0";
remote_address = "00005";
remote_address = "0127";
local_address = "10.224.20.21";
local_port = 50000; #for raw option local port must be the same to remote
remote_port = 50000;
......@@ -155,7 +155,7 @@ rrh_gw_config = (
tr_preference = "raw";
rf_preference = "iris030";
iq_txshift = 4;
tx_sample_advance = 103;
tx_sample_advance = 60;
tx_scheduling_advance = 9;
}
......
......@@ -228,6 +228,7 @@ int16_t node_synch_ref[MAX_NUM_CCs];
uint32_t target_dl_mcs = 28; //maximum allowed mcs
uint32_t target_ul_mcs = 10;
uint32_t tx_sample_advance = 0; //cws: added to test tx/rx sync
uint32_t timing_advance = 0;
uint8_t exit_missed_slots=1;
uint64_t num_missed_slots=0; // counter for the number of missed slots
......@@ -267,7 +268,7 @@ int16_t osa_log_verbosity = LOG_MED;
char *rrh_UE_ip = "127.0.0.1";
char rrh_UE_ip[50] = "127.0.0.1";
int rrh_UE_port = 51000;
......@@ -384,7 +385,7 @@ void help (void) {
printf(" -C Set the downlink frequency for all component carriers\n");
printf(" -d Enable soft scope and L1 and L2 stats (Xforms)\n");
printf(" -F Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n");
printf(" -g Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n");
printf(" -g Set the global log level, valid options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n");
printf(" -G Set the global log verbosity \n");
printf(" -h provides this help message!\n");
printf(" -K Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n");
......@@ -400,6 +401,8 @@ void help (void) {
printf(" -V Enable VCD (generated file will be located atopenair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n");
printf(" -x Set the transmission mode, valid options: 1 \n");
printf(" -E Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n");
printf(" --rrh-remote-address Remote radio head address (serial for Iris)\n");
printf(" --tx-sample-advance TX Sample Advance\n");
#if T_TRACER
printf(" --T_port [port] use given port\n");
printf(" --T_nowait don't wait for tracer, start immediately\n");
......@@ -680,7 +683,7 @@ static void get_options (int argc, char **argv)
LONG_OPTION_NO_L2_CONNECT,
LONG_OPTION_CALIB_PRACH_TX,
LONG_OPTION_RXGAIN,
LONG_OPTION_RXGAINOFF,
LONG_OPTION_RXGAINOFF,
LONG_OPTION_TXGAIN,
LONG_OPTION_SCANCARRIER,
LONG_OPTION_MAXPOWER,
......@@ -690,6 +693,8 @@ static void get_options (int argc, char **argv)
LONG_OPTION_USIMTEST,
LONG_OPTION_MMAPPED_DMA,
LONG_OPTION_SINGLE_THREAD_DISABLE,
LONG_OPTION_RRH_REMOTE_ADDRESS,
LONG_OPTION_TX_SAMPLE_ADVANCE,
#if T_TRACER
LONG_OPTION_T_PORT,
LONG_OPTION_T_NOWAIT,
......@@ -707,7 +712,7 @@ static void get_options (int argc, char **argv)
{"no-L2-connect", no_argument, NULL, LONG_OPTION_NO_L2_CONNECT},
{"calib-prach-tx", no_argument, NULL, LONG_OPTION_CALIB_PRACH_TX},
{"ue-rxgain", required_argument, NULL, LONG_OPTION_RXGAIN},
{"ue-rxgain-off", required_argument, NULL, LONG_OPTION_RXGAINOFF},
{"ue-rxgain-off", required_argument, NULL, LONG_OPTION_RXGAINOFF},
{"ue-txgain", required_argument, NULL, LONG_OPTION_TXGAIN},
{"ue-scan-carrier", no_argument, NULL, LONG_OPTION_SCANCARRIER},
{"ue-max-power", required_argument, NULL, LONG_OPTION_MAXPOWER},
......@@ -717,6 +722,8 @@ static void get_options (int argc, char **argv)
{"usim-test", no_argument, NULL, LONG_OPTION_USIMTEST},
{"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA},
{"single-thread-disable", no_argument, NULL, LONG_OPTION_SINGLE_THREAD_DISABLE},
{"rrh-remote-address", required_argument, NULL, LONG_OPTION_RRH_REMOTE_ADDRESS},
{"tx-sample-advance", required_argument, NULL, LONG_OPTION_TX_SAMPLE_ADVANCE},
#if T_TRACER
{"T_port", required_argument, 0, LONG_OPTION_T_PORT},
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
......@@ -727,6 +734,21 @@ static void get_options (int argc, char **argv)
while ((c = getopt_long (argc, argv, "A:a:C:dEK:g:F:G:hqO:m:SUVRM:r:P:Ws:t:Tx:",long_options,NULL)) != -1) {
switch (c) {
case LONG_OPTION_TX_SAMPLE_ADVANCE:
tx_sample_advance = atoi(optarg);
printf("Setting tx_sample_advance to %d\n",tx_sample_advance);
break;
case LONG_OPTION_RRH_REMOTE_ADDRESS:
if ((strcmp("null", optarg) == 0) || (strcmp("NULL", optarg) == 0)) {
printf("no rrh-remote-address is provided\n");
}
else if (strlen(optarg)<=49){
strcpy(rrh_UE_ip,optarg);
}else {
printf("rrh-remote-address is too long\n");
exit(-1);
}
case LONG_OPTION_RF_CONFIG_FILE:
if ((strcmp("null", optarg) == 0) || (strcmp("NULL", optarg) == 0)) {
printf("no configuration filename is provided\n");
......@@ -1329,9 +1351,11 @@ void init_openair0() {
if (UE_flag) {
printf("ETHERNET: Configuring UE ETH for %s:%d\n",rrh_UE_ip,rrh_UE_port);
openair0_cfg[card].remote_addr = &rrh_UE_ip[0];
openair0_cfg[card].remote_addr = &rrh_UE_ip[0];
openair0_cfg[card].remote_port = rrh_UE_port;
}
openair0_cfg[card].tx_sample_advance = tx_sample_advance; //BS will set this in the config file
printf("Set tx_sample_advance to %d\n", openair0_cfg[card].tx_sample_advance);
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
......
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