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 | /* XXX hack so /opt.../machine/param.h can disable MSIZE and use this one */ |
---|
27 | #define __NEW_RTEMS_BSD__ |
---|
28 | |
---|
29 | /* General defines to activate BSD kernel parts */ |
---|
30 | #define _KERNEL 1 |
---|
31 | |
---|
32 | #include <sys/cdefs.h> |
---|
33 | #include <sys/types.h> |
---|
34 | |
---|
35 | /* Type set from the C standard */ |
---|
36 | #include <stdarg.h> |
---|
37 | #include <stddef.h> |
---|
38 | #include <stdint.h> |
---|
39 | #include <limits.h> |
---|
40 | #include <string.h> |
---|
41 | #include <stdio.h> |
---|
42 | #include <stdlib.h> |
---|
43 | |
---|
44 | /* Ensure that we are RTEMS compatible and can use RTEMS */ |
---|
45 | #include <rtems.h> |
---|
46 | #include <rtems/error.h> |
---|
47 | #include <rtems/chain.h> |
---|
48 | #include <rtems/libio.h> |
---|
49 | |
---|
50 | /* Ensure that we can use POSIX threads */ |
---|
51 | #include <pthread.h> |
---|
52 | |
---|
53 | /* The BSD kernel is not a POSIX source */ |
---|
54 | #undef _POSIX_SOURCE |
---|
55 | |
---|
56 | /* Symbol undefines */ |
---|
57 | #undef MAXPATHLEN |
---|
58 | |
---|
59 | /* Networking */ |
---|
60 | #define IPSEC 1 |
---|
61 | #define INET 1 |
---|
62 | #define INET6 1 |
---|
63 | #define TCP_SIGNATURE 1 |
---|
64 | |
---|
65 | /* Integer type definitions */ |
---|
66 | |
---|
67 | #define __float_t float |
---|
68 | #define __double_t double |
---|
69 | |
---|
70 | #define __clock_t clock_t |
---|
71 | #define __cpumask_t unsigned int |
---|
72 | #define __critical_t intptr_t |
---|
73 | #define __ptrdiff_t ptrdiff_t |
---|
74 | #define __time_t time_t |
---|
75 | |
---|
76 | #define _CLOCKID_T_DECLARED 1 |
---|
77 | #define _TIMER_T_DECLARED 1 |
---|
78 | #define _TIME_T_DECLARED 1 |
---|
79 | #define _USECONDS_T_DECLARED 1 |
---|
80 | #define _FSBLKCNT_T_DECLARED 1 |
---|
81 | #define _BLKSIZE_T_DECLARED 1 |
---|
82 | #define _BLKCNT_T_DECLARED 1 |
---|
83 | |
---|
84 | /* Symbol rename */ |
---|
85 | |
---|
86 | #include <machine/rtems-bsd-symbols.h> |
---|
87 | |
---|
88 | #define gets _bsd_gets |
---|
89 | #define realloc _bsd_realloc |
---|
90 | #define reallocf _bsd_reallocf |
---|
91 | #define setenv _bsd_setenv |
---|
92 | #define abs _bsd_abs |
---|
93 | #define labs _bsd_labs |
---|
94 | |
---|
95 | #include <rtems/score/watchdogimpl.h> |
---|
96 | #define ticks _Watchdog_Ticks_since_boot |
---|
97 | |
---|
98 | /* Debug */ |
---|
99 | |
---|
100 | void rtems_bsd_assert_func(const char *file, int line, const char *func, const char *expr); |
---|
101 | |
---|
102 | #define BSD_PRINTF(fmt, ...) printf("%s: " fmt, __func__, ##__VA_ARGS__) |
---|
103 | |
---|
104 | #define BSD_PANIC(fmt, ...) panic("%s: " fmt "\n", __func__, ##__VA_ARGS__) |
---|
105 | |
---|
106 | #ifdef NDEBUG |
---|
107 | # define BSD_ASSERT(expr) ((void) 0) |
---|
108 | #else |
---|
109 | # define BSD_ASSERT(expr) ((expr) ? (void) 0 : rtems_bsd_assert_func(__FILE__, __LINE__, __func__, #expr)) |
---|
110 | #endif |
---|
111 | |
---|
112 | #define BSD_ASSERT_SC(sc) BSD_ASSERT((sc) == RTEMS_SUCCESSFUL) |
---|
113 | |
---|
114 | #define BSD_ASSERT_RV(rv) BSD_ASSERT((rv) == 0) |
---|
115 | |
---|
116 | /* General definitions */ |
---|
117 | |
---|
118 | #define BSD_TASK_PRIORITY_NORMAL 120 |
---|
119 | |
---|
120 | #define BSD_TASK_PRIORITY_TIMER 110 |
---|
121 | |
---|
122 | #define BSD_TASK_PRIORITY_INTERRUPT 100 |
---|
123 | |
---|
124 | #define BSD_TASK_PRIORITY_RESOURCE_OWNER 100 |
---|
125 | |
---|
126 | /* FIXME */ |
---|
127 | #define BSD_MINIMUM_TASK_STACK_SIZE ((size_t) 32 * 1024) |
---|
128 | |
---|
129 | #define M_RTEMS_HEAP 0 |
---|
130 | |
---|
131 | #define BSD_MAXIMUM_SLEEP_QUEUES 32 |
---|
132 | |
---|
133 | extern rtems_chain_control rtems_bsd_lock_chain; |
---|
134 | |
---|
135 | extern rtems_chain_control rtems_bsd_mtx_chain; |
---|
136 | |
---|
137 | extern rtems_chain_control rtems_bsd_sx_chain; |
---|
138 | |
---|
139 | extern rtems_chain_control rtems_bsd_condvar_chain; |
---|
140 | |
---|
141 | extern rtems_chain_control rtems_bsd_callout_chain; |
---|
142 | |
---|
143 | extern rtems_chain_control rtems_bsd_thread_chain; |
---|
144 | |
---|
145 | extern rtems_chain_control rtems_bsd_malloc_chain; |
---|
146 | |
---|
147 | /* CPU definitions */ |
---|
148 | #define cpu_spinwait() /* nothing */ |
---|
149 | |
---|
150 | #endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_CONFIG_H_ */ |
---|