Xenomai 3.3.2
Loading...
Searching...
No Matches
cobalt.h
1/*
2 * Copyright (C) 2014 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 _COBALT_SYS_COBALT_H
19#define _COBALT_SYS_COBALT_H
20
21#include <sys/types.h>
22#include <signal.h>
23#include <pthread.h>
24#include <sched.h>
25#include <semaphore.h>
26#include <errno.h>
27#include <stdio.h>
28#include <time.h>
29#include <boilerplate/atomic.h>
30#include <boilerplate/list.h>
31#include <cobalt/uapi/kernel/synch.h>
32#include <cobalt/uapi/corectl.h>
33#include <cobalt/uapi/mutex.h>
34#include <cobalt/uapi/event.h>
35#include <cobalt/uapi/monitor.h>
36#include <cobalt/uapi/thread.h>
37#include <cobalt/uapi/cond.h>
38#include <cobalt/uapi/sem.h>
39#include <cobalt/ticks.h>
40
41#define cobalt_commit_memory(p) __cobalt_commit_memory(p, sizeof(*p))
42
43struct cobalt_tsd_hook {
44 void (*create_tsd)(void);
45 void (*delete_tsd)(void);
46 struct pvholder next;
47};
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53int cobalt_extend(unsigned int magic);
54
55int cobalt_corectl(int request, void *buf, size_t bufsz);
56
57int cobalt_thread_stat(pid_t pid,
58 struct cobalt_threadstat *stat);
59
60int cobalt_serial_debug(const char *fmt, ...);
61
62void __cobalt_commit_memory(void *p, size_t len);
63
64void cobalt_thread_harden(void);
65
66void cobalt_thread_relax(void);
67
68int cobalt_thread_join(pthread_t thread);
69
70pid_t cobalt_thread_pid(pthread_t thread);
71
72int cobalt_thread_mode(void);
73
74int cobalt_monitor_init(cobalt_monitor_t *mon,
75 clockid_t clk_id, int flags);
76
77int cobalt_monitor_destroy(cobalt_monitor_t *mon);
78
79int cobalt_monitor_enter(cobalt_monitor_t *mon);
80
81int cobalt_monitor_exit(cobalt_monitor_t *mon);
82
83int cobalt_monitor_wait(cobalt_monitor_t *mon, int event,
84 const struct timespec *ts);
85
86void cobalt_monitor_grant(cobalt_monitor_t *mon,
87 struct xnthread_user_window *u_window);
88
89int cobalt_monitor_grant_sync(cobalt_monitor_t *mon,
90 struct xnthread_user_window *u_window);
91
92void cobalt_monitor_grant_all(cobalt_monitor_t *mon);
93
94int cobalt_monitor_grant_all_sync(cobalt_monitor_t *mon);
95
96void cobalt_monitor_drain(cobalt_monitor_t *mon);
97
98int cobalt_monitor_drain_sync(cobalt_monitor_t *mon);
99
100void cobalt_monitor_drain_all(cobalt_monitor_t *mon);
101
102int cobalt_monitor_drain_all_sync(cobalt_monitor_t *mon);
103
104int cobalt_event_init(cobalt_event_t *event,
105 unsigned int value,
106 int flags);
107
108int cobalt_event_post(cobalt_event_t *event,
109 unsigned int bits);
110
111int cobalt_event_wait(cobalt_event_t *event,
112 unsigned int bits,
113 unsigned int *bits_r,
114 int mode,
115 const struct timespec *timeout);
116
117unsigned long cobalt_event_clear(cobalt_event_t *event,
118 unsigned int bits);
119
120int cobalt_event_inquire(cobalt_event_t *event,
121 struct cobalt_event_info *info,
122 pid_t *waitlist, size_t waitsz);
123
124int cobalt_event_destroy(cobalt_event_t *event);
125
126int cobalt_sem_inquire(sem_t *sem, struct cobalt_sem_info *info,
127 pid_t *waitlist, size_t waitsz);
128
129int cobalt_sched_weighted_prio(int policy,
130 const struct sched_param_ex *param_ex);
131
132void cobalt_register_tsd_hook(struct cobalt_tsd_hook *th);
133
134void cobalt_assert_nrt(void);
135
136unsigned long long cobalt_read_ns(void);
137
138extern int __cobalt_control_bind;
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* !_COBALT_SYS_COBALT_H */