Xenomai  3.1
init.h
1 /*
2  * Copyright (C) 2013 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_INIT_H
20 #define _COBALT_KERNEL_INIT_H
21 
22 #include <linux/atomic.h>
23 #include <linux/notifier.h>
24 #include <cobalt/uapi/corectl.h>
25 
26 extern atomic_t cobalt_runstate;
27 
28 static inline enum cobalt_run_states realtime_core_state(void)
29 {
30  return atomic_read(&cobalt_runstate);
31 }
32 
33 static inline int realtime_core_enabled(void)
34 {
35  return atomic_read(&cobalt_runstate) != COBALT_STATE_DISABLED;
36 }
37 
38 static inline int realtime_core_running(void)
39 {
40  return atomic_read(&cobalt_runstate) == COBALT_STATE_RUNNING;
41 }
42 
43 static inline void set_realtime_core_state(enum cobalt_run_states state)
44 {
45  atomic_set(&cobalt_runstate, state);
46 }
47 
48 void cobalt_add_state_chain(struct notifier_block *nb);
49 
50 void cobalt_remove_state_chain(struct notifier_block *nb);
51 
52 void cobalt_call_state_chain(enum cobalt_run_states newstate);
53 
54 #endif /* !_COBALT_KERNEL_INIT_H_ */
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24