Xenomai  3.1
sched-sporadic.h
1 /*
2  * Copyright (C) 2009 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 #ifndef _COBALT_KERNEL_SCHED_SPORADIC_H
20 #define _COBALT_KERNEL_SCHED_SPORADIC_H
21 
22 #ifndef _COBALT_KERNEL_SCHED_H
23 #error "please don't include cobalt/kernel/sched-sporadic.h directly"
24 #endif
25 
31 #ifdef CONFIG_XENO_OPT_SCHED_SPORADIC
32 
33 #define XNSCHED_SPORADIC_MIN_PRIO 1
34 #define XNSCHED_SPORADIC_MAX_PRIO 255
35 #define XNSCHED_SPORADIC_NR_PRIO \
36  (XNSCHED_SPORADIC_MAX_PRIO - XNSCHED_SPORADIC_MIN_PRIO + 1)
37 
38 extern struct xnsched_class xnsched_class_sporadic;
39 
40 struct xnsched_sporadic_repl {
41  xnticks_t date;
42  xnticks_t amount;
43 };
44 
45 struct xnsched_sporadic_data {
46  xnticks_t resume_date;
47  xnticks_t budget;
48  int repl_in;
49  int repl_out;
50  int repl_pending;
51  struct xntimer repl_timer;
52  struct xntimer drop_timer;
53  struct xnsched_sporadic_repl repl_data[CONFIG_XENO_OPT_SCHED_SPORADIC_MAXREPL];
54  struct xnsched_sporadic_param param;
55  struct xnthread *thread;
56 };
57 
58 struct xnsched_sporadic {
59 #ifdef CONFIG_XENO_OPT_DEBUG_COBALT
60  unsigned long drop_retries;
61 #endif
62 };
63 
64 static inline int xnsched_sporadic_init_thread(struct xnthread *thread)
65 {
66  thread->pss = NULL;
67 
68  return 0;
69 }
70 
71 #endif /* !CONFIG_XENO_OPT_SCHED_SPORADIC */
72 
75 #endif /* !_COBALT_KERNEL_SCHED_SPORADIC_H */