rebase from 2017.w25
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
typedef struct threads_s {
|
||||
int iq;
|
||||
int odd;
|
||||
int even;
|
||||
int one;
|
||||
int two;
|
||||
int three;
|
||||
} threads_t;
|
||||
|
||||
#endif /* _THREADS_T_H_ */
|
||||
|
||||
@@ -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,11 +147,11 @@ 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_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.1.1/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ void proc_tx_high0(PHY_VARS_eNB *eNB,
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB+offset, proc->frame_tx );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB+offset, proc->subframe_tx );
|
||||
|
||||
phy_procedures_eNB_TX(eNB,proc,r_type,rn,1);
|
||||
phy_procedures_eNB_TX(eNB,proc,r_type,rn,1,1);
|
||||
|
||||
/* we're done, let the next one proceed */
|
||||
if (pthread_mutex_lock(&sync_phy_proc.mutex_phy_proc_tx) != 0) {
|
||||
|
||||
@@ -222,7 +222,7 @@ double cpuf;
|
||||
char uecap_xer[1024],uecap_xer_in=0;
|
||||
|
||||
int oaisim_flag=0;
|
||||
threads_t threads= {-1,-1,-1};
|
||||
threads_t threads= {-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
|
||||
@@ -637,8 +637,9 @@ static void get_options (int argc, char **argv) {
|
||||
LONG_OPTION_WAIT_FOR_SYNC,
|
||||
LONG_OPTION_SINGLE_THREAD_DISABLE,
|
||||
LONG_OPTION_THREADIQ,
|
||||
LONG_OPTION_THREADODDSUBFRAME,
|
||||
LONG_OPTION_THREADEVENSUBFRAME,
|
||||
LONG_OPTION_THREADONESUBFRAME,
|
||||
LONG_OPTION_THREADTWOSUBFRAME,
|
||||
LONG_OPTION_THREADTHREESUBFRAME,
|
||||
LONG_OPTION_DEMOD_SHIFT,
|
||||
#if T_TRACER
|
||||
LONG_OPTION_T_PORT,
|
||||
@@ -673,8 +674,9 @@ static void get_options (int argc, char **argv) {
|
||||
{"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},
|
||||
{"threadOneSubframe", required_argument, NULL, LONG_OPTION_THREADONESUBFRAME},
|
||||
{"threadTwoSubframe", required_argument, NULL, LONG_OPTION_THREADTWOSUBFRAME},
|
||||
{"threadThreeSubframe", required_argument, NULL, LONG_OPTION_THREADTHREESUBFRAME},
|
||||
{"dlsch-demod-shift", required_argument, NULL, LONG_OPTION_DEMOD_SHIFT},
|
||||
#if T_TRACER
|
||||
{"T_port", required_argument, 0, LONG_OPTION_T_PORT},
|
||||
@@ -800,12 +802,15 @@ static void get_options (int argc, char **argv) {
|
||||
case LONG_OPTION_THREADIQ:
|
||||
threads.iq=atoi(optarg);
|
||||
break;
|
||||
case LONG_OPTION_THREADODDSUBFRAME:
|
||||
threads.odd=atoi(optarg);
|
||||
case LONG_OPTION_THREADONESUBFRAME:
|
||||
threads.one=atoi(optarg);
|
||||
break;
|
||||
case LONG_OPTION_THREADEVENSUBFRAME:
|
||||
threads.even=atoi(optarg);
|
||||
case LONG_OPTION_THREADTWOSUBFRAME:
|
||||
threads.two=atoi(optarg);
|
||||
break;
|
||||
case LONG_OPTION_THREADTHREESUBFRAME:
|
||||
threads.three=atoi(optarg);
|
||||
break;
|
||||
case LONG_OPTION_DEMOD_SHIFT: {
|
||||
extern int16_t dlsch_demod_shift;
|
||||
dlsch_demod_shift = atof(optarg);
|
||||
|
||||
+28
-13
@@ -498,10 +498,13 @@ 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(1, &cpuset);
|
||||
if ( (proc->sub_frame_start+1)%2 == 1 && threads.odd != -1 )
|
||||
CPU_SET(2, &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);
|
||||
|
||||
@@ -546,7 +549,7 @@ 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 );
|
||||
phy_procedures_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
@@ -635,6 +638,7 @@ void *UE_thread(void *arg) {
|
||||
int start_rx_stream = 0;
|
||||
int i;
|
||||
char threadname[128];
|
||||
int th_id;
|
||||
|
||||
cpu_set_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
@@ -716,8 +720,11 @@ 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->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 ==
|
||||
@@ -734,7 +741,7 @@ 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[sub_frame%RX_NB_TH];
|
||||
|
||||
if (UE->mode != loop_through_memory) {
|
||||
for (i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
@@ -801,11 +808,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);
|
||||
@@ -1123,16 +1136,18 @@ void init_UE_threads(PHY_VARS_UE *UE) {
|
||||
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
|
||||
|
||||
@@ -163,7 +163,7 @@ PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
|
||||
for (j=0; j<2; j++) { // 2CWs
|
||||
for (int l=0; l<2; l++){ // 2Threads
|
||||
for (int l=0; l<RX_NB_TH_MAX; l++){ // 2Threads
|
||||
PHY_vars_UE->dlsch[l][i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
|
||||
|
||||
if (!PHY_vars_UE->dlsch[l][i][j]) {
|
||||
|
||||
Reference in New Issue
Block a user