Merge remote-tracking branch 'origin/develop' into RU-RAU-split
Conflicts: openair1/PHY/INIT/lte_init.c openair1/PHY/LTE_ESTIMATION/defs.h openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c openair1/PHY/LTE_TRANSPORT/dci.c openair1/PHY/LTE_TRANSPORT/dci_tools.c openair1/PHY/LTE_TRANSPORT/defs.h openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c openair1/PHY/LTE_TRANSPORT/if5_tools.c openair1/PHY/LTE_TRANSPORT/phich.c openair1/PHY/LTE_TRANSPORT/proto.h openair1/PHY/defs.h openair1/SCHED/phy_procedures_lte_eNb.c openair1/SCHED/phy_procedures_lte_ue.c openair1/SCHED/pusch_pc.c openair2/ENB_APP/enb_config.c openair2/LAYER2/MAC/defs.h openair2/LAYER2/MAC/eNB_scheduler.c openair2/LAYER2/MAC/eNB_scheduler_dlsch.c openair2/LAYER2/MAC/eNB_scheduler_primitives.c openair2/LAYER2/MAC/eNB_scheduler_ulsch.c openair2/LAYER2/MAC/pre_processor.c openair2/LAYER2/MAC/ue_procedures.c targets/RT/USER/lte-enb.c targets/RT/USER/lte-softmodem.c targets/RT/USER/lte-softmodem.h targets/RT/USER/lte-ue.c targets/SIMU/USER/init_lte.c targets/SIMU/USER/oaisim_functions.c
This commit is contained in:
@@ -82,6 +82,48 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod
|
||||
* \returns 0 on success
|
||||
*/
|
||||
int trx_brf_start(openair0_device *device) {
|
||||
brf_state_t *brf = (brf_state_t*)device->priv;
|
||||
int status;
|
||||
|
||||
brf->meta_tx.flags = 0;
|
||||
|
||||
if ((status = bladerf_sync_config(brf->dev,
|
||||
BLADERF_MODULE_TX,
|
||||
BLADERF_FORMAT_SC16_Q11_META,
|
||||
brf->num_buffers,
|
||||
brf->buffer_size,
|
||||
brf->num_transfers,
|
||||
100/*brf->tx_timeout_ms*/)) != 0 ) {
|
||||
fprintf(stderr,"Failed to configure TX sync interface: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
if ((status = bladerf_sync_config(brf->dev,
|
||||
BLADERF_MODULE_RX,
|
||||
BLADERF_FORMAT_SC16_Q11_META,
|
||||
brf->num_buffers,
|
||||
brf->buffer_size,
|
||||
brf->num_transfers,
|
||||
100/*brf->rx_timeout_ms*/)) != 0 ) {
|
||||
fprintf(stderr,"Failed to configure RX sync interface: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
if ((status=bladerf_enable_module(brf->dev, BLADERF_MODULE_TX, true)) != 0) {
|
||||
fprintf(stderr,"Failed to enable TX module: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
if ((status=bladerf_enable_module(brf->dev, BLADERF_MODULE_RX, true)) != 0) {
|
||||
fprintf(stderr,"Failed to enable RX module: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
|
||||
if ((status=bladerf_calibrate_dc(brf->dev, BLADERF_MODULE_TX)) != 0) {
|
||||
fprintf(stderr,"Failed to calibrate TX DC: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
if ((status=bladerf_calibrate_dc(brf->dev, BLADERF_MODULE_RX)) != 0) {
|
||||
fprintf(stderr,"Failed to calibrate RX DC: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -133,7 +175,7 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp,
|
||||
brf->tx_count++;
|
||||
|
||||
|
||||
return(0);
|
||||
return nsamps; //brf->meta_tx.actual_count;
|
||||
}
|
||||
|
||||
/*! \brief Receive samples from hardware.
|
||||
@@ -155,6 +197,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
|
||||
// BRF has only one rx/tx chain
|
||||
int16_t *samples = (int16_t*)buff[0];
|
||||
|
||||
brf->meta_rx.actual_count = 0;
|
||||
brf->meta_rx.flags = BLADERF_META_FLAG_RX_NOW;
|
||||
status = bladerf_sync_rx(brf->dev, samples, (unsigned int) nsamps, &brf->meta_rx, 2*brf->rx_timeout_ms);
|
||||
|
||||
@@ -170,6 +213,10 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
|
||||
brf->num_overflows,brf->meta_rx.timestamp, brf->meta_rx.actual_count, nsamps);
|
||||
}
|
||||
|
||||
if (brf->meta_rx.actual_count != nsamps) {
|
||||
printf("RX bad samples count, wanted %d, got %d\n", nsamps, brf->meta_rx.actual_count);
|
||||
}
|
||||
|
||||
//printf("Current RX timestampe %u\n", brf->meta_rx.timestamp);
|
||||
//printf("[BRF] (buff %p) ts=0x%"PRIu64" %s\n",samples, brf->meta_rx.timestamp,bladerf_strerror(status));
|
||||
brf->rx_current_ts=brf->meta_rx.timestamp;
|
||||
@@ -180,7 +227,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
|
||||
|
||||
*ptimestamp = brf->meta_rx.timestamp;
|
||||
|
||||
return brf->meta_rx.actual_count;
|
||||
return nsamps; //brf->meta_rx.actual_count;
|
||||
|
||||
}
|
||||
|
||||
@@ -188,6 +235,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
void trx_brf_end(openair0_device *device) {
|
||||
abort();
|
||||
|
||||
int status;
|
||||
brf_state_t *brf = (brf_state_t*)device->priv;
|
||||
@@ -1081,6 +1129,15 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
|
||||
// memcpy((void*)&device->openair0_cfg,(void*)&openair0_cfg[0],sizeof(openair0_config_t));
|
||||
|
||||
if ((status=bladerf_enable_module(brf->dev, BLADERF_MODULE_TX, false)) != 0) {
|
||||
fprintf(stderr,"Failed to enable TX module: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
if ((status=bladerf_enable_module(brf->dev, BLADERF_MODULE_RX, false)) != 0) {
|
||||
fprintf(stderr,"Failed to enable RX module: %s\n", bladerf_strerror(status));
|
||||
abort();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,9 @@ typedef enum {
|
||||
//! This tells the underlying hardware to use the internal reference
|
||||
internal=0,
|
||||
//! This tells the underlying hardware to use the external reference
|
||||
external=1
|
||||
external=1,
|
||||
//! This tells the underlying hardware to use the gpsdo reference
|
||||
gpsdo=2
|
||||
} clock_source_t;
|
||||
|
||||
/*! \brief RF frontend parameters set by application */
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <uhd/version.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <iostream>
|
||||
#include <complex>
|
||||
#include <fstream>
|
||||
@@ -92,12 +94,181 @@ typedef struct {
|
||||
int num_seq_errors;
|
||||
int64_t tx_count;
|
||||
int64_t rx_count;
|
||||
int wait_for_first_pps;
|
||||
int use_gps;
|
||||
//! timestamp of RX packet
|
||||
openair0_timestamp rx_timestamp;
|
||||
|
||||
} usrp_state_t;
|
||||
|
||||
//void print_notes(void)
|
||||
//{
|
||||
// Helpful notes
|
||||
// std::cout << boost::format("**************************************Helpful Notes on Clock/PPS Selection**************************************\n");
|
||||
// std::cout << boost::format("As you can see, the default 10 MHz Reference and 1 PPS signals are now from the GPSDO.\n");
|
||||
// std::cout << boost::format("If you would like to use the internal reference(TCXO) in other applications, you must configure that explicitly.\n");
|
||||
// std::cout << boost::format("You can no longer select the external SMAs for 10 MHz or 1 PPS signaling.\n");
|
||||
// std::cout << boost::format("****************************************************************************************************************\n");
|
||||
//}
|
||||
|
||||
static int sync_to_gps(openair0_device *device)
|
||||
{
|
||||
uhd::set_thread_priority_safe();
|
||||
|
||||
//std::string args;
|
||||
|
||||
//Set up program options
|
||||
//po::options_description desc("Allowed options");
|
||||
//desc.add_options()
|
||||
//("help", "help message")
|
||||
//("args", po::value<std::string>(&args)->default_value(""), "USRP device arguments")
|
||||
//;
|
||||
//po::variables_map vm;
|
||||
//po::store(po::parse_command_line(argc, argv, desc), vm);
|
||||
//po::notify(vm);
|
||||
|
||||
//Print the help message
|
||||
//if (vm.count("help"))
|
||||
//{
|
||||
// std::cout << boost::format("Synchronize USRP to GPS %s") % desc << std::endl;
|
||||
// return EXIT_FAILURE;
|
||||
//}
|
||||
|
||||
//Create a USRP device
|
||||
//std::cout << boost::format("\nCreating the USRP device with: %s...\n") % args;
|
||||
//uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
|
||||
//std::cout << boost::format("Using Device: %s\n") % usrp->get_pp_string();
|
||||
|
||||
usrp_state_t *s = (usrp_state_t*)device->priv;
|
||||
|
||||
try
|
||||
{
|
||||
size_t num_mboards = s->usrp->get_num_mboards();
|
||||
size_t num_gps_locked = 0;
|
||||
for (size_t mboard = 0; mboard < num_mboards; mboard++)
|
||||
{
|
||||
std::cout << "Synchronizing mboard " << mboard << ": " << s->usrp->get_mboard_name(mboard) << std::endl;
|
||||
|
||||
//Set references to GPSDO
|
||||
s->usrp->set_clock_source("gpsdo", mboard);
|
||||
s->usrp->set_time_source("gpsdo", mboard);
|
||||
|
||||
//std::cout << std::endl;
|
||||
//print_notes();
|
||||
//std::cout << std::endl;
|
||||
|
||||
//Check for 10 MHz lock
|
||||
std::vector<std::string> sensor_names = s->usrp->get_mboard_sensor_names(mboard);
|
||||
if(std::find(sensor_names.begin(), sensor_names.end(), "ref_locked") != sensor_names.end())
|
||||
{
|
||||
std::cout << "Waiting for reference lock..." << std::flush;
|
||||
bool ref_locked = false;
|
||||
for (int i = 0; i < 30 and not ref_locked; i++)
|
||||
{
|
||||
ref_locked = s->usrp->get_mboard_sensor("ref_locked", mboard).to_bool();
|
||||
if (not ref_locked)
|
||||
{
|
||||
std::cout << "." << std::flush;
|
||||
boost::this_thread::sleep(boost::posix_time::seconds(1));
|
||||
}
|
||||
}
|
||||
if(ref_locked)
|
||||
{
|
||||
std::cout << "LOCKED" << std::endl;
|
||||
} else {
|
||||
std::cout << "FAILED" << std::endl;
|
||||
std::cout << "Failed to lock to GPSDO 10 MHz Reference. Exiting." << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << boost::format("ref_locked sensor not present on this board.\n");
|
||||
}
|
||||
|
||||
//Wait for GPS lock
|
||||
bool gps_locked = s->usrp->get_mboard_sensor("gps_locked", mboard).to_bool();
|
||||
if(gps_locked)
|
||||
{
|
||||
num_gps_locked++;
|
||||
std::cout << boost::format("GPS Locked\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WARNING: GPS not locked - time will not be accurate until locked" << std::endl;
|
||||
}
|
||||
|
||||
//Set to GPS time
|
||||
uhd::time_spec_t gps_time = uhd::time_spec_t(time_t(s->usrp->get_mboard_sensor("gps_time", mboard).to_int()));
|
||||
//s->usrp->set_time_next_pps(gps_time+1.0, mboard);
|
||||
s->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
|
||||
|
||||
//Wait for it to apply
|
||||
//The wait is 2 seconds because N-Series has a known issue where
|
||||
//the time at the last PPS does not properly update at the PPS edge
|
||||
//when the time is actually set.
|
||||
boost::this_thread::sleep(boost::posix_time::seconds(2));
|
||||
|
||||
//Check times
|
||||
gps_time = uhd::time_spec_t(time_t(s->usrp->get_mboard_sensor("gps_time", mboard).to_int()));
|
||||
uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps(mboard);
|
||||
std::cout << "USRP time: " << (boost::format("%0.9f") % time_last_pps.get_real_secs()) << std::endl;
|
||||
std::cout << "GPSDO time: " << (boost::format("%0.9f") % gps_time.get_real_secs()) << std::endl;
|
||||
//if (gps_time.get_real_secs() == time_last_pps.get_real_secs())
|
||||
// std::cout << std::endl << "SUCCESS: USRP time synchronized to GPS time" << std::endl << std::endl;
|
||||
//else
|
||||
// std::cerr << std::endl << "ERROR: Failed to synchronize USRP time to GPS time" << std::endl << std::endl;
|
||||
}
|
||||
|
||||
if (num_gps_locked == num_mboards and num_mboards > 1)
|
||||
{
|
||||
//Check to see if all USRP times are aligned
|
||||
//First, wait for PPS.
|
||||
uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps();
|
||||
while (time_last_pps == s->usrp->get_time_last_pps())
|
||||
{
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(1));
|
||||
}
|
||||
|
||||
//Sleep a little to make sure all devices have seen a PPS edge
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(200));
|
||||
|
||||
//Compare times across all mboards
|
||||
bool all_matched = true;
|
||||
uhd::time_spec_t mboard0_time = s->usrp->get_time_last_pps(0);
|
||||
for (size_t mboard = 1; mboard < num_mboards; mboard++)
|
||||
{
|
||||
uhd::time_spec_t mboard_time = s->usrp->get_time_last_pps(mboard);
|
||||
if (mboard_time != mboard0_time)
|
||||
{
|
||||
all_matched = false;
|
||||
std::cerr << (boost::format("ERROR: Times are not aligned: USRP 0=%0.9f, USRP %d=%0.9f")
|
||||
% mboard0_time.get_real_secs()
|
||||
% mboard
|
||||
% mboard_time.get_real_secs()) << std::endl;
|
||||
}
|
||||
}
|
||||
if (all_matched)
|
||||
{
|
||||
std::cout << "SUCCESS: USRP times aligned" << std::endl << std::endl;
|
||||
} else {
|
||||
std::cout << "ERROR: USRP times are not aligned" << std::endl << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cout << boost::format("\nError: %s") % e.what();
|
||||
std::cout << boost::format("This could mean that you have not installed the GPSDO correctly.\n\n");
|
||||
std::cout << boost::format("Visit one of these pages if the problem persists:\n");
|
||||
std::cout << boost::format(" * N2X0/E1X0: http://files.ettus.com/manual/page_gpsdo.html");
|
||||
std::cout << boost::format(" * X3X0: http://files.ettus.com/manual/page_gpsdo_x3x0.html\n\n");
|
||||
std::cout << boost::format(" * E3X0: http://files.ettus.com/manual/page_usrp_e3x0.html#e3x0_hw_gps\n\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
@@ -106,9 +277,31 @@ 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", 0x1f, 0x1f);
|
||||
|
||||
//set control register to ATR
|
||||
s->usrp->set_gpio_attr("FP0", "CTRL", 0x1f,0x1f);
|
||||
|
||||
//set ATR register
|
||||
s->usrp->set_gpio_attr("FP0", "ATR_RX", 1<<4, 0x1f);
|
||||
|
||||
// init recv and send streaming
|
||||
uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
|
||||
cmd.time_spec = s->usrp->get_time_now() + uhd::time_spec_t(0.05);
|
||||
LOG_I(PHY,"Time in secs now: %llu \n", s->usrp->get_time_now().to_ticks(s->sample_rate));
|
||||
LOG_I(PHY,"Time in secs last pps: %llu \n", s->usrp->get_time_last_pps().to_ticks(s->sample_rate));
|
||||
|
||||
if (s->use_gps == 1) {
|
||||
s->wait_for_first_pps = 1;
|
||||
cmd.time_spec = s->usrp->get_time_last_pps() + uhd::time_spec_t(1.0);
|
||||
}
|
||||
else {
|
||||
s->wait_for_first_pps = 0;
|
||||
cmd.time_spec = s->usrp->get_time_now() + uhd::time_spec_t(0.05);
|
||||
}
|
||||
|
||||
cmd.stream_now = false; // start at constant delay
|
||||
s->rx_stream->issue_stream_cmd(cmd);
|
||||
|
||||
@@ -256,9 +449,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
|
||||
while (samples_received != nsamps) {
|
||||
samples_received += s->rx_stream->recv(buff_tmp[0]+samples_received,
|
||||
nsamps-samples_received, s->rx_md);
|
||||
if (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)
|
||||
if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE))
|
||||
break;
|
||||
if ((s->wait_for_first_pps == 1) && (samples_received != nsamps)) { printf("sleep...\n");} //usleep(100);
|
||||
}
|
||||
if (samples_received == nsamps) s->wait_for_first_pps=0;
|
||||
}
|
||||
// bring RX data into 12 LSBs for softmodem RX
|
||||
for (int i=0; i<cc; i++) {
|
||||
@@ -497,6 +692,10 @@ extern "C" {
|
||||
int device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
|
||||
uhd::set_thread_priority_safe(1.0);
|
||||
usrp_state_t *s = (usrp_state_t*)calloc(sizeof(usrp_state_t),1);
|
||||
|
||||
if (openair0_cfg[0].clock_source==gpsdo)
|
||||
s->use_gps =1;
|
||||
|
||||
// Initialize USRP device
|
||||
device->openair0_cfg = openair0_cfg;
|
||||
|
||||
@@ -590,10 +789,13 @@ extern "C" {
|
||||
// set master clock rate and sample rate for tx & rx for streaming
|
||||
|
||||
// lock mboard clocks
|
||||
if (openair0_cfg[0].clock_source == internal)
|
||||
s->usrp->set_clock_source("internal");
|
||||
else
|
||||
if (openair0_cfg[0].clock_source == internal){
|
||||
s->usrp->set_clock_source("internal");
|
||||
}
|
||||
else{
|
||||
s->usrp->set_clock_source("external");
|
||||
s->usrp->set_time_source("external");
|
||||
}
|
||||
|
||||
device->type = USRP_B200_DEV;
|
||||
if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
|
||||
@@ -714,8 +916,6 @@ extern "C" {
|
||||
for(int i=0; i<s->usrp->get_rx_num_channels() && i<openair0_cfg[0].rx_num_channels; i++)
|
||||
s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
|
||||
|
||||
s->usrp->set_time_now(uhd::time_spec_t(0.0));
|
||||
|
||||
for (int i=0; i<openair0_cfg[0].rx_num_channels; i++) {
|
||||
LOG_I(PHY,"RX Channel %d\n",i);
|
||||
LOG_I(PHY," Actual RX sample rate: %fMSps...\n",s->usrp->get_rx_rate(i)/1e6);
|
||||
@@ -757,6 +957,14 @@ extern "C" {
|
||||
s->tx_forward_nsamps = 90;
|
||||
if(is_equal(s->sample_rate, (double)7.68e6))
|
||||
s->tx_forward_nsamps = 50;
|
||||
|
||||
if (s->use_gps == 1) {
|
||||
if (sync_to_gps(device)) {
|
||||
LOG_I(PHY,"USRP fails to sync with GPS...\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "common_lib.h"
|
||||
#include "ethernet_lib.h"
|
||||
|
||||
#include "mobipass.h"
|
||||
#include "queues.h"
|
||||
|
||||
struct mobipass_header {
|
||||
uint16_t flags;
|
||||
uint16_t fifo_status;
|
||||
unsigned char seqno;
|
||||
unsigned char ack;
|
||||
uint32_t word0;
|
||||
uint32_t timestamp;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
int mobipass_start(openair0_device *device) { init_mobipass(device->priv); return 0; }
|
||||
int mobipass_request(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; }
|
||||
int mobipass_reply(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; }
|
||||
int mobipass_get_stats(openair0_device* device) { return 0; }
|
||||
int mobipass_reset_stats(openair0_device* device) { return 0; }
|
||||
void mobipass_end(openair0_device *device) {}
|
||||
int mobipass_stop(openair0_device *device) { return 0; }
|
||||
int mobipass_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config) { return 0; }
|
||||
int mobipass_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { return 0; }
|
||||
|
||||
int mobipass_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
mobipass_state_t *mobi = device->priv;
|
||||
struct mobipass_header *mh = (struct mobipass_header *)(((char *)buff[0]) + 14);
|
||||
mobi->mobipass_write_last_timestamp += 640;
|
||||
mobi->mobipass_write_last_timestamp %= mobi->samples_per_1024_frames;
|
||||
mh->timestamp = htonl(ntohl(mh->timestamp) % mobi->samples_per_1024_frames);
|
||||
if (mobi->mobipass_write_last_timestamp != ntohl(mh->timestamp))
|
||||
{ printf("mobipass: ERROR: bad timestamp wanted %d got %d\n", mobi->mobipass_write_last_timestamp, ntohl(mh->timestamp)); exit(1); }
|
||||
//printf("__write nsamps %d timestamps %ld seqno %d (packet timestamp %d)\n", nsamps, timestamp, mh->seqno, ntohl(mh->timestamp));
|
||||
if (nsamps != 640) abort();
|
||||
enqueue_to_mobipass(mobi->qstate, buff[0]);
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
int mobipass_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
mobipass_state_t *mobi = device->priv;
|
||||
//printf("__read nsamps %d return timestamp %d\n", nsamps, ts);
|
||||
*timestamp = htonl(mobi->mobipass_read_ts);
|
||||
mobi->mobipass_read_ts += nsamps;
|
||||
mobi->mobipass_read_ts %= mobi->samples_per_1024_frames;
|
||||
if (nsamps != 640) { printf("mobipass: ERROR: bad nsamps %d, should be 640\n", nsamps); fflush(stdout); abort(); }
|
||||
|
||||
dequeue_from_mobipass(mobi->qstate, ntohl(*timestamp), buff[0]);
|
||||
|
||||
#if 1
|
||||
struct mobipass_header *mh = (struct mobipass_header *)(((char *)buff[0]) + 14);
|
||||
mh->flags = 0;
|
||||
mh->fifo_status = 0;
|
||||
mh->seqno = mobi->mobipass_read_seqno++;
|
||||
mh->ack = 0;
|
||||
mh->word0 = 0;
|
||||
mh->timestamp = htonl(mobi->mobipass_read_ts);
|
||||
#endif
|
||||
|
||||
return nsamps;
|
||||
}
|
||||
|
||||
/* this is the only function in the library that is visible from outside
|
||||
* because in CMakeLists.txt we use -fvisibility=hidden
|
||||
*/
|
||||
__attribute__((__visibility__("default")))
|
||||
int transport_init(openair0_device *device, openair0_config_t *openair0_cfg,
|
||||
eth_params_t * eth_params )
|
||||
{
|
||||
//init_mobipass();
|
||||
|
||||
mobipass_state_t *mobi = (mobipass_state_t*)malloc(sizeof(mobipass_state_t));
|
||||
memset(mobi, 0, sizeof(mobipass_state_t));
|
||||
|
||||
if (eth_params->transp_preference != 4) goto err;
|
||||
if (eth_params->if_compress != 0) goto err;
|
||||
|
||||
/* only 50 PRBs handled for the moment */
|
||||
if (openair0_cfg[0].sample_rate != 15360000) {
|
||||
printf("mobipass: ERROR: only 50 PRBs supported\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
mobi->eth.flags = ETH_RAW_IF5_MOBIPASS;
|
||||
mobi->eth.compression = NO_COMPRESS;
|
||||
device->Mod_id = 0;//num_devices_eth++;
|
||||
device->transp_type = ETHERNET_TP;
|
||||
|
||||
device->trx_start_func = mobipass_start;
|
||||
device->trx_request_func = mobipass_request;
|
||||
device->trx_reply_func = mobipass_reply;
|
||||
device->trx_get_stats_func = mobipass_get_stats;
|
||||
device->trx_reset_stats_func = mobipass_reset_stats;
|
||||
device->trx_end_func = mobipass_end;
|
||||
device->trx_stop_func = mobipass_stop;
|
||||
device->trx_set_freq_func = mobipass_set_freq;
|
||||
device->trx_set_gains_func = mobipass_set_gains;
|
||||
device->trx_write_func = mobipass_write;
|
||||
device->trx_read_func = mobipass_read;
|
||||
|
||||
device->priv = mobi;
|
||||
|
||||
mobi->eth.if_name = strdup(eth_params->local_if_name);
|
||||
if (mobi->eth.if_name == NULL) abort();
|
||||
|
||||
if (sscanf(eth_params->my_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
|
||||
&mobi->eth_local[0],
|
||||
&mobi->eth_local[1],
|
||||
&mobi->eth_local[2],
|
||||
&mobi->eth_local[3],
|
||||
&mobi->eth_local[4],
|
||||
&mobi->eth_local[5]) != 6) {
|
||||
printf("mobipass: ERROR: bad local ethernet address '%s', check configuration file\n",
|
||||
eth_params->my_addr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (sscanf(eth_params->remote_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
|
||||
&mobi->eth_remote[0],
|
||||
&mobi->eth_remote[1],
|
||||
&mobi->eth_remote[2],
|
||||
&mobi->eth_remote[3],
|
||||
&mobi->eth_remote[4],
|
||||
&mobi->eth_remote[5]) != 6) {
|
||||
printf("mobipass: ERROR: bad remote ethernet address '%s', check configuration file\n",
|
||||
eth_params->remote_addr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* note: this only works for 50 PRBs */
|
||||
mobi->samples_per_1024_frames = 7680*2*10*1024;
|
||||
|
||||
/* TX starts at subframe 4, let's pretend we are at the right position */
|
||||
/* note: this only works for 50 PRBs */
|
||||
mobi->mobipass_write_last_timestamp = 4*7680*2-640;
|
||||
|
||||
/* device specific */
|
||||
openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
|
||||
openair0_cfg[0].iq_txshift = eth_params->iq_txshift;// shift
|
||||
openair0_cfg[0].tx_sample_advance = eth_params->tx_sample_advance;
|
||||
|
||||
/* this is useless, I think */
|
||||
if (device->host_type == BBU_HOST) {
|
||||
/*Note scheduling advance values valid only for case 7680000 */
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
case 30720000:
|
||||
openair0_cfg[0].samples_per_packet = 3840;
|
||||
break;
|
||||
case 23040000:
|
||||
openair0_cfg[0].samples_per_packet = 2880;
|
||||
break;
|
||||
case 15360000:
|
||||
openair0_cfg[0].samples_per_packet = 1920;
|
||||
break;
|
||||
case 7680000:
|
||||
openair0_cfg[0].samples_per_packet = 960;
|
||||
break;
|
||||
case 1920000:
|
||||
openair0_cfg[0].samples_per_packet = 240;
|
||||
break;
|
||||
default:
|
||||
printf("mobipass: ERROR: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
device->openair0_cfg=&openair0_cfg[0];
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
printf("mobipass: ERROR: bad configuration file?\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "queues.h"
|
||||
#include "mobipass.h"
|
||||
|
||||
/******************************************************************/
|
||||
/* time begin */
|
||||
/******************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
static void init_time(mobipass_state_t *mobi)
|
||||
{
|
||||
struct timespec now;
|
||||
if (clock_gettime(CLOCK_MONOTONIC_RAW, &now)) abort();
|
||||
mobi->t0 = (uint64_t)now.tv_sec * (uint64_t)1000000000 + (uint64_t)now.tv_nsec;
|
||||
}
|
||||
|
||||
/* called before sending data to mobipass
|
||||
* waits if called too early with respect to system clock
|
||||
* does not wait more than 1ms in any case
|
||||
*/
|
||||
static void synch_time(mobipass_state_t *mobi, uint32_t ts)
|
||||
{
|
||||
if (ts < mobi->synch_time_last_ts) mobi->synch_time_mega_ts++;
|
||||
mobi->synch_time_last_ts = ts;
|
||||
|
||||
struct timespec now;
|
||||
if (clock_gettime(CLOCK_MONOTONIC_RAW, &now)) abort();
|
||||
|
||||
uint64_t tnow;
|
||||
tnow = (uint64_t)now.tv_sec * (uint64_t)1000000000 + (uint64_t)now.tv_nsec;
|
||||
|
||||
uint64_t cur = tnow - mobi->t0;
|
||||
|
||||
/* 15360000 samples/second, in nanoseconds:
|
||||
* = 15360000 / 1000000000 = 1536 / 100000 = 48 / 3125*/
|
||||
|
||||
uint64_t ts_ns = ((uint64_t)ts + mobi->synch_time_mega_ts * (uint64_t)mobi->samples_per_1024_frames) * (uint64_t)3125 / (uint64_t)48;
|
||||
|
||||
/* TODO: if cur is way higher than ts_ns, we are very late, log something? */
|
||||
if (cur >= ts_ns) return;
|
||||
|
||||
uint64_t delta = ts_ns - cur;
|
||||
/* don't sleep more than 1 ms */
|
||||
if (delta > 1000*1000) delta = 1000*1000;
|
||||
delta = delta/1000;
|
||||
if (delta) usleep(delta);
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/* time end */
|
||||
/******************************************************************/
|
||||
|
||||
struct ethernet_header {
|
||||
unsigned char dst[6];
|
||||
unsigned char src[6];
|
||||
uint16_t packet_type;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct mobipass_header {
|
||||
uint16_t flags;
|
||||
uint16_t fifo_status;
|
||||
unsigned char seqno;
|
||||
unsigned char ack;
|
||||
uint32_t word0;
|
||||
uint32_t timestamp;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
static void do_receive(mobipass_state_t *mobi, unsigned char *b)
|
||||
{
|
||||
if (recv(mobi->sock, b, 14+14+1280, 0) != 14+14+1280) { perror("recv"); exit(1); }
|
||||
struct mobipass_header *mh = (struct mobipass_header *)(b+14);
|
||||
mh->timestamp = htonl((ntohl(mh->timestamp)-45378/*40120*/) % mobi->samples_per_1024_frames);
|
||||
//printf("recv timestamp %u\n", ntohl(mh->timestamp));
|
||||
}
|
||||
|
||||
/* receiver thread */
|
||||
static void *receiver(void *_mobi)
|
||||
{
|
||||
mobipass_state_t *mobi = _mobi;
|
||||
unsigned char receive_packet[14 + 14 + 1280];
|
||||
while (1) {
|
||||
do_receive(mobi, receive_packet);
|
||||
enqueue_from_mobipass(mobi->qstate, receive_packet);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void do_send(mobipass_state_t *mobi, int seqno, uint32_t ts,
|
||||
unsigned char *packet)
|
||||
{
|
||||
struct ethernet_header *eh = (struct ethernet_header *)packet;
|
||||
struct mobipass_header *mh = (struct mobipass_header *)(packet+14);
|
||||
|
||||
ts %= mobi->samples_per_1024_frames;
|
||||
//printf("SEND seqno %d ts %d\n", seqno, ts);
|
||||
|
||||
memcpy(eh->dst, mobi->eth_remote, 6);
|
||||
memcpy(eh->src, mobi->eth_local, 6);
|
||||
|
||||
eh->packet_type = htons(0xbffe);
|
||||
|
||||
mh->flags = 0;
|
||||
mh->fifo_status = 0;
|
||||
mh->seqno = seqno;
|
||||
mh->ack = 0;
|
||||
mh->word0 = 0;
|
||||
mh->timestamp = htonl(ts);
|
||||
|
||||
synch_time(mobi, ts);
|
||||
|
||||
if (send(mobi->sock, packet, 14+14+1280, 0) != 14+14+1280) { perror("send"); exit(1); }
|
||||
}
|
||||
|
||||
/* sender thread */
|
||||
static void *sender(void *_mobi)
|
||||
{
|
||||
mobipass_state_t *mobi = _mobi;
|
||||
unsigned char packet[14 + 14 + 1280];
|
||||
uint32_t ts = 0;
|
||||
unsigned char seqno = 0;
|
||||
while (1) {
|
||||
dequeue_to_mobipass(mobi->qstate, ts, packet);
|
||||
do_send(mobi, seqno, ts, packet);
|
||||
seqno++;
|
||||
ts += 640;
|
||||
ts %= mobi->samples_per_1024_frames;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void new_thread(void *(*f)(void *), void *data)
|
||||
{
|
||||
pthread_t t;
|
||||
pthread_attr_t att;
|
||||
|
||||
if (pthread_attr_init(&att))
|
||||
{ fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
|
||||
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
|
||||
{ fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
|
||||
if (pthread_attr_setstacksize(&att, 10000000))
|
||||
{ fprintf(stderr, "pthread_attr_setstacksize err\n"); exit(1); }
|
||||
if (pthread_create(&t, &att, f, data))
|
||||
{ fprintf(stderr, "pthread_create err\n"); exit(1); }
|
||||
if (pthread_attr_destroy(&att))
|
||||
{ fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
|
||||
}
|
||||
|
||||
void init_mobipass(mobipass_state_t *mobi)
|
||||
{
|
||||
int i;
|
||||
unsigned char data[14+14+640];
|
||||
memset(data, 0, 14+14+640);
|
||||
|
||||
init_time(mobi);
|
||||
|
||||
mobi->qstate = init_queues(mobi->samples_per_1024_frames);
|
||||
|
||||
for (i = 0; i < 24*4; i++) {
|
||||
uint32_t timestamp = i*640;
|
||||
unsigned char seqno = i;
|
||||
struct mobipass_header *mh = (struct mobipass_header *)(data+14);
|
||||
mh->seqno = seqno;
|
||||
mh->timestamp = htonl(timestamp);
|
||||
enqueue_to_mobipass(mobi->qstate, data);
|
||||
}
|
||||
|
||||
mobi->sock = socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW);
|
||||
if (mobi->sock == -1) { perror("socket"); exit(1); }
|
||||
|
||||
/* get if index */
|
||||
struct ifreq if_index;
|
||||
memset(&if_index, 0, sizeof(struct ifreq));
|
||||
strcpy(if_index.ifr_name, mobi->eth.if_name);
|
||||
if (ioctl(mobi->sock, SIOCGIFINDEX, &if_index)<0) {perror("SIOCGIFINDEX");exit(1);}
|
||||
|
||||
struct sockaddr_ll local_addr;
|
||||
local_addr.sll_family = AF_PACKET;
|
||||
local_addr.sll_ifindex = if_index.ifr_ifindex;
|
||||
local_addr.sll_protocol = htons(0xbffe);
|
||||
local_addr.sll_halen = ETH_ALEN;
|
||||
local_addr.sll_pkttype = PACKET_OTHERHOST;
|
||||
|
||||
if (bind(mobi->sock, (struct sockaddr *)&local_addr, sizeof(struct sockaddr_ll))<0)
|
||||
{ perror("bind"); exit(1); }
|
||||
|
||||
new_thread(receiver, mobi);
|
||||
new_thread(sender, mobi);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef _MOBIPASS_H_
|
||||
#define _MOBIPASS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ethernet_lib.h"
|
||||
|
||||
typedef struct {
|
||||
/* this has to come first */
|
||||
eth_state_t eth;
|
||||
|
||||
void *qstate;
|
||||
|
||||
uint8_t eth_local[6];
|
||||
uint8_t eth_remote[6];
|
||||
|
||||
int samples_per_1024_frames;
|
||||
|
||||
/* variables used by the function interface.c:mobipass_read */
|
||||
uint32_t mobipass_read_ts;
|
||||
unsigned char mobipass_read_seqno;
|
||||
|
||||
/* variables used by the function interface.c:mobipass_write */
|
||||
uint32_t mobipass_write_last_timestamp;
|
||||
|
||||
/* variables used by the function mobipass.c:[init_time|synch_time] */
|
||||
uint64_t t0;
|
||||
|
||||
/* variables used by the function mobipass.c:synch_time */
|
||||
uint32_t synch_time_last_ts;
|
||||
uint64_t synch_time_mega_ts;
|
||||
|
||||
/* sock is used in mobipass.c */
|
||||
int sock;
|
||||
} mobipass_state_t;
|
||||
|
||||
void init_mobipass(mobipass_state_t *mobi);
|
||||
|
||||
#endif /* _MOBIPASS_H_ */
|
||||
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "queues.h"
|
||||
#include "mobipass.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define QSIZE 10000
|
||||
|
||||
struct mobipass_header {
|
||||
uint16_t flags;
|
||||
uint16_t fifo_status;
|
||||
unsigned char seqno;
|
||||
unsigned char ack;
|
||||
uint32_t word0;
|
||||
uint32_t timestamp;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct queue {
|
||||
unsigned char buf[QSIZE][14+14+640*2];
|
||||
volatile int start;
|
||||
volatile int len;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct queue to_mobipass;
|
||||
struct queue from_mobipass;
|
||||
int samples_per_1024_frames;
|
||||
|
||||
/* variables used by dequeue_from_mobipass */
|
||||
int dequeue_from_mobipass_seqno;
|
||||
|
||||
/* variables used to manage logging of "missing samples"
|
||||
* coming from mobipass. (Yes, this can happen, mostly
|
||||
* at startup.)
|
||||
* This idea is to print some logs, but not too much to
|
||||
* flood stdout. (This is already a bad idea to call
|
||||
* printf in a 'realtime' thread.)
|
||||
*/
|
||||
int no_sample_log_running;
|
||||
uint32_t no_sample_log_start_sample;
|
||||
uint32_t no_sample_log_next_sample;
|
||||
} queue_state_t;
|
||||
|
||||
static void enqueue(void *data, struct queue *q)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (pthread_mutex_lock(&q->mutex)) abort();
|
||||
if (q->len == QSIZE) {
|
||||
printf("mobipass: WARNING: enqueue: full\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
pos = (q->start + q->len) % QSIZE;
|
||||
memcpy(q->buf[pos], data, 14+14+640*2);
|
||||
q->len++;
|
||||
|
||||
done:
|
||||
if (pthread_cond_signal(&q->cond)) abort();
|
||||
if (pthread_mutex_unlock(&q->mutex)) abort();
|
||||
}
|
||||
|
||||
void enqueue_to_mobipass(void *_qstate, void *data)
|
||||
{
|
||||
queue_state_t *qstate = _qstate;
|
||||
enqueue(data, &qstate->to_mobipass);
|
||||
}
|
||||
|
||||
void dequeue_to_mobipass(void *_qstate, uint32_t timestamp, void *data)
|
||||
{
|
||||
queue_state_t *qstate = _qstate;
|
||||
if (pthread_mutex_lock(&qstate->to_mobipass.mutex)) abort();
|
||||
while (qstate->to_mobipass.len == 0) {
|
||||
if (pthread_cond_wait(&qstate->to_mobipass.cond, &qstate->to_mobipass.mutex)) abort();
|
||||
}
|
||||
|
||||
memcpy(data, qstate->to_mobipass.buf[qstate->to_mobipass.start], 14+14+640*2);
|
||||
qstate->to_mobipass.len--;
|
||||
qstate->to_mobipass.start = (qstate->to_mobipass.start + 1) % QSIZE;
|
||||
|
||||
if (pthread_mutex_unlock(&qstate->to_mobipass.mutex)) abort();
|
||||
}
|
||||
|
||||
void enqueue_from_mobipass(void *_qstate, void *data)
|
||||
{
|
||||
queue_state_t *qstate = _qstate;
|
||||
struct mobipass_header *mh = (struct mobipass_header *)((char*)data+14);
|
||||
mh->timestamp = htonl(ntohl(mh->timestamp) % qstate->samples_per_1024_frames);
|
||||
//printf("from mobipass! timestamp %u seqno %d\n", ntohl(mh->timestamp), mh->seqno);
|
||||
enqueue(data, &qstate->from_mobipass);
|
||||
}
|
||||
|
||||
static int cmp_timestamps(uint32_t a, uint32_t b, int samples_per_1024_frames)
|
||||
{
|
||||
if (a == b) return 0;
|
||||
if (a < b) {
|
||||
if (b-a > samples_per_1024_frames/2) return 1;
|
||||
return -1;
|
||||
}
|
||||
if (a-b > samples_per_1024_frames/2) return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*************************************************/
|
||||
/* missing samples logging management begin */
|
||||
/*************************************************/
|
||||
|
||||
static void log_flush(queue_state_t *qstate)
|
||||
{
|
||||
/* print now if there is something to print */
|
||||
if (qstate->no_sample_log_running == 0)
|
||||
return;
|
||||
qstate->no_sample_log_running = 0;
|
||||
printf("mobipass: WARNING: missing samples [%u-%u]\n",
|
||||
qstate->no_sample_log_start_sample,
|
||||
(uint32_t)(qstate->no_sample_log_next_sample-1));
|
||||
}
|
||||
|
||||
static void log_missed_sample(queue_state_t *qstate, uint32_t timestamp)
|
||||
{
|
||||
/* collect data, print if there is a discontinuity */
|
||||
if (qstate->no_sample_log_running == 0 ||
|
||||
timestamp != qstate->no_sample_log_next_sample) {
|
||||
log_flush(qstate);
|
||||
qstate->no_sample_log_start_sample = timestamp;
|
||||
}
|
||||
|
||||
qstate->no_sample_log_next_sample = timestamp+1;
|
||||
qstate->no_sample_log_running = 1;
|
||||
}
|
||||
|
||||
static void log_flush_if_old(queue_state_t *qstate, uint32_t timestamp)
|
||||
{
|
||||
/* log every second (more or less), if we have to */
|
||||
/* note that if mobipass stopped, it may take much more
|
||||
* than one second to log, due to the sleeps done while
|
||||
* waiting for samples (that never come)
|
||||
*/
|
||||
if (qstate->no_sample_log_running == 1 &&
|
||||
labs(timestamp-qstate->no_sample_log_start_sample) > qstate->samples_per_1024_frames/10)
|
||||
log_flush(qstate);
|
||||
}
|
||||
|
||||
/*************************************************/
|
||||
/* missing samples logging management end */
|
||||
/*************************************************/
|
||||
|
||||
/* to be called with lock on */
|
||||
static void get_sample_from_mobipass(queue_state_t *qstate, char *I, char *Q, uint32_t timestamp)
|
||||
{
|
||||
unsigned char *b = NULL;
|
||||
unsigned char *data = NULL;
|
||||
struct mobipass_header *mh = NULL;
|
||||
uint32_t packet_timestamp = 0;
|
||||
|
||||
#if 0
|
||||
uint32_t old_start = qstate->from_mobipass.start;
|
||||
uint32_t old_len = qstate->from_mobipass.len;
|
||||
b = qstate->from_mobipass.buf[qstate->from_mobipass.start];
|
||||
mh = (struct mobipass_header *)(b+14);
|
||||
uint32_t old_pts = qstate->from_mobipass.len ? ntohl(mh->timestamp) : -1;
|
||||
b=NULL;
|
||||
mh=NULL;
|
||||
#endif
|
||||
|
||||
while (qstate->from_mobipass.len) {
|
||||
b = qstate->from_mobipass.buf[qstate->from_mobipass.start];
|
||||
mh = (struct mobipass_header *)(b+14);
|
||||
data = b + 14*2;
|
||||
packet_timestamp = ntohl(mh->timestamp);
|
||||
if (cmp_timestamps(timestamp, packet_timestamp, qstate->samples_per_1024_frames) < 0) goto nodata;
|
||||
if (cmp_timestamps(timestamp, (packet_timestamp+640) % qstate->samples_per_1024_frames, qstate->samples_per_1024_frames) < 0) break;
|
||||
qstate->from_mobipass.len--;
|
||||
qstate->from_mobipass.start = (qstate->from_mobipass.start+1) % QSIZE;
|
||||
}
|
||||
|
||||
if (qstate->from_mobipass.len == 0) goto nodata;
|
||||
|
||||
if (timestamp == (packet_timestamp + 639) % qstate->samples_per_1024_frames) {
|
||||
qstate->from_mobipass.len--;
|
||||
qstate->from_mobipass.start = (qstate->from_mobipass.start+1) % QSIZE;
|
||||
}
|
||||
|
||||
if (timestamp < packet_timestamp) timestamp += qstate->samples_per_1024_frames;
|
||||
|
||||
*I = data[(timestamp - packet_timestamp) * 2];
|
||||
*Q = data[(timestamp - packet_timestamp) * 2 + 1];
|
||||
|
||||
return;
|
||||
|
||||
nodata:
|
||||
*I = 0;
|
||||
*Q = 0;
|
||||
|
||||
log_missed_sample(qstate, timestamp);
|
||||
|
||||
#if 0
|
||||
printf("no sample timestamp %u pt %u start %d old_start %d old_pt %u len %d old len %d\n", timestamp, packet_timestamp, qstate->from_mobipass.start, old_start, old_pts, qstate->from_mobipass.len, old_len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* doesn't work with delay more than 1s */
|
||||
static void wait_for_data(pthread_cond_t *cond, pthread_mutex_t *mutex, int delay_us)
|
||||
{
|
||||
struct timeval now;
|
||||
struct timespec target;
|
||||
gettimeofday(&now, NULL);
|
||||
target.tv_sec = now.tv_sec;
|
||||
target.tv_nsec = (now.tv_usec + delay_us) * 1000;
|
||||
if (target.tv_nsec >= 1000 * 1000 * 1000) { target.tv_nsec -= 1000 * 1000 * 1000; target.tv_sec++; }
|
||||
int err = pthread_cond_timedwait(cond, mutex, &target);
|
||||
if (err != 0 && err != ETIMEDOUT) { printf("mobipass: ERROR: pthread_cond_timedwait: err (%d) %s\n", err, strerror(err)); abort(); }
|
||||
}
|
||||
|
||||
/* don't block infinitely when waiting for data
|
||||
* if waiting for too long, just return some zeros
|
||||
*/
|
||||
void dequeue_from_mobipass(void *_qstate, uint32_t timestamp, void *data)
|
||||
{
|
||||
queue_state_t *qstate = _qstate;
|
||||
int i;
|
||||
// int ts = timestamp;
|
||||
int waiting_allowed;
|
||||
|
||||
if (pthread_mutex_lock(&qstate->from_mobipass.mutex)) abort();
|
||||
|
||||
if (qstate->from_mobipass.len == 0) {
|
||||
//printf("sleep 1\n");
|
||||
wait_for_data(&qstate->from_mobipass.cond, &qstate->from_mobipass.mutex, 2000); //1000/3);
|
||||
}
|
||||
|
||||
waiting_allowed = qstate->from_mobipass.len != 0;
|
||||
|
||||
for (i = 0; i < 640*2; i+=2) {
|
||||
if (qstate->from_mobipass.len == 0 && waiting_allowed) {
|
||||
//printf("sleep 2\n");
|
||||
wait_for_data(&qstate->from_mobipass.cond, &qstate->from_mobipass.mutex, 2000); //1000/3);
|
||||
waiting_allowed = qstate->from_mobipass.len != 0;
|
||||
}
|
||||
|
||||
get_sample_from_mobipass(qstate, (char*)data + 14*2 + i, (char*)data + 14*2 + i+1, timestamp % qstate->samples_per_1024_frames);
|
||||
timestamp++;
|
||||
}
|
||||
|
||||
log_flush_if_old(qstate, timestamp);
|
||||
|
||||
if (pthread_mutex_unlock(&qstate->from_mobipass.mutex)) abort();
|
||||
|
||||
struct mobipass_header *mh = (struct mobipass_header *)(((char *)data) + 14);
|
||||
mh->flags = 0;
|
||||
mh->fifo_status = 0;
|
||||
mh->seqno = qstate->dequeue_from_mobipass_seqno++;
|
||||
mh->ack = 0;
|
||||
mh->word0 = 0;
|
||||
mh->timestamp = htonl(timestamp);
|
||||
}
|
||||
|
||||
void *init_queues(int samples_per_1024_frames)
|
||||
{
|
||||
queue_state_t *q;
|
||||
q = malloc(sizeof(queue_state_t));
|
||||
if (q == NULL) abort();
|
||||
memset(q, 0, sizeof(queue_state_t));
|
||||
|
||||
if (pthread_mutex_init(&q->to_mobipass.mutex, NULL)) abort();
|
||||
if (pthread_mutex_init(&q->from_mobipass.mutex, NULL)) abort();
|
||||
if (pthread_cond_init(&q->to_mobipass.cond, NULL)) abort();
|
||||
if (pthread_cond_init(&q->from_mobipass.cond, NULL)) abort();
|
||||
|
||||
q->samples_per_1024_frames = samples_per_1024_frames;
|
||||
|
||||
return q;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef _QUEUES_H_
|
||||
#define _QUEUES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void enqueue_to_mobipass(void *qstate, void *data);
|
||||
void dequeue_to_mobipass(void *qstate, uint32_t timestamp, void *data);
|
||||
|
||||
void enqueue_from_mobipass(void *qstate, void *receive_packet);
|
||||
void dequeue_from_mobipass(void *qstate, uint32_t timestamp, void *data);
|
||||
|
||||
/* returns a queue state type, as opaque data structure */
|
||||
void *init_queues(int samples_per_1024_frames);
|
||||
|
||||
#endif /* _QUEUES_H_ */
|
||||
@@ -3,8 +3,12 @@
|
||||
|
||||
typedef struct threads_s {
|
||||
int iq;
|
||||
int odd;
|
||||
int even;
|
||||
int one;
|
||||
int two;
|
||||
int three;
|
||||
int slot1_proc_one;
|
||||
int slot1_proc_two;
|
||||
int slot1_proc_three;
|
||||
} threads_t;
|
||||
|
||||
#endif /* _THREADS_T_H_ */
|
||||
|
||||
@@ -118,7 +118,7 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "none";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "none";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "94";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
node_function = "eNodeB_3GPP";
|
||||
node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0;
|
||||
frame_type = "TDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 5;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 40;
|
||||
downlink_frequency = 2350000000L;
|
||||
uplink_frequency_offset = 0;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 100;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antenna_ports = 1;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 125;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -96;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -103;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -104;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
|
||||
ue_TransmissionMode = 1;
|
||||
}
|
||||
);
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
|
||||
mme_ip_address = ( { ipv4 = "127.0.0.3";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,175 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "94";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
node_function = "eNodeB_3GPP";
|
||||
node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0;
|
||||
frame_type = "TDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 5;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 40;
|
||||
downlink_frequency = 2350000000L;
|
||||
uplink_frequency_offset = 0;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antenna_ports = 1;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 125;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -96;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -103;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -104;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
|
||||
ue_TransmissionMode = 1;
|
||||
}
|
||||
);
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
|
||||
mme_ip_address = ( { ipv4 = "127.0.0.3";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,175 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "94";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
node_function = "eNodeB_3GPP";
|
||||
node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0;
|
||||
frame_type = "TDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 5;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 40;
|
||||
downlink_frequency = 2350000000L;
|
||||
uplink_frequency_offset = 0;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 50;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antenna_ports = 1;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 125;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -24;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -96;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -103;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -104;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
|
||||
ue_TransmissionMode = 1;
|
||||
}
|
||||
);
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
|
||||
mme_ip_address = ( { ipv4 = "127.0.0.3";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -121,7 +121,7 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "none";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
NETWORK_CONTROLLER :
|
||||
|
||||
@@ -17,7 +17,7 @@ eNBs =
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "10";
|
||||
mobile_network_code = "93";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
@@ -138,7 +138,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.188.2.2";
|
||||
mme_ip_address = ( { ipv4 = "10.0.1.2";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -147,12 +147,12 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "tun2";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.188.2.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.1.1/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.1/8";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.1.1/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
@@ -121,7 +121,7 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "none";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
@@ -151,7 +151,7 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.1/8";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "none";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24";
|
||||
ENB_PORT_FOR_S1U = 2153; # Spec 2152
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
|
||||
mobile_network_code = "92";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
// second carrier-> for ERCOM
|
||||
{
|
||||
node_function = "eNodeB_3GPP_BBU" # should be verified
|
||||
//node_function = "NGFI_RCC_IF5" # should be verified
|
||||
node_timing = "synch_to_mobipass_standalone";
|
||||
//node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0; #should
|
||||
frame_type = "FDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 7;
|
||||
downlink_frequency = 2660000000L;
|
||||
uplink_frequency_offset = -120000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 50;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antenna_ports = 1;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 125;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 3;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -96;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -100;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -108;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
|
||||
ue_TransmissionMode = 1;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "127.0.0.3";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
|
||||
rrh_gw_config = (
|
||||
//second config for Ercom
|
||||
{
|
||||
local_if_name = "eth1.300";
|
||||
remote_address = "00:21:5e:91:5c:7e"; # should be updated with ERCOM's MAC
|
||||
local_address = "f0:1f:af:db:b9:c8";
|
||||
local_port = 50000; #for raw option local port must be the same to remote
|
||||
remote_port = 50000;
|
||||
rrh_gw_active = "yes";
|
||||
tr_preference = "raw_if5_mobipass";
|
||||
rf_preference = "usrp_b200";
|
||||
iq_txshift = 0;
|
||||
tx_sample_advance = 80;
|
||||
tx_scheduling_advance = 9;
|
||||
if_compression = "None"
|
||||
}
|
||||
);
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ eNBs =
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nRB_CQI = 0;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -29;
|
||||
|
||||
@@ -145,6 +145,7 @@ void exit_fun(const char* s);
|
||||
void init_eNB(int,int);
|
||||
void stop_eNB(int nb_inst);
|
||||
|
||||
|
||||
void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
|
||||
#ifdef Rel14
|
||||
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
|
||||
@@ -519,11 +520,12 @@ static void* eNB_thread_prach( void* param ) {
|
||||
|
||||
thread_top_init("eNB_thread_prach",1,500000L,1000000L,20000000L);
|
||||
|
||||
|
||||
while (!oai_exit) {
|
||||
|
||||
if (oai_exit) break;
|
||||
|
||||
|
||||
|
||||
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
|
||||
|
||||
LOG_D(PHY,"Running eNB prach procedures\n");
|
||||
|
||||
+17
-537
@@ -171,6 +171,9 @@ int chain_offset=0;
|
||||
int phy_test = 0;
|
||||
uint8_t usim_test = 0;
|
||||
|
||||
uint8_t dci_Format = 0;
|
||||
uint8_t agregation_Level =0xFF;
|
||||
|
||||
uint8_t nb_antenna_tx = 1;
|
||||
uint8_t nb_antenna_rx = 1;
|
||||
|
||||
@@ -240,7 +243,7 @@ extern char uecap_xer[1024];
|
||||
char uecap_xer_in=0;
|
||||
|
||||
int oaisim_flag=0;
|
||||
threads_t threads= {-1,-1,-1};
|
||||
threads_t threads= {-1,-1,-1,-1,-1,-1,-1};
|
||||
|
||||
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
|
||||
* this is very hackish - find a proper solution
|
||||
@@ -323,58 +326,6 @@ void signal_handler(int sig) {
|
||||
#define KBLU "\x1B[34m"
|
||||
#define RESET "\033[0m"
|
||||
|
||||
void help (void) {
|
||||
printf (KGRN "Usage:\n");
|
||||
printf(" sudo -E lte-softmodem [options]\n");
|
||||
printf(" sudo -E ./lte-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.openEPC.conf -S -V -m 26 -t 16 -x 1 --ulsch-max-errors 100 -W\n\n");
|
||||
printf("Options:\n");
|
||||
printf(" --rf-config-file Configuration file for front-end (e.g. LMS7002M)\n");
|
||||
printf(" --ulsch-max-errors set the max ULSCH erros\n");
|
||||
printf(" --calib-ue-rx set UE RX calibration\n");
|
||||
printf(" --calib-ue-rx-med \n");
|
||||
printf(" --calib-ue-rxbyp\n");
|
||||
printf(" --debug-ue-prach run normal prach power ramping, but don't continue random-access\n");
|
||||
printf(" --calib-prach-tx run normal prach with maximum power, but don't continue random-access\n");
|
||||
printf(" --no-L2-connect bypass L2 and upper layers\n");
|
||||
printf(" --ue-rxgain set UE RX gain\n");
|
||||
printf(" --ue-rxgain-off external UE amplifier offset\n");
|
||||
printf(" --ue-txgain set UE TX gain\n");
|
||||
printf(" --ue-nb-ant-rx set UE number of rx antennas\n");
|
||||
printf(" --ue-scan-carrier set UE to scan around carrier\n");
|
||||
printf(" --dlsch-demod-shift dynamic shift for LLR compuation for TM3/4 (default 0)\n");
|
||||
printf(" --loop-memory get softmodem (UE) to loop through memory instead of acquiring from HW\n");
|
||||
printf(" --mmapped-dma sets flag for improved EXMIMO UE performance\n");
|
||||
printf(" --external-clock tells hardware to use an external clock reference\n");
|
||||
printf(" --usim-test use XOR autentication algo in case of test usim mode\n");
|
||||
printf(" --single-thread-disable. Disables single-thread mode in lte-softmodem\n");
|
||||
printf(" -A Set timing_advance\n");
|
||||
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 verbosity \n");
|
||||
printf(" -h provides this help message!\n");
|
||||
printf(" -K Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n");
|
||||
printf(" -m Set the maximum downlink MCS\n");
|
||||
printf(" -O eNB configuration file (located in targets/PROJECTS/GENERIC-LTE-EPC/CONF\n");
|
||||
printf(" -q Enable processing timing measurement of lte softmodem on per subframe basis \n");
|
||||
printf(" -r Set the PRB, valid values: 6, 25, 50, 100 \n");
|
||||
printf(" -S Skip the missed slots/subframes \n");
|
||||
printf(" -t Set the maximum uplink MCS\n");
|
||||
printf(" -T Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n");
|
||||
printf(" -U Set the lte softmodem as a UE\n");
|
||||
printf(" -W Enable L2 wireshark messages on localhost \n");
|
||||
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");
|
||||
#if T_TRACER
|
||||
printf(" --T_port [port] use given port\n");
|
||||
printf(" --T_nowait don't wait for tracer, start immediately\n");
|
||||
printf(" --T_dont_fork to ease debugging with gdb\n");
|
||||
#endif
|
||||
printf(RESET);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
void exit_fun(const char* s)
|
||||
@@ -624,6 +575,7 @@ void *l2l1_task(void *arg) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void get_options(void) {
|
||||
int CC_id;
|
||||
int clock_src;
|
||||
@@ -719,485 +671,20 @@ static void get_options(void) {
|
||||
if (UE_flag == 0) {
|
||||
memset((void*)&RC,0,sizeof(RC));
|
||||
/* Read RC configuration file */
|
||||
RCConfig(NULL);
|
||||
RCConfig();
|
||||
NB_eNB_INST = RC.nb_inst;
|
||||
NB_RU = RC.nb_RU;
|
||||
printf("Configuration: nb_inst %d, nb_ru %d\n",NB_eNB_INST,NB_RU);
|
||||
|
||||
|
||||
} else if (UE_flag == 1) {
|
||||
if (conf_config_file_name != NULL) {
|
||||
|
||||
// Here the configuration file is the XER encoded UE capabilities
|
||||
// Read it in and store in asn1c data structures
|
||||
strcpy(uecap_xer,conf_config_file_name);
|
||||
uecap_xer_in=1;
|
||||
|
||||
}
|
||||
}
|
||||
} /* CONFIG_ABORT not set */
|
||||
} else if (UE_flag == 1 && (CONFIG_GETCONFFILE != NULL)) {
|
||||
// Here the configuration file is the XER encoded UE capabilities
|
||||
// Read it in and store in asn1c data structures
|
||||
strcpy(uecap_xer,CONFIG_GETCONFFILE);
|
||||
uecap_xer_in=1;
|
||||
} /* UE with config file */
|
||||
}
|
||||
|
||||
|
||||
static void old_get_options (int argc, char **argv) {
|
||||
int c;
|
||||
// char line[1000];
|
||||
// int l;
|
||||
int i;
|
||||
#if defined(OAI_USRP) || defined(CPRIGW)
|
||||
int clock_src;
|
||||
#endif
|
||||
int CC_id;
|
||||
|
||||
|
||||
|
||||
enum long_option_e {
|
||||
LONG_OPTION_START = 0x100, /* Start after regular single char options */
|
||||
LONG_OPTION_RF_CONFIG_FILE,
|
||||
LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS,
|
||||
LONG_OPTION_CALIB_UE_RX,
|
||||
LONG_OPTION_CALIB_UE_RX_MED,
|
||||
LONG_OPTION_CALIB_UE_RX_BYP,
|
||||
LONG_OPTION_DEBUG_UE_PRACH,
|
||||
LONG_OPTION_NO_L2_CONNECT,
|
||||
LONG_OPTION_CALIB_PRACH_TX,
|
||||
LONG_OPTION_RXGAIN,
|
||||
LONG_OPTION_RXGAINOFF,
|
||||
LONG_OPTION_TXGAIN,
|
||||
LONG_OPTION_NBRXANT,
|
||||
LONG_OPTION_NBTXANT,
|
||||
LONG_OPTION_SCANCARRIER,
|
||||
LONG_OPTION_MAXPOWER,
|
||||
LONG_OPTION_DUMP_FRAME,
|
||||
LONG_OPTION_LOOPMEMORY,
|
||||
LONG_OPTION_PHYTEST,
|
||||
LONG_OPTION_USIMTEST,
|
||||
LONG_OPTION_MMAPPED_DMA,
|
||||
LONG_OPTION_EXTERNAL_CLOCK,
|
||||
LONG_OPTION_WAIT_FOR_SYNC,
|
||||
LONG_OPTION_SINGLE_THREAD_DISABLE,
|
||||
LONG_OPTION_THREADIQ,
|
||||
LONG_OPTION_THREADODDSUBFRAME,
|
||||
LONG_OPTION_THREADEVENSUBFRAME,
|
||||
LONG_OPTION_DEMOD_SHIFT,
|
||||
#if T_TRACER
|
||||
LONG_OPTION_T_PORT,
|
||||
LONG_OPTION_T_NOWAIT,
|
||||
LONG_OPTION_T_DONT_FORK,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{"rf-config-file",required_argument, NULL, LONG_OPTION_RF_CONFIG_FILE},
|
||||
{"ulsch-max-errors",required_argument, NULL, LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS},
|
||||
{"calib-ue-rx", required_argument, NULL, LONG_OPTION_CALIB_UE_RX},
|
||||
{"calib-ue-rx-med", required_argument, NULL, LONG_OPTION_CALIB_UE_RX_MED},
|
||||
{"calib-ue-rx-byp", required_argument, NULL, LONG_OPTION_CALIB_UE_RX_BYP},
|
||||
{"debug-ue-prach", no_argument, NULL, LONG_OPTION_DEBUG_UE_PRACH},
|
||||
{"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-txgain", required_argument, NULL, LONG_OPTION_TXGAIN},
|
||||
{"ue-nb-ant-rx", required_argument, NULL, LONG_OPTION_NBRXANT},
|
||||
{"ue-nb-ant-tx", required_argument, NULL, LONG_OPTION_NBTXANT},
|
||||
{"ue-scan-carrier", no_argument, NULL, LONG_OPTION_SCANCARRIER},
|
||||
{"ue-max-power", required_argument, NULL, LONG_OPTION_MAXPOWER},
|
||||
{"ue-dump-frame", no_argument, NULL, LONG_OPTION_DUMP_FRAME},
|
||||
{"loop-memory", required_argument, NULL, LONG_OPTION_LOOPMEMORY},
|
||||
{"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST},
|
||||
{"usim-test", no_argument, NULL, LONG_OPTION_USIMTEST},
|
||||
{"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA},
|
||||
{"external-clock", no_argument, NULL, LONG_OPTION_EXTERNAL_CLOCK},
|
||||
{"wait-for-sync", no_argument, NULL, LONG_OPTION_WAIT_FOR_SYNC},
|
||||
{"single-thread-disable", no_argument, NULL, LONG_OPTION_SINGLE_THREAD_DISABLE},
|
||||
{"threadIQ", required_argument, NULL, LONG_OPTION_THREADIQ},
|
||||
{"threadOddSubframe", required_argument, NULL, LONG_OPTION_THREADODDSUBFRAME},
|
||||
{"threadEvenSubframe", required_argument, NULL, LONG_OPTION_THREADEVENSUBFRAME},
|
||||
{"dlsch-demod-shift", required_argument, NULL, LONG_OPTION_DEMOD_SHIFT},
|
||||
#if T_TRACER
|
||||
{"T_port", required_argument, 0, LONG_OPTION_T_PORT},
|
||||
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
|
||||
{"T_dont_fork", no_argument, 0, LONG_OPTION_T_DONT_FORK},
|
||||
#endif
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
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_RF_CONFIG_FILE:
|
||||
if ((strcmp("null", optarg) == 0) || (strcmp("NULL", optarg) == 0)) {
|
||||
printf("no configuration filename is provided\n");
|
||||
}
|
||||
else if (strlen(optarg)<=1024){
|
||||
strcpy(rf_config_file,optarg);
|
||||
}else {
|
||||
printf("Configuration filename is too long\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case LONG_OPTION_MAXPOWER:
|
||||
tx_max_power[0]=atoi(optarg);
|
||||
for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++)
|
||||
tx_max_power[CC_id]=tx_max_power[0];
|
||||
break;
|
||||
case LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS:
|
||||
ULSCH_max_consecutive_errors = atoi(optarg);
|
||||
printf("Set ULSCH_max_consecutive_errors = %d\n",ULSCH_max_consecutive_errors);
|
||||
break;
|
||||
|
||||
case LONG_OPTION_CALIB_UE_RX:
|
||||
mode = rx_calib_ue;
|
||||
rx_input_level_dBm = atoi(optarg);
|
||||
printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
|
||||
break;
|
||||
|
||||
case LONG_OPTION_CALIB_UE_RX_MED:
|
||||
mode = rx_calib_ue_med;
|
||||
rx_input_level_dBm = atoi(optarg);
|
||||
printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
|
||||
break;
|
||||
|
||||
case LONG_OPTION_CALIB_UE_RX_BYP:
|
||||
mode = rx_calib_ue_byp;
|
||||
rx_input_level_dBm = atoi(optarg);
|
||||
printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
|
||||
break;
|
||||
|
||||
case LONG_OPTION_DEBUG_UE_PRACH:
|
||||
mode = debug_prach;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_NO_L2_CONNECT:
|
||||
mode = no_L2_connect;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_CALIB_PRACH_TX:
|
||||
mode = calib_prach_tx;
|
||||
printf("Setting mode to calib_prach_tx (%d)\n",mode);
|
||||
break;
|
||||
|
||||
case LONG_OPTION_RXGAIN:
|
||||
for (i=0; i<4; i++)
|
||||
rx_gain[0][i] = atof(optarg);
|
||||
|
||||
break;
|
||||
|
||||
case LONG_OPTION_RXGAINOFF:
|
||||
rx_gain_off = atof(optarg);
|
||||
break;
|
||||
|
||||
case LONG_OPTION_TXGAIN:
|
||||
for (i=0; i<4; i++)
|
||||
tx_gain[0][i] = atof(optarg);
|
||||
|
||||
break;
|
||||
case LONG_OPTION_NBRXANT:
|
||||
nb_antenna_rx = atof(optarg);
|
||||
break;
|
||||
case LONG_OPTION_NBTXANT:
|
||||
nb_antenna_tx = atof(optarg);
|
||||
break;
|
||||
case LONG_OPTION_SCANCARRIER:
|
||||
UE_scan_carrier=1;
|
||||
|
||||
break;
|
||||
|
||||
case LONG_OPTION_LOOPMEMORY:
|
||||
mode=loop_through_memory;
|
||||
input_fd = fopen(optarg,"r");
|
||||
AssertFatal(input_fd != NULL,"Please provide an input file\n");
|
||||
break;
|
||||
|
||||
case LONG_OPTION_DUMP_FRAME:
|
||||
mode = rx_dump_frame;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_PHYTEST:
|
||||
phy_test = 1;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_USIMTEST:
|
||||
usim_test = 1;
|
||||
break;
|
||||
case LONG_OPTION_MMAPPED_DMA:
|
||||
mmapped_dma = 1;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_SINGLE_THREAD_DISABLE:
|
||||
single_thread_flag = 0;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_EXTERNAL_CLOCK:
|
||||
clock_source = external;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_WAIT_FOR_SYNC:
|
||||
wait_for_sync = 1;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_THREADIQ:
|
||||
threads.iq=atoi(optarg);
|
||||
break;
|
||||
case LONG_OPTION_THREADODDSUBFRAME:
|
||||
threads.odd=atoi(optarg);
|
||||
break;
|
||||
case LONG_OPTION_THREADEVENSUBFRAME:
|
||||
threads.even=atoi(optarg);
|
||||
break;
|
||||
case LONG_OPTION_DEMOD_SHIFT: {
|
||||
extern int16_t dlsch_demod_shift;
|
||||
dlsch_demod_shift = atof(optarg);
|
||||
break;
|
||||
}
|
||||
#if T_TRACER
|
||||
case LONG_OPTION_T_PORT: {
|
||||
extern int T_port;
|
||||
if (optarg == NULL) abort(); /* should not happen */
|
||||
T_port = atoi(optarg);
|
||||
break;
|
||||
}
|
||||
|
||||
case LONG_OPTION_T_NOWAIT: {
|
||||
extern int T_wait;
|
||||
T_wait = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case LONG_OPTION_T_DONT_FORK: {
|
||||
extern int T_dont_fork;
|
||||
T_dont_fork = 1;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case 'A':
|
||||
timing_advance = atoi (optarg);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
downlink_frequency[CC_id][0] = atof(optarg); // Use float to avoid issue with frequency over 2^31.
|
||||
downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
|
||||
downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
|
||||
downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
|
||||
printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
|
||||
}
|
||||
|
||||
UE_scan=0;
|
||||
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
chain_offset = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
#ifdef XFORMS
|
||||
do_forms=1;
|
||||
printf("Running with XFORMS!\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
threequarter_fs=1;
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
#if defined(ENABLE_ITTI)
|
||||
itti_dump_file = strdup(optarg);
|
||||
#else
|
||||
printf("-K option is disabled when ENABLE_ITTI is not defined\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
conf_config_file_name = optarg;
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
UE_flag = 1;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
target_dl_mcs = atoi (optarg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
target_ul_mcs = atoi (optarg);
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
opt_enabled=1;
|
||||
opt_type = OPT_WIRESHARK;
|
||||
strncpy(in_ip, "127.0.0.1", sizeof(in_ip));
|
||||
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
|
||||
printf("Enabling OPT for wireshark for local interface");
|
||||
/*
|
||||
if (optarg == NULL){
|
||||
in_ip[0] =NULL;
|
||||
printf("Enabling OPT for wireshark for local interface");
|
||||
} else {
|
||||
strncpy(in_ip, optarg, sizeof(in_ip));
|
||||
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
|
||||
printf("Enabling OPT for wireshark with %s \n",in_ip);
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
opt_type = OPT_PCAP;
|
||||
opt_enabled=1;
|
||||
|
||||
if (optarg == NULL) {
|
||||
strncpy(in_path, "/tmp/oai_opt.pcap", sizeof(in_path));
|
||||
in_path[sizeof(in_path) - 1] = 0; // terminate string
|
||||
printf("Enabling OPT for PCAP with the following path /tmp/oai_opt.pcap");
|
||||
} else {
|
||||
strncpy(in_path, optarg, sizeof(in_path));
|
||||
in_path[sizeof(in_path) - 1] = 0; // terminate string
|
||||
printf("Enabling OPT for PCAP with the following file %s \n",in_path);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
ouput_vcd = 1;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
opp_enabled = 1;
|
||||
break;
|
||||
|
||||
case 'R' :
|
||||
online_log_messages =1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
UE_scan = 0;
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
switch(atoi(optarg)) {
|
||||
case 6:
|
||||
frame_parms[CC_id]->N_RB_DL=6;
|
||||
frame_parms[CC_id]->N_RB_UL=6;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
frame_parms[CC_id]->N_RB_DL=25;
|
||||
frame_parms[CC_id]->N_RB_UL=25;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
frame_parms[CC_id]->N_RB_DL=50;
|
||||
frame_parms[CC_id]->N_RB_UL=50;
|
||||
break;
|
||||
|
||||
case 100:
|
||||
frame_parms[CC_id]->N_RB_DL=100;
|
||||
frame_parms[CC_id]->N_RB_UL=100;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown N_RB_DL %d, switching to 25\n",atoi(optarg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 's':
|
||||
#if defined(OAI_USRP) || defined(CPRIGW)
|
||||
|
||||
clock_src = atoi(optarg);
|
||||
|
||||
if (clock_src == 0) {
|
||||
// char ref[128] = "internal";
|
||||
//strncpy(uhd_ref, ref, strlen(ref)+1);
|
||||
} else if (clock_src == 1) {
|
||||
//char ref[128] = "external";
|
||||
//strncpy(uhd_ref, ref, strlen(ref)+1);
|
||||
}
|
||||
|
||||
#else
|
||||
printf("Note: -s not defined for ExpressMIMO2\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
glog_level=atoi(optarg); // value between 1 - 9
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
glog_verbosity=atoi(optarg);// value from 0, 0x5, 0x15, 0x35, 0x75
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
exit_missed_slots=0;
|
||||
printf("Skip exit for missed slots\n");
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
printf("Transmission mode should be set in config file now\n");
|
||||
exit(-1);
|
||||
/*
|
||||
transmission_mode = atoi(optarg);
|
||||
|
||||
if (transmission_mode > 7) {
|
||||
printf("Transmission mode %d not supported for the moment\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
|
||||
frame_parms[CC_id]->frame_type = TDD;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
help ();
|
||||
exit (-1);
|
||||
|
||||
default:
|
||||
help ();
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (UE_flag == 0)
|
||||
AssertFatal(conf_config_file_name != NULL,"Please provide a configuration file\n");
|
||||
|
||||
if ((UE_flag == 0) && (conf_config_file_name != NULL)) {
|
||||
|
||||
|
||||
memset((void*)&RC,0,sizeof(RC));
|
||||
|
||||
/* Read RC configuration file */
|
||||
RCConfig(conf_config_file_name);
|
||||
|
||||
NB_eNB_INST = RC.nb_inst;
|
||||
NB_RU = RC.nb_RU;
|
||||
|
||||
printf("Read in %s : nb_inst %d, nb_ru %d\n",conf_config_file_name,NB_eNB_INST,NB_RU);
|
||||
|
||||
|
||||
} else if (UE_flag == 1) {
|
||||
if (conf_config_file_name != NULL) {
|
||||
|
||||
// Here the configuration file is the XER encoded UE capabilities
|
||||
// Read it in and store in asn1c data structures
|
||||
strcpy(uecap_xer,conf_config_file_name);
|
||||
uecap_xer_in=1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if T_TRACER
|
||||
int T_wait = 1; /* by default we wait for the tracer */
|
||||
@@ -1205,6 +692,7 @@ int T_port = 2021; /* default port to listen to to wait for the tracer */
|
||||
int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */
|
||||
#endif
|
||||
|
||||
|
||||
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
|
||||
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
|
||||
|
||||
@@ -1428,18 +916,8 @@ int main( int argc, char **argv )
|
||||
// get options and fill parameters from configuration file
|
||||
// temporary test to allow legacy config or config module */
|
||||
|
||||
if ( CONFIG_ISFLAGSET(CONFIG_LEGACY) == 0) {
|
||||
printf("configuration via the configuration module \n");
|
||||
get_options ();
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
fprintf(stderr,"Getting configuration failed\n");
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
printf("Legacy configuration mode \n");
|
||||
old_get_options (argc,argv);
|
||||
}
|
||||
|
||||
get_options ();
|
||||
|
||||
|
||||
#if T_TRACER
|
||||
T_init(T_port, T_wait, T_dont_fork);
|
||||
@@ -1576,8 +1054,10 @@ int main( int argc, char **argv )
|
||||
|
||||
|
||||
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
|
||||
if (UE_flag==1) {
|
||||
NB_UE_INST=1;
|
||||
NB_INST=1;
|
||||
|
||||
@@ -149,8 +149,11 @@ extern int16_t dlsch_demod_shift;
|
||||
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
|
||||
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
|
||||
{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadOddSubframe", NULL, 0, iptr:&(threads.odd), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadEvenSubframe", NULL, 0, iptr:&(threads.even), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
|
||||
{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
|
||||
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
||||
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
|
||||
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
|
||||
@@ -231,7 +234,10 @@ extern void init_RU(const char*);
|
||||
// In lte-ue.c
|
||||
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||
extern void fill_ue_band_info(void);
|
||||
|
||||
extern void init_UE(int,int,int);
|
||||
extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char * name);
|
||||
|
||||
extern void reset_opp_meas(void);
|
||||
extern void print_opp_meas(void);
|
||||
|
||||
|
||||
+230
-179
@@ -141,7 +141,6 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
{
|
||||
|
||||
int i,j;
|
||||
PHY_VARS_UE* ue;
|
||||
|
||||
if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in
|
||||
@@ -381,179 +380,177 @@ static void *UE_thread_synch(void *arg)
|
||||
if (UE->UE_scan_carrier) {
|
||||
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case pbch:
|
||||
|
||||
LOG_I(PHY,"[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
|
||||
#if DISABLE_LOG_X
|
||||
printf("[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
|
||||
#else
|
||||
LOG_I(PHY, "[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
|
||||
#endif
|
||||
if (initial_sync( UE, UE->mode ) == 0) {
|
||||
|
||||
hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_tti;
|
||||
LOG_I( HW, "Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n",
|
||||
hw_slot_offset,
|
||||
freq_offset,
|
||||
UE->rx_total_gain_dB,
|
||||
downlink_frequency[0][0]+freq_offset,
|
||||
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset,
|
||||
UE->UE_scan_carrier );
|
||||
|
||||
|
||||
LOG_I(PHY,"[UE thread Synch] Running Initial Synch (mode %d)\n",UE->mode);
|
||||
if (initial_sync( UE, UE->mode ) == 0) {
|
||||
|
||||
hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_tti;
|
||||
LOG_I( HW, "Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n",
|
||||
hw_slot_offset,
|
||||
freq_offset,
|
||||
UE->rx_total_gain_dB,
|
||||
downlink_frequency[0][0]+freq_offset,
|
||||
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset,
|
||||
UE->UE_scan_carrier );
|
||||
|
||||
|
||||
// rerun with new cell parameters and frequency-offset
|
||||
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
||||
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
|
||||
if (UE->UE_scan_carrier == 1) {
|
||||
if (freq_offset >= 0)
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] += abs(UE->common_vars.freq_offset);
|
||||
else
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] -= abs(UE->common_vars.freq_offset);
|
||||
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] =
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+uplink_frequency_offset[CC_id][i];
|
||||
downlink_frequency[CC_id][i] = openair0_cfg[CC_id].rx_freq[i];
|
||||
freq_offset=0;
|
||||
// rerun with new cell parameters and frequency-offset
|
||||
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
||||
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
|
||||
if (UE->UE_scan_carrier == 1) {
|
||||
if (freq_offset >= 0)
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] += abs(UE->common_vars.freq_offset);
|
||||
else
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] -= abs(UE->common_vars.freq_offset);
|
||||
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] =
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+uplink_frequency_offset[CC_id][i];
|
||||
downlink_frequency[CC_id][i] = openair0_cfg[CC_id].rx_freq[i];
|
||||
freq_offset=0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// reconfigure for potentially different bandwidth
|
||||
switch(UE->frame_parms.N_RB_DL) {
|
||||
case 6:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate =1.92e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw =.96e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw =.96e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 12;
|
||||
break;
|
||||
case 25:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate =7.68e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw =2.5e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw =2.5e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 6;
|
||||
break;
|
||||
case 50:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate =15.36e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw =5.0e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw =5.0e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 3;
|
||||
break;
|
||||
case 100:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate=30.72e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw=10.0e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw=10.0e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 0;
|
||||
break;
|
||||
}
|
||||
|
||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
||||
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
||||
sleep(1);
|
||||
init_frame_parms(&UE->frame_parms,1);
|
||||
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
}*/
|
||||
|
||||
if (UE->UE_scan_carrier == 1) {
|
||||
|
||||
UE->UE_scan_carrier = 0;
|
||||
} else {
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
UE->is_synchronized = 1;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
if( UE->mode == rx_dump_frame ) {
|
||||
FILE *fd;
|
||||
if ((UE->proc.proc_rxtx[0].frame_rx&1) == 0) { // this guarantees SIB1 is present
|
||||
if ((fd = fopen("rxsig_frame0.dat","w")) != NULL) {
|
||||
fwrite((void*)&UE->common_vars.rxdata[0][0],
|
||||
sizeof(int32_t),
|
||||
10*UE->frame_parms.samples_per_tti,
|
||||
fd);
|
||||
LOG_I(PHY,"Dummping Frame ... bye bye \n");
|
||||
fclose(fd);
|
||||
exit(0);
|
||||
} else {
|
||||
LOG_E(PHY,"Cannot open file for writing\n");
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
UE->is_synchronized = 0;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// initial sync failed
|
||||
// calculate new offset and try again
|
||||
if (UE->UE_scan_carrier == 1) {
|
||||
if (freq_offset >= 0)
|
||||
freq_offset += 100;
|
||||
freq_offset *= -1;
|
||||
|
||||
if (abs(freq_offset) > 7500) {
|
||||
LOG_I( PHY, "[initial_sync] No cell synchronization found, abandoning\n" );
|
||||
FILE *fd;
|
||||
if ((fd = fopen("rxsig_frame0.dat","w"))!=NULL) {
|
||||
fwrite((void*)&UE->common_vars.rxdata[0][0],
|
||||
sizeof(int32_t),
|
||||
10*UE->frame_parms.samples_per_tti,
|
||||
fd);
|
||||
LOG_I(PHY,"Dummping Frame ... bye bye \n");
|
||||
fclose(fd);
|
||||
exit(0);
|
||||
}
|
||||
exit_fun("No cell synchronization found, abandoning");
|
||||
return &UE_thread_synch_retval; // not reached
|
||||
}
|
||||
}
|
||||
LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n",
|
||||
freq_offset,
|
||||
UE->rx_total_gain_dB,
|
||||
downlink_frequency[0][0]+freq_offset,
|
||||
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset );
|
||||
|
||||
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+freq_offset;
|
||||
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i]+freq_offset;
|
||||
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
|
||||
if (UE->UE_scan_carrier==1)
|
||||
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
|
||||
}
|
||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
||||
}// initial_sync=0
|
||||
break;
|
||||
case si:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
// indicate readiness
|
||||
UE->proc.instance_cnt_synch--;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH, 0 );
|
||||
} // while !oai_exit
|
||||
|
||||
return &UE_thread_synch_retval;
|
||||
|
||||
// reconfigure for potentially different bandwidth
|
||||
switch(UE->frame_parms.N_RB_DL) {
|
||||
case 6:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate =1.92e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw =.96e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw =.96e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 12;
|
||||
break;
|
||||
case 25:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate =7.68e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw =2.5e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw =2.5e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 6;
|
||||
break;
|
||||
case 50:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate =15.36e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw =5.0e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw =5.0e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 3;
|
||||
break;
|
||||
case 100:
|
||||
openair0_cfg[UE->rf_map.card].sample_rate=30.72e6;
|
||||
openair0_cfg[UE->rf_map.card].rx_bw=10.0e6;
|
||||
openair0_cfg[UE->rf_map.card].tx_bw=10.0e6;
|
||||
// openair0_cfg[0].rx_gain[0] -= 0;
|
||||
break;
|
||||
}
|
||||
|
||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
||||
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
||||
sleep(1);
|
||||
init_frame_parms(&UE->frame_parms,1);
|
||||
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
}*/
|
||||
|
||||
if (UE->UE_scan_carrier == 1) {
|
||||
|
||||
UE->UE_scan_carrier = 0;
|
||||
} else {
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
UE->is_synchronized = 1;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
if( UE->mode == rx_dump_frame ) {
|
||||
FILE *fd;
|
||||
if ((UE->proc.proc_rxtx[0].frame_rx&1) == 0) { // this guarantees SIB1 is present
|
||||
if ((fd = fopen("rxsig_frame0.dat","w")) != NULL) {
|
||||
fwrite((void*)&UE->common_vars.rxdata[0][0],
|
||||
sizeof(int32_t),
|
||||
10*UE->frame_parms.samples_per_tti,
|
||||
fd);
|
||||
LOG_I(PHY,"Dummping Frame ... bye bye \n");
|
||||
fclose(fd);
|
||||
exit(0);
|
||||
} else {
|
||||
LOG_E(PHY,"Cannot open file for writing\n");
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
UE->is_synchronized = 0;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// initial sync failed
|
||||
// calculate new offset and try again
|
||||
if (UE->UE_scan_carrier == 1) {
|
||||
if (freq_offset >= 0)
|
||||
freq_offset += 100;
|
||||
freq_offset *= -1;
|
||||
|
||||
if (abs(freq_offset) > 7500) {
|
||||
LOG_I( PHY, "[initial_sync] No cell synchronization found, abandoning\n" );
|
||||
FILE *fd;
|
||||
if ((fd = fopen("rxsig_frame0.dat","w"))!=NULL) {
|
||||
fwrite((void*)&UE->common_vars.rxdata[0][0],
|
||||
sizeof(int32_t),
|
||||
10*UE->frame_parms.samples_per_tti,
|
||||
fd);
|
||||
LOG_I(PHY,"Dummping Frame ... bye bye \n");
|
||||
fclose(fd);
|
||||
exit(0);
|
||||
}
|
||||
AssertFatal(1==0,"No cell synchronization found, abandoning");
|
||||
return &UE_thread_synch_retval; // not reached
|
||||
}
|
||||
}
|
||||
#if DISABLE_LOG_X
|
||||
printf("[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n",
|
||||
freq_offset,
|
||||
UE->rx_total_gain_dB,
|
||||
downlink_frequency[0][0]+freq_offset,
|
||||
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset );
|
||||
#else
|
||||
LOG_I(PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n",
|
||||
freq_offset,
|
||||
UE->rx_total_gain_dB,
|
||||
downlink_frequency[0][0]+freq_offset,
|
||||
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset );
|
||||
#endif
|
||||
|
||||
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
|
||||
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+freq_offset;
|
||||
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i]+freq_offset;
|
||||
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
|
||||
if (UE->UE_scan_carrier==1)
|
||||
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
|
||||
}
|
||||
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
|
||||
}// initial_sync=0
|
||||
break;
|
||||
case si:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
// indicate readiness
|
||||
UE->proc.instance_cnt_synch--;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH, 0 );
|
||||
} // while !oai_exit
|
||||
|
||||
return &UE_thread_synch_retval;
|
||||
}
|
||||
|
||||
|
||||
/* this structure is used to pass both UE phy vars and
|
||||
* proc to the function UE_thread_rxn_txnp4
|
||||
*/
|
||||
struct rx_tx_thread_data {
|
||||
PHY_VARS_UE *UE;
|
||||
UE_rxtx_proc_t *proc;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief This is the UE thread for RX subframe n and TX subframe n+4.
|
||||
* This thread performs the phy_procedures_UE_RX() on every received slot.
|
||||
@@ -576,10 +573,14 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
sprintf(threadname,"UE_%d_proc_%d", UE->Mod_id, proc->sub_frame_start);
|
||||
cpu_set_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
if ( (proc->sub_frame_start+1)%2 == 0 && threads.even != -1 )
|
||||
CPU_SET(threads.even, &cpuset);
|
||||
if ( (proc->sub_frame_start+1)%2 == 1 && threads.odd != -1 )
|
||||
CPU_SET(threads.odd, &cpuset);
|
||||
|
||||
if ( (proc->sub_frame_start+1)%RX_NB_TH == 0 && threads.one != -1 )
|
||||
CPU_SET(threads.one, &cpuset);
|
||||
if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.two != -1 )
|
||||
CPU_SET(threads.two, &cpuset);
|
||||
if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.three != -1 )
|
||||
CPU_SET(threads.three, &cpuset);
|
||||
//CPU_SET(threads.three, &cpuset);
|
||||
init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset,
|
||||
threadname);
|
||||
|
||||
@@ -624,11 +625,16 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
(sf_type==SF_UL? "SF_UL" :
|
||||
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
|
||||
}
|
||||
phy_procedures_UE_RX( UE, proc, 0, 0, UE->mode, no_relay, NULL );
|
||||
#ifdef UE_SLOT_PARALLELISATION
|
||||
phy_procedures_slot_parallelization_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||
#else
|
||||
phy_procedures_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&UE->generic_stat);
|
||||
|
||||
#endif
|
||||
if (UE->mac_enabled==1) {
|
||||
|
||||
ret = ue_scheduler(UE->Mod_id,
|
||||
@@ -658,8 +664,9 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
UE->Mod_id, proc->frame_rx, proc->subframe_tx,txt );
|
||||
}
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&UE->generic_stat);
|
||||
#endif
|
||||
|
||||
|
||||
// Prepare the future Tx data
|
||||
@@ -713,6 +720,9 @@ void *UE_thread(void *arg) {
|
||||
void* rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX];
|
||||
int start_rx_stream = 0;
|
||||
int i;
|
||||
int th_id;
|
||||
|
||||
static uint8_t thread_idx = 0;
|
||||
|
||||
cpu_set_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
@@ -760,6 +770,10 @@ void *UE_thread(void *arg) {
|
||||
}
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
} else {
|
||||
#if OAISIM
|
||||
(void)dummy_rx; /* avoid gcc warnings */
|
||||
usleep(500);
|
||||
#else
|
||||
// grab 10 ms of signal into dummy buffer
|
||||
if (UE->mode != loop_through_memory) {
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
@@ -772,6 +786,7 @@ void *UE_thread(void *arg) {
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // UE->is_synchronized==0
|
||||
@@ -789,8 +804,12 @@ void *UE_thread(void *arg) {
|
||||
UE->frame_parms.nb_antennas_rx),"");
|
||||
}
|
||||
UE->rx_offset=0;
|
||||
UE->proc.proc_rxtx[0].frame_rx++;
|
||||
UE->proc.proc_rxtx[1].frame_rx++;
|
||||
UE->time_sync_cell=0;
|
||||
//UE->proc.proc_rxtx[0].frame_rx++;
|
||||
//UE->proc.proc_rxtx[1].frame_rx++;
|
||||
for (th_id=0; th_id < RX_NB_TH; th_id++) {
|
||||
UE->proc.proc_rxtx[th_id].frame_rx++;
|
||||
}
|
||||
|
||||
// read in first symbol
|
||||
AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 ==
|
||||
@@ -807,7 +826,16 @@ void *UE_thread(void *arg) {
|
||||
} else {
|
||||
sub_frame++;
|
||||
sub_frame%=10;
|
||||
UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[sub_frame&1];
|
||||
UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[thread_idx];
|
||||
// update thread index for received subframe
|
||||
UE->current_thread_id[sub_frame] = thread_idx;
|
||||
|
||||
LOG_D(PHY,"Process Subframe %d thread Idx %d \n", sub_frame, UE->current_thread_id[sub_frame]);
|
||||
|
||||
thread_idx++;
|
||||
if(thread_idx>=RX_NB_TH)
|
||||
thread_idx = 0;
|
||||
|
||||
|
||||
if (UE->mode != loop_through_memory) {
|
||||
for (i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
@@ -874,11 +902,17 @@ void *UE_thread(void *arg) {
|
||||
// operate on thread sf mod 2
|
||||
AssertFatal(pthread_mutex_lock(&proc->mutex_rxtx) ==0,"");
|
||||
if(sub_frame == 0) {
|
||||
UE->proc.proc_rxtx[0].frame_rx++;
|
||||
UE->proc.proc_rxtx[1].frame_rx++;
|
||||
//UE->proc.proc_rxtx[0].frame_rx++;
|
||||
//UE->proc.proc_rxtx[1].frame_rx++;
|
||||
for (th_id=0; th_id < RX_NB_TH; th_id++) {
|
||||
UE->proc.proc_rxtx[th_id].frame_rx++;
|
||||
}
|
||||
}
|
||||
//UE->proc.proc_rxtx[0].gotIQs=readTime(gotIQs);
|
||||
//UE->proc.proc_rxtx[1].gotIQs=readTime(gotIQs);
|
||||
for (th_id=0; th_id < RX_NB_TH; th_id++) {
|
||||
UE->proc.proc_rxtx[th_id].gotIQs=readTime(gotIQs);
|
||||
}
|
||||
UE->proc.proc_rxtx[0].gotIQs=readTime(gotIQs);
|
||||
UE->proc.proc_rxtx[1].gotIQs=readTime(gotIQs);
|
||||
proc->subframe_rx=sub_frame;
|
||||
proc->subframe_tx=(sub_frame+4)%10;
|
||||
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
|
||||
@@ -887,6 +921,7 @@ void *UE_thread(void *arg) {
|
||||
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
|
||||
|
||||
proc->instance_cnt_rxtx++;
|
||||
LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx);
|
||||
if (proc->instance_cnt_rxtx == 0) {
|
||||
if (pthread_cond_signal(&proc->cond_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE %d] ERROR pthread_cond_signal for UE RX thread\n", UE->Mod_id);
|
||||
@@ -922,6 +957,10 @@ void *UE_thread(void *arg) {
|
||||
* - UE_thread_rxtx0
|
||||
* - UE_thread_rxtx1
|
||||
* - UE_thread_synch
|
||||
* - UE_thread_fep_slot0
|
||||
* - UE_thread_fep_slot1
|
||||
* - UE_thread_dlsch_proc_slot0
|
||||
* - UE_thread_dlsch_proc_slot1
|
||||
* and the locking between them.
|
||||
*/
|
||||
void init_UE_threads(int inst) {
|
||||
@@ -940,20 +979,32 @@ void init_UE_threads(int inst) {
|
||||
pthread_cond_init(&UE->proc.cond_synch,NULL);
|
||||
|
||||
// the threads are not yet active, therefore access is allowed without locking
|
||||
int nb_threads=2;
|
||||
int nb_threads=RX_NB_TH;
|
||||
for (int i=0; i<nb_threads; i++) {
|
||||
rtd = calloc(1, sizeof(struct rx_tx_thread_data));
|
||||
if (rtd == NULL) abort();
|
||||
rtd->UE = UE;
|
||||
rtd->proc = &UE->proc.proc_rxtx[i];
|
||||
|
||||
pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL);
|
||||
pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL);
|
||||
UE->proc.proc_rxtx[i].sub_frame_start=i;
|
||||
UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
|
||||
printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
|
||||
pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_thread_rxn_txnp4, rtd);
|
||||
|
||||
#ifdef UE_SLOT_PARALLELISATION
|
||||
//pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot0_dl_processing,NULL);
|
||||
//pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot0_dl_processing,NULL);
|
||||
//pthread_create(&UE->proc.proc_rxtx[i].pthread_slot0_dl_processing,NULL,UE_thread_slot0_dl_processing, rtd);
|
||||
|
||||
pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_slot1_dl_processing,NULL);
|
||||
pthread_cond_init(&UE->proc.proc_rxtx[i].cond_slot1_dl_processing,NULL);
|
||||
pthread_create(&UE->proc.proc_rxtx[i].pthread_slot1_dl_processing,NULL,UE_thread_slot1_dl_processing, rtd);
|
||||
#endif
|
||||
|
||||
}
|
||||
pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
@@ -183,7 +183,7 @@ extern uint16_t Nid_cell;
|
||||
|
||||
double cpuf;
|
||||
#include "threads_t.h"
|
||||
threads_t threads= {-1,-1,-1};
|
||||
threads_t threads= {-1,-1,-1,-1,-1,-1,-1};
|
||||
|
||||
//#ifdef XFORMS
|
||||
int otg_enabled;
|
||||
@@ -1457,7 +1457,8 @@ reset_opp_meas_oaisim (void)
|
||||
reset_meas (&ul_chan_stats);
|
||||
|
||||
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
|
||||
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc);
|
||||
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[0]);
|
||||
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[1]);
|
||||
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[0]);
|
||||
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx[1]);
|
||||
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_tx);
|
||||
@@ -1626,7 +1627,9 @@ print_opp_meas_oaisim (void)
|
||||
}
|
||||
|
||||
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
|
||||
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc, "[UE][total_phy_proc]",
|
||||
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[0], "[UE][total_phy_proc[0]]",
|
||||
&oaisim_stats, &oaisim_stats_f);
|
||||
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc[1], "[UE][total_phy_proc[1]]",
|
||||
&oaisim_stats, &oaisim_stats_f);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user