Commit dc86fb2b authored by Raymond Knopp's avatar Raymond Knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5509 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 5538b865
...@@ -160,12 +160,19 @@ static SEM *mutex; ...@@ -160,12 +160,19 @@ static SEM *mutex;
static int thread0; static int thread0;
static int thread1; static int thread1;
#ifdef USRP
static SEM *sync_sem; // to sync rx & tx streaming
#endif
//static int sync_thread; //static int sync_thread;
#else #else
pthread_t thread0; pthread_t thread0;
pthread_t thread1; pthread_t thread1;
pthread_attr_t attr_dlsch_threads; pthread_attr_t attr_dlsch_threads;
struct sched_param sched_param_dlsch; struct sched_param sched_param_dlsch;
#ifdef USRP
pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
#endif
#endif #endif
pthread_attr_t attr_eNB_proc_tx[10]; pthread_attr_t attr_eNB_proc_tx[10];
...@@ -713,15 +720,14 @@ static void * eNB_thread_tx(void *param) { ...@@ -713,15 +720,14 @@ static void * eNB_thread_tx(void *param) {
//unsigned long cpuid; //unsigned long cpuid;
eNB_proc_t *proc = (eNB_proc_t*)param; eNB_proc_t *proc = (eNB_proc_t*)param;
int i;
int subframe_tx; int subframe_tx;
// RTIME time_in,time_out; // RTIME time_in,time_out;
#ifdef RTAI #ifdef RTAI
RT_TASK *task; RT_TASK *task;
char task_name[8]; char task_name[8];
#endif #endif
int dummy_tx_b[7680*4] __attribute__((aligned(16)));
unsigned int aa,slot_offset,slot_offset_F,slot_offset_F2;
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
/* Wait for eNB application initialization to be complete (eNB registration to MME) */ /* Wait for eNB application initialization to be complete (eNB registration to MME) */
...@@ -1541,7 +1547,7 @@ static void get_options (int argc, char **argv) { ...@@ -1541,7 +1547,7 @@ static void get_options (int argc, char **argv) {
{"no-L2-connect", no_argument, NULL, LONG_OPTION_NO_L2_CONNECT}, {"no-L2-connect", no_argument, NULL, LONG_OPTION_NO_L2_CONNECT},
{NULL, 0, NULL, 0}}; {NULL, 0, NULL, 0}};
while ((c = getopt_long (argc, argv, "C:dK:qO:SUVRMr:",long_options,NULL)) != -1) { while ((c = getopt_long (argc, argv, "C:dK:qO:SUVRMr:s:",long_options,NULL)) != -1) {
switch (c) { switch (c) {
case LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS: case LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS:
ULSCH_max_consecutive_errors = atoi(optarg); ULSCH_max_consecutive_errors = atoi(optarg);
...@@ -1637,6 +1643,23 @@ static void get_options (int argc, char **argv) { ...@@ -1637,6 +1643,23 @@ static void get_options (int argc, char **argv) {
printf("Unknown N_RB_DL %d, switching to 25\n",atoi(optarg)); printf("Unknown N_RB_DL %d, switching to 25\n",atoi(optarg));
break; break;
} }
case 's':
{
#ifdef USRP
int clock_src = atoi(optarg);
if (clock_src == 0) {
char ref[128] = "internal";
//strncpy(uhd_ref, ref, strlen(ref)+1);
}
else if (clock_src == 1) {
char ref[128] = "external";
//strncpy(uhd_ref, ref, strlen(ref)+1);
}
}
#else
printf("Note: -s not defined for ExpressMIMO2\n");
#endif
break;
default: default:
break; break;
} }
...@@ -2126,6 +2149,16 @@ int main(int argc, char **argv) { ...@@ -2126,6 +2149,16 @@ int main(int argc, char **argv) {
} }
else else
printf("mutex=%p\n",mutex); printf("mutex=%p\n",mutex);
#ifdef USRP
sync_sem = rt_typed_sem_init(nam2num("syncsem"), 0, BIN_SEM|FIFO_Q);
if(sync_sem == 0)
printf("error init sync semphore\n");
#endif
#else
#ifdef USRP
pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL);
#endif
#endif #endif
...@@ -2239,7 +2272,17 @@ int main(int argc, char **argv) { ...@@ -2239,7 +2272,17 @@ int main(int argc, char **argv) {
#endif #endif
} }
#ifdef USRP
openair0.trx_start_func(&openair0);
#ifdef RTAI
rt_sem_signal(sync_sem);
#else
//pthread_mutex_lock(&sync_mutex);
pthread_cond_signal(&sync_cond);
//pthread_mutex_unlock(&sync_mutex);
#endif
#endif
// wait for end of program // wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n"); printf("TYPE <CTRL-C> TO TERMINATE\n");
//getchar(); //getchar();
...@@ -2312,7 +2355,13 @@ int main(int argc, char **argv) { ...@@ -2312,7 +2355,13 @@ int main(int argc, char **argv) {
#endif #endif
#ifdef RTAI #ifdef RTAI
#ifdef USRP
rt_sem_delete(sync_sem);
#endif
stop_rt_timer(); stop_rt_timer();
#else
pthread_cond_destroy(&sync_cond);
pthread_mutex_destroy(&sync_mutex);
#endif #endif
printf("stopping card\n"); printf("stopping card\n");
......
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