[c594489] | 1 | /*
|
---|
[df4ed85] | 2 | * Copyright (c) 2006 Ondrej Palkovsky
|
---|
[c594489] | 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
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
[fadd381] | 29 | /** @addtogroup libc
|
---|
[b2951e2] | 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | */
|
---|
| 34 |
|
---|
[64d2b10] | 35 | #if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_)))
|
---|
| 36 | #error Do not intermix low-level IPC interface and async framework
|
---|
| 37 | #endif
|
---|
| 38 |
|
---|
[fadd381] | 39 | #ifndef LIBC_ASYNC_H_
|
---|
| 40 | #define LIBC_ASYNC_H_
|
---|
[630c3a9] | 41 |
|
---|
[64d2b10] | 42 | #include <ipc/common.h>
|
---|
[c1c0184] | 43 | #include <async_sess.h>
|
---|
[bc1f1c2] | 44 | #include <fibril.h>
|
---|
[f25b73d6] | 45 | #include <sys/time.h>
|
---|
[fc42b28] | 46 | #include <atomic.h>
|
---|
[0cc4313] | 47 | #include <bool.h>
|
---|
[64d2b10] | 48 | #include <task.h>
|
---|
[630c3a9] | 49 |
|
---|
[01ff41c] | 50 | typedef ipc_callid_t aid_t;
|
---|
[46eec3b] | 51 |
|
---|
| 52 | typedef void *(*async_client_data_ctor_t)(void);
|
---|
| 53 | typedef void (*async_client_data_dtor_t)(void *);
|
---|
| 54 |
|
---|
[11bb813] | 55 | typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *);
|
---|
[9db9b10] | 56 |
|
---|
[8619f25] | 57 | extern atomic_t threads_in_ipc_wait;
|
---|
| 58 |
|
---|
[db24058] | 59 | extern int __async_init(void);
|
---|
[11bb813] | 60 | extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t);
|
---|
[9db9b10] | 61 |
|
---|
[49d072e] | 62 | static inline ipc_callid_t async_get_call(ipc_call_t *data)
|
---|
| 63 | {
|
---|
| 64 | return async_get_call_timeout(data, 0);
|
---|
| 65 | }
|
---|
[440cff5] | 66 |
|
---|
[db24058] | 67 | static inline void async_manager(void)
|
---|
| 68 | {
|
---|
| 69 | fibril_switch(FIBRIL_TO_MANAGER);
|
---|
| 70 | }
|
---|
| 71 |
|
---|
[0cc4313] | 72 | /*
|
---|
| 73 | * User-friendly wrappers for async_send_fast() and async_send_slow(). The
|
---|
| 74 | * macros are in the form async_send_m(), where m denotes the number of payload
|
---|
| 75 | * arguments. Each macros chooses between the fast and the slow version based
|
---|
| 76 | * on m.
|
---|
[440cff5] | 77 | */
|
---|
| 78 |
|
---|
[0cc4313] | 79 | #define async_send_0(phoneid, method, dataptr) \
|
---|
[9db9b10] | 80 | async_send_fast((phoneid), (method), 0, 0, 0, 0, (dataptr))
|
---|
[0cc4313] | 81 | #define async_send_1(phoneid, method, arg1, dataptr) \
|
---|
[9db9b10] | 82 | async_send_fast((phoneid), (method), (arg1), 0, 0, 0, (dataptr))
|
---|
[0cc4313] | 83 | #define async_send_2(phoneid, method, arg1, arg2, dataptr) \
|
---|
[9db9b10] | 84 | async_send_fast((phoneid), (method), (arg1), (arg2), 0, 0, (dataptr))
|
---|
[0cc4313] | 85 | #define async_send_3(phoneid, method, arg1, arg2, arg3, dataptr) \
|
---|
[9db9b10] | 86 | async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (dataptr))
|
---|
[0cc4313] | 87 | #define async_send_4(phoneid, method, arg1, arg2, arg3, arg4, dataptr) \
|
---|
[9db9b10] | 88 | async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 89 | (dataptr))
|
---|
[0cc4313] | 90 | #define async_send_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
|
---|
[9db9b10] | 91 | async_send_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 92 | (arg5), (dataptr))
|
---|
[19b28b0] | 93 |
|
---|
[11bb813] | 94 | extern aid_t async_send_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 95 | sysarg_t, ipc_call_t *);
|
---|
| 96 | extern aid_t async_send_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 97 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 98 | extern void async_wait_for(aid_t, sysarg_t *);
|
---|
| 99 | extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
|
---|
[440cff5] | 100 |
|
---|
[3c22f70] | 101 | extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
|
---|
| 102 | ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *));
|
---|
[11bb813] | 103 | extern void async_usleep(suseconds_t);
|
---|
[9db9b10] | 104 | extern void async_create_manager(void);
|
---|
| 105 | extern void async_destroy_manager(void);
|
---|
[01ff41c] | 106 |
|
---|
[46eec3b] | 107 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
| 108 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
| 109 |
|
---|
[23882034] | 110 | extern void *async_client_data_get(void);
|
---|
| 111 |
|
---|
[11bb813] | 112 | extern void async_set_client_connection(async_client_conn_t);
|
---|
| 113 | extern void async_set_interrupt_received(async_client_conn_t);
|
---|
[0cc4313] | 114 |
|
---|
[64d2b10] | 115 | /*
|
---|
| 116 | * Wrappers for simple communication.
|
---|
| 117 | */
|
---|
| 118 |
|
---|
| 119 | extern void async_msg_0(int, sysarg_t);
|
---|
| 120 | extern void async_msg_1(int, sysarg_t, sysarg_t);
|
---|
| 121 | extern void async_msg_2(int, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 122 | extern void async_msg_3(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 123 | extern void async_msg_4(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 124 | extern void async_msg_5(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 125 | sysarg_t);
|
---|
| 126 |
|
---|
| 127 | /*
|
---|
| 128 | * Wrappers for answer routines.
|
---|
| 129 | */
|
---|
| 130 |
|
---|
| 131 | extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t);
|
---|
| 132 | extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t);
|
---|
| 133 | extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 134 | extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 135 | sysarg_t);
|
---|
| 136 | extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 137 | sysarg_t, sysarg_t);
|
---|
| 138 | extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 139 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 140 |
|
---|
| 141 | /*
|
---|
| 142 | * Wrappers for forwarding routines.
|
---|
| 143 | */
|
---|
| 144 |
|
---|
| 145 | extern int async_forward_fast(ipc_callid_t, int, int, sysarg_t, sysarg_t, int);
|
---|
| 146 | extern int async_forward_slow(ipc_callid_t, int, int, sysarg_t, sysarg_t,
|
---|
| 147 | sysarg_t, sysarg_t, sysarg_t, int);
|
---|
[0cc4313] | 148 |
|
---|
| 149 | /*
|
---|
| 150 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
| 151 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
[6b21292] | 152 | * and n is the number of return arguments. The macros decide between the fast
|
---|
[0cc4313] | 153 | * and slow verion based on m.
|
---|
| 154 | */
|
---|
[64d2b10] | 155 |
|
---|
[0cc4313] | 156 | #define async_req_0_0(phoneid, method) \
|
---|
[9db9b10] | 157 | async_req_fast((phoneid), (method), 0, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
| 158 | NULL)
|
---|
[0cc4313] | 159 | #define async_req_0_1(phoneid, method, r1) \
|
---|
[9db9b10] | 160 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), NULL, NULL, NULL, \
|
---|
| 161 | NULL)
|
---|
[0cc4313] | 162 | #define async_req_0_2(phoneid, method, r1, r2) \
|
---|
[9db9b10] | 163 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), NULL, NULL, \
|
---|
| 164 | NULL)
|
---|
[0cc4313] | 165 | #define async_req_0_3(phoneid, method, r1, r2, r3) \
|
---|
[9db9b10] | 166 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), NULL, \
|
---|
| 167 | NULL)
|
---|
[0cc4313] | 168 | #define async_req_0_4(phoneid, method, r1, r2, r3, r4) \
|
---|
[9db9b10] | 169 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
|
---|
| 170 | NULL)
|
---|
[0cc4313] | 171 | #define async_req_0_5(phoneid, method, r1, r2, r3, r4, r5) \
|
---|
[9db9b10] | 172 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
|
---|
| 173 | (r5))
|
---|
[0cc4313] | 174 | #define async_req_1_0(phoneid, method, arg1) \
|
---|
[9db9b10] | 175 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, NULL, NULL, NULL, \
|
---|
| 176 | NULL, NULL)
|
---|
[0cc4313] | 177 | #define async_req_1_1(phoneid, method, arg1, rc1) \
|
---|
[9db9b10] | 178 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), NULL, NULL, \
|
---|
| 179 | NULL, NULL)
|
---|
[0cc4313] | 180 | #define async_req_1_2(phoneid, method, arg1, rc1, rc2) \
|
---|
[9db9b10] | 181 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), NULL, \
|
---|
| 182 | NULL, NULL)
|
---|
[0cc4313] | 183 | #define async_req_1_3(phoneid, method, arg1, rc1, rc2, rc3) \
|
---|
[9db9b10] | 184 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
|
---|
| 185 | NULL, NULL)
|
---|
[0cc4313] | 186 | #define async_req_1_4(phoneid, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
[9db9b10] | 187 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
|
---|
| 188 | (rc4), NULL)
|
---|
[0cc4313] | 189 | #define async_req_1_5(phoneid, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
[9db9b10] | 190 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
|
---|
| 191 | (rc4), (rc5))
|
---|
[0cc4313] | 192 | #define async_req_2_0(phoneid, method, arg1, arg2) \
|
---|
[9db9b10] | 193 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL, NULL, \
|
---|
| 194 | NULL, NULL, NULL)
|
---|
[0cc4313] | 195 | #define async_req_2_1(phoneid, method, arg1, arg2, rc1) \
|
---|
[9db9b10] | 196 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), NULL, \
|
---|
| 197 | NULL, NULL, NULL)
|
---|
[0cc4313] | 198 | #define async_req_2_2(phoneid, method, arg1, arg2, rc1, rc2) \
|
---|
[9db9b10] | 199 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 200 | NULL, NULL, NULL)
|
---|
[0cc4313] | 201 | #define async_req_2_3(phoneid, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
[9db9b10] | 202 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 203 | (rc3), NULL, NULL)
|
---|
[0cc4313] | 204 | #define async_req_2_4(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
[9db9b10] | 205 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 206 | (rc3), (rc4), NULL)
|
---|
[0cc4313] | 207 | #define async_req_2_5(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
[9db9b10] | 208 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 209 | (rc3), (rc4), (rc5))
|
---|
[0cc4313] | 210 | #define async_req_3_0(phoneid, method, arg1, arg2, arg3) \
|
---|
[9db9b10] | 211 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, NULL, NULL, \
|
---|
| 212 | NULL, NULL, NULL)
|
---|
[0cc4313] | 213 | #define async_req_3_1(phoneid, method, arg1, arg2, arg3, rc1) \
|
---|
[9db9b10] | 214 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 215 | NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 216 | #define async_req_3_2(phoneid, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
[9db9b10] | 217 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 218 | (rc2), NULL, NULL, NULL)
|
---|
[0cc4313] | 219 | #define async_req_3_3(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
[9db9b10] | 220 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 221 | (rc2), (rc3), NULL, NULL)
|
---|
[0cc4313] | 222 | #define async_req_3_4(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
[9db9b10] | 223 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 224 | (rc2), (rc3), (rc4), NULL)
|
---|
[0cc4313] | 225 | #define async_req_3_5(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
| 226 | rc5) \
|
---|
| 227 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 228 | (rc2), (rc3), (rc4), (rc5))
|
---|
| 229 | #define async_req_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
|
---|
[9db9b10] | 230 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), NULL, \
|
---|
| 231 | NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 232 | #define async_req_4_1(phoneid, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
[9db9b10] | 233 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
|
---|
| 234 | NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 235 | #define async_req_4_2(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
[9db9b10] | 236 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
|
---|
| 237 | (rc2), NULL, NULL, NULL)
|
---|
[0cc4313] | 238 | #define async_req_4_3(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
[9db9b10] | 239 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
|
---|
| 240 | (rc2), (rc3), NULL, NULL)
|
---|
[0cc4313] | 241 | #define async_req_4_4(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 242 | rc4) \
|
---|
| 243 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 244 | (rc1), (rc2), (rc3), (rc4), NULL)
|
---|
| 245 | #define async_req_4_5(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 246 | rc4, rc5) \
|
---|
| 247 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 248 | (rc1), (rc2), (rc3), (rc4), (rc5))
|
---|
| 249 | #define async_req_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
[9db9b10] | 250 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 251 | (arg5), NULL, NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 252 | #define async_req_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
[9db9b10] | 253 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 254 | (arg5), (rc1), NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 255 | #define async_req_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
[9db9b10] | 256 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 257 | (arg5), (rc1), (rc2), NULL, NULL, NULL)
|
---|
[0cc4313] | 258 | #define async_req_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 259 | rc3) \
|
---|
| 260 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 261 | (arg5), (rc1), (rc2), (rc3), NULL, NULL)
|
---|
| 262 | #define async_req_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 263 | rc3, rc4) \
|
---|
| 264 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 265 | (arg5), (rc1), (rc2), (rc3), (rc4), NULL)
|
---|
| 266 | #define async_req_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 267 | rc3, rc4, rc5) \
|
---|
| 268 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 269 | (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
|
---|
[fc42b28] | 270 |
|
---|
[11bb813] | 271 | extern sysarg_t async_req_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 272 | sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
|
---|
| 273 | extern sysarg_t async_req_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 274 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 275 | sysarg_t *);
|
---|
[085bd54] | 276 |
|
---|
| 277 | static inline void async_serialize_start(void)
|
---|
| 278 | {
|
---|
[bc1f1c2] | 279 | fibril_inc_sercount();
|
---|
[085bd54] | 280 | }
|
---|
[3dbe2d1f] | 281 |
|
---|
[085bd54] | 282 | static inline void async_serialize_end(void)
|
---|
| 283 | {
|
---|
[bc1f1c2] | 284 | fibril_dec_sercount();
|
---|
[085bd54] | 285 | }
|
---|
[fc42b28] | 286 |
|
---|
[007e6efa] | 287 | extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 288 | async_client_conn_t);
|
---|
[96b02eb9] | 289 | extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 290 | extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
|
---|
[64d2b10] | 291 | extern int async_connect_kbox(task_id_t);
|
---|
| 292 | extern int async_hangup(int);
|
---|
| 293 | extern void async_poke(void);
|
---|
[f74392f] | 294 |
|
---|
[0da4e41] | 295 | /*
|
---|
| 296 | * User-friendly wrappers for async_share_in_start().
|
---|
| 297 | */
|
---|
[64d2b10] | 298 |
|
---|
[0da4e41] | 299 | #define async_share_in_start_0_0(phoneid, dst, size) \
|
---|
| 300 | async_share_in_start((phoneid), (dst), (size), 0, NULL)
|
---|
| 301 | #define async_share_in_start_0_1(phoneid, dst, size, flags) \
|
---|
| 302 | async_share_in_start((phoneid), (dst), (size), 0, (flags))
|
---|
| 303 | #define async_share_in_start_1_0(phoneid, dst, size, arg) \
|
---|
| 304 | async_share_in_start((phoneid), (dst), (size), (arg), NULL)
|
---|
| 305 | #define async_share_in_start_1_1(phoneid, dst, size, arg, flags) \
|
---|
| 306 | async_share_in_start((phoneid), (dst), (size), (arg), (flags))
|
---|
| 307 |
|
---|
[96b02eb9] | 308 | extern int async_share_in_start(int, void *, size_t, sysarg_t, int *);
|
---|
[0da4e41] | 309 | extern int async_share_in_receive(ipc_callid_t *, size_t *);
|
---|
| 310 | extern int async_share_in_finalize(ipc_callid_t, void *, int );
|
---|
| 311 | extern int async_share_out_start(int, void *, int);
|
---|
| 312 | extern int async_share_out_receive(ipc_callid_t *, size_t *, int *);
|
---|
| 313 | extern int async_share_out_finalize(ipc_callid_t, void *);
|
---|
[b4cbef1] | 314 |
|
---|
| 315 | /*
|
---|
| 316 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
| 317 | */
|
---|
[64d2b10] | 318 |
|
---|
[b4cbef1] | 319 | #define async_data_read_forward_0_0(phoneid, method, answer) \
|
---|
| 320 | async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
|
---|
| 321 | #define async_data_read_forward_0_1(phoneid, method, answer) \
|
---|
| 322 | async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
|
---|
| 323 | #define async_data_read_forward_1_0(phoneid, method, arg1, answer) \
|
---|
| 324 | async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
|
---|
| 325 | #define async_data_read_forward_1_1(phoneid, method, arg1, answer) \
|
---|
| 326 | async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer))
|
---|
| 327 | #define async_data_read_forward_2_0(phoneid, method, arg1, arg2, answer) \
|
---|
| 328 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL)
|
---|
| 329 | #define async_data_read_forward_2_1(phoneid, method, arg1, arg2, answer) \
|
---|
| 330 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
|
---|
| 331 | (answer))
|
---|
| 332 | #define async_data_read_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 333 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
|
---|
| 334 | NULL)
|
---|
| 335 | #define async_data_read_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 336 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
|
---|
| 337 | (answer))
|
---|
| 338 | #define async_data_read_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 339 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 340 | (arg4), NULL)
|
---|
| 341 | #define async_data_read_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 342 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 343 | (arg4), (answer))
|
---|
| 344 |
|
---|
[0da4e41] | 345 | extern int async_data_read_start(int, void *, size_t);
|
---|
| 346 | extern int async_data_read_receive(ipc_callid_t *, size_t *);
|
---|
| 347 | extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
|
---|
[eda925a] | 348 |
|
---|
[96b02eb9] | 349 | extern int async_data_read_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 350 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[b4cbef1] | 351 |
|
---|
| 352 | /*
|
---|
[eda925a] | 353 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
[b4cbef1] | 354 | */
|
---|
[64d2b10] | 355 |
|
---|
[eda925a] | 356 | #define async_data_write_forward_0_0(phoneid, method, answer) \
|
---|
| 357 | async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
|
---|
| 358 | #define async_data_write_forward_0_1(phoneid, method, answer) \
|
---|
| 359 | async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
|
---|
| 360 | #define async_data_write_forward_1_0(phoneid, method, arg1, answer) \
|
---|
| 361 | async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
|
---|
| 362 | #define async_data_write_forward_1_1(phoneid, method, arg1, answer) \
|
---|
| 363 | async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, \
|
---|
[b4cbef1] | 364 | (answer))
|
---|
[eda925a] | 365 | #define async_data_write_forward_2_0(phoneid, method, arg1, arg2, answer) \
|
---|
| 366 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
|
---|
[b4cbef1] | 367 | NULL)
|
---|
[eda925a] | 368 | #define async_data_write_forward_2_1(phoneid, method, arg1, arg2, answer) \
|
---|
| 369 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
|
---|
[b4cbef1] | 370 | (answer))
|
---|
[eda925a] | 371 | #define async_data_write_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 372 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 373 | 0, NULL)
|
---|
| 374 | #define async_data_write_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 375 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 376 | 0, (answer))
|
---|
| 377 | #define async_data_write_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 378 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
[b4cbef1] | 379 | (arg4), NULL)
|
---|
[eda925a] | 380 | #define async_data_write_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 381 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
[b4cbef1] | 382 | (arg4), (answer))
|
---|
| 383 |
|
---|
[0da4e41] | 384 | extern int async_data_write_start(int, const void *, size_t);
|
---|
| 385 | extern int async_data_write_receive(ipc_callid_t *, size_t *);
|
---|
| 386 | extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
|
---|
[eda925a] | 387 |
|
---|
| 388 | extern int async_data_write_accept(void **, const bool, const size_t,
|
---|
| 389 | const size_t, const size_t, size_t *);
|
---|
| 390 | extern void async_data_write_void(const int);
|
---|
| 391 |
|
---|
[96b02eb9] | 392 | extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 393 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[8aa42e3] | 394 |
|
---|
[630c3a9] | 395 | #endif
|
---|
[b2951e2] | 396 |
|
---|
[fadd381] | 397 | /** @}
|
---|
[b2951e2] | 398 | */
|
---|