intmbox_bounds[20]={8,16,24,30,38,46,54,60,68,76,84,90,98,106,114,120,128,136,144,0};///boundaries of slots in terms ob mbox counter rounded up to even numbers
//int mbox_bounds[20] = {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
printf("[EMOS] count %d (%d sec), total bytes wrote %llu\n",counter,counter/2000,total_bytes);
}
free(fifo2file_buffer);
fclose(dumpfile_id);
close(fifo);
pthread_exit((void*)arg);
rt_printk("fun0: finished, ran %d times.\n",slot);
#ifdef HARD_RT
rt_make_soft_real_time();
#endif
// clean task
rt_task_delete(task);
rt_printk("Task deleted. returning\n");
return0;
}
#endif
/* This is the main UE thread. Initially it is doing a periodic get_frame. One synchronized it gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
staticvoid*UE_thread(void*arg)
/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
printf("started RTAI timer with period %llu ns\n",count2nano(period));
#endif
printf("Init mutex\n");
//mutex = rt_get_adr(nam2num("MUTEX"));
...
...
@@ -1591,154 +999,287 @@ int main(int argc, char **argv) {
}
else
printf("mutex=%p\n",mutex);
/*
cond = rt_cond_init(nam2num("CONDITION"));
//cond = rt_get_adr(nam2num("CONDITION"));
if (cond==0)
printf("Error init cond\n");
*/
// initialize the instance cnt before starting the thread
instance_cnt_ptr_user=&instance_cnt;
// signal the driver to set up for user-space operation
// this will initialize the semaphore and the task pointers in the kernel
// further we receive back the pointer to the shared instance counter which is used to signal if the thread is busy or not. This pointer needs to be mapped to user space.