system.h 2.5 KB
Newer Older
1 2 3 4 5
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

#ifndef _SYSTEM_H_OAI_
#define _SYSTEM_H_OAI_
laurent's avatar
laurent committed
24
#include <stdint.h>
Laurent's avatar
Laurent committed
25
#include <pthread.h>
laurent's avatar
laurent committed
26 27 28 29
#ifdef __cplusplus
extern "C" {
#endif

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

/****************************************************
 * send a command to the background process
 *     return -1 on error, 0 on success
 ****************************************************/

int background_system(char *command);

/****************************************************
 * initialize the background process
 *     to be called very early
 ****************************************************/

void start_background_system(void);

laurent's avatar
laurent committed
45 46
void set_latency_target(void);

47 48
void threadCreate(pthread_t *t, void *(*func)(void *), void *param, char *name, int affinity, int priority);

49 50
#define SCHED_OAI SCHED_RR
#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI)
51
#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2)
Laurent OpenCells's avatar
Laurent OpenCells committed
52
#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2
laurent's avatar
laurent committed
53 54 55 56 57 58 59

void thread_top_init(char *thread_name,
                     int affinity,
                     uint64_t runtime,
                     uint64_t deadline,
                     uint64_t period);

60 61 62 63 64 65 66
/****************************************************
 * Functions to check system at runtime.
 ****************************************************/

int checkIfFedoraDistribution(void);
int checkIfGenericKernelOnFedora(void);
int checkIfInsideContainer(void);
67
int rt_sleep_ns (uint64_t x);
laurent's avatar
laurent committed
68 69 70 71 72
#ifdef __cplusplus
}
#endif


73
#endif /* _SYSTEM_H_OAI_ */