Merge remote-tracking branch 'origin/develop' into nr_prs
This commit is contained in:
@@ -314,6 +314,8 @@ typedef struct {
|
||||
pthread_cond_t cond_write;
|
||||
/// mutex for trx write thread
|
||||
pthread_mutex_t mutex_write;
|
||||
/// to inform the thread to exit
|
||||
bool write_thread_exit;
|
||||
} openair0_thread_t;
|
||||
|
||||
/*!\brief structure holds the parameters to configure USRP devices */
|
||||
|
||||
@@ -95,7 +95,7 @@ typedef struct {
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define DEVICE_RECPLAY_PARAMS_DESC { \
|
||||
{CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:(char **)((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 1024}, \
|
||||
{CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:&((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 0}, \
|
||||
{CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \
|
||||
{CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \
|
||||
{CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_conf)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \
|
||||
@@ -105,7 +105,7 @@ typedef struct {
|
||||
{CONFIG_OPT_USE_MMAP, CONFIG_HLP_USE_MMAP, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->use_mmap), defuintval:1, TYPE_UINT, 0}, \
|
||||
}/*! \brief Record Player Configuration and state */
|
||||
typedef struct {
|
||||
char u_sf_filename[1024]; // subframes file path
|
||||
char *u_sf_filename; // subframes file path
|
||||
unsigned int u_sf_max ; // max number of recorded subframes
|
||||
unsigned int u_sf_loops ; // number of loops in replay mode
|
||||
unsigned int u_sf_read_delay; // read delay in replay mode
|
||||
|
||||
@@ -313,6 +313,26 @@ static int trx_usrp_start(openair0_device *device) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void trx_usrp_send_end_of_burst(usrp_state_t *s) {
|
||||
// if last packet sent was end of burst no need to do anything. otherwise send end of burst packet
|
||||
if (s->tx_md.end_of_burst)
|
||||
return;
|
||||
|
||||
s->tx_md.end_of_burst = true;
|
||||
s->tx_md.start_of_burst = false;
|
||||
s->tx_md.has_time_spec = false;
|
||||
|
||||
int32_t dummy = 0;
|
||||
std::vector<const void *> buffs;
|
||||
for (size_t ch = 0; ch < s->tx_stream->get_num_channels(); ch++)
|
||||
buffs.push_back(&dummy); // same buffer for each channel
|
||||
|
||||
s->tx_stream->send(buffs, 0, s->tx_md);
|
||||
}
|
||||
|
||||
static void trx_usrp_write_reset(openair0_thread_t *wt);
|
||||
|
||||
/*! \brief Terminate operation of the USRP transceiver -- free all associated resources
|
||||
* \param device the hardware to use
|
||||
*/
|
||||
@@ -322,11 +342,27 @@ static void trx_usrp_end(openair0_device *device) {
|
||||
|
||||
usrp_state_t *s = (usrp_state_t *)device->priv;
|
||||
|
||||
if (s == NULL)
|
||||
return;
|
||||
AssertFatal(s != NULL, "%s() called on uninitialized USRP\n", __func__);
|
||||
iqrecorder_end(device);
|
||||
|
||||
LOG_I(HW, "releasing USRP\n");
|
||||
if (usrp_tx_thread != 0)
|
||||
trx_usrp_write_reset(&device->write_thread);
|
||||
|
||||
trx_usrp_send_end_of_burst(s);
|
||||
s->tx_stream->~tx_streamer();
|
||||
s->rx_stream->~rx_streamer();
|
||||
s->usrp->~multi_usrp();
|
||||
free(s);
|
||||
device->priv = NULL;
|
||||
device->trx_start_func = NULL;
|
||||
device->trx_get_stats_func = NULL;
|
||||
device->trx_reset_stats_func = NULL;
|
||||
device->trx_end_func = NULL;
|
||||
device->trx_stop_func = NULL;
|
||||
device->trx_set_freq_func = NULL;
|
||||
device->trx_set_gains_func = NULL;
|
||||
device->trx_write_init = NULL;
|
||||
}
|
||||
|
||||
/*! \brief Called to send samples to the USRP RF target
|
||||
@@ -516,6 +552,8 @@ void *trx_usrp_write_thread(void * arg){
|
||||
while (write_thread->count_write == 0) {
|
||||
pthread_cond_wait(&write_thread->cond_write,&write_thread->mutex_write); // this unlocks mutex_rxtx while waiting and then locks it again
|
||||
}
|
||||
if (write_thread->write_thread_exit)
|
||||
break;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, 1 );
|
||||
s = (usrp_state_t *)device->priv;
|
||||
start = write_thread->start;
|
||||
@@ -617,6 +655,7 @@ int trx_usrp_write_init(openair0_device *device){
|
||||
write_thread->start = 0;
|
||||
write_thread->end = 0;
|
||||
write_thread->count_write = 0;
|
||||
write_thread->write_thread_exit = false;
|
||||
printf("end of tx write thread\n");
|
||||
pthread_mutex_init(&write_thread->mutex_write, NULL);
|
||||
pthread_cond_init(&write_thread->cond_write, NULL);
|
||||
@@ -625,6 +664,17 @@ int trx_usrp_write_init(openair0_device *device){
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void trx_usrp_write_reset(openair0_thread_t *wt) {
|
||||
pthread_mutex_lock(&wt->mutex_write);
|
||||
wt->count_write = 1;
|
||||
wt->write_thread_exit = true;
|
||||
pthread_mutex_unlock(&wt->mutex_write);
|
||||
pthread_cond_signal(&wt->cond_write);
|
||||
void *retval = NULL;
|
||||
pthread_join(wt->pthread_write, &retval);
|
||||
LOG_I(HW, "stopped USRP write thread\n");
|
||||
}
|
||||
|
||||
//---------------------end-------------------------
|
||||
|
||||
/*! \brief Receive samples from hardware.
|
||||
|
||||
@@ -77,11 +77,11 @@
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#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 },\
|
||||
{"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 },\
|
||||
{"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 }\
|
||||
@@ -225,15 +225,16 @@ enum blocking_t {
|
||||
};
|
||||
|
||||
static void setblocking(int sock, enum blocking_t active) {
|
||||
int opts;
|
||||
AssertFatal( (opts = fcntl(sock, F_GETFL)) >= 0,"");
|
||||
int opts = fcntl(sock, F_GETFL);
|
||||
AssertFatal(opts >= 0, "fcntl(): errno %d, %s\n", errno, strerror(errno));
|
||||
|
||||
if (active==blocking)
|
||||
opts = opts & ~O_NONBLOCK;
|
||||
else
|
||||
opts = opts | O_NONBLOCK;
|
||||
|
||||
AssertFatal(fcntl(sock, F_SETFL, opts) >= 0, "");
|
||||
opts = fcntl(sock, F_SETFL, opts);
|
||||
AssertFatal(opts >= 0, "fcntl(): errno %d, %s\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps);
|
||||
@@ -248,7 +249,6 @@ static void fullwrite(int fd, void *_buf, ssize_t count, rfsimulator_state_t *t)
|
||||
"Bug: %d/%p/%zd/%p", fd, _buf, count, t);
|
||||
char *buf = _buf;
|
||||
ssize_t l;
|
||||
setblocking(fd, notBlocking);
|
||||
|
||||
while (count) {
|
||||
l = write(fd, buf, count);
|
||||
@@ -740,7 +740,15 @@ static int rfsimulator_get_stats(openair0_device *device) {
|
||||
static int rfsimulator_reset_stats(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
static void rfsimulator_end(openair0_device *device) {}
|
||||
static void rfsimulator_end(openair0_device *device) {
|
||||
rfsimulator_state_t* s = device->priv;
|
||||
for (int i = 0; i < FD_SETSIZE; i++) {
|
||||
buffer_t *b = &s->buf[i];
|
||||
if (b->conn_sock >= 0 )
|
||||
close(b->conn_sock);
|
||||
}
|
||||
close(s->epollfd);
|
||||
}
|
||||
static int rfsimulator_stop(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ struct timing_info_t {
|
||||
// Fix per CC openair rf/if device update
|
||||
// extern openair0_device openair0;
|
||||
|
||||
extern volatile int oai_exit;
|
||||
extern int oai_exit;
|
||||
|
||||
extern int transmission_mode;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ static int DEFBFW[] = {0x00007fff};
|
||||
|
||||
#define MBMS_EXPERIMENTAL
|
||||
|
||||
extern volatile int oai_exit;
|
||||
extern int oai_exit;
|
||||
extern clock_source_t clock_source;
|
||||
#include "executables/thread-common.h"
|
||||
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
|
||||
|
||||
@@ -106,7 +106,7 @@ uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75,
|
||||
uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
|
||||
|
||||
|
||||
volatile int oai_exit = 0;
|
||||
int oai_exit = 0;
|
||||
|
||||
uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
|
||||
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
|
||||
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
|
||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
|
||||
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
|
||||
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
|
||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0}, \
|
||||
@@ -146,7 +146,7 @@ extern int rx_input_level_dBm;
|
||||
extern uint64_t num_missed_slots; // counter for the number of missed slots
|
||||
|
||||
extern int oaisim_flag;
|
||||
extern volatile int oai_exit;
|
||||
extern int oai_exit;
|
||||
|
||||
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
extern pthread_cond_t sync_cond;
|
||||
|
||||
@@ -1986,13 +1986,13 @@ void *UE_thread(void *arg) {
|
||||
for(int sf=0; sf<10; sf++) {
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf];
|
||||
write_dummy(UE, timestamp);
|
||||
|
||||
AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx), "");
|
||||
write_dummy(UE, timestamp);
|
||||
}
|
||||
} else {
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
|
||||
@@ -99,7 +99,7 @@ int config_sync_var=-1;
|
||||
uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
|
||||
uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
|
||||
|
||||
volatile int oai_exit = 0;
|
||||
int oai_exit = 0;
|
||||
|
||||
unsigned int mmapped_dma=0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user