Xenomai  3.0.8
sched-tp.h
1 /*
2  * Copyright (C) 2008 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_TP_H
20 #define _COBALT_KERNEL_SCHED_TP_H
21 
22 #ifndef _COBALT_KERNEL_SCHED_H
23 #error "please don't include cobalt/kernel/sched-tp.h directly"
24 #endif
25 
31 #ifdef CONFIG_XENO_OPT_SCHED_TP
32 
33 #define XNSCHED_TP_MIN_PRIO 1
34 #define XNSCHED_TP_MAX_PRIO 255
35 #define XNSCHED_TP_NR_PRIO \
36  (XNSCHED_TP_MAX_PRIO - XNSCHED_TP_MIN_PRIO + 1)
37 
38 extern struct xnsched_class xnsched_class_tp;
39 
40 struct xnsched_tp_window {
41  xnticks_t w_offset;
42  int w_part;
43 };
44 
45 struct xnsched_tp_schedule {
46  int pwin_nr;
47  xnticks_t tf_duration;
48  atomic_t refcount;
49  struct xnsched_tp_window pwins[0];
50 };
51 
52 struct xnsched_tp {
53  struct xnsched_tpslot {
55  xnsched_queue_t runnable;
56  } partitions[CONFIG_XENO_OPT_SCHED_TP_NRPART];
58  struct xnsched_tpslot idle;
60  struct xnsched_tpslot *tps;
62  struct xntimer tf_timer;
64  struct xnsched_tp_schedule *gps;
66  int wnext;
68  xnticks_t tf_start;
70  struct list_head threads;
71 };
72 
73 static inline int xnsched_tp_init_thread(struct xnthread *thread)
74 {
75  thread->tps = NULL;
76 
77  return 0;
78 }
79 
80 struct xnsched_tp_schedule *
81 xnsched_tp_set_schedule(struct xnsched *sched,
82  struct xnsched_tp_schedule *gps);
83 
84 void xnsched_tp_start_schedule(struct xnsched *sched);
85 
86 void xnsched_tp_stop_schedule(struct xnsched *sched);
87 
88 int xnsched_tp_get_partition(struct xnsched *sched);
89 
90 struct xnsched_tp_schedule *
91 xnsched_tp_get_schedule(struct xnsched *sched);
92 
93 void xnsched_tp_put_schedule(struct xnsched_tp_schedule *gps);
94 
95 #endif /* CONFIG_XENO_OPT_SCHED_TP */
96 
99 #endif /* !_COBALT_KERNEL_SCHED_TP_H */
Scheduling information structure.
Definition: sched.h:58
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24