Merge branch 'develop' into integration_2021_wk13_b
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#ifndef COMMON_LIB_H
|
||||
#define COMMON_LIB_H
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <openair1/PHY/TOOLS/tools_defs.h>
|
||||
#include "record_player.h"
|
||||
|
||||
@@ -68,8 +68,10 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_
|
||||
*recplay_conf=NULL;
|
||||
}
|
||||
|
||||
if (u_sf_replay == 1) return RECPLAY_REPLAYMODE;
|
||||
else if (u_sf_record == 1) return RECPLAY_RECORDMODE;
|
||||
if (u_sf_replay == 1)
|
||||
return RECPLAY_REPLAYMODE;
|
||||
else if (u_sf_record == 1)
|
||||
return RECPLAY_RECORDMODE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -80,7 +82,7 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_
|
||||
*/
|
||||
void iqrecorder_end(openair0_device *device) {
|
||||
if (device->recplay_state != NULL) { // subframes store
|
||||
iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,OAIIQFILE_ID};
|
||||
iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID};
|
||||
recplay_state_t *rs = device->recplay_state;
|
||||
recplay_conf_t *rc = device->openair0_cfg[0].recplay_conf;
|
||||
rs->pFile = fopen (rc->u_sf_filename,"wb+");
|
||||
@@ -91,16 +93,20 @@ void iqrecorder_end(openair0_device *device) {
|
||||
unsigned int i = 0;
|
||||
unsigned int modu = 0;
|
||||
|
||||
if ((modu = rs->nb_samples % 10) != 0) {
|
||||
rs->nb_samples -= modu; // store entire number of frames
|
||||
if ((modu = rs->nbSamplesBlocks % 10) != 0) {
|
||||
rs->nbSamplesBlocks -= modu; // store entire number of frames
|
||||
}
|
||||
|
||||
fh.nbSamplesBlocks=rs->nbSamplesBlocks;
|
||||
LOG_I(HW,"Writing file header to %s \n", rc->u_sf_filename );
|
||||
fwrite(&fh, sizeof(fh), 1, rs->pFile);
|
||||
LOG_UI(HW,"Writing %u subframes to %s \n",rs->nb_samples, rc->u_sf_filename );
|
||||
LOG_UI(HW,"Writing %u subframes to %s \n",rs->nbSamplesBlocks, rc->u_sf_filename );
|
||||
uint8_t *ptr=(uint8_t *)rs->ms_sample;
|
||||
|
||||
for (i = 0; i < rs->nb_samples; i++) {
|
||||
fwrite(rs->ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), rs->pFile);
|
||||
for (i = 0; i < rs->nbSamplesBlocks; i++) {
|
||||
int blockBytes=sizeof(iqrec_t)+((iqrec_t *)ptr)->nbBytes;
|
||||
fwrite(ptr, sizeof(unsigned char), blockBytes, rs->pFile);
|
||||
ptr+=blockBytes;
|
||||
}
|
||||
|
||||
fclose (rs->pFile);
|
||||
@@ -112,4 +118,4 @@ void iqrecorder_end(openair0_device *device) {
|
||||
rs->ms_sample = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,21 +46,22 @@ extern "C"
|
||||
#define BELL_LABS_IQ_HEADER 0xabababababababab
|
||||
#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now
|
||||
#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
|
||||
#define MAX_BELL_LABS_IQ_BYTES_PER_SF BELL_LABS_IQ_BYTES_PER_SF*10
|
||||
|
||||
#define OAIIQFILE_ID "OIQF"
|
||||
#define OAIIQFILE_ID {'O', 'I','Q','F'}
|
||||
typedef struct {
|
||||
uint64_t devtype;
|
||||
uint64_t tx_sample_advance;
|
||||
double bw;
|
||||
unsigned int nbSamplesBlocks;
|
||||
char oaiid[4];
|
||||
} iqfile_header_t;
|
||||
|
||||
typedef struct {
|
||||
int64_t header;
|
||||
int64_t ts;
|
||||
int64_t rfu1;
|
||||
int64_t nbBytes;
|
||||
int64_t rfu2; // pad for 256 bits alignement required by AVX2
|
||||
unsigned char samples[BELL_LABS_IQ_BYTES_PER_SF]; // iq's for one subframe
|
||||
} iqrec_t;
|
||||
#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz)
|
||||
#define DEF_SF_FILE "/tmp/iqfile" // default subframes file name
|
||||
@@ -114,14 +115,16 @@ typedef struct {
|
||||
int use_mmap; // default is to use mmap
|
||||
size_t mapsize;
|
||||
FILE *pFile;
|
||||
int mmapfd;
|
||||
int iqfd;
|
||||
int fd;
|
||||
iqrec_t *ms_sample; // memory for all subframes
|
||||
unsigned int nb_samples;
|
||||
unsigned int nbSamplesBlocks;
|
||||
uint8_t *currentPtr;
|
||||
uint64_t currentTs;
|
||||
unsigned int curSamplesBlock;
|
||||
int64_t wrap_count;
|
||||
size_t maxSizeBytes;
|
||||
} recplay_state_t;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "common_lib.h"
|
||||
#include "ethernet_lib.h"
|
||||
|
||||
@@ -153,7 +153,7 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
|
||||
}
|
||||
|
||||
static int sync_to_gps(openair0_device *device) {
|
||||
uhd::set_thread_priority_safe();
|
||||
//uhd::set_thread_priority_safe();
|
||||
//std::string args;
|
||||
//Set up program options
|
||||
//po::options_description desc("Allowed options");
|
||||
@@ -276,7 +276,7 @@ static int trx_usrp_start(openair0_device *device) {
|
||||
// setup GPIO for TDD, GPIO(4) = ATR_RX
|
||||
//set data direction register (DDR) to output
|
||||
s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff);
|
||||
//set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually)
|
||||
//set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually)
|
||||
s->usrp->set_gpio_attr("FP0", "CTRL", 0x7f,0xfff);
|
||||
//set pins 4 (RX_TX_Switch) and 6 (Shutdown PA) to 1 when the radio is only receiving (ATR_RX)
|
||||
s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4)|(1<<6), 0x7f);
|
||||
@@ -301,7 +301,7 @@ static int trx_usrp_start(openair0_device *device) {
|
||||
}
|
||||
|
||||
uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
|
||||
cmd.time_spec = uhd::time_spec_t(1.0);
|
||||
cmd.time_spec = uhd::time_spec_t(1.0);
|
||||
cmd.stream_now = false; // start at constant delay
|
||||
s->rx_stream->issue_stream_cmd(cmd);
|
||||
|
||||
@@ -315,7 +315,7 @@ static void trx_usrp_end(openair0_device *device) {
|
||||
return;
|
||||
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
|
||||
|
||||
if (s == NULL)
|
||||
return;
|
||||
iqrecorder_end(device);
|
||||
@@ -436,7 +436,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI
|
||||
buff_ptrs.push_back(&(((int16_t *)buff_tx[i])[0]));
|
||||
|
||||
ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md);
|
||||
}
|
||||
@@ -480,7 +480,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI
|
||||
@param antenna_id index of the antenna if the device has multiple antennas
|
||||
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
|
||||
*/
|
||||
void *trx_usrp_write_thread(void * arg){
|
||||
void *trx_usrp_write_thread(void * arg){
|
||||
int ret=0;
|
||||
openair0_device *device=(openair0_device *)arg;
|
||||
openair0_thread_t *write_thread = &device->write_thread;
|
||||
@@ -549,7 +549,7 @@ void *trx_usrp_write_thread(void * arg){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
s->tx_md.has_time_spec = true;
|
||||
s->tx_md.start_of_burst = (s->tx_count==0) ? true : first_packet;
|
||||
s->tx_md.end_of_burst = last_packet;
|
||||
@@ -572,7 +572,7 @@ void *trx_usrp_write_thread(void * arg){
|
||||
buff_ptrs.push_back(&(((int16_t *)buff_tx[i])[0]));
|
||||
|
||||
ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md);
|
||||
}
|
||||
@@ -589,7 +589,7 @@ void *trx_usrp_write_thread(void * arg){
|
||||
|
||||
int trx_usrp_write_init(openair0_device *device){
|
||||
|
||||
uhd::set_thread_priority_safe(1.0);
|
||||
//uhd::set_thread_priority_safe(1.0);
|
||||
openair0_thread_t *write_thread = &device->write_thread;
|
||||
printf("initializing tx write thread\n");
|
||||
|
||||
@@ -697,15 +697,23 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
|
||||
s->usrp->set_gpio_attr("FP0", "OUT", gpio789<<7, 0x380);
|
||||
s->usrp->clear_command_time();
|
||||
gpio789 = (gpio789+1)&7;*/
|
||||
recplay_state_t *recPlay=device->recplay_state;
|
||||
|
||||
if (device->recplay_state != NULL) { // record mode
|
||||
if ( recPlay != NULL) { // record mode
|
||||
// Copy subframes to memory (later dump on a file)
|
||||
if (device->recplay_state->nb_samples < device->openair0_cfg->recplay_conf->u_sf_max) {
|
||||
(device->recplay_state->ms_sample+device->recplay_state->nb_samples)->header = BELL_LABS_IQ_HEADER;
|
||||
(device->recplay_state->ms_sample+device->recplay_state->nb_samples)->ts = *ptimestamp;
|
||||
memcpy((device->recplay_state->ms_sample+device->recplay_state->nb_samples)->samples, buff[0], nsamps*4);
|
||||
device->recplay_state->nb_samples++;
|
||||
} else exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n");
|
||||
if (recPlay->nbSamplesBlocks < device->openair0_cfg->recplay_conf->u_sf_max &&
|
||||
recPlay->maxSizeBytes > (recPlay->currentPtr-(uint8_t *)recPlay->ms_sample) +
|
||||
sizeof(iqrec_t) + nsamps*4 ) {
|
||||
iqrec_t *hdr=(iqrec_t *)recPlay->currentPtr;
|
||||
hdr->header = BELL_LABS_IQ_HEADER;
|
||||
hdr->ts = *ptimestamp;
|
||||
hdr->nbBytes=nsamps*4;
|
||||
memcpy(hdr+1, buff[0], nsamps*4);
|
||||
recPlay->currentPtr+=sizeof(iqrec_t)+nsamps*4;
|
||||
recPlay->nbSamplesBlocks++;
|
||||
LOG_D(HW,"recorded %d samples, for TS %lu, shift in buffer %ld\n", nsamps, hdr->ts, recPlay->currentPtr-(uint8_t *)recPlay->ms_sample);
|
||||
} else
|
||||
exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n");
|
||||
}
|
||||
|
||||
return samples_received;
|
||||
@@ -940,29 +948,29 @@ extern "C" {
|
||||
|
||||
|
||||
// hotfix! to be checked later
|
||||
uhd::set_thread_priority_safe(1.0);
|
||||
//uhd::set_thread_priority_safe(1.0);
|
||||
// Initialize USRP device
|
||||
int vers=0,subvers=0,subsubvers=0;
|
||||
int bw_gain_adjust=0;
|
||||
|
||||
|
||||
if (device->openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) {
|
||||
std::cerr << "USRP device initialized in subframes record mode" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
|
||||
LOG_I(HW,"UHD version %s (%d.%d.%d)\n",
|
||||
uhd::get_version_string().c_str(),vers,subvers,subsubvers);
|
||||
std::string args;
|
||||
|
||||
|
||||
if (openair0_cfg[0].sdr_addrs == NULL) {
|
||||
args = "type=b200";
|
||||
} else {
|
||||
args = openair0_cfg[0].sdr_addrs;
|
||||
LOG_I(HW,"Checking for USRP with args %s\n",openair0_cfg[0].sdr_addrs);
|
||||
}
|
||||
|
||||
|
||||
uhd::device_addrs_t device_adds = uhd::device::find(args);
|
||||
|
||||
|
||||
if (device_adds.size() == 0) {
|
||||
LOG_E(HW,"No USRP Device Found.\n ");
|
||||
free(s);
|
||||
@@ -972,38 +980,38 @@ extern "C" {
|
||||
free(s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
LOG_I(HW,"Found USRP %s\n", device_adds[0].get("type").c_str());
|
||||
double usrp_master_clock;
|
||||
|
||||
|
||||
if (device_adds[0].get("type") == "b200") {
|
||||
device->type = USRP_B200_DEV;
|
||||
usrp_master_clock = 30.72e6;
|
||||
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
|
||||
args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ;
|
||||
}
|
||||
|
||||
|
||||
if (device_adds[0].get("type") == "n3xx") {
|
||||
printf("Found USRP n300\n");
|
||||
device->type=USRP_N300_DEV;
|
||||
device->type=USRP_N300_DEV;
|
||||
usrp_master_clock = 122.88e6;
|
||||
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
|
||||
//args += ", send_buff_size=33554432";
|
||||
}
|
||||
|
||||
|
||||
if (device_adds[0].get("type") == "x300") {
|
||||
printf("Found USRP x300\n");
|
||||
device->type=USRP_X300_DEV;
|
||||
usrp_master_clock = 184.32e6;
|
||||
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
|
||||
|
||||
|
||||
// USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html
|
||||
if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") )
|
||||
LOG_W(HW,"Can't set kernel parameters for X3xx\n");
|
||||
}
|
||||
|
||||
|
||||
s->usrp = uhd::usrp::multi_usrp::make(args);
|
||||
|
||||
|
||||
if (args.find("clock_source")==std::string::npos) {
|
||||
if (openair0_cfg[0].clock_source == internal) {
|
||||
s->usrp->set_clock_source("internal");
|
||||
@@ -1017,7 +1025,7 @@ extern "C" {
|
||||
s->usrp->set_clock_source("gpsdo");
|
||||
LOG_D(HW,"Setting clock source to gpsdo\n");
|
||||
}
|
||||
else {
|
||||
else {
|
||||
LOG_W(HW,"Clock source set neither in usrp_args nor on command line, using default!\n");
|
||||
}
|
||||
}
|
||||
@@ -1040,7 +1048,7 @@ extern "C" {
|
||||
s->usrp->set_time_source("gpsdo");
|
||||
LOG_D(HW,"Setting time source to gpsdo\n");
|
||||
}
|
||||
else {
|
||||
else {
|
||||
LOG_W(HW,"Time source set neither in usrp_args nor on command line, using default!\n");
|
||||
}
|
||||
}
|
||||
@@ -1050,10 +1058,10 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (s->usrp->get_clock_source(0) == "gpsdo") {
|
||||
s->use_gps = 1;
|
||||
|
||||
|
||||
if (sync_to_gps(device)==EXIT_SUCCESS) {
|
||||
LOG_I(HW,"USRP synced with GPS!\n");
|
||||
} else {
|
||||
@@ -1068,15 +1076,15 @@ extern "C" {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (device->type==USRP_X300_DEV) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
|
||||
std::cerr << "-- Using calibration table: calib_table_x310" << std::endl;
|
||||
std::cerr << "-- Using calibration table: calib_table_x310" << std::endl;
|
||||
}
|
||||
|
||||
if (device->type==USRP_N300_DEV) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_n310;
|
||||
std::cerr << "-- Using calibration table: calib_table_n310" << std::endl;
|
||||
std::cerr << "-- Using calibration table: calib_table_n310" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -1091,7 +1099,7 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 80e6;
|
||||
openair0_cfg[0].rx_bw = 80e6;
|
||||
break;
|
||||
|
||||
|
||||
case 92160000:
|
||||
// from usrp_time_offset
|
||||
//openair0_cfg[0].samples_per_packet = 2048;
|
||||
@@ -1099,7 +1107,7 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 80e6;
|
||||
openair0_cfg[0].rx_bw = 80e6;
|
||||
break;
|
||||
|
||||
|
||||
case 61440000:
|
||||
// from usrp_time_offset
|
||||
//openair0_cfg[0].samples_per_packet = 2048;
|
||||
@@ -1107,14 +1115,14 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 40e6;
|
||||
openair0_cfg[0].rx_bw = 40e6;
|
||||
break;
|
||||
|
||||
|
||||
case 46080000:
|
||||
//openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 65;
|
||||
openair0_cfg[0].tx_sample_advance = 15;
|
||||
openair0_cfg[0].tx_bw = 40e6;
|
||||
openair0_cfg[0].rx_bw = 40e6;
|
||||
break;
|
||||
|
||||
|
||||
case 30720000:
|
||||
// from usrp_time_offset
|
||||
//openair0_cfg[0].samples_per_packet = 2048;
|
||||
@@ -1122,35 +1130,35 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 20e6;
|
||||
openair0_cfg[0].rx_bw = 20e6;
|
||||
break;
|
||||
|
||||
|
||||
case 15360000:
|
||||
//openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 40;
|
||||
openair0_cfg[0].tx_sample_advance = 45;
|
||||
openair0_cfg[0].tx_bw = 10e6;
|
||||
openair0_cfg[0].rx_bw = 10e6;
|
||||
break;
|
||||
|
||||
|
||||
case 7680000:
|
||||
//openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 50;
|
||||
openair0_cfg[0].tx_bw = 5e6;
|
||||
openair0_cfg[0].rx_bw = 5e6;
|
||||
break;
|
||||
|
||||
|
||||
case 1920000:
|
||||
//openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 50;
|
||||
openair0_cfg[0].tx_bw = 1.25e6;
|
||||
openair0_cfg[0].rx_bw = 1.25e6;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (device->type == USRP_B200_DEV) {
|
||||
if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
|
||||
@@ -1161,7 +1169,7 @@ extern "C" {
|
||||
bw_gain_adjust=1;
|
||||
std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info
|
||||
}
|
||||
|
||||
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
case 46080000:
|
||||
s->usrp->set_master_clock_rate(46.08e6);
|
||||
@@ -1170,7 +1178,7 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 40e6;
|
||||
openair0_cfg[0].rx_bw = 40e6;
|
||||
break;
|
||||
|
||||
|
||||
case 30720000:
|
||||
s->usrp->set_master_clock_rate(30.72e6);
|
||||
//openair0_cfg[0].samples_per_packet = 1024;
|
||||
@@ -1178,7 +1186,7 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 20e6;
|
||||
openair0_cfg[0].rx_bw = 20e6;
|
||||
break;
|
||||
|
||||
|
||||
case 23040000:
|
||||
s->usrp->set_master_clock_rate(23.04e6); //to be checked
|
||||
//openair0_cfg[0].samples_per_packet = 1024;
|
||||
@@ -1186,7 +1194,7 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 20e6;
|
||||
openair0_cfg[0].rx_bw = 20e6;
|
||||
break;
|
||||
|
||||
|
||||
case 15360000:
|
||||
s->usrp->set_master_clock_rate(30.72e06);
|
||||
//openair0_cfg[0].samples_per_packet = 1024;
|
||||
@@ -1194,7 +1202,7 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 20e6;
|
||||
openair0_cfg[0].rx_bw = 20e6;
|
||||
break;
|
||||
|
||||
|
||||
case 7680000:
|
||||
s->usrp->set_master_clock_rate(30.72e6);
|
||||
//openair0_cfg[0].samples_per_packet = 1024;
|
||||
@@ -1202,7 +1210,7 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 20e6;
|
||||
openair0_cfg[0].rx_bw = 20e6;
|
||||
break;
|
||||
|
||||
|
||||
case 1920000:
|
||||
s->usrp->set_master_clock_rate(30.72e6);
|
||||
//openair0_cfg[0].samples_per_packet = 1024;
|
||||
@@ -1210,20 +1218,20 @@ extern "C" {
|
||||
openair0_cfg[0].tx_bw = 20e6;
|
||||
openair0_cfg[0].rx_bw = 20e6;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* device specific */
|
||||
//openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered
|
||||
//openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered
|
||||
openair0_cfg[0].iq_txshift = 4;//shift
|
||||
openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
|
||||
|
||||
|
||||
for(int i=0; i<((int) s->usrp->get_rx_num_channels()); i++) {
|
||||
if (i<openair0_cfg[0].rx_num_channels) {
|
||||
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
|
||||
@@ -1240,13 +1248,13 @@ extern "C" {
|
||||
openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],gain_range.stop());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOG_D(HW, "usrp->get_tx_num_channels() == %zd\n", s->usrp->get_tx_num_channels());
|
||||
LOG_D(HW, "openair0_cfg[0].tx_num_channels == %d\n", openair0_cfg[0].tx_num_channels);
|
||||
|
||||
|
||||
for(int i=0; i<((int) s->usrp->get_tx_num_channels()); i++) {
|
||||
::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(i);
|
||||
|
||||
|
||||
if (i<openair0_cfg[0].tx_num_channels) {
|
||||
s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
|
||||
s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
|
||||
@@ -1254,7 +1262,7 @@ extern "C" {
|
||||
LOG_I(HW,"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf\n", gain_range_tx.stop()-openair0_cfg[0].tx_gain[i], gain_range_tx.stop(), openair0_cfg[0].tx_gain[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//s->usrp->set_clock_source("external");
|
||||
//s->usrp->set_time_source("external");
|
||||
// display USRP settings
|
||||
@@ -1268,32 +1276,32 @@ extern "C" {
|
||||
int max=s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps();
|
||||
samples/=10000;
|
||||
LOG_I(HW,"RF board max packet size %u, size for 100µs jitter %d \n", max, samples);
|
||||
|
||||
|
||||
if ( samples < max ) {
|
||||
stream_args_rx.args["spp"] = str(boost::format("%d") % samples );
|
||||
}
|
||||
|
||||
|
||||
LOG_I(HW,"rx_max_num_samps %zu\n",
|
||||
s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps());
|
||||
|
||||
|
||||
for (int i = 0; i<openair0_cfg[0].rx_num_channels; i++)
|
||||
stream_args_rx.channels.push_back(i);
|
||||
|
||||
|
||||
s->rx_stream = s->usrp->get_rx_stream(stream_args_rx);
|
||||
uhd::stream_args_t stream_args_tx("sc16", "sc16");
|
||||
|
||||
|
||||
for (int i = 0; i<openair0_cfg[0].tx_num_channels; i++)
|
||||
stream_args_tx.channels.push_back(i);
|
||||
|
||||
|
||||
s->tx_stream = s->usrp->get_tx_stream(stream_args_tx);
|
||||
|
||||
|
||||
/* Setting TX/RX BW after streamers are created due to USRP calibration issue */
|
||||
for(int i=0; i<((int) s->usrp->get_tx_num_channels()) && i<openair0_cfg[0].tx_num_channels; i++)
|
||||
s->usrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i);
|
||||
|
||||
|
||||
for(int i=0; i<((int) 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);
|
||||
|
||||
|
||||
for (int i=0; i<openair0_cfg[0].rx_num_channels; i++) {
|
||||
LOG_I(HW,"RX Channel %d\n",i);
|
||||
LOG_I(HW," Actual RX sample rate: %fMSps...\n",s->usrp->get_rx_rate(i)/1e6);
|
||||
@@ -1302,7 +1310,7 @@ extern "C" {
|
||||
LOG_I(HW," Actual RX bandwidth: %fM...\n", s->usrp->get_rx_bandwidth(i)/1e6);
|
||||
LOG_I(HW," Actual RX antenna: %s...\n", s->usrp->get_rx_antenna(i).c_str());
|
||||
}
|
||||
|
||||
|
||||
for (int i=0; i<openair0_cfg[0].tx_num_channels; i++) {
|
||||
LOG_I(HW,"TX Channel %d\n",i);
|
||||
LOG_I(HW," Actual TX sample rate: %fMSps...\n", s->usrp->get_tx_rate(i)/1e6);
|
||||
@@ -1312,33 +1320,35 @@ extern "C" {
|
||||
LOG_I(HW," Actual TX antenna: %s...\n", s->usrp->get_tx_antenna(i).c_str());
|
||||
LOG_I(HW," Actual TX packet size: %lu\n",s->tx_stream->get_max_num_samps());
|
||||
}
|
||||
|
||||
|
||||
LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs());
|
||||
device->trx_write_func = trx_usrp_write;
|
||||
device->trx_read_func = trx_usrp_read;
|
||||
s->sample_rate = openair0_cfg[0].sample_rate;
|
||||
|
||||
|
||||
// TODO:
|
||||
// init tx_forward_nsamps based usrp_time_offset ex
|
||||
if(is_equal(s->sample_rate, (double)30.72e6))
|
||||
s->tx_forward_nsamps = 176;
|
||||
|
||||
|
||||
if(is_equal(s->sample_rate, (double)15.36e6))
|
||||
s->tx_forward_nsamps = 90;
|
||||
|
||||
|
||||
if(is_equal(s->sample_rate, (double)7.68e6))
|
||||
s->tx_forward_nsamps = 50;
|
||||
|
||||
|
||||
if (device->recplay_state != NULL) { // record mode
|
||||
device->recplay_state->ms_sample = (iqrec_t *) malloc(openair0_cfg[0].recplay_conf->u_sf_max * sizeof(iqrec_t));
|
||||
|
||||
if (device->recplay_state->ms_sample == NULL) {
|
||||
|
||||
recplay_state_t *recPlay=device->recplay_state;
|
||||
|
||||
if (recPlay != NULL) { // record mode
|
||||
recPlay->maxSizeBytes=openair0_cfg[0].recplay_conf->u_sf_max *
|
||||
(sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF);
|
||||
recPlay->ms_sample = (iqrec_t *) malloc(recPlay->maxSizeBytes);
|
||||
recPlay->currentPtr= (uint8_t *)recPlay->ms_sample;
|
||||
|
||||
if (recPlay->ms_sample == NULL) {
|
||||
std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
memset(device->recplay_state->ms_sample, 0, openair0_cfg[0].recplay_conf->u_sf_max * BELL_LABS_IQ_BYTES_PER_SF);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -39,18 +39,15 @@
|
||||
#include "assertions.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) {
|
||||
AssertFatal((memcmp(iq_fh->oaiid,OAIIQFILE_ID,sizeof(OAIIQFILE_ID)) == 0),
|
||||
"iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n",
|
||||
iq_fh->oaiid);
|
||||
char tmp[4]=OAIIQFILE_ID;
|
||||
AssertFatal((memcmp(iq_fh->oaiid,tmp,sizeof(iq_fh->oaiid)) == 0),
|
||||
"iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n",
|
||||
iq_fh->oaiid);
|
||||
device->type = iq_fh->devtype;
|
||||
device->openair0_cfg[0].tx_sample_advance=iq_fh->tx_sample_advance;
|
||||
device->openair0_cfg[0].tx_bw = device->openair0_cfg[0].rx_bw = iq_fh->bw;
|
||||
device->recplay_state->nbSamplesBlocks=iq_fh->nbSamplesBlocks;
|
||||
LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw);
|
||||
}
|
||||
|
||||
@@ -62,89 +59,73 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair
|
||||
recplay_state_t *s = device->recplay_state;
|
||||
recplay_conf_t *c = openair0_cfg->recplay_conf;
|
||||
|
||||
struct stat sb;
|
||||
s->fd = open(c->u_sf_filename, O_RDONLY );
|
||||
if (s->fd >= 0 ) {
|
||||
fstat(s->fd, &sb);
|
||||
} else {
|
||||
LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (s->use_mmap) {
|
||||
// use mmap
|
||||
s->mmapfd = open(c->u_sf_filename, O_RDONLY );
|
||||
|
||||
if (s->mmapfd != 0) {
|
||||
struct stat sb;
|
||||
fstat(s->mmapfd, &sb);
|
||||
s->mapsize=sb.st_size;
|
||||
LOG_I(HW,"Loading subframes using mmap() from %s size=%lu bytes ...\n",c->u_sf_filename, (uint64_t)sb.st_size );
|
||||
void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) ;
|
||||
s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) + sizeof(iqfile_header_t));
|
||||
void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) ;
|
||||
s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) + sizeof(iqfile_header_t));
|
||||
|
||||
if (mptr != MAP_FAILED) {
|
||||
parse_iqfile_header(device, (iqfile_header_t *)mptr);
|
||||
s->ms_sample = (iqrec_t *)((char *)mptr + sizeof(iqfile_header_t));
|
||||
s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t)) / sizeof(iqrec_t));
|
||||
int aligned = (((unsigned long)s->ms_sample & 31) == 0)? 1:0;
|
||||
LOG_I(HW,"Loaded %u subframes.\n",s->nb_samples );
|
||||
|
||||
if (aligned == 0) {
|
||||
LOG_E(HW, "mmap address is not 32 bytes aligned, exiting.\n" );
|
||||
close(s->mmapfd);
|
||||
exit(-1);
|
||||
}
|
||||
LOG_I(HW,"Loaded %u subframes.\n",s->nbSamplesBlocks );
|
||||
} else {
|
||||
LOG_E(HW,"Cannot mmap file, exiting.\n");
|
||||
close(s->mmapfd);
|
||||
close(s->fd);
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename );
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
s->iqfd = open(c->u_sf_filename, O_RDONLY);
|
||||
iqfile_header_t fh;
|
||||
size_t hs = read(s->fd,&fh,sizeof(fh));
|
||||
|
||||
if (s->iqfd != 0) {
|
||||
struct stat sb;
|
||||
iqfile_header_t fh;
|
||||
size_t hs = read(s->iqfd,&fh,sizeof(fh));
|
||||
|
||||
if (hs == sizeof(fh)) {
|
||||
parse_iqfile_header(device, &fh);
|
||||
fstat(s->iqfd, &sb);
|
||||
if (hs == sizeof(fh)) {
|
||||
parse_iqfile_header(device, &fh);
|
||||
fstat(s->fd, &sb);
|
||||
s->mapsize=sb.st_size;
|
||||
s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t))/ sizeof(iqrec_t));
|
||||
LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nb_samples, c->u_sf_filename,(uint64_t)sb.st_size);
|
||||
LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nbSamplesBlocks, c->u_sf_filename,(uint64_t)sb.st_size);
|
||||
// allocate buffer for 1 sample at a time
|
||||
s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t));
|
||||
s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)+MAX_BELL_LABS_IQ_BYTES_PER_SF*4);
|
||||
|
||||
if (s->ms_sample == NULL) {
|
||||
LOG_E(HW,"Memory allocation failed for individual subframe replay mode.\n" );
|
||||
close(s->iqfd);
|
||||
close(s->fd);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
memset(s->ms_sample, 0, sizeof(iqrec_t));
|
||||
|
||||
// point at beginning of iqs in file
|
||||
if (lseek(s->iqfd,sizeof(iqfile_header_t), SEEK_SET) == 0) {
|
||||
if (lseek(s->fd,sizeof(iqfile_header_t), SEEK_SET) == 0) {
|
||||
LOG_I(HW,"Initial seek at beginning of the file\n" );
|
||||
} else {
|
||||
LOG_I(HW,"Problem initial seek at beginning of the file\n");
|
||||
}
|
||||
} else {
|
||||
LOG_E(HW,"Cannot read header in %s exiting.\n",c->u_sf_filename );
|
||||
close(s->iqfd);
|
||||
close(s->fd);
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
LOG_E(HW,"Cannot open %s exiting.\n",c->u_sf_filename );
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
s->currentPtr=(uint8_t *)s->ms_sample;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief start the oai iq player
|
||||
* \param device, the hardware used
|
||||
*/
|
||||
static int trx_iqplayer_start(openair0_device *device){
|
||||
return 0;
|
||||
static int trx_iqplayer_start(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief Terminate operation of the oai iq player
|
||||
@@ -156,28 +137,22 @@ static void trx_iqplayer_end(openair0_device *device) {
|
||||
|
||||
if (device->recplay_state == NULL)
|
||||
return;
|
||||
|
||||
|
||||
if (device->recplay_state->use_mmap) {
|
||||
if (device->recplay_state->ms_sample != MAP_FAILED) {
|
||||
munmap(device->recplay_state->ms_sample, device->recplay_state->mapsize);
|
||||
device->recplay_state->ms_sample = NULL;
|
||||
}
|
||||
|
||||
if (device->recplay_state->mmapfd != 0) {
|
||||
close(device->recplay_state->mmapfd);
|
||||
device->recplay_state->mmapfd = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (device->recplay_state->ms_sample != NULL) {
|
||||
free(device->recplay_state->ms_sample);
|
||||
device->recplay_state->ms_sample = NULL;
|
||||
}
|
||||
|
||||
if (device->recplay_state->iqfd != 0) {
|
||||
close(device->recplay_state->iqfd);
|
||||
device->recplay_state->iqfd = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
device->recplay_state->ms_sample = NULL;
|
||||
if (device->recplay_state->fd >= 0) {
|
||||
close(device->recplay_state->fd);
|
||||
device->recplay_state->fd = -1;
|
||||
}
|
||||
|
||||
}
|
||||
/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
|
||||
@param device pointer to the device structure specific to the RF hardware target
|
||||
@@ -207,93 +182,68 @@ static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timest
|
||||
* \returns the number of sample read
|
||||
*/
|
||||
static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
|
||||
int samples_received=0;
|
||||
static unsigned int cur_samples;
|
||||
static int64_t wrap_count;
|
||||
static int64_t wrap_ts;
|
||||
recplay_state_t *s = device->recplay_state;
|
||||
|
||||
if (cur_samples == s->nb_samples) {
|
||||
cur_samples = 0;
|
||||
wrap_count++;
|
||||
if (s->curSamplesBlock==0 && s->wrap_count==0 )
|
||||
s->currentTs=s->ms_sample->ts;
|
||||
|
||||
if (s->curSamplesBlock == s->nbSamplesBlocks) {
|
||||
LOG_I(HW, "wrapping on iq file (%ld)\n", s->wrap_count);
|
||||
s->curSamplesBlock = 0;
|
||||
s->wrap_count++;
|
||||
|
||||
if (wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) {
|
||||
LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n",device->openair0_cfg->recplay_conf->u_sf_loops);
|
||||
if (s->wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) {
|
||||
LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n",
|
||||
device->openair0_cfg->recplay_conf->u_sf_loops);
|
||||
exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n");
|
||||
}
|
||||
|
||||
wrap_ts = wrap_count * (s->nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000));
|
||||
LOG_I(HW,"go back at the beginning of IQ file");
|
||||
device->recplay_state->currentPtr=(uint8_t *)device->recplay_state->ms_sample;
|
||||
|
||||
if (!device->recplay_state->use_mmap) {
|
||||
if (lseek(device->recplay_state->iqfd, 0, SEEK_SET) == 0) {
|
||||
LOG_I(HW,"Seeking at the beginning of IQ file");
|
||||
} else {
|
||||
LOG_I(HW, "Problem seeking at the beginning of IQ file");
|
||||
if (!s->use_mmap) {
|
||||
if (lseek(device->recplay_state->fd, 0, SEEK_SET) != 0) {
|
||||
LOG_E(HW, "Problem seeking at the beginning of IQ file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s->use_mmap) {
|
||||
if (cur_samples < s->nb_samples) {
|
||||
*ptimestamp = (s->ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts;
|
||||
|
||||
if (cur_samples == 0) {
|
||||
LOG_I(HW,"starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu\n", wrap_count,wrap_ts,*ptimestamp);
|
||||
}
|
||||
|
||||
memcpy(buff[0], &s->ms_sample[cur_samples].samples[0], nsamps*4);
|
||||
cur_samples++;
|
||||
}
|
||||
} else {
|
||||
if (!s->use_mmap) {
|
||||
// read sample from file
|
||||
if (read(s->iqfd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) {
|
||||
LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*cur_samples );
|
||||
close(s->iqfd);
|
||||
free(s->ms_sample);
|
||||
s->ms_sample = NULL;
|
||||
s->iqfd = 0;
|
||||
if (read(s->fd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) {
|
||||
LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (cur_samples < s->nb_samples) {
|
||||
static int64_t ts0 = 0;
|
||||
|
||||
if ((cur_samples == 0) && (wrap_count == 0)) {
|
||||
ts0 = s->ms_sample->ts;
|
||||
}
|
||||
|
||||
*ptimestamp = ts0 + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)) + wrap_ts;
|
||||
|
||||
if (cur_samples == 0) {
|
||||
LOG_I(HW, "starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu ",wrap_count,wrap_ts, *ptimestamp);
|
||||
}
|
||||
|
||||
memcpy(buff[0], &s->ms_sample->samples[0], nsamps*4);
|
||||
cur_samples++;
|
||||
// Prepare for next read
|
||||
off_t where = lseek(s->iqfd, cur_samples * sizeof(iqrec_t), SEEK_SET);
|
||||
|
||||
if (where < 0) {
|
||||
LOG_E(HW,"Cannot lseek in iqfile: %s\n",strerror(errno));
|
||||
} else {
|
||||
if (read(s->fd, s->ms_sample+1, s->ms_sample->nbBytes) != s->ms_sample->nbBytes) {
|
||||
LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock );
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iqrec_t *curHeader=(iqrec_t *)s->currentPtr;
|
||||
AssertFatal(curHeader->header==BELL_LABS_IQ_HEADER,"" );
|
||||
// the current timestamp is the stored timestamp until we wrap on input
|
||||
// USRP shifts 1 sample time to time
|
||||
AssertFatal(s->wrap_count !=0 || abs(curHeader->ts-s->currentTs) < 5 ,"");
|
||||
AssertFatal(nsamps*4==curHeader->nbBytes,"");
|
||||
*ptimestamp = s->currentTs;
|
||||
memcpy(buff[0], curHeader+1, nsamps*4);
|
||||
s->curSamplesBlock++;
|
||||
// Prepare for next read
|
||||
s->currentTs+=nsamps;
|
||||
|
||||
if (s->use_mmap)
|
||||
s->currentPtr+=sizeof(iqrec_t)+s->ms_sample->nbBytes;
|
||||
|
||||
struct timespec req;
|
||||
|
||||
req.tv_sec = 0;
|
||||
|
||||
req.tv_nsec = (device->openair0_cfg[0].recplay_conf->u_sf_read_delay) * 1000;
|
||||
|
||||
nanosleep(&req, NULL);
|
||||
|
||||
LOG_D(HW, "returning %d samples at ts %lu\n", nsamps, *ptimestamp);
|
||||
return nsamps;
|
||||
|
||||
return samples_received;
|
||||
}
|
||||
|
||||
|
||||
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
device->openair0_cfg = openair0_cfg;
|
||||
device->trx_start_func = trx_iqplayer_start;
|
||||
@@ -312,5 +262,4 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
LOG_UI(HW,"iqplayer device initialized, replay %s for %i iterations",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
@@ -65,17 +65,8 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
|
||||
// Fixme: not sure when it is "volts" so dB is 20*log10(...) or "power", so dB is 10*log10(...)
|
||||
const double pathLossLinear = pow(10,channelDesc->path_loss_dB/20.0);
|
||||
// Energy in one sample to calibrate input noise
|
||||
//Fixme: modified the N0W computation, not understand the origin value
|
||||
const double KT=1.38e-23*290; //Boltzman*temperature
|
||||
// sampling rate is linked to acquisition band (the input pass band filter)
|
||||
const double noise_figure_watt = KT*channelDesc->sampling_rate;
|
||||
// Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ?
|
||||
// the parameter "-s" is declared as SNR, but the input power is not well defined
|
||||
// −132.24 dBm is a LTE subcarrier noise, that was used in origin code (15KHz BW thermal noise)
|
||||
const double rxGain= 132.24 - channelmod_get_snr_dB();
|
||||
// sqrt(4*noise_figure_watt) is the thermal noise factor (volts)
|
||||
// fixme: the last constant is pure trial results to make decent noise
|
||||
const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10;
|
||||
// the normalized OAI value seems to be 256 as average amplitude (numerical amplification = 1)
|
||||
const double noise_per_sample = pow(10,channelDesc->noise_power_dB/10.0) * 256;
|
||||
// Fixme: we don't fill the offset length samples at begining ?
|
||||
// anyway, in today code, channel_offset=0
|
||||
const int dd = abs(channelDesc->channel_offset);
|
||||
|
||||
@@ -69,7 +69,9 @@ extern RAN_CONTEXT_t RC;
|
||||
|
||||
#define RFSIMU_SECTION "rfsimulator"
|
||||
#define RFSIMU_OPTIONS_PARAMNAME "options"
|
||||
# define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\
|
||||
|
||||
|
||||
#define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\
|
||||
" chanmod: enable channel modelisation\n"\
|
||||
" saviq: enable saving written iqs to a file\n"
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
@@ -78,21 +80,21 @@ extern RAN_CONTEXT_t RC;
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED
|
||||
#define RFSIMULATOR_PARAMS_DESC { \
|
||||
{"serveraddr", "<ip address to connect to>\n", simOpt , strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\
|
||||
{"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
|
||||
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\
|
||||
{"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
|
||||
{"modelname", "<channel model name>\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\
|
||||
{"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\
|
||||
{"serveraddr", "<ip address to connect to>\n", simOpt, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\
|
||||
{"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
|
||||
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\
|
||||
{"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
|
||||
{"modelname", "<channel model name>\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\
|
||||
{"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
|
||||
static telnetshell_cmddef_t rfsimu_cmdarray[] = {
|
||||
{"setmodel","<model name>",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ},
|
||||
{"setmodel","<model name> <model type>",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ},
|
||||
{"","",NULL},
|
||||
};
|
||||
|
||||
@@ -133,6 +135,7 @@ typedef struct {
|
||||
double chan_pathloss;
|
||||
double chan_forgetfact;
|
||||
int chan_offset;
|
||||
float noise_power_dB;
|
||||
void *telnetcmd_qid;
|
||||
poll_telnetcmdq_func_t poll_telnetcmdq;
|
||||
} rfsimulator_state_t;
|
||||
@@ -182,15 +185,9 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
|
||||
tableNor(rand);
|
||||
init_done=true;
|
||||
}
|
||||
|
||||
ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels,
|
||||
bridge->channelmod,
|
||||
bridge->sample_rate,
|
||||
bridge->tx_bw,
|
||||
30e-9, // TDL delay-spread parameter
|
||||
bridge->chan_forgetfact, // forgetting_factor
|
||||
bridge->chan_offset, // maybe used for TA
|
||||
bridge->chan_pathloss); // path_loss in dB
|
||||
char *modelname = (bridge->typeStamp == ENB_MAGICDL) ? "rfsimu_channel_ue0":"rfsimu_channel_enB0";
|
||||
ptr->channel_model=find_channel_desc_fromname(modelname); // path_loss in dB
|
||||
AssertFatal((ptr->channel_model!= NULL),"Channel model %s not found, check config file\n",modelname);
|
||||
set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID);
|
||||
random_channel(ptr->channel_model,false);
|
||||
}
|
||||
@@ -299,7 +296,8 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
|
||||
break;
|
||||
} else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) {
|
||||
init_channelmod();
|
||||
rfsimulator->channelmod=modelid_fromname(modelname);
|
||||
load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw);
|
||||
rfsimulator->channelmod=true;
|
||||
} else {
|
||||
fprintf(stderr,"Unknown rfsimulator option: %s\n",rfsimu_params[p].strlistptr[i]);
|
||||
exit(-1);
|
||||
@@ -320,20 +318,27 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
|
||||
|
||||
static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) {
|
||||
char *modelname=NULL;
|
||||
int s = sscanf(buff,"%ms\n",&modelname);
|
||||
char *modeltype=NULL;
|
||||
if (debug)
|
||||
prnt("rfsimu_setchanmod_cmd buffer \"%s\"\n",buff);
|
||||
int s = sscanf(buff,"%m[^ ] %ms\n",&modelname, &modeltype);
|
||||
|
||||
if (s == 1) {
|
||||
int channelmod=modelid_fromname(modelname);
|
||||
if (s == 2) {
|
||||
int channelmod=modelid_fromstrtype(modeltype);
|
||||
|
||||
if (channelmod<0)
|
||||
prnt("ERROR: model %s unknown\n",modelname);
|
||||
prnt("ERROR: model type %s unknown\n",modeltype);
|
||||
else {
|
||||
rfsimulator_state_t *t = (rfsimulator_state_t *)arg;
|
||||
|
||||
int found=0;
|
||||
for (int i=0; i<FD_SETSIZE; i++) {
|
||||
buffer_t *b=&t->buf[i];
|
||||
if ( b->channel_model==NULL)
|
||||
continue;
|
||||
if (b->channel_model->model_name==NULL)
|
||||
continue;
|
||||
if (b->conn_sock >= 0 && (strcmp(b->channel_model->model_name,modelname)==0)) {
|
||||
|
||||
if (b->conn_sock >= 0 ) {
|
||||
channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels,
|
||||
channelmod,
|
||||
t->sample_rate,
|
||||
@@ -341,21 +346,29 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt,
|
||||
30e-9, // TDL delay-spread parameter
|
||||
t->chan_forgetfact, // forgetting_factor
|
||||
t->chan_offset, // maybe used for TA
|
||||
t->chan_pathloss); // path_loss in dB
|
||||
t->chan_pathloss,
|
||||
t->noise_power_dB
|
||||
); // path_loss in dB
|
||||
set_channeldesc_owner(newmodel, RFSIMU_MODULEID);
|
||||
set_channeldesc_name(newmodel,modelname);
|
||||
random_channel(newmodel,false);
|
||||
channel_desc_t *oldmodel=b->channel_model;
|
||||
b->channel_model=newmodel;
|
||||
free_channel_desc_scm(oldmodel);
|
||||
prnt("New model %s applied to channel connected to sock %d\n",modelname,i);
|
||||
prnt("New model type %s applied to channel %s connected to sock %d\n",modeltype,modelname,i);
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* for */
|
||||
if (found==0)
|
||||
prnt("Channel %s not found or not currently used\n",modelname);
|
||||
}
|
||||
} else {
|
||||
prnt("ERROR: no model specified\n");
|
||||
prnt("ERROR: 2 parameters required: model name and model type (%i found)\n",s);
|
||||
}
|
||||
|
||||
free(modelname);
|
||||
free(modeltype);
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
|
||||
@@ -774,6 +787,11 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
// to change the log level, use this on command line
|
||||
// --log_config.hw_log_level debug
|
||||
rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1);
|
||||
// initialize channel simulation
|
||||
rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels;
|
||||
rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels;
|
||||
rfsimulator->sample_rate=openair0_cfg->sample_rate;
|
||||
rfsimulator->tx_bw=openair0_cfg->tx_bw;
|
||||
rfsimulator_readconfig(rfsimulator);
|
||||
pthread_mutex_init(&Sockmutex, NULL);
|
||||
LOG_I(HW,"rfsimulator: running as %s\n", rfsimulator-> typeStamp == ENB_MAGICDL ? "server waiting opposite rfsimulators to connect" : "client: will connect to a rfsimulator server side");
|
||||
@@ -798,11 +816,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
rfsimulator->buf[i].conn_sock=-1;
|
||||
|
||||
AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,"");
|
||||
// initialize channel simulation
|
||||
rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels;
|
||||
rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels;
|
||||
rfsimulator->sample_rate=openair0_cfg->sample_rate;
|
||||
rfsimulator->tx_bw=openair0_cfg->tx_bw;
|
||||
|
||||
//randominit(0);
|
||||
set_taus_seed(0);
|
||||
/* look for telnet server, if it is loaded, add the channel modeling commands to it */
|
||||
|
||||
@@ -186,14 +186,14 @@ int main(int argc, char *argv[]) {
|
||||
serviceSock=client_start(argv[2],atoi(argv[3]));
|
||||
}
|
||||
|
||||
uint64_t typeStamp=ENB_MAGICDL_FDD;
|
||||
uint64_t typeStamp=ENB_MAGICDL;
|
||||
boolean_t raw=false;
|
||||
|
||||
if ( argc == 5 ) {
|
||||
raw=true;
|
||||
|
||||
if (strcmp(argv[4],"UL") == 0 )
|
||||
typeStamp=UE_MAGICDL_FDD;
|
||||
typeStamp=UE_MAGICDL;
|
||||
}
|
||||
|
||||
samplesBlockHeader_t header;
|
||||
@@ -201,7 +201,6 @@ int main(int argc, char *argv[]) {
|
||||
void *buff=malloc(bufSize);
|
||||
uint64_t timestamp=0;
|
||||
const int blockSize=1920;
|
||||
|
||||
// If fileSize is not multiple of blockSize*4 then discard remaining samples
|
||||
fileSize = (fileSize/(blockSize<<2))*(blockSize<<2);
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
# include "enb_app.h"
|
||||
# include "openair2/LAYER2/MAC/mac_proto.h"
|
||||
#include <executables/split_headers.h>
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
# include "mce_app.h"
|
||||
# include "mme_app.h"
|
||||
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
//extern RAN_CONTEXT_t RC;
|
||||
|
||||
int create_tasks_mbms(uint32_t enb_nb) {
|
||||
|
||||
@@ -13,7 +13,7 @@ gNBs =
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;});
|
||||
plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;});
|
||||
|
||||
tr_s_preference = "local_mac"
|
||||
|
||||
@@ -21,6 +21,7 @@ gNBs =
|
||||
|
||||
ssb_SubcarrierOffset = 0;
|
||||
pdsch_AntennaPorts = 1;
|
||||
pusch_AntennaPorts = 1;
|
||||
|
||||
pdcch_ConfigSIB1 = (
|
||||
{
|
||||
@@ -51,7 +52,7 @@ gNBs =
|
||||
#initialDownlinkBWP
|
||||
#genericParameters
|
||||
# this is RBstart=41,L=24 (275*(L-1))+RBstart
|
||||
initialDLBWPlocationAndBandwidth = 6368;
|
||||
initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialDLBWPsubcarrierSpacing = 1;
|
||||
@@ -80,7 +81,7 @@ gNBs =
|
||||
pMax = 20;
|
||||
#initialUplinkBWP
|
||||
#genericParameters
|
||||
initialULBWPlocationAndBandwidth = 6368;
|
||||
initialULBWPlocationAndBandwidth = 12952;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialULBWPsubcarrierSpacing = 1;
|
||||
@@ -92,7 +93,7 @@ gNBs =
|
||||
prach_msg1_FDM = 0;
|
||||
prach_msg1_FrequencyStart = 0;
|
||||
zeroCorrelationZoneConfig = 13;
|
||||
preambleReceivedTargetPower = -100;
|
||||
preambleReceivedTargetPower = -96;
|
||||
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
||||
preambleTransMax = 6;
|
||||
#powerRampingStep
|
||||
@@ -174,7 +175,7 @@ gNBs =
|
||||
nrofUplinkSlots = 2;
|
||||
nrofUplinkSymbols = 4;
|
||||
|
||||
ssPBCH_BlockPower = 10;
|
||||
ssPBCH_BlockPower = -25;
|
||||
}
|
||||
|
||||
);
|
||||
@@ -233,10 +234,11 @@ MACRLCs = (
|
||||
);
|
||||
|
||||
L1s = (
|
||||
{
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_n_preference = "local_mac";
|
||||
}
|
||||
pusch_proc_threads = 8;
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
|
||||
@@ -13,7 +13,7 @@ gNBs =
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;});
|
||||
plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;});
|
||||
|
||||
tr_s_preference = "local_mac"
|
||||
|
||||
@@ -21,6 +21,7 @@ gNBs =
|
||||
|
||||
ssb_SubcarrierOffset = 0;
|
||||
pdsch_AntennaPorts = 1;
|
||||
pusch_AntennaPorts = 1;
|
||||
|
||||
pdcch_ConfigSIB1 = (
|
||||
{
|
||||
@@ -50,8 +51,8 @@ gNBs =
|
||||
dl_carrierBandwidth = 106;
|
||||
#initialDownlinkBWP
|
||||
#genericParameters
|
||||
# this is RBstart=41,L=24 (275*(L-1))+RBstart
|
||||
initialDLBWPlocationAndBandwidth = 6368;
|
||||
# this is RBstart=27,L=48 (275*(L-1))+RBstart
|
||||
initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialDLBWPsubcarrierSpacing = 1;
|
||||
@@ -80,7 +81,7 @@ gNBs =
|
||||
pMax = 20;
|
||||
#initialUplinkBWP
|
||||
#genericParameters
|
||||
initialULBWPlocationAndBandwidth = 6368;
|
||||
initialULBWPlocationAndBandwidth = 12952;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialULBWPsubcarrierSpacing = 1;
|
||||
@@ -92,7 +93,7 @@ gNBs =
|
||||
prach_msg1_FDM = 0;
|
||||
prach_msg1_FrequencyStart = 0;
|
||||
zeroCorrelationZoneConfig = 13;
|
||||
preambleReceivedTargetPower = -100;
|
||||
preambleReceivedTargetPower = -96;
|
||||
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
||||
preambleTransMax = 6;
|
||||
#powerRampingStep
|
||||
@@ -174,7 +175,7 @@ gNBs =
|
||||
nrofUplinkSlots = 2;
|
||||
nrofUplinkSymbols = 4;
|
||||
|
||||
ssPBCH_BlockPower = 10;
|
||||
ssPBCH_BlockPower = -25;
|
||||
}
|
||||
|
||||
);
|
||||
@@ -233,10 +234,11 @@ MACRLCs = (
|
||||
);
|
||||
|
||||
L1s = (
|
||||
{
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_n_preference = "local_mac";
|
||||
}
|
||||
pusch_proc_threads = 8;
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
|
||||
@@ -869,7 +869,6 @@ static void *ru_thread_asynch_rxtx( void *param ) {
|
||||
LOG_I(PHY, "devices ok (ru_thread_asynch_rxtx)\n");
|
||||
|
||||
while (!oai_exit) {
|
||||
if (oai_exit) break;
|
||||
|
||||
if (ru->state != RU_RUN) {
|
||||
subframe=0;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <sched.h>
|
||||
|
||||
#include "rt_wrapper.h"
|
||||
#include <common/utils/msc/msc.h>
|
||||
|
||||
|
||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
@@ -56,6 +57,8 @@
|
||||
|
||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
#include <openair1/PHY/phy_extern_ue.h>
|
||||
|
||||
#include "PHY/phy_vars.h"
|
||||
#include "SCHED/sched_common_vars.h"
|
||||
#include "LAYER2/MAC/mac_vars.h"
|
||||
@@ -100,6 +103,8 @@ pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||
|
||||
msc_interface_t msc_interface;
|
||||
|
||||
|
||||
uint16_t sf_ahead=4;
|
||||
|
||||
@@ -170,7 +175,6 @@ extern void init_eNB_afterRU(void);
|
||||
int transmission_mode=1;
|
||||
int emulate_rf = 0;
|
||||
int numerology = 0;
|
||||
int usrp_tx_thread = 0;
|
||||
|
||||
THREAD_STRUCT thread_struct;
|
||||
/* struct for ethernet specific parameters given in eNB conf file */
|
||||
@@ -727,7 +731,7 @@ int main ( int argc, char **argv )
|
||||
fflush(stderr);
|
||||
// end of CI modifications
|
||||
//getchar();
|
||||
if(IS_SOFTMODEM_DOFORMS)
|
||||
if(IS_SOFTMODEM_DOSCOPE)
|
||||
load_softscope("enb",NULL);
|
||||
itti_wait_tasks_end();
|
||||
oai_exit=1;
|
||||
@@ -735,7 +739,7 @@ int main ( int argc, char **argv )
|
||||
// stop threads
|
||||
|
||||
if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) {
|
||||
if(IS_SOFTMODEM_DOFORMS)
|
||||
if(IS_SOFTMODEM_DOSCOPE)
|
||||
end_forms();
|
||||
|
||||
LOG_I(ENB_APP,"stopping MODEM threads\n");
|
||||
|
||||
@@ -95,6 +95,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
|
||||
extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
|
||||
|
||||
|
||||
int tx_req_num_elems;
|
||||
extern uint16_t sf_ahead;
|
||||
//extern int tx_req_UE_MAC1();
|
||||
|
||||
@@ -181,9 +182,8 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t abstraction_flag)
|
||||
|
||||
{
|
||||
PHY_VARS_UE *ue = (PHY_VARS_UE *)malloc(sizeof(PHY_VARS_UE));
|
||||
memset(ue,0,sizeof(PHY_VARS_UE));
|
||||
|
||||
PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE));
|
||||
AssertFatal(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
|
||||
memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
#include "lte-softmodem.h"
|
||||
|
||||
|
||||
msc_interface_t msc_interface;
|
||||
/* temporary compilation wokaround (UE/eNB split */
|
||||
uint16_t sf_ahead;
|
||||
|
||||
@@ -168,7 +169,6 @@ extern void get_uethreads_params(void);
|
||||
|
||||
int transmission_mode=1;
|
||||
|
||||
int usrp_tx_thread = 0;
|
||||
|
||||
|
||||
char *usrp_args=NULL;
|
||||
@@ -758,7 +758,7 @@ int main( int argc, char **argv ) {
|
||||
PHY_vars_UE_g[0][0]->no_timing_correction = 1;
|
||||
}
|
||||
|
||||
if(IS_SOFTMODEM_DOFORMS)
|
||||
if(IS_SOFTMODEM_DOSCOPE)
|
||||
load_softscope("ue",NULL);
|
||||
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
@@ -783,7 +783,7 @@ int main( int argc, char **argv ) {
|
||||
printf("oai_exit=%d\n",oai_exit);
|
||||
|
||||
// stop threads
|
||||
if(IS_SOFTMODEM_DOFORMS)
|
||||
if(IS_SOFTMODEM_DOSCOPE)
|
||||
end_forms();
|
||||
|
||||
printf("stopping MODEM threads\n");
|
||||
|
||||
@@ -361,6 +361,7 @@ void init_ocm(void) {
|
||||
DS_TDL,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
random_channel(sim.RU2UE[ru_id][UE_id][CC_id],0);
|
||||
LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN", UE_id, ru_id);
|
||||
@@ -374,6 +375,7 @@ void init_ocm(void) {
|
||||
DS_TDL,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
random_channel(sim.UE2RU[UE_id][ru_id][CC_id],0);
|
||||
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <sys/sysinfo.h>
|
||||
#include "rt_wrapper.h"
|
||||
#include <errno.h>
|
||||
#include <common/utils/msc/msc.h>
|
||||
|
||||
#include "openair1/PHY/defs_common.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user