2 * \file ferret/include/sensors/list_producer_wrap.h
3 * \brief Convenience wrapper functions for creating events
6 * \author Martin Pohlack <mp26@os.inf.tu-dresden.de>
9 * (c) 2006-2009 Technische Universität Dresden
10 * This file is part of TUD:OS and distributed under the terms of the
11 * GNU General Public License 2.
12 * Please see the COPYING-GPL-2 file for details.
14 #ifndef __FERRET_INCLUDE_SENSORS_LIST_PRODUCER_WRAP_H_
15 #define __FERRET_INCLUDE_SENSORS_LIST_PRODUCER_WRAP_H_
17 #include <l4/sys/compiler.h>
18 #include <l4/ferret/sensors/list.h>
19 #include <l4/ferret/sensors/list_producer.h>
23 /**********************************************************************
25 **********************************************************************/
27 /**********************************************************************
28 * Basic event poster functions
29 **********************************************************************/
31 #define FERRET_POST_sig(a, b...) \
33 ferret_list_post##a(ferret_list_local_t * l, uint16_t maj, uint16_t min, \
37 ferret_list_post(ferret_list_local_t * l, uint16_t maj, uint16_t min,
40 FERRET_POST_sig(_1w, uint32_t d0);
41 FERRET_POST_sig(_2w, uint32_t d0, uint32_t d1);
42 FERRET_POST_sig(_3w, uint32_t d0, uint32_t d1, uint32_t d2);
43 FERRET_POST_sig(_4w, uint32_t d0, uint32_t d1, uint32_t d2, uint32_t d3);
45 /* No special handling for thread IDs anymore -- there _are_ non in Re. */
47 FERRET_POST_sig(_1t, l4_threadid_t t);
48 FERRET_POST_sig(_1t1w, l4_threadid_t t, uint32_t d0);
49 FERRET_POST_sig(_1t2w, l4_threadid_t t, uint32_t d0, uint32_t d1);
50 FERRET_POST_sig(_1t3w, l4_threadid_t t, uint32_t d0, uint32_t d1, uint32_t d2);
51 FERRET_POST_sig(_1t4w, l4_threadid_t t, uint32_t d0, uint32_t d1, uint32_t d2,
55 /**********************************************************************
57 **********************************************************************/
59 #define FERRET_POSTX_sig(a, b...) \
61 ferret_list_postX##a(ferret_list_local_t * l, uint32_t maj_min, \
64 FERRET_POSTX_sig(_2w, uint32_t d0, uint32_t d1);
66 /**********************************************************************
67 * Conditional macros: here you can dynamically activate / deactivate
69 **********************************************************************/
71 #define FERRET_POST_sigc_body(n, a, b...) \
76 ferret_list_post##n(b); \
80 #define ferret_list_post_c(a, b...) FERRET_POST_sigc_body( , a, b)
81 #define ferret_list_post_1wc(a, b...) FERRET_POST_sigc_body(_1w, a, b)
82 #define ferret_list_post_2wc(a, b...) FERRET_POST_sigc_body(_2w, a, b)
83 #define ferret_list_post_3wc(a, b...) FERRET_POST_sigc_body(_3w, a, b)
84 #define ferret_list_post_4wc(a, b...) FERRET_POST_sigc_body(_4w, a, b)
87 #define ferret_list_post_1tc(a, b...) FERRET_POST_sigc_body(_1t , a, b)
88 #define ferret_list_post_1t1wc(a, b...) FERRET_POST_sigc_body(_1t1w, a, b)
89 #define ferret_list_post_1t2wc(a, b...) FERRET_POST_sigc_body(_1t2w, a, b)
90 #define ferret_list_post_1t3wc(a, b...) FERRET_POST_sigc_body(_1t3w, a, b)
91 #define ferret_list_post_1t4wc(a, b...) FERRET_POST_sigc_body(_1t4w, a, b)
94 /**********************************************************************
96 **********************************************************************/
98 #define FERRET_POST_begin \
101 ferret_list_entry_common_t * elc; \
103 index = ferret_list_dequeue(l); \
104 elc = (ferret_list_entry_common_t *)ferret_list_e4i(l->glob, index); \
107 elc->instance = instance; \
108 elc->cpu = 0; // fixme
110 #define FERRET_POSTX_begin \
113 ferret_list_entry_common_t * elc; \
115 index = ferret_list_dequeue(l); \
116 elc = (ferret_list_entry_common_t *)ferret_list_e4i(l->glob, index); \
117 elc->maj_min = maj_min; \
118 elc->instance = instance; \
119 elc->cpu = 0; // fixme
121 #define FERRET_POST_end \
122 ferret_list_commit(l, index); \
125 #define FERRET_POST_assign_1w(o) \
126 elc->data32[0 + (o)] = d0;
128 #define FERRET_POST_assign_2w(o) \
129 elc->data32[0 + (o)] = d0; \
130 elc->data32[1 + (o)] = d1;
132 #define FERRET_POST_assign_3w(o) \
133 elc->data32[0 + (o)] = d0; \
134 elc->data32[1 + (o)] = d1; \
135 elc->data32[2 + (o)] = d2;
137 #define FERRET_POST_assign_4w(o) \
138 elc->data32[0 + (o)] = d0; \
139 elc->data32[1 + (o)] = d1; \
140 elc->data32[2 + (o)] = d2; \
141 elc->data32[3 + (o)] = d3;
144 #define FERRET_POST_assign_1t \
145 elc->data64[0] = t.raw;
150 ferret_list_post(ferret_list_local_t * l, uint16_t maj, uint16_t min,
155 FERRET_POST_sig(_1w, uint32_t d0)
157 FERRET_POST_assign_1w(0)
160 FERRET_POST_sig(_2w, uint32_t d0, uint32_t d1)
162 FERRET_POST_assign_2w(0)
165 FERRET_POSTX_sig(_2w, uint32_t d0, uint32_t d1)
167 FERRET_POST_assign_2w(0)
170 FERRET_POST_sig(_3w, uint32_t d0, uint32_t d1, uint32_t d2)
172 FERRET_POST_assign_3w(0)
175 FERRET_POST_sig(_4w, uint32_t d0, uint32_t d1, uint32_t d2, uint32_t d3)
177 FERRET_POST_assign_4w(0)
181 FERRET_POST_sig(_1t, l4_threadid_t t)
183 FERRET_POST_assign_1t
186 FERRET_POST_sig(_1t1w, l4_threadid_t t, uint32_t d0)
188 FERRET_POST_assign_1t
189 FERRET_POST_assign_1w(1)
192 FERRET_POST_sig(_1t2w, l4_threadid_t t, uint32_t d0, uint32_t d1)
194 FERRET_POST_assign_1t
195 FERRET_POST_assign_2w(1)
198 FERRET_POST_sig(_1t3w, l4_threadid_t t, uint32_t d0, uint32_t d1, uint32_t d2)
200 FERRET_POST_assign_1t
201 FERRET_POST_assign_3w(1)
204 FERRET_POST_sig(_1t4w, l4_threadid_t t, uint32_t d0, uint32_t d1, uint32_t d2,
207 FERRET_POST_assign_1t
208 FERRET_POST_assign_4w(1)
213 #undef FERRET_POST_sig
214 #undef FERRET_POSTX_sig
215 #undef FERRET_POST_begin
216 #undef FERRET_POSTX_begin
217 #undef FERRET_POST_end
218 #undef FERRET_POST_assign_1w
219 #undef FERRET_POST_assign_2w
220 #undef FERRET_POSTX_assign_2w
221 #undef FERRET_POST_assign_3w
222 #undef FERRET_POST_assign_4w
223 #undef FERRET_POST_assign_1t