Xenomai  3.1
internal.h
1 /*
2  * Copyright (C) 2008 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18 #ifndef _LIB_COBALT_INTERNAL_H
19 #define _LIB_COBALT_INTERNAL_H
20 
21 #include <limits.h>
22 #include <boilerplate/ancillaries.h>
23 #include <cobalt/sys/cobalt.h>
24 #include "current.h"
25 
26 extern void *cobalt_umm_private;
27 
28 extern void *cobalt_umm_shared;
29 
30 static inline int cobalt_is_relaxed(void)
31 {
32  return cobalt_get_current_mode() & XNRELAX;
33 }
34 
35 static inline int cobalt_should_warn(void)
36 {
37  return (cobalt_get_current_mode() & (XNRELAX|XNWARN)) == XNWARN;
38 }
39 
40 #ifdef CONFIG_XENO_LAZY_SETSCHED
41 static inline int cobalt_eager_setsched(void)
42 {
43  return cobalt_is_relaxed();
44 }
45 #else
46 static inline int cobalt_eager_setsched(void)
47 {
48  return 1;
49 }
50 #endif
51 
52 static inline
53 struct cobalt_mutex_state *mutex_get_state(struct cobalt_mutex_shadow *shadow)
54 {
55  if (shadow->attr.pshared)
56  return cobalt_umm_shared + shadow->state_offset;
57 
58  return cobalt_umm_private + shadow->state_offset;
59 }
60 
61 static inline atomic_t *mutex_get_ownerp(struct cobalt_mutex_shadow *shadow)
62 {
63  return &mutex_get_state(shadow)->owner;
64 }
65 
66 void cobalt_sigshadow_install_once(void);
67 
68 void cobalt_thread_init(void);
69 
70 int cobalt_thread_probe(pid_t pid);
71 
72 void cobalt_sched_init(void);
73 
74 void cobalt_print_init(void);
75 
76 void cobalt_print_init_atfork(void);
77 
78 void cobalt_ticks_init(unsigned long long freq);
79 
80 void cobalt_mutex_init(void);
81 
82 void cobalt_default_condattr_init(void);
83 
84 int cobalt_xlate_schedparam(int policy,
85  const struct sched_param_ex *param_ex,
86  struct sched_param *param);
87 int cobalt_init(void);
88 
89 struct cobalt_featinfo;
90 
91 void cobalt_check_features(struct cobalt_featinfo *finfo);
92 
93 extern struct sigaction __cobalt_orig_sigdebug;
94 
95 extern int __cobalt_std_fifo_minpri,
96  __cobalt_std_fifo_maxpri;
97 
98 extern int __cobalt_std_rr_minpri,
99  __cobalt_std_rr_maxpri;
100 
101 #endif /* _LIB_COBALT_INTERNAL_H */
#define XNWARN
Issue SIGDEBUG on error detection.
Definition: thread.h:46
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24
#define XNRELAX
Relaxed shadow thread (blocking bit)
Definition: thread.h:39