• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

include/posix/sched.h

00001 /*
00002  * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef _XENO_POSIX_SCHED_H
00020 #define _XENO_POSIX_SCHED_H
00021 
00022 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00023 
00024 #include <nucleus/xenomai.h>
00025 
00026 #ifdef __KERNEL__
00027 #include <linux/sched.h>
00028 #endif /* __KERNEL__ */
00029 
00030 #ifdef __XENO_SIM__
00031 #include <posix_overrides.h>
00032 #define SCHED_FIFO      1
00033 #define SCHED_RR        2
00034 #endif /* __XENO_SIM__ */
00035 
00036 #define SCHED_OTHER 0
00037 
00038 struct timespec;
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 int sched_yield(void);
00045 
00046 int sched_get_priority_min(int policy);
00047 
00048 int sched_get_priority_max(int policy);
00049 
00050 int sched_rr_get_interval(int pid, struct timespec *interval);
00051 
00052 #ifdef __cplusplus
00053 }
00054 #endif
00055 
00056 #else /* !(__KERNEL__ || __XENO_SIM__) */
00057 
00058 #include_next <sched.h>
00059 
00060 int __real_sched_yield(void);
00061 
00062 #endif /* !(__KERNEL__ || __XENO_SIM__) */
00063 
00064 #ifndef __sched_extensions_defined
00065 #define __sched_extensions_defined
00066 
00067 #ifndef SCHED_SPORADIC
00068 #define SCHED_SPORADIC          10
00069 #define sched_ss_low_priority   sched_u.ss.__sched_low_priority
00070 #define sched_ss_repl_period    sched_u.ss.__sched_repl_period
00071 #define sched_ss_init_budget    sched_u.ss.__sched_init_budget
00072 #define sched_ss_max_repl       sched_u.ss.__sched_max_repl
00073 #endif  /* !SCHED_SPORADIC */
00074 
00075 struct __sched_ss_param {
00076         int __sched_low_priority;
00077         struct timespec __sched_repl_period;
00078         struct timespec __sched_init_budget;
00079         int __sched_max_repl;
00080 };
00081 
00082 #ifndef SCHED_TP
00083 #define SCHED_TP                11
00084 #define sched_tp_partition      sched_u.tp.__sched_partition
00085 #endif  /* !SCHED_TP */
00086 
00087 struct __sched_tp_param {
00088         int __sched_partition;
00089 };
00090 
00091 struct sched_param_ex {
00092         int sched_priority;
00093         union {
00094                 struct __sched_ss_param ss;
00095                 struct __sched_tp_param tp;
00096         } sched_u;
00097 };
00098 
00099 struct sched_tp_window {
00100         struct timespec offset;
00101         struct timespec duration;
00102         int ptid;
00103 };
00104 
00105 struct __sched_config_tp {
00106         int nr_windows;
00107         struct sched_tp_window windows[0];
00108 };
00109 
00110 union sched_config {
00111         struct __sched_config_tp tp;
00112 };
00113 
00114 #define sched_tp_confsz(nr_win) \
00115   (sizeof(struct __sched_config_tp) + nr_win * sizeof(struct sched_tp_window))
00116 
00117 #ifdef __cplusplus
00118 extern "C" {
00119 #endif
00120 
00121 int sched_setconfig_np(int cpu, int policy,
00122                        union sched_config *config, size_t len);
00123 
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127 
00128 #endif /* __sched_extensions_defined */
00129 
00130 #endif /* SCHED_H */

Generated on Wed Jan 23 2013 13:24:01 for Xenomai API by  doxygen 1.7.1