[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 |
|
---|
[11bb813] | 59 | extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t);
|
---|
[9db9b10] | 60 |
|
---|
[49d072e] | 61 | static inline ipc_callid_t async_get_call(ipc_call_t *data)
|
---|
| 62 | {
|
---|
| 63 | return async_get_call_timeout(data, 0);
|
---|
| 64 | }
|
---|
[440cff5] | 65 |
|
---|
[db24058] | 66 | static inline void async_manager(void)
|
---|
| 67 | {
|
---|
| 68 | fibril_switch(FIBRIL_TO_MANAGER);
|
---|
| 69 | }
|
---|
| 70 |
|
---|
[0cc4313] | 71 | /*
|
---|
| 72 | * User-friendly wrappers for async_send_fast() and async_send_slow(). The
|
---|
| 73 | * macros are in the form async_send_m(), where m denotes the number of payload
|
---|
| 74 | * arguments. Each macros chooses between the fast and the slow version based
|
---|
| 75 | * on m.
|
---|
[440cff5] | 76 | */
|
---|
| 77 |
|
---|
[0cc4313] | 78 | #define async_send_0(phoneid, method, dataptr) \
|
---|
[9db9b10] | 79 | async_send_fast((phoneid), (method), 0, 0, 0, 0, (dataptr))
|
---|
[0cc4313] | 80 | #define async_send_1(phoneid, method, arg1, dataptr) \
|
---|
[9db9b10] | 81 | async_send_fast((phoneid), (method), (arg1), 0, 0, 0, (dataptr))
|
---|
[0cc4313] | 82 | #define async_send_2(phoneid, method, arg1, arg2, dataptr) \
|
---|
[9db9b10] | 83 | async_send_fast((phoneid), (method), (arg1), (arg2), 0, 0, (dataptr))
|
---|
[0cc4313] | 84 | #define async_send_3(phoneid, method, arg1, arg2, arg3, dataptr) \
|
---|
[9db9b10] | 85 | async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (dataptr))
|
---|
[0cc4313] | 86 | #define async_send_4(phoneid, method, arg1, arg2, arg3, arg4, dataptr) \
|
---|
[9db9b10] | 87 | async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 88 | (dataptr))
|
---|
[0cc4313] | 89 | #define async_send_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
|
---|
[9db9b10] | 90 | async_send_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 91 | (arg5), (dataptr))
|
---|
[19b28b0] | 92 |
|
---|
[11bb813] | 93 | extern aid_t async_send_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 94 | sysarg_t, ipc_call_t *);
|
---|
| 95 | extern aid_t async_send_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 96 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 97 | extern void async_wait_for(aid_t, sysarg_t *);
|
---|
| 98 | extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
|
---|
[440cff5] | 99 |
|
---|
[3c22f70] | 100 | extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
|
---|
| 101 | ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *));
|
---|
[11bb813] | 102 | extern void async_usleep(suseconds_t);
|
---|
[9db9b10] | 103 | extern void async_create_manager(void);
|
---|
| 104 | extern void async_destroy_manager(void);
|
---|
[01ff41c] | 105 |
|
---|
[46eec3b] | 106 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
| 107 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
| 108 |
|
---|
[23882034] | 109 | extern void *async_client_data_get(void);
|
---|
| 110 |
|
---|
[11bb813] | 111 | extern void async_set_client_connection(async_client_conn_t);
|
---|
| 112 | extern void async_set_interrupt_received(async_client_conn_t);
|
---|
[0cc4313] | 113 |
|
---|
[64d2b10] | 114 | /*
|
---|
| 115 | * Wrappers for simple communication.
|
---|
| 116 | */
|
---|
| 117 |
|
---|
| 118 | extern void async_msg_0(int, sysarg_t);
|
---|
| 119 | extern void async_msg_1(int, sysarg_t, sysarg_t);
|
---|
| 120 | extern void async_msg_2(int, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 121 | extern void async_msg_3(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 122 | extern void async_msg_4(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 123 | extern void async_msg_5(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 124 | sysarg_t);
|
---|
| 125 |
|
---|
| 126 | /*
|
---|
| 127 | * Wrappers for answer routines.
|
---|
| 128 | */
|
---|
| 129 |
|
---|
| 130 | extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t);
|
---|
| 131 | extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t);
|
---|
| 132 | extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 133 | extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 134 | sysarg_t);
|
---|
| 135 | extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 136 | sysarg_t, sysarg_t);
|
---|
| 137 | extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 138 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 139 |
|
---|
| 140 | /*
|
---|
| 141 | * Wrappers for forwarding routines.
|
---|
| 142 | */
|
---|
| 143 |
|
---|
| 144 | extern int async_forward_fast(ipc_callid_t, int, int, sysarg_t, sysarg_t, int);
|
---|
| 145 | extern int async_forward_slow(ipc_callid_t, int, int, sysarg_t, sysarg_t,
|
---|
| 146 | sysarg_t, sysarg_t, sysarg_t, int);
|
---|
[0cc4313] | 147 |
|
---|
| 148 | /*
|
---|
| 149 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
| 150 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
[6b21292] | 151 | * and n is the number of return arguments. The macros decide between the fast
|
---|
[0cc4313] | 152 | * and slow verion based on m.
|
---|
| 153 | */
|
---|
[64d2b10] | 154 |
|
---|
[0cc4313] | 155 | #define async_req_0_0(phoneid, method) \
|
---|
[9db9b10] | 156 | async_req_fast((phoneid), (method), 0, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
| 157 | NULL)
|
---|
[0cc4313] | 158 | #define async_req_0_1(phoneid, method, r1) \
|
---|
[9db9b10] | 159 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), NULL, NULL, NULL, \
|
---|
| 160 | NULL)
|
---|
[0cc4313] | 161 | #define async_req_0_2(phoneid, method, r1, r2) \
|
---|
[9db9b10] | 162 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), NULL, NULL, \
|
---|
| 163 | NULL)
|
---|
[0cc4313] | 164 | #define async_req_0_3(phoneid, method, r1, r2, r3) \
|
---|
[9db9b10] | 165 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), NULL, \
|
---|
| 166 | NULL)
|
---|
[0cc4313] | 167 | #define async_req_0_4(phoneid, method, r1, r2, r3, r4) \
|
---|
[9db9b10] | 168 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
|
---|
| 169 | NULL)
|
---|
[0cc4313] | 170 | #define async_req_0_5(phoneid, method, r1, r2, r3, r4, r5) \
|
---|
[9db9b10] | 171 | async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
|
---|
| 172 | (r5))
|
---|
[0cc4313] | 173 | #define async_req_1_0(phoneid, method, arg1) \
|
---|
[9db9b10] | 174 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, NULL, NULL, NULL, \
|
---|
| 175 | NULL, NULL)
|
---|
[0cc4313] | 176 | #define async_req_1_1(phoneid, method, arg1, rc1) \
|
---|
[9db9b10] | 177 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), NULL, NULL, \
|
---|
| 178 | NULL, NULL)
|
---|
[0cc4313] | 179 | #define async_req_1_2(phoneid, method, arg1, rc1, rc2) \
|
---|
[9db9b10] | 180 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), NULL, \
|
---|
| 181 | NULL, NULL)
|
---|
[0cc4313] | 182 | #define async_req_1_3(phoneid, method, arg1, rc1, rc2, rc3) \
|
---|
[9db9b10] | 183 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
|
---|
| 184 | NULL, NULL)
|
---|
[0cc4313] | 185 | #define async_req_1_4(phoneid, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
[9db9b10] | 186 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
|
---|
| 187 | (rc4), NULL)
|
---|
[0cc4313] | 188 | #define async_req_1_5(phoneid, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
[9db9b10] | 189 | async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
|
---|
| 190 | (rc4), (rc5))
|
---|
[0cc4313] | 191 | #define async_req_2_0(phoneid, method, arg1, arg2) \
|
---|
[9db9b10] | 192 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL, NULL, \
|
---|
| 193 | NULL, NULL, NULL)
|
---|
[0cc4313] | 194 | #define async_req_2_1(phoneid, method, arg1, arg2, rc1) \
|
---|
[9db9b10] | 195 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), NULL, \
|
---|
| 196 | NULL, NULL, NULL)
|
---|
[0cc4313] | 197 | #define async_req_2_2(phoneid, method, arg1, arg2, rc1, rc2) \
|
---|
[9db9b10] | 198 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 199 | NULL, NULL, NULL)
|
---|
[0cc4313] | 200 | #define async_req_2_3(phoneid, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
[9db9b10] | 201 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 202 | (rc3), NULL, NULL)
|
---|
[0cc4313] | 203 | #define async_req_2_4(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
[9db9b10] | 204 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 205 | (rc3), (rc4), NULL)
|
---|
[0cc4313] | 206 | #define async_req_2_5(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
[9db9b10] | 207 | async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
|
---|
| 208 | (rc3), (rc4), (rc5))
|
---|
[0cc4313] | 209 | #define async_req_3_0(phoneid, method, arg1, arg2, arg3) \
|
---|
[9db9b10] | 210 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, NULL, NULL, \
|
---|
| 211 | NULL, NULL, NULL)
|
---|
[0cc4313] | 212 | #define async_req_3_1(phoneid, method, arg1, arg2, arg3, rc1) \
|
---|
[9db9b10] | 213 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 214 | NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 215 | #define async_req_3_2(phoneid, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
[9db9b10] | 216 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 217 | (rc2), NULL, NULL, NULL)
|
---|
[0cc4313] | 218 | #define async_req_3_3(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
[9db9b10] | 219 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 220 | (rc2), (rc3), NULL, NULL)
|
---|
[0cc4313] | 221 | #define async_req_3_4(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
[9db9b10] | 222 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 223 | (rc2), (rc3), (rc4), NULL)
|
---|
[0cc4313] | 224 | #define async_req_3_5(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
| 225 | rc5) \
|
---|
| 226 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
|
---|
| 227 | (rc2), (rc3), (rc4), (rc5))
|
---|
| 228 | #define async_req_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
|
---|
[9db9b10] | 229 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), NULL, \
|
---|
| 230 | NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 231 | #define async_req_4_1(phoneid, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
[9db9b10] | 232 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
|
---|
| 233 | NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 234 | #define async_req_4_2(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
[9db9b10] | 235 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
|
---|
| 236 | (rc2), NULL, NULL, NULL)
|
---|
[0cc4313] | 237 | #define async_req_4_3(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
[9db9b10] | 238 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
|
---|
| 239 | (rc2), (rc3), NULL, NULL)
|
---|
[0cc4313] | 240 | #define async_req_4_4(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 241 | rc4) \
|
---|
| 242 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 243 | (rc1), (rc2), (rc3), (rc4), NULL)
|
---|
| 244 | #define async_req_4_5(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 245 | rc4, rc5) \
|
---|
| 246 | async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 247 | (rc1), (rc2), (rc3), (rc4), (rc5))
|
---|
| 248 | #define async_req_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
[9db9b10] | 249 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 250 | (arg5), NULL, NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 251 | #define async_req_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
[9db9b10] | 252 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 253 | (arg5), (rc1), NULL, NULL, NULL, NULL)
|
---|
[0cc4313] | 254 | #define async_req_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
[9db9b10] | 255 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 256 | (arg5), (rc1), (rc2), NULL, NULL, NULL)
|
---|
[0cc4313] | 257 | #define async_req_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 258 | rc3) \
|
---|
| 259 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 260 | (arg5), (rc1), (rc2), (rc3), NULL, NULL)
|
---|
| 261 | #define async_req_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 262 | rc3, rc4) \
|
---|
| 263 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 264 | (arg5), (rc1), (rc2), (rc3), (rc4), NULL)
|
---|
| 265 | #define async_req_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 266 | rc3, rc4, rc5) \
|
---|
| 267 | async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 268 | (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
|
---|
[fc42b28] | 269 |
|
---|
[11bb813] | 270 | extern sysarg_t async_req_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 271 | sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
|
---|
| 272 | extern sysarg_t async_req_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 273 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 274 | sysarg_t *);
|
---|
[085bd54] | 275 |
|
---|
| 276 | static inline void async_serialize_start(void)
|
---|
| 277 | {
|
---|
[bc1f1c2] | 278 | fibril_inc_sercount();
|
---|
[085bd54] | 279 | }
|
---|
[3dbe2d1f] | 280 |
|
---|
[085bd54] | 281 | static inline void async_serialize_end(void)
|
---|
| 282 | {
|
---|
[bc1f1c2] | 283 | fibril_dec_sercount();
|
---|
[085bd54] | 284 | }
|
---|
[fc42b28] | 285 |
|
---|
[007e6efa] | 286 | extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 287 | async_client_conn_t);
|
---|
[96b02eb9] | 288 | extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 289 | extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
|
---|
[64d2b10] | 290 | extern int async_connect_kbox(task_id_t);
|
---|
| 291 | extern int async_hangup(int);
|
---|
| 292 | extern void async_poke(void);
|
---|
[f74392f] | 293 |
|
---|
[0da4e41] | 294 | /*
|
---|
| 295 | * User-friendly wrappers for async_share_in_start().
|
---|
| 296 | */
|
---|
[64d2b10] | 297 |
|
---|
[0da4e41] | 298 | #define async_share_in_start_0_0(phoneid, dst, size) \
|
---|
| 299 | async_share_in_start((phoneid), (dst), (size), 0, NULL)
|
---|
| 300 | #define async_share_in_start_0_1(phoneid, dst, size, flags) \
|
---|
| 301 | async_share_in_start((phoneid), (dst), (size), 0, (flags))
|
---|
| 302 | #define async_share_in_start_1_0(phoneid, dst, size, arg) \
|
---|
| 303 | async_share_in_start((phoneid), (dst), (size), (arg), NULL)
|
---|
| 304 | #define async_share_in_start_1_1(phoneid, dst, size, arg, flags) \
|
---|
| 305 | async_share_in_start((phoneid), (dst), (size), (arg), (flags))
|
---|
| 306 |
|
---|
[96b02eb9] | 307 | extern int async_share_in_start(int, void *, size_t, sysarg_t, int *);
|
---|
[0da4e41] | 308 | extern int async_share_in_receive(ipc_callid_t *, size_t *);
|
---|
| 309 | extern int async_share_in_finalize(ipc_callid_t, void *, int );
|
---|
| 310 | extern int async_share_out_start(int, void *, int);
|
---|
| 311 | extern int async_share_out_receive(ipc_callid_t *, size_t *, int *);
|
---|
| 312 | extern int async_share_out_finalize(ipc_callid_t, void *);
|
---|
[b4cbef1] | 313 |
|
---|
| 314 | /*
|
---|
| 315 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
| 316 | */
|
---|
[64d2b10] | 317 |
|
---|
[b4cbef1] | 318 | #define async_data_read_forward_0_0(phoneid, method, answer) \
|
---|
| 319 | async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
|
---|
| 320 | #define async_data_read_forward_0_1(phoneid, method, answer) \
|
---|
| 321 | async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
|
---|
| 322 | #define async_data_read_forward_1_0(phoneid, method, arg1, answer) \
|
---|
| 323 | async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
|
---|
| 324 | #define async_data_read_forward_1_1(phoneid, method, arg1, answer) \
|
---|
| 325 | async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer))
|
---|
| 326 | #define async_data_read_forward_2_0(phoneid, method, arg1, arg2, answer) \
|
---|
| 327 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL)
|
---|
| 328 | #define async_data_read_forward_2_1(phoneid, method, arg1, arg2, answer) \
|
---|
| 329 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
|
---|
| 330 | (answer))
|
---|
| 331 | #define async_data_read_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 332 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
|
---|
| 333 | NULL)
|
---|
| 334 | #define async_data_read_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 335 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
|
---|
| 336 | (answer))
|
---|
| 337 | #define async_data_read_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 338 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 339 | (arg4), NULL)
|
---|
| 340 | #define async_data_read_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 341 | async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 342 | (arg4), (answer))
|
---|
| 343 |
|
---|
[0da4e41] | 344 | extern int async_data_read_start(int, void *, size_t);
|
---|
| 345 | extern int async_data_read_receive(ipc_callid_t *, size_t *);
|
---|
| 346 | extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
|
---|
[eda925a] | 347 |
|
---|
[96b02eb9] | 348 | extern int async_data_read_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 349 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[b4cbef1] | 350 |
|
---|
| 351 | /*
|
---|
[eda925a] | 352 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
[b4cbef1] | 353 | */
|
---|
[64d2b10] | 354 |
|
---|
[eda925a] | 355 | #define async_data_write_forward_0_0(phoneid, method, answer) \
|
---|
| 356 | async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
|
---|
| 357 | #define async_data_write_forward_0_1(phoneid, method, answer) \
|
---|
| 358 | async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
|
---|
| 359 | #define async_data_write_forward_1_0(phoneid, method, arg1, answer) \
|
---|
| 360 | async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
|
---|
| 361 | #define async_data_write_forward_1_1(phoneid, method, arg1, answer) \
|
---|
| 362 | async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, \
|
---|
[b4cbef1] | 363 | (answer))
|
---|
[eda925a] | 364 | #define async_data_write_forward_2_0(phoneid, method, arg1, arg2, answer) \
|
---|
| 365 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
|
---|
[b4cbef1] | 366 | NULL)
|
---|
[eda925a] | 367 | #define async_data_write_forward_2_1(phoneid, method, arg1, arg2, answer) \
|
---|
| 368 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
|
---|
[b4cbef1] | 369 | (answer))
|
---|
[eda925a] | 370 | #define async_data_write_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 371 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 372 | 0, NULL)
|
---|
| 373 | #define async_data_write_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
|
---|
| 374 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
| 375 | 0, (answer))
|
---|
| 376 | #define async_data_write_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 377 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
[b4cbef1] | 378 | (arg4), NULL)
|
---|
[eda925a] | 379 | #define async_data_write_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
|
---|
| 380 | async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
|
---|
[b4cbef1] | 381 | (arg4), (answer))
|
---|
| 382 |
|
---|
[0da4e41] | 383 | extern int async_data_write_start(int, const void *, size_t);
|
---|
| 384 | extern int async_data_write_receive(ipc_callid_t *, size_t *);
|
---|
| 385 | extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
|
---|
[eda925a] | 386 |
|
---|
| 387 | extern int async_data_write_accept(void **, const bool, const size_t,
|
---|
| 388 | const size_t, const size_t, size_t *);
|
---|
| 389 | extern void async_data_write_void(const int);
|
---|
| 390 |
|
---|
[96b02eb9] | 391 | extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 392 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[8aa42e3] | 393 |
|
---|
[630c3a9] | 394 | #endif
|
---|
[b2951e2] | 395 |
|
---|
[fadd381] | 396 | /** @}
|
---|
[b2951e2] | 397 | */
|
---|