Conflicts: openair1/PHY/INIT/lte_init.c openair1/PHY/LTE_TRANSPORT/dci_tools.c openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c openair1/SCHED/phy_procedures_lte_eNb.c openair1/SCHED/phy_procedures_lte_ue.c openair1/SIMULATION/LTE_PHY/dlsim.c openair1/SIMULATION/RF/adc.c openair2/LAYER2/MAC/lte_transport_init.c targets/RT/USER/lte-softmodem.c targets/RT/USER/sched_dlsch.c targets/RT/USER/sched_rx_pdsch.c targets/RT/USER/sched_ulsch.c targets/SIMU/USER/oaisim.c
103 lines
2.4 KiB
C
103 lines
2.4 KiB
C
/*! \file rt_wrapper.h
|
|
* \brief provides a wrapper for the timing function for real-time opeartions. It also implements an API for the SCHED_DEADLINE kernel scheduler.
|
|
* \author F. Kaltenberger and Navid Nikaein
|
|
* \date 2013
|
|
* \version 0.1
|
|
* \company Eurecom
|
|
* \email: florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
|
|
* \note
|
|
* \warning This code will be removed when a legacy libc API becomes available.
|
|
*/
|
|
|
|
|
|
|
|
#define _GNU_SOURCE
|
|
#include <time.h>
|
|
#include <errno.h>
|
|
#include <stdint.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <pthread.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/types.h>
|
|
#include <syscall.h>
|
|
#include <math.h>
|
|
#include <sched.h>
|
|
#include <sys/ioctl.h>
|
|
#include <sys/types.h>
|
|
#include <sys/mman.h>
|
|
#include <sched.h>
|
|
#include <linux/sched.h>
|
|
#include <signal.h>
|
|
#include <execinfo.h>
|
|
#include <getopt.h>
|
|
#include <sys/sysinfo.h>
|
|
|
|
#include "UTIL/LOG/log_extern.h"
|
|
#include "msc.h"
|
|
|
|
#define RTIME long long int
|
|
|
|
#define rt_printk printf
|
|
|
|
void set_latency_target(void);
|
|
|
|
RTIME rt_get_time_ns (void);
|
|
|
|
int rt_sleep_ns (RTIME x);
|
|
|
|
void check_clock(void);
|
|
|
|
int fill_modeled_runtime_table(uint16_t runtime_phy_rx[29][6],uint16_t runtime_phy_tx[29][6]);
|
|
|
|
double get_runtime_tx(int tx_subframe, uint16_t runtime_phy_tx[29][6],uint32_t mcs, int N_RB_DL,double cpuf,int nb_tx_antenna);
|
|
|
|
double get_runtime_rx(int rx_subframe, uint16_t runtime_phy_rx[29][6], uint32_t mcs, int N_RB_DL,double cpuf,int nb_rx_antenna);
|
|
/**
|
|
* see https://www.kernel.org/doc/Documentation/scheduler/sched-deadline.txt or
|
|
* http://www.blaess.fr/christophe/2014/04/05/utiliser-un-appel-systeme-inconnu-de-la-libc/
|
|
*/
|
|
#ifdef DEADLINE_SCHEDULER
|
|
|
|
#define gettid() syscall(__NR_gettid)
|
|
|
|
#define SCHED_DEADLINE 6
|
|
|
|
/* XXX use the proper syscall numbers */
|
|
#ifdef __x86_64__
|
|
#define __NR_sched_setattr 314
|
|
#define __NR_sched_getattr 315
|
|
#endif
|
|
|
|
#ifdef __i386__
|
|
#define __NR_sched_setattr 351
|
|
#define __NR_sched_getattr 352
|
|
#endif
|
|
|
|
struct sched_attr {
|
|
__u32 size;
|
|
|
|
__u32 sched_policy;
|
|
__u64 sched_flags;
|
|
|
|
/* SCHED_NORMAL, SCHED_BATCH */
|
|
__s32 sched_nice;
|
|
|
|
/* SCHED_FIFO, SCHED_RR */
|
|
__u32 sched_priority;
|
|
|
|
/* SCHED_DEADLINE (nsec) */
|
|
__u64 sched_runtime;
|
|
__u64 sched_deadline;
|
|
__u64 sched_period;
|
|
};
|
|
|
|
int sched_setattr(pid_t pid, const struct sched_attr *attr, unsigned int flags);
|
|
|
|
int sched_getattr(pid_t pid,struct sched_attr *attr,unsigned int size, unsigned int flags);
|
|
|
|
#endif
|
|
|
|
#define gettid() syscall(__NR_gettid) // for gettid
|
|
|