Xenomai API
2.6.5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
types.h
1
/*
2
* Copyright (C) 2001,2002,2003 Philippe Gerum <
[email protected]
>.
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
20
#ifndef _XENO_NUCLEUS_TYPES_H
21
#define _XENO_NUCLEUS_TYPES_H
22
23
#ifdef __KERNEL__
24
#include <linux/errno.h>
25
#else
/* !__KERNEL__ */
26
#include <stdio.h>
27
#include <string.h>
28
#include <sys/types.h>
29
#include <errno.h>
30
#ifndef BITS_PER_LONG
31
#include <stdint.h>
32
#define BITS_PER_LONG __WORDSIZE
33
#endif
/* !BITS_PER_LONG */
34
#endif
/* __KERNEL__ */
35
36
#include <asm/xenomai/system.h>
37
#include <nucleus/compiler.h>
38
#include <nucleus/assert.h>
39
40
#if BITS_PER_LONG == 32
41
#define __natural_word_type int
42
#else
/* defaults to long otherwise */
43
#define __natural_word_type long
44
#endif
45
46
typedef
unsigned
long
xnsigmask_t;
47
48
typedef
unsigned
long
long
xnticks_t;
49
50
typedef
long
long
xnsticks_t;
51
52
typedef
unsigned
long
long
xntime_t;
/* ns */
53
54
typedef
long
long
xnstime_t;
55
56
typedef
unsigned
long
xnhandle_t;
57
58
#define XN_NO_HANDLE ((xnhandle_t)0)
59
60
#define XN_HANDLE_SPARE0 ((xnhandle_t)0x10000000)
61
#define XN_HANDLE_SPARE1 ((xnhandle_t)0x20000000)
62
#define XN_HANDLE_SPARE2 ((xnhandle_t)0x40000000)
63
#define XN_HANDLE_SPARE3 ((xnhandle_t)0x80000000)
64
#define XN_HANDLE_SPARE_MASK ((xnhandle_t)0xf0000000)
65
66
#define xnhandle_mask_spare(handle) ((handle) & ~XN_HANDLE_SPARE_MASK)
67
#define xnhandle_test_spare(handle, bits) (!!((handle) & (bits)))
68
#define xnhandle_set_spare(handle, bits) \
69
do { (handle) |= (bits); } while (0)
70
#define xnhandle_clear_spare(handle, bits) \
71
do { (handle) &= ~(bits); } while (0)
72
73
struct
xnintr;
74
75
typedef
int (*xnisr_t)(
struct
xnintr *intr);
76
77
typedef
void (*xniack_t)(
unsigned
irq,
void
*arg);
78
79
#define XN_INFINITE (0)
80
#define XN_NONBLOCK ((xnticks_t)-1)
81
82
/* Timer modes */
83
typedef
enum
xntmode {
84
XN_RELATIVE,
85
XN_ABSOLUTE,
86
XN_REALTIME
87
} xntmode_t;
88
89
#define XN_APERIODIC_TICK 0
90
91
#define testbits(flags,mask) ((flags) & (mask))
92
#define setbits(flags,mask) xnarch_atomic_set_mask(&(flags),mask)
93
#define clrbits(flags,mask) xnarch_atomic_clear_mask(&(flags),mask)
94
#define __testbits(flags,mask) testbits(flags,mask)
95
#define __setbits(flags,mask) do { (flags) |= (mask); } while(0)
96
#define __clrbits(flags,mask) do { (flags) &= ~(mask); } while(0)
97
98
typedef
atomic_flags_t xnflags_t;
99
100
#ifndef NULL
101
#define NULL 0
102
#endif
103
104
#define XNOBJECT_NAME_LEN 32
105
106
#define xnobject_copy_name(dst, src) \
107
do { \
108
strncpy((dst), \
109
((const char *)(src)) ?: "", XNOBJECT_NAME_LEN-1) \
110
[XNOBJECT_NAME_LEN-1] = '\0'; \
111
} while (0)
112
113
#define xnobject_create_name(dst, n, obj) \
114
snprintf(dst, n, "%p", obj)
115
116
#define minval(a,b) ((a) < (b) ? (a) : (b))
117
#define maxval(a,b) ((a) > (b) ? (a) : (b))
118
119
#ifdef __cplusplus
120
extern
"C"
{
121
#endif
122
123
void
xnpod_fatal_helper(
const
char
*format, ...);
124
125
int
__xeno_user_init(
void
);
126
127
void
__xeno_user_exit(
void
);
128
129
#ifdef __cplusplus
130
}
131
#endif
132
133
#define xnprintf(...) xnarch_printf(__VA_ARGS__)
134
#define xnloginfo(...) xnarch_loginfo(__VA_ARGS__)
135
#define xnlogwarn(...) xnarch_logwarn(__VA_ARGS__)
136
#define xnlogerr(...) xnarch_logerr(__VA_ARGS__)
137
#define xnlogerr_noprompt(...) xnarch_logerr_noprompt(__VA_ARGS__)
138
139
#define xnpod_fatal(...) \
140
do { \
141
xnarch_begin_panic(); \
142
xnpod_fatal_helper(__VA_ARGS__); \
143
xnarch_halt(); \
144
} while (0)
145
146
#ifdef __XENO_SIM__
147
#define SKIN_INIT(name) __xeno_skin_init(void)
148
#define SKIN_EXIT(name) __xeno_skin_exit(void)
149
#else
/* !__XENO_SIM__ */
150
#define SKIN_INIT(name) __ ## name ## _skin_init(void)
151
#define SKIN_EXIT(name) __ ## name ## _skin_exit(void)
152
#endif
/* __XENO_SIM__ */
153
154
#define root_thread_init __xeno_user_init
155
#define root_thread_exit __xeno_user_exit
156
157
#endif
/* !_XENO_NUCLEUS_TYPES_H */
include
nucleus
types.h
Generated by
1.8.10