1 /*
2 Copyright (c) 2012, Broadcom Europe Ltd
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7     * Redistributions of source code must retain the above copyright
8       notice, this list of conditions and the following disclaimer.
9     * Redistributions in binary form must reproduce the above copyright
10       notice, this list of conditions and the following disclaimer in the
11       documentation and/or other materials provided with the distribution.
12     * Neither the name of the copyright holder nor the
13       names of its contributors may be used to endorse or promote products
14       derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef KHRN_CLIENT_RPC_H
29 #define KHRN_CLIENT_RPC_H
30 
31 #define RPC_DELAYED_USE_OF_POINTERS
32 
33 #include "interface/khronos/common/khrn_int_util.h"
34 #include "interface/khronos/common/khrn_client.h"
35 
36 #include <stdlib.h> /* for size_t */
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 # if defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
43 #include "rpc_platform.h"
44 #endif
45 
46 #ifdef RPC_DIRECT
47 
48 #include "middleware/khronos/egl/egl_server.h" /* for egl_server_unlock_states() */
49 #if !defined(V3D_LEAN) || defined(RPC_DIRECT_MULTI)
50 #include "middleware/khronos/common/khrn_misc.h"
51 #endif
52 
53 #ifdef RPC_LIBRARY
54 #include "interface/khronos/common/khrn_client.h" /* for khrn_client_get_func_table() */
55 #include "applications/vmcs/khronos/khronos_server.h"
56 #endif
57 
58 #ifdef RPC_DIRECT_MULTI
59 #include "interface/khronos/common/khrn_client.h" /* for khrn_client_get_func_table() */
60 
61 extern int client_library_get_connection(void);
62 extern const KHRONOS_FUNC_TABLE_T *khronos_server_lock_func_table(int);
63 extern void khronos_server_unlock_func_table(void);
64 
65 #endif
66 
67 /******************************************************************************
68 type packing/unpacking macros
69 ******************************************************************************/
70 
71 #define RPC_FLOAT(f)        (f)
72 #define RPC_ENUM(e)         (e)
73 #define RPC_INT(i)          (i)
74 #define RPC_INTPTR(p)       (p)
75 #define RPC_UINT(u)         (u)
76 #define RPC_SIZEI(s)        (s)
77 #define RPC_SIZEIPTR(p)     (p)
78 #define RPC_BOOLEAN(b)      (b)
79 #define RPC_BITFIELD(b)     (b)
80 #define RPC_FIXED(f)        (f)
81 #define RPC_HANDLE(h)       (h)
82 #define RPC_EGLID(i)        (i)
83 
84 #if defined(RPC_LIBRARY) || defined(RPC_DIRECT_MULTI)
RPC_FLOAT_RES(float f)85 static INLINE float RPC_FLOAT_RES(float f) { khronos_server_unlock_func_table(); return f; }
RPC_ENUM_RES(GLenum e)86 static INLINE GLenum RPC_ENUM_RES(GLenum e) { khronos_server_unlock_func_table(); return e; }
RPC_INT_RES(int i)87 static INLINE int RPC_INT_RES(int i) { khronos_server_unlock_func_table(); return i; }
RPC_UINT_RES(uint32_t u)88 static INLINE uint32_t RPC_UINT_RES(uint32_t u) { khronos_server_unlock_func_table(); return u; }
RPC_BOOLEAN_RES(bool b)89 static INLINE bool RPC_BOOLEAN_RES(bool b) { khronos_server_unlock_func_table(); return b; }
90 //static INLINE GLbitfield RPC_BITFIELD_RES(GLbitfield b) { khronos_server_unlock_func_table(); return b; }
RPC_HANDLE_RES(VGHandle h)91 static INLINE VGHandle RPC_HANDLE_RES(VGHandle h) { khronos_server_unlock_func_table(); return h; }
92 #else
93 #define RPC_FLOAT_RES(f)    (f)
94 #define RPC_ENUM_RES(e)     (e)
95 #define RPC_INT_RES(i)      (i)
96 #define RPC_UINT_RES(u)     (u)
97 #define RPC_BOOLEAN_RES(b)  (b)
98 #define RPC_BITFIELD_RES(b) (b)
99 #define RPC_HANDLE_RES(h)   (h)
100 #endif
101 
102 /******************************************************************************
103 rpc call macros
104 ******************************************************************************/
105 
106 #ifdef RPC_DIRECT_MULTI
107 extern bool rpc_direct_multi_init(void);
108 extern void rpc_term(void);
109 #define RPC_INIT() rpc_direct_multi_init()
110 #define RPC_TERM() rpc_term()
111 #else
112 #define RPC_INIT() true
113 #define RPC_TERM()
114 #endif
115 
116 #define RPC_FLUSH(thread) RPC_CALL0(khrn_misc_rpc_flush_impl, thread, no_id)
117 #define RPC_HIGH_PRIORITY_BEGIN(thread)
118 #define RPC_HIGH_PRIORITY_END(thread)
119 
120 #if defined(RPC_LIBRARY) || defined(RPC_DIRECT_MULTI)
121 #define RPC_DO(fn, args) ((khronos_server_lock_func_table(client_library_get_connection())->fn args),khronos_server_unlock_func_table())
122 #define RPC_DO_RES(fn, args) (khronos_server_lock_func_table(client_library_get_connection())->fn args)
123 #else
124 #define RPC_DO(fn, args) fn args
125 #define RPC_DO_RES(fn, args) fn args
126 #endif
127 /*
128    RPC_CALL[n](fn, id, RPC_THING(p0), RPC_THING(p1), ...)
129 
130    Implementation notes:
131 
132    In direct mode, fn is called directly and id is ignored.
133    Otherwise fn is ignored and an RPC message is constructed based on id.
134 
135    Preconditions:
136 
137    p0, p1, etc. satisfy the precondition to fn
138    id matches fn
139    Server is up (except for a special initialise call)
140 
141    Postconditions:
142 
143    We promise to call fn on the server at some point in the future. The RPC calls for this
144    thread will occur in the same order they are made on the client.
145    All postconditions of fn will be satisfied (on the server)
146 
147    Invariants preserved:
148 
149    -
150 
151    Invariants used:
152 
153    -
154 */
155 #define RPC_CALL8_MAKECURRENT(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7)                                             RPC_CALL8(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7)
156 
157 #define RPC_CALL0(fn, thread, id)                                          RPC_DO(fn, ())
158 #define RPC_CALL1(fn, thread, id, p0)                                      RPC_DO(fn, (p0))
159 #define RPC_CALL2(fn, thread, id, p0, p1)                                  RPC_DO(fn, (p0, p1))
160 #define RPC_CALL3(fn, thread, id, p0, p1, p2)                              RPC_DO(fn, (p0, p1, p2))
161 #define RPC_CALL4(fn, thread, id, p0, p1, p2, p3)                          RPC_DO(fn, (p0, p1, p2, p3))
162 #define RPC_CALL5(fn, thread, id, p0, p1, p2, p3, p4)                      RPC_DO(fn, (p0, p1, p2, p3, p4))
163 #define RPC_CALL6(fn, thread, id, p0, p1, p2, p3, p4, p5)                  RPC_DO(fn, (p0, p1, p2, p3, p4, p5))
164 #define RPC_CALL7(fn, thread, id, p0, p1, p2, p3, p4, p5, p6)              RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6))
165 #define RPC_CALL8(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7)          RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7))
166 #define RPC_CALL9(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8)      RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8))
167 #define RPC_CALL10(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9))
168 #define RPC_CALL11(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))
169 #define RPC_CALL16(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) \
170    RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15))
171 
172 /*
173    RPC_THING_RES(RPC_CALL[n]_RES(fn, id, RPC_THING(p0), RPC_THING(p1), ...))
174 
175    Implementation notes:
176 
177    In direct mode, fn is called directly and id is ignored.
178    Otherwise fn is ignored and an RPC message is constructed based on id.
179 
180    Preconditions:
181 
182    p0, p1, etc. satisfy the precondition to fn
183    id matches fn
184    Server is up (except for a special initialise call)
185 
186    Postconditions:
187 
188    The call to fn on the server has completed
189    We return the return value of fn, and all postconditions of fn are satisfied (on the server)
190 
191    Invariants preserved:
192 
193    -
194 
195    Invariants used:
196 
197    -
198 */
199 
200 #define RPC_CALL0_RES(fn, thread, id)                                                    RPC_DO_RES(fn, ())
201 #define RPC_CALL1_RES(fn, thread, id, p0)                                                RPC_DO_RES(fn, (p0))
202 #define RPC_CALL2_RES(fn, thread, id, p0, p1)                                            RPC_DO_RES(fn, (p0, p1))
203 #define RPC_CALL3_RES(fn, thread, id, p0, p1, p2)                                        RPC_DO_RES(fn, (p0, p1, p2))
204 #define RPC_CALL4_RES(fn, thread, id, p0, p1, p2, p3)                                    RPC_DO_RES(fn, (p0, p1, p2, p3))
205 #define RPC_CALL5_RES(fn, thread, id, p0, p1, p2, p3, p4)                                RPC_DO_RES(fn, (p0, p1, p2, p3, p4))
206 #define RPC_CALL6_RES(fn, thread, id, p0, p1, p2, p3, p4, p5)                            RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5))
207 #define RPC_CALL7_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6)                        RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6))
208 #define RPC_CALL8_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7)                    RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7))
209 #define RPC_CALL9_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8)                RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8))
210 #define RPC_CALL10_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)           RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9))
211 #define RPC_CALL11_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)      RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))
212 #define RPC_CALL12_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11))
213 
214 /*
215    message with data in/out via control channel
216 */
217 
218 #define RPC_CALL1_IN_CTRL(fn, thread, id, in, len)                                      RPC_DO(fn, (in))
219 #define RPC_CALL2_IN_CTRL(fn, thread, id, p0, in, len)                                  RPC_DO(fn, (p0, in))
220 #define RPC_CALL3_IN_CTRL(fn, thread, id, p0, p1, in, len)                              RPC_DO(fn, (p0, p1, in))
221 #define RPC_CALL4_IN_CTRL(fn, thread, id, p0, p1, p2, in, len)                          RPC_DO(fn, (p0, p1, p2, in))
222 #define RPC_CALL5_IN_CTRL(fn, thread, id, p0, p1, p2, p3, in, len)                      RPC_DO(fn, (p0, p1, p2, p3, in))
223 #define RPC_CALL6_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, in, len)                  RPC_DO(fn, (p0, p1, p2, p3, p4, in))
224 #define RPC_CALL7_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, in, len)              RPC_DO(fn, (p0, p1, p2, p3, p4, p5, in))
225 #define RPC_CALL8_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)          RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, in))
226 #define RPC_CALL9_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)      RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, in))
227 #define RPC_CALL10_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, in))
228 
229 /*
230    RPC_CALL[n]_OUT_CTRL(fn, id, RPC_THING(p0), RPC_THING(p1), ..., out)
231 
232    Implementation notes:
233 
234    In direct mode, fn is called directly and id is ignored.
235    Otherwise fn is ignored and an RPC message is constructed based on id.
236    The dispatch code is responsible for calculating the length of the returned data.
237 
238    Preconditions:
239 
240    p0, p1, ..., out satisfy the precondition to fn
241    id matches fn
242    Server is up (except for a special initialise call)
243 
244    Postconditions:
245 
246    The call to fn on the server has completed
247    We return whatever fn returned in out
248 
249    Invariants preserved:
250 
251    -
252 
253    Invariants used:
254 
255    -
256 */
257 
258 #define RPC_CALL1_OUT_CTRL(fn, thread, id, out)                                               RPC_DO(fn, (out))
259 #define RPC_CALL2_OUT_CTRL(fn, thread, id, p0, out)                                           RPC_DO(fn, (p0, out))
260 #define RPC_CALL3_OUT_CTRL(fn, thread, id, p0, p1, out)                                       RPC_DO(fn, (p0, p1, out))
261 #define RPC_CALL4_OUT_CTRL(fn, thread, id, p0, p1, p2, out)                                   RPC_DO(fn, (p0, p1, p2, out))
262 #define RPC_CALL5_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, out)                               RPC_DO(fn, (p0, p1, p2, p3, out))
263 #define RPC_CALL6_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, out)                           RPC_DO(fn, (p0, p1, p2, p3, p4, out))
264 #define RPC_CALL7_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, out)                       RPC_DO(fn, (p0, p1, p2, p3, p4, p5, out))
265 #define RPC_CALL8_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)                   RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, out))
266 #define RPC_CALL9_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)               RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, out))
267 #define RPC_CALL10_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out)          RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, out))
268 #define RPC_CALL11_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, out)      RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, out))
269 #define RPC_CALL12_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, out) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, out))
270 #define RPC_CALL13_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, out)      RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, out))
271 #define RPC_CALL14_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, out) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, out))
272 #define RPC_CALL15_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, out) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, out))
273 
274 #define RPC_CALL1_OUT_CTRL_RES(fn, thread, id, out)                                      RPC_DO_RES(fn, (out))
275 #define RPC_CALL2_OUT_CTRL_RES(fn, thread, id, p0, out)                                  RPC_DO_RES(fn, (p0, out))
276 #define RPC_CALL3_OUT_CTRL_RES(fn, thread, id, p0, p1, out)                              RPC_DO_RES(fn, (p0, p1, out))
277 #define RPC_CALL4_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, out)                          RPC_DO_RES(fn, (p0, p1, p2, out))
278 #define RPC_CALL5_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, out)                      RPC_DO_RES(fn, (p0, p1, p2, p3, out))
279 #define RPC_CALL6_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, out)                  RPC_DO_RES(fn, (p0, p1, p2, p3, p4, out))
280 #define RPC_CALL7_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, out)              RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, out))
281 #define RPC_CALL8_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)          RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, out))
282 #define RPC_CALL9_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)      RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, out))
283 #define RPC_CALL10_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out) RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, out))
284 
285 /*
286    message with data in/out via bulk channel
287 */
288 
289 #define RPC_CALL1_IN_BULK(fn, thread, id, in, len)                                      RPC_DO(fn, (in))
290 #define RPC_CALL2_IN_BULK(fn, thread, id, p0, in, len)                                  RPC_DO(fn, (p0, in))
291 #define RPC_CALL3_IN_BULK(fn, thread, id, p0, p1, in, len)                              RPC_DO(fn, (p0, p1, in))
292 #define RPC_CALL4_IN_BULK(fn, thread, id, p0, p1, p2, in, len)                          RPC_DO(fn, (p0, p1, p2, in))
293 #define RPC_CALL5_IN_BULK(fn, thread, id, p0, p1, p2, p3, in, len)                      RPC_DO(fn, (p0, p1, p2, p3, in))
294 #define RPC_CALL6_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, in, len)                  RPC_DO(fn, (p0, p1, p2, p3, p4, in))
295 #define RPC_CALL7_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, in, len)              RPC_DO(fn, (p0, p1, p2, p3, p4, p5, in))
296 #define RPC_CALL8_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)          RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, in))
297 #define RPC_CALL9_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)      RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, in))
298 #define RPC_CALL10_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, in))
299 
300 #define RPC_CALL1_OUT_BULK(fn, thread, id, out)                                      RPC_DO(fn, (out))
301 #define RPC_CALL2_OUT_BULK(fn, thread, id, p0, out)                                  RPC_DO(fn, (p0, out))
302 #define RPC_CALL3_OUT_BULK(fn, thread, id, p0, p1, out)                              RPC_DO(fn, (p0, p1, out))
303 #define RPC_CALL4_OUT_BULK(fn, thread, id, p0, p1, p2, out)                          RPC_DO(fn, (p0, p1, p2, out))
304 #define RPC_CALL5_OUT_BULK(fn, thread, id, p0, p1, p2, p3, out)                      RPC_DO(fn, (p0, p1, p2, p3, out))
305 #define RPC_CALL6_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, out)                  RPC_DO(fn, (p0, p1, p2, p3, p4, out))
306 #define RPC_CALL7_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, out)              RPC_DO(fn, (p0, p1, p2, p3, p4, p5, out))
307 #define RPC_CALL8_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)          RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, out))
308 #define RPC_CALL9_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)      RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, out))
309 #define RPC_CALL10_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out) RPC_DO(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, out))
310 
311 #define RPC_CALL1_IN_BULK_RES(fn, thread, id, in, len)                                      RPC_DO_RES(fn, (in))
312 #define RPC_CALL2_IN_BULK_RES(fn, thread, id, p0, in, len)                                  RPC_DO_RES(fn, (p0, in))
313 #define RPC_CALL3_IN_BULK_RES(fn, thread, id, p0, p1, in, len)                              RPC_DO_RES(fn, (p0, p1, in))
314 #define RPC_CALL4_IN_BULK_RES(fn, thread, id, p0, p1, p2, in, len)                          RPC_DO_RES(fn, (p0, p1, p2, in))
315 #define RPC_CALL5_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, in, len)                      RPC_DO_RES(fn, (p0, p1, p2, p3, in))
316 #define RPC_CALL6_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, in, len)                  RPC_DO_RES(fn, (p0, p1, p2, p3, p4, in))
317 #define RPC_CALL7_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, in, len)              RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, in))
318 #define RPC_CALL8_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)          RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, in))
319 #define RPC_CALL9_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)      RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, in))
320 #define RPC_CALL10_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len) RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, in))
321 
322 #define RPC_CALL1_OUT_BULK_RES(fn, thread, id, out)                                      RPC_DO_RES(fn, (out))
323 #define RPC_CALL2_OUT_BULK_RES(fn, thread, id, p0, out)                                  RPC_DO_RES(fn, (p0, out))
324 #define RPC_CALL3_OUT_BULK_RES(fn, thread, id, p0, p1, out)                              RPC_DO_RES(fn, (p0, p1, out))
325 #define RPC_CALL4_OUT_BULK_RES(fn, thread, id, p0, p1, p2, out)                          RPC_DO_RES(fn, (p0, p1, p2, out))
326 #define RPC_CALL5_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, out)                      RPC_DO_RES(fn, (p0, p1, p2, p3, out))
327 #define RPC_CALL6_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, out)                  RPC_DO_RES(fn, (p0, p1, p2, p3, p4, out))
328 #define RPC_CALL7_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, out)              RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, out))
329 #define RPC_CALL8_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)          RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, out))
330 #define RPC_CALL9_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)      RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, out))
331 #define RPC_CALL10_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out) RPC_DO_RES(fn, (p0, p1, p2, p3, p4, p5, p6, p7, p8, out))
332 
333 #else /* RPC_DIRECT */
334 
335 #include "interface/khronos/common/khrn_int_ids.h"
336 
337 #include "interface/khronos/include/GLES/gl.h"
338 #include "interface/khronos/include/VG/openvg.h"
339 
340 #include <string.h>
341 
342 /******************************************************************************
343 core api
344 ******************************************************************************/
345 
346 extern bool khclient_rpc_init(void);
347 extern void rpc_term(void);
348 
349 extern void rpc_flush(CLIENT_THREAD_STATE_T *thread);
350 extern void rpc_high_priority_begin(CLIENT_THREAD_STATE_T *thread);
351 extern void rpc_high_priority_end(CLIENT_THREAD_STATE_T *thread);
352 
353 extern uint64_t rpc_get_client_id(CLIENT_THREAD_STATE_T *thread);
354 
355 static INLINE uint32_t rpc_pad_ctrl(uint32_t len) { return (len + 0x3) & ~0x3; }
356 static INLINE uint32_t rpc_pad_bulk(uint32_t len) { return len; }
357 
358 /* returns the length of the remainder of the merge buffer (after a flush if this length would be < len_min) */
359 extern uint32_t rpc_send_ctrl_longest(CLIENT_THREAD_STATE_T *thread, uint32_t len_min);
360 
361 extern void rpc_send_ctrl_begin(CLIENT_THREAD_STATE_T *thread, uint32_t len); /* sum of padded lengths -- use rpc_pad_ctrl */
362 extern void rpc_send_ctrl_write(CLIENT_THREAD_STATE_T *thread, const uint32_t msg[], uint32_t msglen); /* len bytes read, rpc_pad_ctrl(len) bytes written */
363 extern void rpc_send_ctrl_end(CLIENT_THREAD_STATE_T *thread);
364 
365 extern void rpc_send_bulk(CLIENT_THREAD_STATE_T *thread, const void *in, uint32_t len); /* len bytes read, rpc_pad_bulk(len) bytes written. in must remain valid until the next "releasing" rpc_end call */
366 extern void rpc_send_bulk_gather(CLIENT_THREAD_STATE_T *thread, const void *in, uint32_t len, int32_t stride, uint32_t n); /* n * len bytes read, rpc_pad_bulk(n * len) bytes written */
367 
368 typedef enum {
369    RPC_RECV_FLAG_RES          = 1 << 0,
370    RPC_RECV_FLAG_CTRL         = 1 << 1,
371    RPC_RECV_FLAG_BULK         = 1 << 2, /* len bytes written, rpc_pad_bulk(len) bytes read */
372    RPC_RECV_FLAG_BULK_SCATTER = 1 << 3, /* len = { len, stride, n, first_mask, last_mask }, n * len bytes written, rpc_pad_bulk(n * len) bytes read */
373    RPC_RECV_FLAG_LEN          = 1 << 4  /* len provided by other side */
374 } RPC_RECV_FLAG_T;
375 
376 extern uint32_t rpc_recv(CLIENT_THREAD_STATE_T *thread, void *out, uint32_t *len, RPC_RECV_FLAG_T flags);
377 extern void rpc_recv_bulk_gather(CLIENT_THREAD_STATE_T *thread, void *out, uint32_t *len, RPC_RECV_FLAG_T flags); /* n * len bytes read, rpc_pad_bulk(n * len) bytes written */
378 
379 /*
380    all rpc macros and rpc_send_ctrl_begin/rpc_send_ctrl_write/rpc_send_ctrl_end
381    are atomic by themselves and do not require calls to rpc_begin/rpc_end
382 
383    rpc_begin/rpc_end can be nested, ie the following code will not deadlock:
384 
385    rpc_begin(thread);
386    rpc_begin(thread);
387    rpc_end(thread);
388    rpc_end(thread);
389 */
390 
391 extern void rpc_begin(CLIENT_THREAD_STATE_T *thread);
392 extern void rpc_end(CLIENT_THREAD_STATE_T *thread);
393 
394 /******************************************************************************
395 helpers
396 ******************************************************************************/
397 
398 static INLINE void rpc_gather(void *out, const void *in, uint32_t len, int32_t stride, uint32_t n)
399 {
400    uint32_t i;
401    for (i = 0; i != n; ++i) {
402       memcpy((uint8_t *)out + (i * len), in, len);
403       in = (const uint8_t *)in + stride;
404    }
405 }
406 
407 static INLINE void rpc_scatter(void *out, uint32_t len, int32_t stride, uint32_t n, uint32_t first_mask, uint32_t last_mask, const void *in)
408 {
409    uint32_t i;
410    for (i = 0; i != n; ++i) {
411       uint32_t first = 0, last = 0;
412       if (first_mask) { first = ((uint8_t *)out)[0] & first_mask; }
413       if (last_mask) { last = ((uint8_t *)out)[len - 1] & last_mask; }
414       memcpy(out, (const uint8_t *)in + (i * len), len);
415       if (first_mask) { ((uint8_t *)out)[0] = (uint8_t)((((uint8_t *)out)[0] & ~first_mask) | first); }
416       if (last_mask) { ((uint8_t *)out)[len - 1] = (uint8_t)((((uint8_t *)out)[len - 1] & ~last_mask) | last); }
417       out = (uint8_t *)out + stride;
418    }
419 }
420 
421 /******************************************************************************
422 type packing/unpacking macros
423 ******************************************************************************/
424 
425 #define RPC_FLOAT(f)        (float_to_bits(f))
426 #define RPC_ENUM(e)         ((uint32_t)(e))
427 #define RPC_INT(i)          ((uint32_t)(i))
428 #define RPC_INTPTR(p)       ((uint32_t)(p))
429 #define RPC_UINT(u)         ((uint32_t)(u))
430 #define RPC_SIZEI(s)        ((uint32_t)(s))
431 #define RPC_SIZEIPTR(p)     ((uint32_t)(p))
432 #define RPC_BOOLEAN(b)      ((uint32_t)(b))
433 #define RPC_BITFIELD(b)     ((uint32_t)(b))
434 #define RPC_FIXED(f)        ((uint32_t)(f))
435 #define RPC_HANDLE(h)       ((uint32_t)(h))
436 #define RPC_EGLID(i)        ((uint32_t)(size_t)(i))
437 
438 #define RPC_FLOAT_RES(f)    (float_from_bits(f))
439 #define RPC_ENUM_RES(e)     ((GLenum)(e))
440 #define RPC_INT_RES(i)      ((GLint)(i))
441 #define RPC_UINT_RES(u)     ((GLuint)(u))
442 #define RPC_BOOLEAN_RES(b)  (!!(b))
443 #define RPC_BITFIELD_RES(b) ((GLbitfield)(b))
444 #define RPC_HANDLE_RES(h)   ((VGHandle)(h))
445 
446 /******************************************************************************
447 rpc call macros
448 ******************************************************************************/
449 
450 #define RPC_INIT() khclient_rpc_init()
451 #define RPC_TERM() rpc_term()
452 
453 #define RPC_FLUSH(thread) rpc_flush(thread)
454 #define RPC_HIGH_PRIORITY_BEGIN(thread) rpc_high_priority_begin(thread)
455 #define RPC_HIGH_PRIORITY_END(thread) rpc_high_priority_end(thread)
456 
457 #define RPC_CALL8_MAKECURRENT(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7)                                             rpc_call8_makecurrent(thread, id, p0, p1, p2, p3, p4, p5, p6, p7)
458 void rpc_call8_makecurrent(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7);
459 uint32_t khronos_kernel_semaphore_create( uint32_t name, uint32_t count );
460 uint32_t khronos_kernel_semaphore_acquire( uint32_t semaphore );
461 uint32_t khronos_kernel_semaphore_acquire_and_release( uint32_t semaphore );
462 uint32_t khronos_kernel_semaphore_release( uint32_t semaphore );
463 uint32_t khronos_kernel_semaphore_destroy( uint32_t semaphore );
464 
465 /*
466    helper macros (shouldn't be used directly)
467 */
468 
469 # if defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
470 #else
471 #ifdef __HIGHC__
472    /*
473       use XXX.../XXX syntax for variadic macros
474    */
475 
476    #define RPC_CALL(thread, ARGS...) \
477       do { \
478          uint32_t message_[] = { ARGS }; \
479          rpc_send_ctrl_begin(thread, sizeof(message_)); \
480          rpc_send_ctrl_write(thread, message_, sizeof(message_)); \
481          rpc_send_ctrl_end(thread); \
482       } while (0)
483 
484    #define RPC_CALL_IN_CTRL(thread, IN, LEN, ARGS...) \
485       do { \
486          const void *in_ = IN; \
487          uint32_t len_ = LEN; \
488          uint32_t message_[] = { ARGS }; \
489          rpc_send_ctrl_begin(thread, sizeof(message_) + rpc_pad_ctrl(len_)); \
490          rpc_send_ctrl_write(thread, message_, sizeof(message_)); \
491          rpc_send_ctrl_write(thread, (uint32_t *)in_, len_); \
492          rpc_send_ctrl_end(thread); \
493       } while (0)
494 
495    #define RPC_CALL_IN_BULK(thread, IN, LEN, ARGS...) \
496       do { \
497          const void *in_ = IN; \
498          uint32_t len_ = LEN; \
499          uint32_t message_[] = { ARGS, in_ ? len_ : LENGTH_SIGNAL_NULL }; \
500          rpc_send_ctrl_begin(thread, sizeof(message_)); \
501          rpc_send_ctrl_write(thread, message_, sizeof(message_)); \
502          rpc_send_ctrl_end(thread); \
503          rpc_send_bulk(thread, in_, len_); \
504       } while (0)
505 #else
506    /*
507       use c99 .../__VA_ARGS__ syntax for variadic macros
508    */
509 
510    #define RPC_CALL(thread, ...) \
511       do { \
512          uint32_t message_[] = { __VA_ARGS__ }; \
513          rpc_send_ctrl_begin(thread, sizeof(message_)); \
514          rpc_send_ctrl_write(thread, message_, sizeof(message_)); \
515          rpc_send_ctrl_end(thread); \
516       } while (0)
517 
518    #define RPC_CALL_IN_CTRL(thread, IN, LEN, ...) \
519       do { \
520          const void *in_ = IN; \
521          uint32_t len_ = LEN; \
522          uint32_t message_[] = { __VA_ARGS__ }; \
523          rpc_send_ctrl_begin(thread, sizeof(message_) + rpc_pad_ctrl(len_)); \
524          rpc_send_ctrl_write(thread, message_, sizeof(message_)); \
525          rpc_send_ctrl_write(thread, in_, len_); \
526          rpc_send_ctrl_end(thread); \
527       } while (0)
528 
529    #define RPC_CALL_IN_BULK(thread, IN, LEN, ...) \
530       do { \
531          const void *in_ = IN; \
532          uint32_t len_ = LEN; \
533          uint32_t message_[] = { __VA_ARGS__, in_ ? len_ : LENGTH_SIGNAL_NULL }; \
534          rpc_send_ctrl_begin(thread, sizeof(message_)); \
535          rpc_send_ctrl_write(thread, message_, sizeof(message_)); \
536          rpc_send_ctrl_end(thread); \
537          rpc_send_bulk(thread, in_, len_); \
538       } while (0)
539 
540 #endif
541 #endif
542 
543 /*
544    just message
545 */
546 
547 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
548 static INLINE void rpc_call0(CLIENT_THREAD_STATE_T *thread, uint32_t id)                                                                                                                                    { RPC_CALL(thread, id);                                         }
549 static INLINE void rpc_call1(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0)                                                                                                                       { RPC_CALL(thread, id, p0);                                     }
550 static INLINE void rpc_call2(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1)                                                                                                          { RPC_CALL(thread, id, p0, p1);                                 }
551 static INLINE void rpc_call3(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2)                                                                                             { RPC_CALL(thread, id, p0, p1, p2);                             }
552 static INLINE void rpc_call4(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3)                                                                                { RPC_CALL(thread, id, p0, p1, p2, p3);                         }
553 static INLINE void rpc_call5(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4)                                                                   { RPC_CALL(thread, id, p0, p1, p2, p3, p4);                     }
554 static INLINE void rpc_call6(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5)                                                      { RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5);                 }
555 static INLINE void rpc_call7(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6)                                         { RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6);             }
556 static INLINE void rpc_call8(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7)                            { RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7);         }
557 static INLINE void rpc_call9(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8)               { RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8);     }
558 static INLINE void rpc_call10(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9) { RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
559 static INLINE void rpc_call16(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7,
560    uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, uint32_t p12, uint32_t p13, uint32_t p14, uint32_t p15)
561    { RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); }
562 static INLINE void rpc_call18(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7,
563    uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, uint32_t p12, uint32_t p13, uint32_t p14, uint32_t p15, uint32_t p16, uint32_t p17)
564    { RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17); }
565 
566 #endif
567 
568 #define RPC_CALL0(fn, thread, id)                                          rpc_call0(thread, id)
569 #define RPC_CALL1(fn, thread, id, p0)                                      rpc_call1(thread, id, p0)
570 #define RPC_CALL2(fn, thread, id, p0, p1)                                  rpc_call2(thread, id, p0, p1)
571 #define RPC_CALL3(fn, thread, id, p0, p1, p2)                              rpc_call3(thread, id, p0, p1, p2)
572 #define RPC_CALL4(fn, thread, id, p0, p1, p2, p3)                          rpc_call4(thread, id, p0, p1, p2, p3)
573 #define RPC_CALL5(fn, thread, id, p0, p1, p2, p3, p4)                      rpc_call5(thread, id, p0, p1, p2, p3, p4)
574 #define RPC_CALL6(fn, thread, id, p0, p1, p2, p3, p4, p5)                  rpc_call6(thread, id, p0, p1, p2, p3, p4, p5)
575 #define RPC_CALL7(fn, thread, id, p0, p1, p2, p3, p4, p5, p6)              rpc_call7(thread, id, p0, p1, p2, p3, p4, p5, p6)
576 #define RPC_CALL8(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7)          rpc_call8(thread, id, p0, p1, p2, p3, p4, p5, p6, p7)
577 #define RPC_CALL9(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8)      rpc_call9(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8)
578 #define RPC_CALL10(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) rpc_call10(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)
579 #define RPC_CALL11(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) rpc_call10(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
580 #define RPC_CALL16(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) \
581    rpc_call16(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15)
582 #define RPC_CALL18(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17) \
583    rpc_call18(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17)
584 
585 /*
586    RPC_THING_RES(rpc_call[n]_res(id, RPC_THING(p0), RPC_THING(p1), ...))
587 
588    Implementation notes:
589 
590    -
591 
592    Preconditions:
593 
594    Not in RPC_DIRECT mode
595    p0, p1, etc. satisfy the preconditions of the operation identified by id
596    Server is up (except for a special initialise call)
597 
598    Postconditions:
599 
600    The operation identified by id has completed on the server
601    We return the result of this operation, and all postconditions are satisfied (on the server)
602 
603    Invariants preserved:
604 
605    -
606 
607    Invariants used:
608 
609    -
610 */
611 
612 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
613 static INLINE uint32_t rpc_call0_res(CLIENT_THREAD_STATE_T *thread, uint32_t id)                                                                                                                                                                { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id);                                                   res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
614 static INLINE uint32_t rpc_call1_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0)                                                                                                                                                   { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0);                                               res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
615 static INLINE uint32_t rpc_call2_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1)                                                                                                                                      { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1);                                           res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
616 static INLINE uint32_t rpc_call3_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2)                                                                                                                         { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2);                                       res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
617 static INLINE uint32_t rpc_call4_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3)                                                                                                            { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3);                                   res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
618 static INLINE uint32_t rpc_call5_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4)                                                                                               { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4);                               res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
619 static INLINE uint32_t rpc_call6_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5)                                                                                  { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5);                           res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
620 static INLINE uint32_t rpc_call7_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6)                                                                     { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6);                       res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
621 static INLINE uint32_t rpc_call8_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7)                                                        { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7);                   res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
622 static INLINE uint32_t rpc_call9_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8)                                           { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8);               res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
623 static INLINE uint32_t rpc_call10_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9)                             { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);           res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
624 static INLINE uint32_t rpc_call11_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10)               { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);      res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
625 static INLINE uint32_t rpc_call12_res(CLIENT_THREAD_STATE_T *thread, uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11) { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
626 #endif
627 
628 #define RPC_CALL0_RES(fn, thread, id)                                                    rpc_call0_res(thread, id)
629 #define RPC_CALL1_RES(fn, thread, id, p0)                                                rpc_call1_res(thread, id, p0)
630 #define RPC_CALL2_RES(fn, thread, id, p0, p1)                                            rpc_call2_res(thread, id, p0, p1)
631 #define RPC_CALL3_RES(fn, thread, id, p0, p1, p2)                                        rpc_call3_res(thread, id, p0, p1, p2)
632 #define RPC_CALL4_RES(fn, thread, id, p0, p1, p2, p3)                                    rpc_call4_res(thread, id, p0, p1, p2, p3)
633 #define RPC_CALL5_RES(fn, thread, id, p0, p1, p2, p3, p4)                                rpc_call5_res(thread, id, p0, p1, p2, p3, p4)
634 #define RPC_CALL6_RES(fn, thread, id, p0, p1, p2, p3, p4, p5)                            rpc_call6_res(thread, id, p0, p1, p2, p3, p4, p5)
635 #define RPC_CALL7_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6)                        rpc_call7_res(thread, id, p0, p1, p2, p3, p4, p5, p6)
636 #define RPC_CALL8_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7)                    rpc_call8_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7)
637 #define RPC_CALL9_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8)                rpc_call9_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8)
638 #define RPC_CALL10_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)           rpc_call10_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)
639 #define RPC_CALL11_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)      rpc_call11_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
640 #define RPC_CALL12_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) rpc_call12_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
641 
642 /*
643    message with data in/out via control channel
644 */
645 
646 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
647 static INLINE void rpc_call1_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, const void *in, uint32_t len)                                                                                                                       { RPC_CALL_IN_CTRL(thread, in, len, id);                                     }
648 static INLINE void rpc_call2_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, const void *in, uint32_t len)                                                                                                          { RPC_CALL_IN_CTRL(thread, in, len, id, p0);                                 }
649 static INLINE void rpc_call3_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, const void *in, uint32_t len)                                                                                             { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1);                             }
650 static INLINE void rpc_call4_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, const void *in, uint32_t len)                                                                                { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1, p2);                         }
651 static INLINE void rpc_call5_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, const void *in, uint32_t len)                                                                   { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1, p2, p3);                     }
652 static INLINE void rpc_call6_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, const void *in, uint32_t len)                                                      { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1, p2, p3, p4);                 }
653 static INLINE void rpc_call7_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, const void *in, uint32_t len)                                         { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1, p2, p3, p4, p5);             }
654 static INLINE void rpc_call8_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, const void *in, uint32_t len)                            { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6);         }
655 static INLINE void rpc_call9_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, const void *in, uint32_t len)               { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6, p7);     }
656 static INLINE void rpc_call10_in_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, const void *in, uint32_t len) { RPC_CALL_IN_CTRL(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6, p7, p8); }
657 
658 #endif
659 
660 #define RPC_CALL1_IN_CTRL(fn, thread, id, in, len)                                      rpc_call1_in_ctrl(thread, id, in, len)
661 #define RPC_CALL2_IN_CTRL(fn, thread, id, p0, in, len)                                  rpc_call2_in_ctrl(thread, id, p0, in, len)
662 #define RPC_CALL3_IN_CTRL(fn, thread, id, p0, p1, in, len)                              rpc_call3_in_ctrl(thread, id, p0, p1, in, len)
663 #define RPC_CALL4_IN_CTRL(fn, thread, id, p0, p1, p2, in, len)                          rpc_call4_in_ctrl(thread, id, p0, p1, p2, in, len)
664 #define RPC_CALL5_IN_CTRL(fn, thread, id, p0, p1, p2, p3, in, len)                      rpc_call5_in_ctrl(thread, id, p0, p1, p2, p3, in, len)
665 #define RPC_CALL6_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, in, len)                  rpc_call6_in_ctrl(thread, id, p0, p1, p2, p3, p4, in, len)
666 #define RPC_CALL7_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, in, len)              rpc_call7_in_ctrl(thread, id, p0, p1, p2, p3, p4, p5, in, len)
667 #define RPC_CALL8_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)          rpc_call8_in_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)
668 #define RPC_CALL9_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)      rpc_call9_in_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)
669 #define RPC_CALL10_IN_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len) rpc_call10_in_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len)
670 
671 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
672 static INLINE void rpc_call1_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, void *out)                                                                                                                                                  { rpc_begin(thread); RPC_CALL(thread, id);                                              rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
673 static INLINE void rpc_call2_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, void *out)                                                                                                                                     { rpc_begin(thread); RPC_CALL(thread, id, p0);                                          rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
674 static INLINE void rpc_call3_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, void *out)                                                                                                                        { rpc_begin(thread); RPC_CALL(thread, id, p0, p1);                                      rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
675 static INLINE void rpc_call4_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, void *out)                                                                                                           { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2);                                  rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
676 static INLINE void rpc_call5_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, void *out)                                                                                              { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3);                              rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
677 static INLINE void rpc_call6_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, void *out)                                                                                 { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4);                          rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
678 static INLINE void rpc_call7_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, void *out)                                                                    { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5);                      rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
679 static INLINE void rpc_call8_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, void *out)                                                       { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6);                  rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
680 static INLINE void rpc_call9_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, void *out)                                          { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7);              rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
681 static INLINE void rpc_call10_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, void *out)                            { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8);          rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
682 static INLINE void rpc_call11_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, void *out)               { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);      rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
683 static INLINE void rpc_call12_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
684 static INLINE void rpc_call13_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, void *out)               { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);      rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
685 static INLINE void rpc_call14_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, uint32_t p12, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
686 static INLINE void rpc_call15_out_ctrl(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, uint32_t p9, uint32_t p10, uint32_t p11, uint32_t p12, uint32_t p13, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
687 #endif
688 
689 #define RPC_CALL1_OUT_CTRL(fn, thread, id, out)                                               rpc_call1_out_ctrl(thread, id, out)
690 #define RPC_CALL2_OUT_CTRL(fn, thread, id, p0, out)                                           rpc_call2_out_ctrl(thread, id, p0, out)
691 #define RPC_CALL3_OUT_CTRL(fn, thread, id, p0, p1, out)                                       rpc_call3_out_ctrl(thread, id, p0, p1, out)
692 #define RPC_CALL4_OUT_CTRL(fn, thread, id, p0, p1, p2, out)                                   rpc_call4_out_ctrl(thread, id, p0, p1, p2, out)
693 #define RPC_CALL5_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, out)                               rpc_call5_out_ctrl(thread, id, p0, p1, p2, p3, out)
694 #define RPC_CALL6_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, out)                           rpc_call6_out_ctrl(thread, id, p0, p1, p2, p3, p4, out)
695 #define RPC_CALL7_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, out)                       rpc_call7_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, out)
696 #define RPC_CALL8_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)                   rpc_call8_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, out)
697 #define RPC_CALL9_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)               rpc_call9_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)
698 #define RPC_CALL10_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out)          rpc_call10_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out)
699 #define RPC_CALL11_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, out)      rpc_call11_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, out)
700 #define RPC_CALL12_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, out) rpc_call12_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, out)
701 #define RPC_CALL13_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, out)      rpc_call13_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, out)
702 #define RPC_CALL14_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, out) rpc_call14_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, out)
703 #define RPC_CALL15_OUT_CTRL(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, out) rpc_call15_out_ctrl(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, out)
704 
705 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
706 static INLINE uint32_t rpc_call1_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, void *out)                                                                                                                       { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id);                                     res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
707 static INLINE uint32_t rpc_call2_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, void *out)                                                                                                          { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0);                                 res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
708 static INLINE uint32_t rpc_call3_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, void *out)                                                                                             { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1);                             res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
709 static INLINE uint32_t rpc_call4_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, void *out)                                                                                { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2);                         res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
710 static INLINE uint32_t rpc_call5_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, void *out)                                                                   { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3);                     res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
711 static INLINE uint32_t rpc_call6_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, void *out)                                                      { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4);                 res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
712 static INLINE uint32_t rpc_call7_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, void *out)                                         { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5);             res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
713 static INLINE uint32_t rpc_call8_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, void *out)                            { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6);         res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
714 static INLINE uint32_t rpc_call9_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, void *out)               { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7);     res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
715 static INLINE uint32_t rpc_call10_out_ctrl_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, void *out) { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8); res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_CTRL | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
716 #endif
717 
718 #define RPC_CALL1_OUT_CTRL_RES(fn, thread, id, out)                                      rpc_call1_out_ctrl_res(thread, id, out)
719 #define RPC_CALL2_OUT_CTRL_RES(fn, thread, id, p0, out)                                  rpc_call2_out_ctrl_res(thread, id, p0, out)
720 #define RPC_CALL3_OUT_CTRL_RES(fn, thread, id, p0, p1, out)                              rpc_call3_out_ctrl_res(thread, id, p0, p1, out)
721 #define RPC_CALL4_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, out)                          rpc_call4_out_ctrl_res(thread, id, p0, p1, p2, out)
722 #define RPC_CALL5_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, out)                      rpc_call5_out_ctrl_res(thread, id, p0, p1, p2, p3, out)
723 #define RPC_CALL6_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, out)                  rpc_call6_out_ctrl_res(thread, id, p0, p1, p2, p3, p4, out)
724 #define RPC_CALL7_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, out)              rpc_call7_out_ctrl_res(thread, id, p0, p1, p2, p3, p4, p5, out)
725 #define RPC_CALL8_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)          rpc_call8_out_ctrl_res(thread, id, p0, p1, p2, p3, p4, p5, p6, out)
726 #define RPC_CALL9_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)      rpc_call9_out_ctrl_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)
727 #define RPC_CALL10_OUT_CTRL_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out) rpc_call10_out_ctrl_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out)
728 
729 /*
730    message with data in/out via bulk channel
731 
732    if in is NULL, no bulk transfer will be performed and LENGTH_SIGNAL_NULL will
733    be passed instead of len
734 */
735 
736 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
737 static INLINE void rpc_call1_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, const void *in, uint32_t len)                                                                                                                       { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id);                                     rpc_end(thread); }
738 static INLINE void rpc_call2_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, const void *in, uint32_t len)                                                                                                          { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0);                                 rpc_end(thread); }
739 static INLINE void rpc_call3_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, const void *in, uint32_t len)                                                                                             { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1);                             rpc_end(thread); }
740 static INLINE void rpc_call4_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, const void *in, uint32_t len)                                                                                { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2);                         rpc_end(thread); }
741 static INLINE void rpc_call5_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, const void *in, uint32_t len)                                                                   { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3);                     rpc_end(thread); }
742 static INLINE void rpc_call6_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, const void *in, uint32_t len)                                                      { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4);                 rpc_end(thread); }
743 static INLINE void rpc_call7_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, const void *in, uint32_t len)                                         { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5);             rpc_end(thread); }
744 static INLINE void rpc_call8_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, const void *in, uint32_t len)                            { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6);         rpc_end(thread); }
745 static INLINE void rpc_call9_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, const void *in, uint32_t len)               { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6, p7);     rpc_end(thread); }
746 static INLINE void rpc_call10_in_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, const void *in, uint32_t len) { rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6, p7, p8); rpc_end(thread); }
747 #endif
748 
749 #define RPC_CALL1_IN_BULK(fn, thread, id, in, len)                                      rpc_call1_in_bulk(thread, id, in, len)
750 #define RPC_CALL2_IN_BULK(fn, thread, id, p0, in, len)                                  rpc_call2_in_bulk(thread, id, p0, in, len)
751 #define RPC_CALL3_IN_BULK(fn, thread, id, p0, p1, in, len)                              rpc_call3_in_bulk(thread, id, p0, p1, in, len)
752 #define RPC_CALL4_IN_BULK(fn, thread, id, p0, p1, p2, in, len)                          rpc_call4_in_bulk(thread, id, p0, p1, p2, in, len)
753 #define RPC_CALL5_IN_BULK(fn, thread, id, p0, p1, p2, p3, in, len)                      rpc_call5_in_bulk(thread, id, p0, p1, p2, p3, in, len)
754 #define RPC_CALL6_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, in, len)                  rpc_call6_in_bulk(thread, id, p0, p1, p2, p3, p4, in, len)
755 #define RPC_CALL7_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, in, len)              rpc_call7_in_bulk(thread, id, p0, p1, p2, p3, p4, p5, in, len)
756 #define RPC_CALL8_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)          rpc_call8_in_bulk(thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)
757 #define RPC_CALL9_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)      rpc_call9_in_bulk(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)
758 #define RPC_CALL10_IN_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len) rpc_call10_in_bulk(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len)
759 
760 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
761 static INLINE void rpc_call1_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, void *out)                                                                                                                       { rpc_begin(thread); RPC_CALL(thread, id);                                     rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
762 static INLINE void rpc_call2_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, void *out)                                                                                                          { rpc_begin(thread); RPC_CALL(thread, id, p0);                                 rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
763 static INLINE void rpc_call3_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, void *out)                                                                                             { rpc_begin(thread); RPC_CALL(thread, id, p0, p1);                             rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
764 static INLINE void rpc_call4_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, void *out)                                                                                { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2);                         rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
765 static INLINE void rpc_call5_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, void *out)                                                                   { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3);                     rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
766 static INLINE void rpc_call6_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, void *out)                                                      { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4);                 rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
767 static INLINE void rpc_call7_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, void *out)                                         { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5);             rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
768 static INLINE void rpc_call8_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, void *out)                            { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6);         rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
769 static INLINE void rpc_call9_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, void *out)               { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7);     rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
770 static INLINE void rpc_call10_out_bulk(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, void *out) { rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8); rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); }
771 #endif
772 
773 #define RPC_CALL1_OUT_BULK(fn, thread, id, out)                                      rpc_call1_out_bulk(thread, id, out)
774 #define RPC_CALL2_OUT_BULK(fn, thread, id, p0, out)                                  rpc_call2_out_bulk(thread, id, p0, out)
775 #define RPC_CALL3_OUT_BULK(fn, thread, id, p0, p1, out)                              rpc_call3_out_bulk(thread, id, p0, p1, out)
776 #define RPC_CALL4_OUT_BULK(fn, thread, id, p0, p1, p2, out)                          rpc_call4_out_bulk(thread, id, p0, p1, p2, out)
777 #define RPC_CALL5_OUT_BULK(fn, thread, id, p0, p1, p2, p3, out)                      rpc_call5_out_bulk(thread, id, p0, p1, p2, p3, out)
778 #define RPC_CALL6_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, out)                  rpc_call6_out_bulk(thread, id, p0, p1, p2, p3, p4, out)
779 #define RPC_CALL7_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, out)              rpc_call7_out_bulk(thread, id, p0, p1, p2, p3, p4, p5, out)
780 #define RPC_CALL8_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)          rpc_call8_out_bulk(thread, id, p0, p1, p2, p3, p4, p5, p6, out)
781 #define RPC_CALL9_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)      rpc_call9_out_bulk(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)
782 #define RPC_CALL10_OUT_BULK(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out) rpc_call10_out_bulk(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out)
783 
784 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
785 static INLINE uint32_t rpc_call1_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, const void *in, uint32_t len)                                                                                                                       { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id);                                     res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
786 static INLINE uint32_t rpc_call2_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, const void *in, uint32_t len)                                                                                                          { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0);                                 res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
787 static INLINE uint32_t rpc_call3_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, const void *in, uint32_t len)                                                                                             { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1);                             res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
788 static INLINE uint32_t rpc_call4_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, const void *in, uint32_t len)                                                                                { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2);                         res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
789 static INLINE uint32_t rpc_call5_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, const void *in, uint32_t len)                                                                   { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3);                     res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
790 static INLINE uint32_t rpc_call6_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, const void *in, uint32_t len)                                                      { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4);                 res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
791 static INLINE uint32_t rpc_call7_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, const void *in, uint32_t len)                                         { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5);             res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
792 static INLINE uint32_t rpc_call8_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, const void *in, uint32_t len)                            { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6);         res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
793 static INLINE uint32_t rpc_call9_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, const void *in, uint32_t len)               { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6, p7);     res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
794 static INLINE uint32_t rpc_call10_in_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, const void *in, uint32_t len) { uint32_t res; rpc_begin(thread); RPC_CALL_IN_BULK(thread, in, len, id, p0, p1, p2, p3, p4, p5, p6, p7, p8); res = rpc_recv(thread, NULL, NULL, RPC_RECV_FLAG_RES); rpc_end(thread); return res; }
795 #endif
796 
797 #define RPC_CALL1_IN_BULK_RES(fn, thread, id, in, len)                                      rpc_call1_in_bulk_res(thread, id, in, len)
798 #define RPC_CALL2_IN_BULK_RES(fn, thread, id, p0, in, len)                                  rpc_call2_in_bulk_res(thread, id, p0, in, len)
799 #define RPC_CALL3_IN_BULK_RES(fn, thread, id, p0, p1, in, len)                              rpc_call3_in_bulk_res(thread, id, p0, p1, in, len)
800 #define RPC_CALL4_IN_BULK_RES(fn, thread, id, p0, p1, p2, in, len)                          rpc_call4_in_bulk_res(thread, id, p0, p1, p2, in, len)
801 #define RPC_CALL5_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, in, len)                      rpc_call5_in_bulk_res(thread, id, p0, p1, p2, p3, in, len)
802 #define RPC_CALL6_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, in, len)                  rpc_call6_in_bulk_res(thread, id, p0, p1, p2, p3, p4, in, len)
803 #define RPC_CALL7_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, in, len)              rpc_call7_in_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, in, len)
804 #define RPC_CALL8_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)          rpc_call8_in_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, p6, in, len)
805 #define RPC_CALL9_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)      rpc_call9_in_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, in, len)
806 #define RPC_CALL10_IN_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len) rpc_call10_in_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, in, len)
807 
808 # if !defined(__SYMBIAN32__)  //use functions defined in khrpc.cpp
809 static INLINE uint32_t rpc_call1_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, void *out)                                                                                                                       { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id);                                     res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
810 static INLINE uint32_t rpc_call2_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, void *out)                                                                                                          { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0);                                 res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
811 static INLINE uint32_t rpc_call3_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, void *out)                                                                                             { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1);                             res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
812 static INLINE uint32_t rpc_call4_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, void *out)                                                                                { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2);                         res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
813 static INLINE uint32_t rpc_call5_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, void *out)                                                                   { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3);                     res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
814 static INLINE uint32_t rpc_call6_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, void *out)                                                      { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4);                 res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
815 static INLINE uint32_t rpc_call7_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, void *out)                                         { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5);             res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
816 static INLINE uint32_t rpc_call8_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, void *out)                            { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6);         res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
817 static INLINE uint32_t rpc_call9_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, void *out)               { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7);     res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
818 static INLINE uint32_t rpc_call10_out_bulk_res(CLIENT_THREAD_STATE_T *thread,uint32_t id, uint32_t p0, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6, uint32_t p7, uint32_t p8, void *out) { uint32_t res; rpc_begin(thread); RPC_CALL(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8); res = rpc_recv(thread, out, NULL, (RPC_RECV_FLAG_T)(RPC_RECV_FLAG_RES | RPC_RECV_FLAG_BULK | RPC_RECV_FLAG_LEN)); rpc_end(thread); return res; }
819 #endif
820 
821 #define RPC_CALL1_OUT_BULK_RES(fn, thread, id, out)                                      rpc_call1_out_bulk_res(thread, id, out)
822 #define RPC_CALL2_OUT_BULK_RES(fn, thread, id, p0, out)                                  rpc_call2_out_bulk_res(thread, id, p0, out)
823 #define RPC_CALL3_OUT_BULK_RES(fn, thread, id, p0, p1, out)                              rpc_call3_out_bulk_res(thread, id, p0, p1, out)
824 #define RPC_CALL4_OUT_BULK_RES(fn, thread, id, p0, p1, p2, out)                          rpc_call4_out_bulk_res(thread, id, p0, p1, p2, out)
825 #define RPC_CALL5_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, out)                      rpc_call5_out_bulk_res(thread, id, p0, p1, p2, p3, out)
826 #define RPC_CALL6_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, out)                  rpc_call6_out_bulk_res(thread, id, p0, p1, p2, p3, p4, out)
827 #define RPC_CALL7_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, out)              rpc_call7_out_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, out)
828 #define RPC_CALL8_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, out)          rpc_call8_out_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, p6, out)
829 #define RPC_CALL9_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)      rpc_call9_out_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, out)
830 #define RPC_CALL10_OUT_BULK_RES(fn, thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out) rpc_call10_out_bulk_res(thread, id, p0, p1, p2, p3, p4, p5, p6, p7, p8, out)
831 
832 #endif /* RPC_DIRECT */
833 
834 #ifdef __cplusplus
835  }
836 #endif
837 #endif
838