Xenomai 3.3.2
Loading...
Searching...
No Matches
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 <stdbool.h>
23#include <time.h>
24#include <boilerplate/ancillaries.h>
25#include <cobalt/sys/cobalt.h>
26#include "current.h"
27
28#if defined(__USE_TIME_BITS64) || __WORDSIZE == 64 || \
29 (defined(__SYSCALL_WORDSIZE) && __SYSCALL_WORDSIZE == 64)
30#define XN_USE_TIME64_SYSCALL
31#endif
32
33extern void *cobalt_umm_private;
34
35extern void *cobalt_umm_shared;
36
37static inline int cobalt_is_relaxed(void)
38{
39 return cobalt_get_current_mode() & XNRELAX;
40}
41
42static inline int cobalt_should_warn(void)
43{
44 return (cobalt_get_current_mode() & (XNRELAX|XNWARN)) == XNWARN;
45}
46
47#ifdef CONFIG_XENO_LAZY_SETSCHED
48static inline int cobalt_eager_setsched(void)
49{
50 return cobalt_is_relaxed();
51}
52#else
53static inline int cobalt_eager_setsched(void)
54{
55 return 1;
56}
57#endif
58
59static inline
60struct cobalt_mutex_state *mutex_get_state(struct cobalt_mutex_shadow *shadow)
61{
62 if (shadow->attr.pshared)
63 return cobalt_umm_shared + shadow->state_offset;
64
65 return cobalt_umm_private + shadow->state_offset;
66}
67
68static inline atomic_t *mutex_get_ownerp(struct cobalt_mutex_shadow *shadow)
69{
70 return &mutex_get_state(shadow)->owner;
71}
72
73void cobalt_sigshadow_install_once(void);
74
75void cobalt_thread_init(void);
76
77int cobalt_thread_probe(pid_t pid);
78
79void cobalt_sched_init(void);
80
81void cobalt_print_init(void);
82
83void cobalt_print_init_atfork(void);
84
85void cobalt_ticks_init(void);
86
87void cobalt_mutex_init(void);
88
89void cobalt_default_condattr_init(void);
90
91int cobalt_xlate_schedparam(int policy,
92 const struct sched_param_ex *param_ex,
93 struct sched_param *param);
94int cobalt_init(void);
95
96void *cobalt_lookup_vdso(const char *version, const char *name);
97
98extern struct sigaction __cobalt_orig_sigdebug;
99
100extern int __cobalt_std_fifo_minpri,
101 __cobalt_std_fifo_maxpri;
102
103extern int __cobalt_std_rr_minpri,
104 __cobalt_std_rr_maxpri;
105
106extern int (*__cobalt_vdso_gettime)(clockid_t clk_id,
107 struct timespec *tp);
108
109extern unsigned int cobalt_features;
110
111struct cobalt_featinfo;
112
118void cobalt_arch_check_features(struct cobalt_featinfo *finfo);
119
125void cobalt_features_init(struct cobalt_featinfo *f);
126
135static inline bool cobalt_features_available(unsigned int feat_mask)
136{
137 return (cobalt_features & feat_mask) == feat_mask;
138}
139
140#endif /* _LIB_COBALT_INTERNAL_H */
#define XNWARN
Issue SIGDEBUG on error detection.
Definition thread.h:45
#define XNRELAX
Relaxed shadow thread (blocking bit)
Definition thread.h:39
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition atomic.h:24