Commit 29fdf1a3 authored by Raymond Knopp's avatar Raymond Knopp

modifications for UE on ExpressMIMO2, validation on USRP. Only RX path is activated.

parent d9501248
......@@ -81,12 +81,14 @@ const char* eurecomVariablesNames[] = {
"subframe_number_RX_eNB",
"runtime_TX_eNB",
"runtime_RX_eNB",
"frame_number_TX_UE",
"frame_number_RX_UE",
"slot_number_TX_UE",
"slot_number_RX_UE",
"subframe_number_TX_UE",
"subframe_number_RX_UE",
"frame_number_TX0_UE",
"frame_number_TX1_UE",
"frame_number_RX0_UE",
"frame_number_RX1_UE",
"subframe_TX0_UE",
"subframe_TX1_UE",
"subframe_RX0_UE",
"subframe_RX1_UE",
"missed_slot_enb",
"daq_mbox",
"rx_offset_mbox",
......@@ -187,8 +189,9 @@ const char* eurecomFunctionsNames[] = {
"eNB_thread_rxtx1",
"eNB_thread_rx",
"eNB_thread_prach",
"ue_thread_tx",
"ue_thread_rx",
"ue_thread_synch",
"ue_thread_rxtx0",
"ue_thread_rxtx1",
/* RRH signals */
"eNB_tx",
......
......@@ -53,12 +53,14 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_UE,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_UE,
VCD_SIGNAL_DUMPER_VARIABLES_MISSED_SLOTS_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX,
VCD_SIGNAL_DUMPER_VARIABLES_UE_OFFSET_MBOX,
......@@ -161,8 +163,9 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX1,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX,
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_PRACH,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_TX,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX1,
/* RRH signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX,
......
......@@ -326,9 +326,8 @@ struct openair0_device_t {
void (*trx_end_func)(openair0_device *device);
/*! \brief Stop operation of the transceiver
* \param card RF Card to use
*/
int (*trx_stop_func)(int card);
int (*trx_stop_func)(openair0_device *device);
/* Functions API related to UE*/
......
......@@ -58,6 +58,7 @@ typedef struct {
struct sched_param watchdog_sched_param;
pthread_mutex_t watchdog_mutex;
int watchdog_exit;
int wait_first_read;
exmimo_daq_state_t daq_state;
openair0_timestamp ts;
openair0_timestamp last_ts_rx;
......
......@@ -377,7 +377,7 @@ int trx_usrp_set_gains(openair0_device* device,
/*! \brief Stop USRP
* \param card refers to the hardware index to use
*/
int trx_usrp_stop(int card) {
int trx_usrp_stop(openair0_device* device) {
return(0);
}
......
......@@ -1514,6 +1514,11 @@ int main( int argc, char **argv )
for (card=0; card<MAX_CARDS; card++) {
if (UE_flag==0)
openair0_cfg[card].mmapped_dma=1;
else
openair0_cfg[card].mmapped_dma=0;
if(frame_parms[0]->N_RB_DL == 100) {
if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=23.04e6;
......@@ -1796,14 +1801,7 @@ int main( int argc, char **argv )
exit(-1);
}
printf("Setting UE buffer to all-RX\n");
// Set LSBs for antenna switch (ExpressMIMO)
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++)
for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
UE[CC_id]->common_vars.txdata[aa][i] = 0x00010001;
}
if (input_fd) {
printf("Reading in from file to antenna buffer %d\n",0);
......@@ -1905,18 +1903,12 @@ int main( int argc, char **argv )
else init_eNB(node_function);
// Sleep to allow all threads to setup
sleep(1);
sleep(3);
// *** Handle per CC_id openair0
#ifndef USRP_DEBUG
if ((UE_flag==1) && (mode!=loop_through_memory))
if (openair0.trx_start_func(&openair0) != 0 )
LOG_E(HW,"Could not start the device\n");
#endif
printf("Sending sync to all threads\n");
......
......@@ -297,14 +297,7 @@ static void *UE_thread_synch(void *arg)
#endif
pthread_mutex_lock(&sync_mutex);
printf("Locked sync_mutex, waiting (UE_sync_thread)\n");
while (sync_var<0)
pthread_cond_wait(&sync_cond, &sync_mutex);
pthread_mutex_unlock(&sync_mutex);
printf("unlocked sync_mutex (UE_sync_thread)\n");
printf("starting UE synch thread (IC %d)\n",UE->proc.instance_cnt_synch);
ind = 0;
......@@ -344,6 +337,10 @@ static void *UE_thread_synch(void *arg)
openair0_cfg[0].rx_freq[i] = downlink_frequency[0][i];
openair0_cfg[0].tx_freq[i] = downlink_frequency[0][i]+uplink_frequency_offset[0][i];
openair0_cfg[0].autocal[i] = 1;
if (uplink_frequency_offset[0][i] != 0) //
openair0_cfg[0].duplex_mode = duplex_mode_FDD;
else //FDD
openair0_cfg[0].duplex_mode = duplex_mode_TDD;
}
sync_mode = pbch;
......@@ -365,6 +362,19 @@ static void *UE_thread_synch(void *arg)
}
if (openair0.trx_start_func(&openair0) != 0 ) {
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
}
pthread_mutex_lock(&sync_mutex);
printf("Locked sync_mutex, waiting (UE_sync_thread)\n");
while (sync_var<0)
pthread_cond_wait(&sync_cond, &sync_mutex);
pthread_mutex_unlock(&sync_mutex);
printf("Started device, unlocked sync_mutex (UE_sync_thread)\n");
while (oai_exit==0) {
if (pthread_mutex_lock(&UE->proc.mutex_synch) != 0) {
......@@ -385,7 +395,7 @@ static void *UE_thread_synch(void *arg)
return &UE_thread_synch_retval;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH, 1 );
switch (sync_mode) {
case pss:
......@@ -474,11 +484,15 @@ static void *UE_thread_synch(void *arg)
break;
}
openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
//openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
//openair0.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//openair0.trx_stop_func(0);
openair0.trx_stop_func(&openair0);
sleep(1);
init_frame_parms(&UE->frame_parms,1);
if (openair0.trx_start_func(&openair0) != 0 ) {
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
}
}
else {
UE->is_synchronized = 1;
......@@ -546,7 +560,7 @@ static void *UE_thread_synch(void *arg)
openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+freq_offset;
openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+freq_offset;
openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
openair0_cfg[card].rx_gain[i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
......@@ -554,10 +568,12 @@ static void *UE_thread_synch(void *arg)
}
}
// openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
if (UE->UE_scan_carrier==1) {
for (i=0;i<openair0_cfg[0].rx_num_channels;i++)
openair0_cfg[0].autocal[i] = 1;
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
// openair0_cfg[0].autocal[i] = 1;
}
}
}// initial_sync=0
......@@ -568,9 +584,6 @@ static void *UE_thread_synch(void *arg)
break;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH, 0 );
if (pthread_mutex_lock(&UE->proc.mutex_synch) != 0) {
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE synch\n" );
......@@ -587,7 +600,7 @@ static void *UE_thread_synch(void *arg)
return &UE_thread_synch_retval;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH, 0 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH, 0 );
} // while !oai_exit
return &UE_thread_synch_retval;
......@@ -923,7 +936,11 @@ static void *UE_thread_rxn_txnp4(void *arg)
return &UE_thread_rx_retval;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0+(proc->subframe_rx&1), 1 );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_UE+(proc->subframe_rx&1), proc->subframe_rx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_UE+(proc->subframe_tx&1), proc->subframe_tx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE+(proc->subframe_rx&1), proc->frame_rx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE+(proc->subframe_tx&1), proc->frame_tx );
if ((subframe_select( &UE->frame_parms, proc->subframe_rx) == SF_DL) ||
(UE->frame_parms.frame_type == FDD) ||
......@@ -955,8 +972,8 @@ static void *UE_thread_rxn_txnp4(void *arg)
UE->UE_mode[0] = PRACH;
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RX, 0 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0+(proc->subframe_rx&1), 0 );
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RX\n" );
......@@ -1114,6 +1131,7 @@ void *UE_thread(void *arg) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void*)&dummy_rx[i][0];
for (int sf=0;sf<10;sf++) {
// printf("Reading dummy sf %d\n",sf);
rxs = openair0.trx_read_func(&openair0,
&timestamp,
rxp,
......@@ -1164,7 +1182,6 @@ void *UE_thread(void *arg) {
}// start_rx_stream==0
else {
// printf("Frame %d, rx_offset %d (diff %d, timer %d)\n",UE->proc.proc_rxtx[0].frame_rx,UE->rx_offset,rx_off_diff,rx_correction_timer);
UE->proc.proc_rxtx[0].frame_rx++;
UE->proc.proc_rxtx[1].frame_rx++;
......@@ -1172,6 +1189,7 @@ void *UE_thread(void *arg) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void*)&rxdata[i][UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0+(sf*UE->frame_parms.samples_per_tti)];
// grab signal for subframe
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
if (UE->mode != loop_through_memory) {
if (sf<9) {
rxs = openair0.trx_read_func(&openair0,
......@@ -1196,7 +1214,7 @@ void *UE_thread(void *arg) {
rx_off_diff = 0;
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
// operate on thread sf mod 2
UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[sf&1];
......@@ -1650,8 +1668,8 @@ void *UE_thread_old(void *arg)
/*!
* \brief Initialize the UE theads.
* Creates the UE threads:
* - UE_thread_tx
* - UE_thread_rx
* - UE_thread_rxtx0
* - UE_thread_rxtx1
* - UE_thread_synch
* and the locking between them.
*/
......@@ -1751,6 +1769,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
free( phy_vars_ue[CC_id]->common_vars.rxdata[i] );
rxdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
phy_vars_ue[CC_id]->common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD
printf("rxdata[%d] : %p\n",i,rxdata[i]);
}
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
......@@ -1758,6 +1777,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
free( phy_vars_ue[CC_id]->common_vars.txdata[i] );
txdata[i] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) );
phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i];
printf("txdata[%d] : %p\n",i,txdata[i]);
}
// rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.rxdata[x]
......
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Sun Mar 20 18:27:06 2016
[*] Sun Jul 17 20:46:59 2016
[*]
[dumpfile] "/tmp/openair_dump_UE.vcd"
[dumpfile_mtime] "Sun Mar 20 18:14:17 2016"
[dumpfile_size] 92262400
[savefile] "/home/papillon/openairinterface5g/targets/RT/USER/ue_usrp.gtkw"
[timestart] 30032830000
[dumpfile_mtime] "Sun Jul 17 20:46:29 2016"
[dumpfile_size] 10932224
[savefile] "/home/fourmi/openairinterface5g/targets/RT/USER/ue_usrp.gtkw"
[timestart] 11696930000
[size] 1215 640
[pos] 105 102
*-22.292629 30041590000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
......@@ -19,22 +19,25 @@ variables.hw_subframe[63:0]
@28
functions.trx_read
functions.trx_write
functions.ue_thread_synch
functions.ue_thread_rxtx0
@24
variables.subframe_number_RX_UE[63:0]
variables.subframe_number_TX_UE[63:0]
variables.subframe_RX0_UE[63:0]
variables.subframe_TX0_UE[63:0]
variables.frame_number_RX0_UE[63:0]
variables.frame_number_TX0_UE[63:0]
@28
functions.ue_thread_rx
functions.ue_thread_tx
@420
variables.ue_inst_cnt_rx[63:0]
variables.ue_inst_cnt_tx[63:0]
functions.ue_thread_rxtx1
@24
variables.subframe_RX1_UE[63:0]
variables.subframe_TX1_UE[63:0]
@25
variables.frame_number_RX1_UE[63:0]
@24
variables.frame_number_TX1_UE[63:0]
@28
functions.phy_procedures_ue_rx
functions.phy_procedures_ue_tx
@24
variables.frame_number_RX_UE[63:0]
variables.frame_number_TX_UE[63:0]
@28
functions.ue_slot_fep
functions.lte_ue_measurement_procedures
functions.ue_rrc_measurements
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment