1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup rtems_bsd_machine |
---|
5 | * |
---|
6 | * @brief TODO. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * embedded brains GmbH |
---|
13 | * Obere Lagerstr. 30 |
---|
14 | * 82178 Puchheim |
---|
15 | * Germany |
---|
16 | * <rtems@embedded-brains.de> |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.com/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ |
---|
24 | #define _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ |
---|
25 | |
---|
26 | /* We compile for RTEMS and FreeBSD */ |
---|
27 | #define __rtems__ 1 |
---|
28 | #define __FreeBSD__ 1 |
---|
29 | #define __BSD_VISIBLE 1 |
---|
30 | |
---|
31 | /* Disable procedure call definitions */ |
---|
32 | #undef __P |
---|
33 | #undef __strong_reference |
---|
34 | |
---|
35 | #ifndef _RTEMS_BSD_BSD_HH_ |
---|
36 | /* General defines to activate BSD kernel parts */ |
---|
37 | #define _KERNEL 1 |
---|
38 | |
---|
39 | /* Disable standard system headers */ |
---|
40 | #undef _SYS_UNISTD_H |
---|
41 | #define _SYS_UNISTD_H 1 |
---|
42 | #undef _SYS_FEATURES_H |
---|
43 | #define _SYS_FEATURES_H 1 |
---|
44 | #undef _SYS_TTYCOM_H_ |
---|
45 | #define _SYS_TTYCOM_H_ 1 |
---|
46 | |
---|
47 | /* Disable procedure call definitions */ |
---|
48 | #undef __P |
---|
49 | #undef __strong_reference |
---|
50 | |
---|
51 | /* Disable some quirks in the standard headers */ |
---|
52 | #define _POSIX_SOURCE 1 |
---|
53 | |
---|
54 | /* We need POSIX threads */ |
---|
55 | #define _POSIX_THREADS 1 |
---|
56 | |
---|
57 | #endif /* !_RTEMS_BSD_BSD_HH_ */ |
---|
58 | |
---|
59 | /* Type set from the C standard */ |
---|
60 | #include <stdarg.h> |
---|
61 | #include <stddef.h> |
---|
62 | #include <stdint.h> |
---|
63 | #include <limits.h> |
---|
64 | #include <string.h> |
---|
65 | #include <stdio.h> |
---|
66 | #include <stdlib.h> |
---|
67 | #include <errno.h> |
---|
68 | #include <sys/types.h> |
---|
69 | |
---|
70 | /* Ensure that we are RTEMS compatible and can use RTEMS */ |
---|
71 | #include <rtems.h> |
---|
72 | #include <rtems/error.h> |
---|
73 | #include <rtems/chain.h> |
---|
74 | #include <rtems/libio.h> |
---|
75 | |
---|
76 | #ifndef _RTEMS_BSD_BSD_HH_ |
---|
77 | /* Ensure that we can use POSIX threads */ |
---|
78 | #include <pthread.h> |
---|
79 | |
---|
80 | /* The BSD kernel is not a POSIX source */ |
---|
81 | #undef _POSIX_SOURCE |
---|
82 | |
---|
83 | /* Symbol undefines */ |
---|
84 | #undef MAXPATHLEN |
---|
85 | |
---|
86 | #endif /* !_RTEMS_BSD_BSD_HH_ */ |
---|
87 | |
---|
88 | /* Networking */ |
---|
89 | #define IPSEC 1 |
---|
90 | #define INET 1 |
---|
91 | #define INET6 1 |
---|
92 | #define TCP_SIGNATURE 1 |
---|
93 | |
---|
94 | /* Integer type definitions */ |
---|
95 | |
---|
96 | #define __INT_MAX INT_MAX |
---|
97 | #define GID_MAX UINT_MAX /* max value for a gid_t */ |
---|
98 | #define UID_MAX UINT_MAX /* max value for a uid_t */ |
---|
99 | |
---|
100 | #define __int8_t int8_t |
---|
101 | #define __int16_t int16_t |
---|
102 | #define __int32_t int32_t |
---|
103 | #define __int64_t int64_t |
---|
104 | |
---|
105 | #define __int_least8_t int_least8_t |
---|
106 | #define __int_least16_t int_least16_t |
---|
107 | #define __int_least32_t int_least32_t |
---|
108 | #define __int_least64_t int_least64_t |
---|
109 | |
---|
110 | #define __int_fast8_t int_fast8_t |
---|
111 | #define __int_fast16_t int_fast16_t |
---|
112 | #define __int_fast32_t int_fast32_t |
---|
113 | #define __int_fast64_t int_fast64_t |
---|
114 | |
---|
115 | #define __uint8_t uint8_t |
---|
116 | #define __uint16_t uint16_t |
---|
117 | #define __uint32_t uint32_t |
---|
118 | #define __uint64_t uint64_t |
---|
119 | |
---|
120 | #define __uint_least8_t uint_least8_t |
---|
121 | #define __uint_least16_t uint_least16_t |
---|
122 | #define __uint_least32_t uint_least32_t |
---|
123 | #define __uint_least64_t uint_least64_t |
---|
124 | |
---|
125 | #define __uint_fast8_t uint_fast8_t |
---|
126 | #define __uint_fast16_t uint_fast16_t |
---|
127 | #define __uint_fast32_t uint_fast32_t |
---|
128 | #define __uint_fast64_t uint_fast64_t |
---|
129 | |
---|
130 | #define __intfptr_t intptr_t |
---|
131 | #define __uintfptr_t uintptr_t |
---|
132 | |
---|
133 | #define __intptr_t intptr_t |
---|
134 | #define __uintptr_t uintptr_t |
---|
135 | |
---|
136 | #define __intmax_t intmax_t |
---|
137 | #define __uintmax_t uintmax_t |
---|
138 | |
---|
139 | #define __register_t int |
---|
140 | #define __u_register_t unsigned int |
---|
141 | |
---|
142 | #define __float_t float |
---|
143 | #define __double_t double |
---|
144 | |
---|
145 | #define __vm_offset_t uintptr_t |
---|
146 | #define __vm_ooffset_t uint64_t |
---|
147 | #define __vm_paddr_t uintptr_t |
---|
148 | #define __vm_pindex_t uint64_t |
---|
149 | #define __vm_size_t uintptr_t |
---|
150 | |
---|
151 | #define __clock_t clock_t |
---|
152 | #define __cpumask_t unsigned int |
---|
153 | #define __critical_t intptr_t |
---|
154 | #define __ptrdiff_t ptrdiff_t |
---|
155 | #define __segsz_t intptr_t |
---|
156 | #define __time_t time_t |
---|
157 | |
---|
158 | #define __va_list va_list |
---|
159 | |
---|
160 | #undef __size_t |
---|
161 | #define __size_t size_t |
---|
162 | |
---|
163 | #define _CLOCKID_T_DECLARED 1 |
---|
164 | #define _DEV_T_DECLARED 1 |
---|
165 | #define _GID_T_DECLARED 1 |
---|
166 | #define _MODE_T_DECLARED 1 |
---|
167 | #define _OFF_T_DECLARED 1 |
---|
168 | #define _PID_T_DECLARED 1 |
---|
169 | #define _SSIZE_T_DECLARED 1 |
---|
170 | #define _TIMER_T_DECLARED 1 |
---|
171 | #define _TIME_T_DECLARED 1 |
---|
172 | #define _UID_T_DECLARED 1 |
---|
173 | #define _USECONDS_T_DECLARED 1 |
---|
174 | #define _FSBLKCNT_T_DECLARED 1 |
---|
175 | #define _BLKSIZE_T_DECLARED 1 |
---|
176 | #define _BLKCNT_T_DECLARED 1 |
---|
177 | |
---|
178 | #define __dev_t _bsd_dev_t |
---|
179 | #define __gid_t _bsd_gid_t |
---|
180 | #define __off_t _bsd_off_t |
---|
181 | #define __pid_t _bsd_pid_t |
---|
182 | #define __uid_t _bsd_uid_t |
---|
183 | |
---|
184 | /* Missing error number */ |
---|
185 | //#define ENOIOCTL EINVAL |
---|
186 | |
---|
187 | #ifndef _RTEMS_BSD_BSD_HH_ |
---|
188 | /* Symbol rename */ |
---|
189 | |
---|
190 | #include <rtems/freebsd/machine/rtems-bsd-symbols.h> |
---|
191 | |
---|
192 | #define gets _bsd_gets |
---|
193 | #define realloc _bsd_realloc |
---|
194 | #define reallocf _bsd_reallocf |
---|
195 | #define setenv _bsd_setenv |
---|
196 | #define abs _bsd_abs |
---|
197 | #define labs _bsd_labs |
---|
198 | |
---|
199 | #define ticks _Watchdog_Ticks_since_boot |
---|
200 | |
---|
201 | /* Debug */ |
---|
202 | |
---|
203 | void rtems_bsd_assert_func(const char *file, int line, const char *func, const char *expr); |
---|
204 | |
---|
205 | #define BSD_PRINTF(fmt, ...) printf("%s: " fmt, __func__, ##__VA_ARGS__) |
---|
206 | |
---|
207 | #define BSD_PANIC(fmt, ...) panic("%s: " fmt "\n", __func__, ##__VA_ARGS__) |
---|
208 | |
---|
209 | #ifdef NDEBUG |
---|
210 | # define BSD_ASSERT(expr) ((void) 0) |
---|
211 | #else |
---|
212 | # define BSD_ASSERT(expr) ((expr) ? (void) 0 : rtems_bsd_assert_func(__FILE__, __LINE__, __func__, #expr)) |
---|
213 | #endif |
---|
214 | |
---|
215 | #define BSD_ASSERT_SC(sc) BSD_ASSERT((sc) == RTEMS_SUCCESSFUL) |
---|
216 | |
---|
217 | #define BSD_ASSERT_RV(rv) BSD_ASSERT((rv) == 0) |
---|
218 | |
---|
219 | /* General definitions */ |
---|
220 | |
---|
221 | #define BSD_TASK_PRIORITY_NORMAL 120 |
---|
222 | |
---|
223 | #define BSD_TASK_PRIORITY_TIMER 110 |
---|
224 | |
---|
225 | #define BSD_TASK_PRIORITY_INTERRUPT 100 |
---|
226 | |
---|
227 | #define BSD_TASK_PRIORITY_RESOURCE_OWNER 100 |
---|
228 | |
---|
229 | /* FIXME */ |
---|
230 | #define BSD_MINIMUM_TASK_STACK_SIZE ((size_t) 32 * 1024) |
---|
231 | |
---|
232 | #define M_RTEMS_HEAP 0 |
---|
233 | |
---|
234 | #define BSD_MAXIMUM_SLEEP_QUEUES 32 |
---|
235 | |
---|
236 | extern rtems_chain_control rtems_bsd_lock_chain; |
---|
237 | |
---|
238 | extern rtems_chain_control rtems_bsd_mtx_chain; |
---|
239 | |
---|
240 | extern rtems_chain_control rtems_bsd_sx_chain; |
---|
241 | |
---|
242 | extern rtems_chain_control rtems_bsd_condvar_chain; |
---|
243 | |
---|
244 | extern rtems_chain_control rtems_bsd_callout_chain; |
---|
245 | |
---|
246 | extern rtems_chain_control rtems_bsd_thread_chain; |
---|
247 | |
---|
248 | extern rtems_chain_control rtems_bsd_malloc_chain; |
---|
249 | |
---|
250 | /* CPU definitions */ |
---|
251 | #define cpu_spinwait() /* nothing */ |
---|
252 | |
---|
253 | #endif /* !_RTEMS_BSD_BSD_HH_ */ |
---|
254 | |
---|
255 | #endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ */ |
---|