Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony
Conflicts: openair1/SCHED/phy_procedures_lte_ue.c targets/RT/USER/lte-softmodem.c targets/RT/USER/lte-ue.c
This commit is contained in:
+40
-17
@@ -69,6 +69,7 @@
|
||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
#include "PHY/LTE_TRANSPORT/if4_tools.h"
|
||||
#include "PHY/LTE_TRANSPORT/if5_mobipass_tools.h"
|
||||
|
||||
#include "PHY/extern.h"
|
||||
#include "SCHED/extern.h"
|
||||
@@ -297,7 +298,10 @@ static void* eNB_thread_rxtx( void* param ) {
|
||||
FILE *tx_time_file = NULL;
|
||||
char tx_time_name[101];
|
||||
void *txp[PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx];
|
||||
|
||||
|
||||
uint16_t packet_type;
|
||||
uint32_t symbol_number=0;
|
||||
|
||||
if (opp_enabled == 1) {
|
||||
snprintf(tx_time_name, 100,"/tmp/%s_tx_time_thread_sf", "eNB");
|
||||
tx_time_file = fopen(tx_time_name,"w");
|
||||
@@ -488,19 +492,23 @@ static void* eNB_thread_rxtx( void* param ) {
|
||||
} else {
|
||||
|
||||
/// **** recv_IF4 of txdataF from RCC **** ///
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 );
|
||||
//recv_IF4(PHY_vars_eNB_g[0][proc->CC_id], proc->frame_tx, proc->subframe_tx, packet_type, symbol_number);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 );
|
||||
while (symbol_number < PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.symbols_per_tti-1) {
|
||||
recv_IF4(PHY_vars_eNB_g[0][proc->CC_id], &proc->frame_tx, &proc->subframe_tx, &packet_type, &symbol_number);
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 0 );
|
||||
|
||||
// Check the recv frame/subframe
|
||||
}
|
||||
}
|
||||
|
||||
// eNodeB_3GPP and RRU create txdata and write to RF device
|
||||
// eNodeB_3GPP, _BBU and RRU create txdata
|
||||
if (PHY_vars_eNB_g[0][proc->CC_id]->node_function != NGFI_RCC_IF4) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN , 1 );
|
||||
do_OFDM_mod_rt( proc->subframe_tx, PHY_vars_eNB_g[0][proc->CC_id] );
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN , 0 );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
short *txdata = (short*)&PHY_vars_eNB_g[0][proc->CC_id]->common_vars.txdata[0][0][proc->subframe_tx*PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.samples_per_tti];
|
||||
int i;
|
||||
@@ -513,8 +521,12 @@ static void* eNB_thread_rxtx( void* param ) {
|
||||
txdata[i+5] = 0;
|
||||
txdata[i+6] = 0;
|
||||
txdata[i+7] = -2047; }
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
// eNodeB_3GPP, RRU write to RF device
|
||||
if (PHY_vars_eNB_g[0][proc->CC_id]->node_function == eNodeB_3GPP ||
|
||||
PHY_vars_eNB_g[0][proc->CC_id]->node_function == NGFI_RRU_IF4) {
|
||||
// Transmit TX buffer based on timestamp from RX
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
|
||||
// prepare tx buffer pointers
|
||||
@@ -534,13 +546,15 @@ static void* eNB_thread_rxtx( void* param ) {
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-openair0_cfg[0].tx_sample_advance)&0xffffffff );
|
||||
|
||||
} else if (PHY_vars_eNB_g[0][proc->CC_id]->node_function == eNodeB_3GPP_BBU) {
|
||||
/// **** trx_write_func to IF device **** ///
|
||||
// send_IF5(PHY_vars_eNB_g[0][proc->CC_id], proc, 0);
|
||||
|
||||
} else {
|
||||
|
||||
/// **** send_IF4 of txdataF to RRU **** ///
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 );
|
||||
send_IF4(PHY_vars_eNB_g[0][proc->CC_id], proc->frame_tx, proc->subframe_tx, IF4_PDLFFT, 0);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 0 );
|
||||
|
||||
}
|
||||
|
||||
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
|
||||
@@ -611,10 +625,11 @@ static void* eNB_thread_rx_common( void* param ) {
|
||||
eNB_proc_t *proc = (eNB_proc_t*)param;
|
||||
PHY_VARS_eNB *eNB = PHY_vars_eNB_g[0][proc->CC_id];
|
||||
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
|
||||
|
||||
|
||||
uint8_t seqno=0;
|
||||
FILE *rx_time_file = NULL;
|
||||
char rx_time_name[101];
|
||||
//int i;
|
||||
int i;
|
||||
struct timespec wait;
|
||||
|
||||
wait.tv_sec=0;
|
||||
@@ -737,19 +752,27 @@ static void* eNB_thread_rx_common( void* param ) {
|
||||
#if defined(ENABLE_ITTI)
|
||||
wait_system_ready ("Waiting for eNB application to be ready %s\r", &start_eNB);
|
||||
#endif
|
||||
|
||||
// Start RF device for this CC
|
||||
if (eNB->node_function != NGFI_RCC_IF4) {
|
||||
if (eNB->rfdevice.trx_start_func(&eNB->rfdevice) != 0 )
|
||||
LOG_E(HW,"Could not start the RF device\n");
|
||||
}
|
||||
|
||||
|
||||
// Start IF device for this CC
|
||||
if (eNB->node_function != eNodeB_3GPP) {
|
||||
if (eNB->ifdevice.trx_start_func(&eNB->ifdevice) != 0 )
|
||||
LOG_E(HW,"Could not start the IF device\n");
|
||||
}
|
||||
|
||||
// Start RF device for this CC
|
||||
if (eNB->node_function == eNodeB_3GPP || eNB->node_function == NGFI_RRU_IF4) {
|
||||
if (eNB->rfdevice.trx_start_func(&eNB->rfdevice) != 0 )
|
||||
LOG_E(HW,"Could not start the RF device\n");
|
||||
}
|
||||
|
||||
// proc->proc_rxtx[0].timestamp_tx = 0;
|
||||
// seqno = send_IF5(eNB, &proc->proc_rxtx[0], 0);
|
||||
|
||||
// for (i=0; i<1000;i++) {
|
||||
// seqno = send_IF5(eNB, &proc->proc_rxtx[0], seqno);
|
||||
// proc->proc_rxtx[0].timestamp_tx += 7680*2;
|
||||
// }
|
||||
|
||||
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
|
||||
while (!oai_exit) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RX, 0 );
|
||||
|
||||
+102
-97
@@ -299,35 +299,35 @@ struct timespec max_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
|
||||
|
||||
struct timespec clock_difftime(struct timespec start, struct timespec end)
|
||||
{
|
||||
struct timespec temp;
|
||||
if ((end.tv_nsec-start.tv_nsec)<0) {
|
||||
temp.tv_sec = end.tv_sec-start.tv_sec-1;
|
||||
temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
|
||||
} else {
|
||||
temp.tv_sec = end.tv_sec-start.tv_sec;
|
||||
temp.tv_nsec = end.tv_nsec-start.tv_nsec;
|
||||
}
|
||||
return temp;
|
||||
struct timespec temp;
|
||||
if ((end.tv_nsec-start.tv_nsec)<0) {
|
||||
temp.tv_sec = end.tv_sec-start.tv_sec-1;
|
||||
temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
|
||||
} else {
|
||||
temp.tv_sec = end.tv_sec-start.tv_sec;
|
||||
temp.tv_nsec = end.tv_nsec-start.tv_nsec;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
void print_difftimes(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
|
||||
printf("difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
|
||||
#else
|
||||
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
|
||||
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
|
||||
#endif
|
||||
}
|
||||
|
||||
void update_difftimes(struct timespec start, struct timespec end)
|
||||
{
|
||||
struct timespec diff_time = { .tv_sec = 0, .tv_nsec = 0 };
|
||||
int changed = 0;
|
||||
diff_time = clock_difftime(start, end);
|
||||
if ((min_diff_time.tv_nsec == 0) || (diff_time.tv_nsec < min_diff_time.tv_nsec)) { min_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; }
|
||||
if ((max_diff_time.tv_nsec == 0) || (diff_time.tv_nsec > max_diff_time.tv_nsec)) { max_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; }
|
||||
struct timespec diff_time = { .tv_sec = 0, .tv_nsec = 0 };
|
||||
int changed = 0;
|
||||
diff_time = clock_difftime(start, end);
|
||||
if ((min_diff_time.tv_nsec == 0) || (diff_time.tv_nsec < min_diff_time.tv_nsec)) { min_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; }
|
||||
if ((max_diff_time.tv_nsec == 0) || (diff_time.tv_nsec > max_diff_time.tv_nsec)) { max_diff_time.tv_nsec = diff_time.tv_nsec; changed = 1; }
|
||||
#if 1
|
||||
if (changed) print_difftimes();
|
||||
if (changed) print_difftimes();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ static void *scope_thread(void *arg)
|
||||
|
||||
while (!oai_exit) {
|
||||
if (UE_flag==1) {
|
||||
len = dump_ue_stats (PHY_vars_UE_g[0][0], stats_buffer, 0, mode,rx_input_level_dBm);
|
||||
len = dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
|
||||
//fl_set_object_label(form_stats->stats_text, stats_buffer);
|
||||
fl_clear_browser(form_stats->stats_text);
|
||||
fl_add_browser_line(form_stats->stats_text, stats_buffer);
|
||||
@@ -686,7 +686,8 @@ static void get_options (int argc, char **argv)
|
||||
LONG_OPTION_PHYTEST,
|
||||
LONG_OPTION_RCC,
|
||||
LONG_OPTION_RRU,
|
||||
LONG_OPTION_ENB
|
||||
LONG_OPTION_ENB,
|
||||
LONG_OPTION_ENB_BBU
|
||||
#if T_TRACER
|
||||
,
|
||||
LONG_OPTION_T_PORT,
|
||||
@@ -713,6 +714,7 @@ static void get_options (int argc, char **argv)
|
||||
{"RCC", no_argument, NULL, LONG_OPTION_RCC},
|
||||
{"RRU", no_argument, NULL, LONG_OPTION_RRU},
|
||||
{"eNB", no_argument, NULL, LONG_OPTION_ENB},
|
||||
{"BBU", no_argument, NULL, LONG_OPTION_ENB_BBU},
|
||||
#if T_TRACER
|
||||
{"T_port", required_argument, 0, LONG_OPTION_T_PORT},
|
||||
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
|
||||
@@ -729,8 +731,8 @@ static void get_options (int argc, char **argv)
|
||||
else if (strlen(optarg)<=1024){
|
||||
strcpy(rf_config_file,optarg);
|
||||
}else {
|
||||
printf("Configuration filename is too long\n");
|
||||
exit(-1);
|
||||
printf("Configuration filename is too long\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case LONG_OPTION_MAXPOWER:
|
||||
@@ -815,6 +817,10 @@ static void get_options (int argc, char **argv)
|
||||
case LONG_OPTION_ENB:
|
||||
node_function = eNodeB_3GPP;
|
||||
break;
|
||||
|
||||
case LONG_OPTION_ENB_BBU:
|
||||
node_function = eNodeB_3GPP_BBU;
|
||||
break;
|
||||
|
||||
#if T_TRACER
|
||||
case LONG_OPTION_T_PORT: {
|
||||
@@ -894,14 +900,14 @@ static void get_options (int argc, char **argv)
|
||||
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
|
||||
printf("Enabling OPT for wireshark for local interface");
|
||||
/*
|
||||
if (optarg == NULL){
|
||||
in_ip[0] =NULL;
|
||||
printf("Enabling OPT for wireshark for local interface");
|
||||
} else {
|
||||
strncpy(in_ip, optarg, sizeof(in_ip));
|
||||
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
|
||||
printf("Enabling OPT for wireshark with %s \n",in_ip);
|
||||
}
|
||||
if (optarg == NULL){
|
||||
in_ip[0] =NULL;
|
||||
printf("Enabling OPT for wireshark for local interface");
|
||||
} else {
|
||||
strncpy(in_ip, optarg, sizeof(in_ip));
|
||||
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
|
||||
printf("Enabling OPT for wireshark with %s \n",in_ip);
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
@@ -1065,6 +1071,8 @@ static void get_options (int argc, char **argv)
|
||||
(eth_params+j)->transp_preference = ETH_RAW_IF4_MODE;
|
||||
} else if (enb_properties->properties[i]->rrh_gw_config[j].udpif4 == 1) {
|
||||
(eth_params+j)->transp_preference = ETH_UDP_IF4_MODE;
|
||||
} else if (enb_properties->properties[i]->rrh_gw_config[j].rawif5_mobipass == 1) {
|
||||
(eth_params+j)->transp_preference = ETH_RAW_IF5_MOBIPASS;
|
||||
} else {
|
||||
(eth_params+j)->transp_preference = ETH_UDP_MODE;
|
||||
}
|
||||
@@ -1541,13 +1549,6 @@ int main( int argc, char **argv )
|
||||
openair0_cfg[card].my_port = eth_params->my_port;
|
||||
}
|
||||
|
||||
//if (node_function == NGFI_RCC_IF4 || node_function == NGFI_RRU_IF4) {
|
||||
//openair0_cfg[card].remote_addr = eth_params->remote_addr;
|
||||
//openair0_cfg[card].remote_port = eth_params->remote_port;
|
||||
//openair0_cfg[card].my_addr = eth_params->my_addr;
|
||||
//openair0_cfg[card].my_port = eth_params->my_port;
|
||||
//}
|
||||
|
||||
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
|
||||
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx),
|
||||
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
|
||||
@@ -1611,37 +1612,37 @@ int main( int argc, char **argv )
|
||||
int s;
|
||||
char cpu_affinity[1024];
|
||||
CPU_ZERO(&cpuset);
|
||||
#ifdef CPU_AFFINITY
|
||||
#ifdef CPU_AFFINITY
|
||||
if (get_nprocs() > 2)
|
||||
{
|
||||
CPU_SET(0, &cpuset);
|
||||
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0)
|
||||
{
|
||||
perror( "pthread_setaffinity_np");
|
||||
exit_fun("Error setting processor affinity");
|
||||
CPU_SET(0, &cpuset);
|
||||
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0)
|
||||
{
|
||||
perror( "pthread_setaffinity_np");
|
||||
exit_fun("Error setting processor affinity");
|
||||
}
|
||||
LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n");
|
||||
}
|
||||
LOG_I(HW, "Setting the affinity of main function to CPU 0, for device library to use CPU 0 only!\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Check the actual affinity mask assigned to the thread */
|
||||
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0)
|
||||
{
|
||||
perror( "pthread_getaffinity_np");
|
||||
exit_fun("Error getting processor affinity ");
|
||||
}
|
||||
{
|
||||
perror( "pthread_getaffinity_np");
|
||||
exit_fun("Error getting processor affinity ");
|
||||
}
|
||||
memset(cpu_affinity, 0 , sizeof(cpu_affinity));
|
||||
for (int j = 0; j < CPU_SETSIZE; j++)
|
||||
{
|
||||
if (CPU_ISSET(j, &cpuset))
|
||||
{
|
||||
char temp[1024];
|
||||
sprintf(temp, " CPU_%d ", j);
|
||||
strcat(cpu_affinity, temp);
|
||||
{
|
||||
if (CPU_ISSET(j, &cpuset))
|
||||
{
|
||||
char temp[1024];
|
||||
sprintf(temp, " CPU_%d ", j);
|
||||
strcat(cpu_affinity, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity);
|
||||
#endif
|
||||
|
||||
@@ -1649,68 +1650,71 @@ int main( int argc, char **argv )
|
||||
|
||||
if (UE_flag == 0) {
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = BBU_HOST;
|
||||
if (node_function == NGFI_RRU_IF4) {
|
||||
PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = RRH_HOST;
|
||||
PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = RRH_HOST;
|
||||
} else {
|
||||
PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = BBU_HOST;
|
||||
PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = BBU_HOST;
|
||||
}
|
||||
|
||||
PHY_vars_eNB_g[0][CC_id]->rfdevice.type = NONE_DEV;
|
||||
PHY_vars_eNB_g[0][CC_id]->rfdevice.transp_type = NONE_TP;
|
||||
|
||||
PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = BBU_HOST;
|
||||
PHY_vars_eNB_g[0][CC_id]->ifdevice.type = NONE_DEV;
|
||||
PHY_vars_eNB_g[0][CC_id]->ifdevice.transp_type = NONE_TP;
|
||||
}
|
||||
}
|
||||
|
||||
/* device host type is set*/
|
||||
openair0.host_type = BBU_HOST;
|
||||
/* device type is initialized NONE_DEV (no RF device) when the RF device will be initiated device type will be set */
|
||||
openair0.type = NONE_DEV;
|
||||
/* transport type is initialized NONE_TP (no transport protocol) when the transport protocol will be initiated transport protocol type will be set */
|
||||
openair0.transp_type = NONE_TP;
|
||||
//openair0_cfg[0].log_level = glog_level;
|
||||
|
||||
// Legacy BBU - RRH init
|
||||
//int returns=-1;
|
||||
///* BBU can have either a local or a remote radio head */
|
||||
//if (local_remote_radio == BBU_LOCAL_RADIO_HEAD) { //local radio head active - load library of radio head and initiate it
|
||||
//if (mode!=loop_through_memory) {
|
||||
//returns=openair0_device_load(&openair0, &openair0_cfg[0]);
|
||||
//printf("openair0_device_init returns %d\n",returns);
|
||||
//if (returns<0) {
|
||||
//printf("Exiting, cannot initialize device\n");
|
||||
//exit(-1);
|
||||
//}
|
||||
//}
|
||||
//else if (mode==loop_through_memory) {
|
||||
//}
|
||||
//if (mode!=loop_through_memory) {
|
||||
//returns=openair0_device_load(&openair0, &openair0_cfg[0]);
|
||||
//printf("openair0_device_init returns %d\n",returns);
|
||||
//if (returns<0) {
|
||||
//printf("Exiting, cannot initialize device\n");
|
||||
//exit(-1);
|
||||
//}
|
||||
//}
|
||||
//else if (mode==loop_through_memory) {
|
||||
//}
|
||||
//} else { //remote radio head active - load library of transport protocol and initiate it
|
||||
//if (mode!=loop_through_memory) {
|
||||
//returns=openair0_transport_load(&openair0, &openair0_cfg[0], eth_params);
|
||||
//printf("openair0_transport_init returns %d\n",returns);
|
||||
//if (returns<0) {
|
||||
//printf("Exiting, cannot initialize transport protocol\n");
|
||||
//exit(-1);
|
||||
//}
|
||||
//}
|
||||
//else if (mode==loop_through_memory) {
|
||||
//}
|
||||
//if (mode!=loop_through_memory) {
|
||||
//returns=openair0_transport_load(&openair0, &openair0_cfg[0], eth_params);
|
||||
//printf("openair0_transport_init returns %d\n",returns);
|
||||
//if (returns<0) {
|
||||
//printf("Exiting, cannot initialize transport protocol\n");
|
||||
//exit(-1);
|
||||
//}
|
||||
//}
|
||||
//else if (mode==loop_through_memory) {
|
||||
//}
|
||||
//}
|
||||
|
||||
//printf("Done\n");
|
||||
|
||||
|
||||
int returns=-1;
|
||||
|
||||
// Handle spatially distributed MIMO antenna ports
|
||||
// Load RF device and initialize
|
||||
if ((UE_flag==1) || (node_function != NGFI_RCC_IF4)) {
|
||||
|
||||
if (node_function == NGFI_RRU_IF4 || node_function == eNodeB_3GPP) {
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
if (mode!=loop_through_memory) {
|
||||
returns= (UE_flag == 0) ?
|
||||
openair0_device_load(&(PHY_vars_eNB_g[0][CC_id]->rfdevice), &openair0_cfg[0]) :
|
||||
openair0_device_load(&openair0, &openair0_cfg[0]);
|
||||
openair0_device_load(&openair0, &openair0_cfg[0]);
|
||||
|
||||
printf("openair0_device_init returns %d for CC_id %d\n",returns,CC_id);
|
||||
if (returns<0) {
|
||||
printf("Exiting, cannot initialize device\n");
|
||||
exit(-1);
|
||||
printf("Exiting, cannot initialize device\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
else if (mode==loop_through_memory) {
|
||||
@@ -1719,14 +1723,15 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
// Load transport protocol and initialize
|
||||
|
||||
if ((UE_flag==0) && (node_function != eNodeB_3GPP)){
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
if (mode!=loop_through_memory) {
|
||||
returns=openair0_transport_load(&(PHY_vars_eNB_g[0][CC_id]->ifdevice), &openair0_cfg[0], (eth_params+CC_id));
|
||||
printf("openair0_transport_init returns %d for CC_id %d\n",returns,CC_id);
|
||||
if (returns<0) {
|
||||
printf("Exiting, cannot initialize transport protocol\n");
|
||||
exit(-1);
|
||||
printf("Exiting, cannot initialize transport protocol\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
else if (mode==loop_through_memory) {
|
||||
@@ -1858,8 +1863,8 @@ int main( int argc, char **argv )
|
||||
fl_set_button(form_enb[CC_id][UE_id]->button_0,0);
|
||||
fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // CC_id
|
||||
} // UE_id
|
||||
} else {
|
||||
form_stats = create_form_stats_form();
|
||||
fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
|
||||
@@ -1869,15 +1874,15 @@ int main( int argc, char **argv )
|
||||
fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
|
||||
/*
|
||||
if (openair_daq_vars.use_ia_receiver) {
|
||||
if (openair_daq_vars.use_ia_receiver) {
|
||||
fl_set_button(form_ue[UE_id]->button_0,1);
|
||||
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
|
||||
} else {
|
||||
} else {
|
||||
fl_set_button(form_ue[UE_id]->button_0,0);
|
||||
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
|
||||
}*/
|
||||
fl_set_button(form_ue[UE_id]->button_0,0);
|
||||
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
|
||||
fl_set_button(form_ue[UE_id]->button_0,0);
|
||||
fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
|
||||
}
|
||||
|
||||
ret = pthread_create(&forms_thread, NULL, scope_thread, NULL);
|
||||
@@ -1904,7 +1909,7 @@ int main( int argc, char **argv )
|
||||
|
||||
|
||||
|
||||
// *** Handle per CC_id openair0
|
||||
// *** Handle per CC_id openair0
|
||||
#ifndef USRP_DEBUG
|
||||
if ((UE_flag==1) && (mode!=loop_through_memory))
|
||||
if (openair0.trx_start_func(&openair0) != 0 )
|
||||
|
||||
+169
-36
@@ -306,7 +306,7 @@ static void *UE_thread_synch(void *arg)
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
printf("unlocked sync_mutex (UE_sync_thread)\n");
|
||||
|
||||
printf("starting UE synch thread (IC %d)\n",UE->instance_cnt_synch);
|
||||
printf("starting UE synch thread (IC %d)\n",UE->proc.instance_cnt_synch);
|
||||
ind = 0;
|
||||
found = 0;
|
||||
|
||||
@@ -367,19 +367,19 @@ static void *UE_thread_synch(void *arg)
|
||||
|
||||
while (oai_exit==0) {
|
||||
|
||||
if (pthread_mutex_lock(&UE->mutex_synch) != 0) {
|
||||
if (pthread_mutex_lock(&UE->proc.mutex_synch) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE initial synch thread\n" );
|
||||
exit_fun("noting to add");
|
||||
return &UE_thread_synch_retval;
|
||||
}
|
||||
|
||||
|
||||
while (UE->instance_cnt_synch < 0) {
|
||||
while (UE->proc.instance_cnt_synch < 0) {
|
||||
// the thread waits here most of the time
|
||||
pthread_cond_wait( &UE->cond_synch, &UE->mutex_synch );
|
||||
pthread_cond_wait( &UE->proc.cond_synch, &UE->proc.mutex_synch );
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(&UE->mutex_synch) != 0) {
|
||||
if (pthread_mutex_unlock(&UE->proc.mutex_synch) != 0) {
|
||||
LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for UE Initial Synch thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_synch_retval;
|
||||
@@ -485,7 +485,7 @@ static void *UE_thread_synch(void *arg)
|
||||
|
||||
if( UE->mode == rx_dump_frame ){
|
||||
FILE *fd;
|
||||
if ((UE->frame_rx&1) == 0) { // this guarantees SIB1 is present
|
||||
if ((UE->proc.proc_rxtx[0].frame_rx&1) == 0) { // this guarantees SIB1 is present
|
||||
if ((fd = fopen("rxsig_frame0.dat","w")) != NULL) {
|
||||
fwrite((void*)&UE->common_vars.rxdata[0][0],
|
||||
sizeof(int32_t),
|
||||
@@ -504,11 +504,6 @@ static void *UE_thread_synch(void *arg)
|
||||
UE->is_synchronized = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
UE->slot_rx = 0;
|
||||
UE->slot_tx = 4;
|
||||
}
|
||||
} else {
|
||||
// initial sync failed
|
||||
@@ -577,16 +572,16 @@ static void *UE_thread_synch(void *arg)
|
||||
|
||||
|
||||
|
||||
if (pthread_mutex_lock(&UE->mutex_synch) != 0) {
|
||||
if (pthread_mutex_lock(&UE->proc.mutex_synch) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE synch\n" );
|
||||
exit_fun("noting to add");
|
||||
return &UE_thread_synch_retval;
|
||||
}
|
||||
|
||||
// indicate readiness
|
||||
UE->instance_cnt_synch--;
|
||||
UE->proc.instance_cnt_synch--;
|
||||
|
||||
if (pthread_mutex_unlock(&UE->mutex_synch) != 0) {
|
||||
if (pthread_mutex_unlock(&UE->proc.mutex_synch) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE synch\n" );
|
||||
exit_fun("noting to add");
|
||||
return &UE_thread_synch_retval;
|
||||
@@ -798,7 +793,6 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
{
|
||||
static int UE_thread_rx_retval;
|
||||
UE_rxtx_proc_t *proc = (UE_rxtx_proc_t *)arg;
|
||||
int i;
|
||||
int ret;
|
||||
PHY_VARS_UE *UE=PHY_vars_UE_g[0][proc->CC_id];
|
||||
proc->instance_cnt_rxtx=-1;
|
||||
@@ -934,11 +928,12 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
if ((subframe_select( &UE->frame_parms, proc->subframe_rx) == SF_DL) ||
|
||||
(UE->frame_parms.frame_type == FDD) ||
|
||||
(subframe_select( &UE->frame_parms, proc->subframe_rx ) == SF_S)) {
|
||||
phy_procedures_UE_RX( UE, 0, 0, UE->mode, no_relay, NULL );
|
||||
|
||||
phy_procedures_UE_RX( UE, proc, 0, 0, UE->mode, no_relay, NULL );
|
||||
}
|
||||
|
||||
|
||||
if ((UE->mac_enabled==1) && (i==0)) {
|
||||
if (UE->mac_enabled==1) {
|
||||
|
||||
ret = mac_xface->ue_scheduler(UE->Mod_id,
|
||||
proc->frame_tx,
|
||||
proc->subframe_rx,
|
||||
@@ -1007,14 +1002,18 @@ void *UE_thread(void *arg) {
|
||||
PHY_VARS_UE *UE = PHY_vars_UE_g[0][0];
|
||||
// int tx_enabled = 0;
|
||||
unsigned int rxs;
|
||||
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti];
|
||||
openair0_timestamp timestamp;
|
||||
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32)));
|
||||
openair0_timestamp timestamp,timestamp1;
|
||||
void* rxp[2];
|
||||
|
||||
#ifdef NAS_UE
|
||||
MessageDef *message_p;
|
||||
#endif
|
||||
|
||||
int start_rx_stream = 0;
|
||||
int rx_off_diff = 0;
|
||||
int rx_correction_timer = 0;
|
||||
|
||||
#ifdef DEADLINE_SCHEDULER
|
||||
|
||||
struct sched_attr attr;
|
||||
@@ -1069,15 +1068,15 @@ void *UE_thread(void *arg) {
|
||||
|
||||
if (UE->is_synchronized == 0) {
|
||||
|
||||
if (pthread_mutex_lock(&UE->mutex_synch) != 0) {
|
||||
if (pthread_mutex_lock(&UE->proc.mutex_synch) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] verror locking mutex for UE initial synch thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
|
||||
int instance_cnt_synch = UE->instance_cnt_synch;
|
||||
int instance_cnt_synch = UE->proc.instance_cnt_synch;
|
||||
|
||||
if (pthread_mutex_unlock(&UE->mutex_synch) != 0) {
|
||||
if (pthread_mutex_unlock(&UE->proc.mutex_synch) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE initial synch thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_retval;
|
||||
@@ -1095,9 +1094,9 @@ void *UE_thread(void *arg) {
|
||||
UE->frame_parms.samples_per_tti*10,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
instance_cnt_synch = ++UE->instance_cnt_synch;
|
||||
instance_cnt_synch = ++UE->proc.instance_cnt_synch;
|
||||
if (instance_cnt_synch == 0) {
|
||||
if (pthread_cond_signal(&UE->cond_synch) != 0) {
|
||||
if (pthread_cond_signal(&UE->proc.cond_synch) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] ERROR pthread_cond_signal for UE sync thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_retval;
|
||||
@@ -1114,19 +1113,153 @@ void *UE_thread(void *arg) {
|
||||
if (UE->mode != loop_through_memory) {
|
||||
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++)
|
||||
for (int sf=0;sf<10;sf++) {
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // UE->is_synchronized==1
|
||||
} // UE->is_synchronized==0
|
||||
else {
|
||||
exit(-1);
|
||||
}
|
||||
if (start_rx_stream==0) {
|
||||
start_rx_stream=1;
|
||||
if (UE->mode != loop_through_memory) {
|
||||
LOG_I(PHY,"Resynchronizing RX by %d samples\n",UE->rx_offset);
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
(void**)rxdata,
|
||||
UE->rx_offset,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
if (rxs != UE->rx_offset) {
|
||||
exit_fun("problem in rx");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
UE->rx_offset=0;
|
||||
UE->proc.proc_rxtx[0].frame_rx++;
|
||||
UE->proc.proc_rxtx[1].frame_rx++;
|
||||
|
||||
// read in first symbol
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
(void**)rxdata,
|
||||
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
slot_fep(UE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (rxs != UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0) {
|
||||
exit_fun("problem in rx");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
} //UE->mode != loop_through_memory
|
||||
else
|
||||
rt_sleep_ns(1000000);
|
||||
|
||||
}// 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++;
|
||||
|
||||
for (int sf=0;sf<10;sf++) {
|
||||
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
|
||||
if (UE->mode != loop_through_memory) {
|
||||
if (sf<9) {
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
|
||||
else {
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
// read in first symbol of next frame and adjust for timing drift
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp1,
|
||||
(void**)rxdata,
|
||||
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 - rx_off_diff,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
rx_off_diff = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// operate on thread sf mod 2
|
||||
UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[sf&1];
|
||||
|
||||
// lock mutex
|
||||
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RX\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
// increment instance count and change proc subframe/frame variables
|
||||
int instance_cnt_rxtx = ++proc->instance_cnt_rxtx;
|
||||
proc->subframe_rx=sf;
|
||||
proc->subframe_tx=(sf+4)%10;
|
||||
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5)?1:0;
|
||||
proc->timestamp_tx = timestamp+(4*UE->frame_parms.samples_per_tti)-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
|
||||
|
||||
|
||||
if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RX\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
|
||||
|
||||
if (instance_cnt_rxtx == 0) {
|
||||
if (pthread_cond_signal(&proc->cond_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] ERROR pthread_cond_signal for UE RX thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
} else {
|
||||
LOG_E( PHY, "[SCHED][UE] UE RX thread busy (IC %d)!!\n", instance_cnt_rxtx);
|
||||
if (instance_cnt_rxtx > 2) {
|
||||
sleep(1);
|
||||
exit_fun("instance_cnt_rxtx > 2");
|
||||
return &UE_thread_retval;
|
||||
}
|
||||
}
|
||||
if (UE->mode == loop_through_memory) {
|
||||
printf("Processing subframe %d",proc->subframe_rx);
|
||||
getchar();
|
||||
}
|
||||
}// for sf=0..10
|
||||
if ((UE->rx_offset<(5*UE->frame_parms.samples_per_tti)) &&
|
||||
(UE->rx_offset > RX_OFF_MIN) &&
|
||||
(rx_correction_timer == 0)) {
|
||||
rx_off_diff = -UE->rx_offset + RX_OFF_MIN;
|
||||
LOG_D(PHY,"UE->rx_offset %d > %d, diff %d\n",UE->rx_offset,RX_OFF_MIN,rx_off_diff);
|
||||
rx_correction_timer = 5;
|
||||
} else if ((UE->rx_offset>(5*UE->frame_parms.samples_per_tti)) &&
|
||||
(UE->rx_offset < ((10*UE->frame_parms.samples_per_tti)-RX_OFF_MIN)) &&
|
||||
(rx_correction_timer == 0)) { // moving to the left so drop rx_off_diff samples
|
||||
rx_off_diff = 10*UE->frame_parms.samples_per_tti - RX_OFF_MIN - UE->rx_offset;
|
||||
LOG_D(PHY,"UE->rx_offset %d < %d, diff %d\n",UE->rx_offset,10*UE->frame_parms.samples_per_tti-RX_OFF_MIN,rx_off_diff);
|
||||
|
||||
rx_correction_timer = 5;
|
||||
}
|
||||
|
||||
if (rx_correction_timer>0)
|
||||
rx_correction_timer--;
|
||||
} // start_rx_stream==1
|
||||
} // UE->is_synchronized==1
|
||||
|
||||
} // while !oai_exit
|
||||
} // UE_thread
|
||||
|
||||
@@ -1316,7 +1449,7 @@ void *UE_thread_old(void *arg)
|
||||
|
||||
if (instance_cnt_rx == 0) {
|
||||
LOG_D(HW,"signalling rx thread to wake up, hw_frame %d, hw_subframe %d (time %lli)\n", frame, hw_subframe, rt_get_time_ns()-T0 );
|
||||
if (pthread_cond_signal(&UE->cond_rx) != 0) {
|
||||
if (pthread_cond_signal(&UE->proc.cond_rx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] ERROR pthread_cond_signal for UE RX thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_retval;
|
||||
@@ -1544,12 +1677,12 @@ void init_UE_threads(void)
|
||||
pthread_cond_init(&UE->proc.proc_rxtx[0].cond_rxtx,NULL);
|
||||
pthread_cond_init(&UE->proc.proc_rxtx[1].cond_rxtx,NULL);
|
||||
pthread_cond_init(&UE->proc.cond_synch,NULL);
|
||||
pthread_create(&UE->proc.proc_rxtx[0].thread_rxtx,NULL,UE_thread_rxn_txnp4,(void*)&UE->proc.proc_rxtx[0]);
|
||||
pthread_setname_np( UE->proc.proc_rxtx[0].thread_rxtx, "UE_thread_rxn_txnp4_even" );
|
||||
pthread_create(&UE->proc.proc_rxtx[1].thread_rxtx,NULL,UE_thread_rxn_txnp4,(void*)&UE->proc.proc_rxtx[1]);
|
||||
pthread_setname_np( UE->proc.proc_rxtx[1].thread_rxtx, "UE_thread_rxn_txnp4_odd" );
|
||||
pthread_create(&UE->proc.thread_synch,NULL,UE_thread_synch,(void*)UE);
|
||||
pthread_setname_np( UE->proc.thread_synch, "UE_thread_synch" );
|
||||
pthread_create(&UE->proc.proc_rxtx[0].pthread_rxtx,NULL,UE_thread_rxn_txnp4,(void*)&UE->proc.proc_rxtx[0]);
|
||||
pthread_setname_np( UE->proc.proc_rxtx[0].pthread_rxtx, "UE_thread_rxn_txnp4_even" );
|
||||
pthread_create(&UE->proc.proc_rxtx[1].pthread_rxtx,NULL,UE_thread_rxn_txnp4,(void*)&UE->proc.proc_rxtx[1]);
|
||||
pthread_setname_np( UE->proc.proc_rxtx[1].pthread_rxtx, "UE_thread_rxn_txnp4_odd" );
|
||||
pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
|
||||
pthread_setname_np( UE->proc.pthread_synch, "UE_thread_synch" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user