[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>
|
---|
[bc1f1c2] | 43 | #include <fibril.h>
|
---|
[f25b73d6] | 44 | #include <sys/time.h>
|
---|
[fc42b28] | 45 | #include <atomic.h>
|
---|
[3e6a98c5] | 46 | #include <stdbool.h>
|
---|
[1c635d6] | 47 | #include <abi/proc/task.h>
|
---|
[8820544] | 48 | #include <abi/ddi/irq.h>
|
---|
| 49 | #include <abi/ipc/event.h>
|
---|
[abf2dfd] | 50 | #include <abi/ipc/interfaces.h>
|
---|
[630c3a9] | 51 |
|
---|
[01ff41c] | 52 | typedef ipc_callid_t aid_t;
|
---|
[abf2dfd] | 53 | typedef sysarg_t port_id_t;
|
---|
[46eec3b] | 54 |
|
---|
| 55 | typedef void *(*async_client_data_ctor_t)(void);
|
---|
| 56 | typedef void (*async_client_data_dtor_t)(void *);
|
---|
| 57 |
|
---|
[b688fd8] | 58 | /** Port connection handler
|
---|
[9934f7d] | 59 | *
|
---|
[3815efb] | 60 | * @param callid ID of incoming call or 0 if connection initiated from
|
---|
| 61 | * inside using async_connect_to_me()
|
---|
| 62 | * @param call Incoming call or 0 if connection initiated from inside
|
---|
| 63 | * @param arg Local argument passed from async_new_connection() or
|
---|
| 64 | * async_connect_to_me()
|
---|
[9934f7d] | 65 | */
|
---|
[b688fd8] | 66 | typedef void (*async_port_handler_t)(ipc_callid_t, ipc_call_t *, void *);
|
---|
[9934f7d] | 67 |
|
---|
[8820544] | 68 | /** Notification handler */
|
---|
| 69 | typedef void (*async_notification_handler_t)(ipc_callid_t, ipc_call_t *,
|
---|
| 70 | void *);
|
---|
[9db9b10] | 71 |
|
---|
[79ae36dd] | 72 | /** Exchange management style
|
---|
| 73 | *
|
---|
| 74 | */
|
---|
| 75 | typedef enum {
|
---|
| 76 | /** No explicit exchange management
|
---|
| 77 | *
|
---|
| 78 | * Suitable for protocols which use a single
|
---|
| 79 | * IPC message per exchange only.
|
---|
| 80 | *
|
---|
| 81 | */
|
---|
| 82 | EXCHANGE_ATOMIC = 0,
|
---|
| 83 |
|
---|
| 84 | /** Exchange management via phone cloning
|
---|
| 85 | *
|
---|
| 86 | * Suitable for servers which support client
|
---|
| 87 | * data tracking by task hashes and do not
|
---|
| 88 | * mind cloned phones.
|
---|
| 89 | *
|
---|
| 90 | */
|
---|
[abf2dfd] | 91 | EXCHANGE_PARALLEL = 1,
|
---|
[79ae36dd] | 92 |
|
---|
| 93 | /** Exchange management via mutual exclusion
|
---|
| 94 | *
|
---|
| 95 | * Suitable for any kind of client/server communication,
|
---|
| 96 | * but can limit parallelism.
|
---|
| 97 | *
|
---|
| 98 | */
|
---|
[abf2dfd] | 99 | EXCHANGE_SERIALIZE = 2
|
---|
[79ae36dd] | 100 | } exch_mgmt_t;
|
---|
| 101 |
|
---|
[b76a7329] | 102 | /** Forward declarations */
|
---|
[5da7199] | 103 | struct async_exch;
|
---|
| 104 | struct async_sess;
|
---|
[b76a7329] | 105 |
|
---|
[5da7199] | 106 | typedef struct async_sess async_sess_t;
|
---|
| 107 | typedef struct async_exch async_exch_t;
|
---|
[79ae36dd] | 108 |
|
---|
[8619f25] | 109 | extern atomic_t threads_in_ipc_wait;
|
---|
| 110 |
|
---|
[47b7006] | 111 | #define async_manager() \
|
---|
[c721d26] | 112 | do { \
|
---|
| 113 | futex_down(&async_futex); \
|
---|
| 114 | fibril_switch(FIBRIL_FROM_DEAD); \
|
---|
| 115 | } while (0)
|
---|
[9db9b10] | 116 |
|
---|
[47b7006] | 117 | #define async_get_call(data) \
|
---|
| 118 | async_get_call_timeout(data, 0)
|
---|
[440cff5] | 119 |
|
---|
[47b7006] | 120 | extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t);
|
---|
[db24058] | 121 |
|
---|
[0cc4313] | 122 | /*
|
---|
| 123 | * User-friendly wrappers for async_send_fast() and async_send_slow(). The
|
---|
| 124 | * macros are in the form async_send_m(), where m denotes the number of payload
|
---|
[79ae36dd] | 125 | * arguments. Each macros chooses between the fast and the slow version based
|
---|
[0cc4313] | 126 | * on m.
|
---|
[440cff5] | 127 | */
|
---|
| 128 |
|
---|
[79ae36dd] | 129 | #define async_send_0(exch, method, dataptr) \
|
---|
| 130 | async_send_fast(exch, method, 0, 0, 0, 0, dataptr)
|
---|
| 131 | #define async_send_1(exch, method, arg1, dataptr) \
|
---|
| 132 | async_send_fast(exch, method, arg1, 0, 0, 0, dataptr)
|
---|
| 133 | #define async_send_2(exch, method, arg1, arg2, dataptr) \
|
---|
| 134 | async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr)
|
---|
| 135 | #define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \
|
---|
| 136 | async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr)
|
---|
| 137 | #define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \
|
---|
| 138 | async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr)
|
---|
| 139 | #define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
|
---|
| 140 | async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr)
|
---|
| 141 |
|
---|
| 142 | extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[11bb813] | 143 | sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[79ae36dd] | 144 | extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 145 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 146 |
|
---|
[11bb813] | 147 | extern void async_wait_for(aid_t, sysarg_t *);
|
---|
| 148 | extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
|
---|
[47c9a8c] | 149 | extern void async_forget(aid_t);
|
---|
[440cff5] | 150 |
|
---|
[e2ab36f1] | 151 | extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
|
---|
[b688fd8] | 152 | ipc_call_t *, async_port_handler_t, void *);
|
---|
[79ae36dd] | 153 |
|
---|
[11bb813] | 154 | extern void async_usleep(suseconds_t);
|
---|
[9db9b10] | 155 | extern void async_create_manager(void);
|
---|
| 156 | extern void async_destroy_manager(void);
|
---|
[01ff41c] | 157 |
|
---|
[46eec3b] | 158 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
| 159 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
[79ae36dd] | 160 | extern void *async_get_client_data(void);
|
---|
[e2ab36f1] | 161 | extern void *async_get_client_data_by_id(task_id_t);
|
---|
| 162 | extern void async_put_client_data_by_id(task_id_t);
|
---|
[23882034] | 163 |
|
---|
[b688fd8] | 164 | extern void async_set_fallback_port_handler(async_port_handler_t, void *);
|
---|
[8820544] | 165 | extern void async_set_notification_handler_stack_size(size_t);
|
---|
| 166 |
|
---|
| 167 | extern int async_irq_subscribe(int, int, async_notification_handler_t, void *,
|
---|
| 168 | const irq_code_t *);
|
---|
| 169 | extern int async_irq_unsubscribe(int, int);
|
---|
| 170 |
|
---|
| 171 | extern int async_event_subscribe(event_type_t, async_notification_handler_t,
|
---|
| 172 | void *);
|
---|
| 173 | extern int async_event_task_subscribe(event_task_type_t,
|
---|
| 174 | async_notification_handler_t, void *);
|
---|
| 175 | extern int async_event_unsubscribe(event_type_t);
|
---|
| 176 | extern int async_event_task_unsubscribe(event_task_type_t);
|
---|
| 177 | extern int async_event_unmask(event_type_t);
|
---|
| 178 | extern int async_event_task_unmask(event_task_type_t);
|
---|
[0cc4313] | 179 |
|
---|
[64d2b10] | 180 | /*
|
---|
| 181 | * Wrappers for simple communication.
|
---|
| 182 | */
|
---|
| 183 |
|
---|
[79ae36dd] | 184 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
---|
| 185 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
---|
| 186 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 187 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 188 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 189 | sysarg_t);
|
---|
[79ae36dd] | 190 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 191 | sysarg_t, sysarg_t);
|
---|
[64d2b10] | 192 |
|
---|
| 193 | /*
|
---|
| 194 | * Wrappers for answer routines.
|
---|
| 195 | */
|
---|
| 196 |
|
---|
| 197 | extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t);
|
---|
| 198 | extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t);
|
---|
| 199 | extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 200 | extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 201 | sysarg_t);
|
---|
| 202 | extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 203 | sysarg_t, sysarg_t);
|
---|
| 204 | extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 205 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 206 |
|
---|
| 207 | /*
|
---|
| 208 | * Wrappers for forwarding routines.
|
---|
| 209 | */
|
---|
| 210 |
|
---|
[79ae36dd] | 211 | extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 212 | sysarg_t, unsigned int);
|
---|
| 213 | extern int async_forward_slow(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 214 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
[0cc4313] | 215 |
|
---|
| 216 | /*
|
---|
| 217 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
| 218 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
[6b21292] | 219 | * and n is the number of return arguments. The macros decide between the fast
|
---|
[0cc4313] | 220 | * and slow verion based on m.
|
---|
| 221 | */
|
---|
[64d2b10] | 222 |
|
---|
[79ae36dd] | 223 | #define async_req_0_0(exch, method) \
|
---|
| 224 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
---|
| 225 | #define async_req_0_1(exch, method, r1) \
|
---|
| 226 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
---|
| 227 | #define async_req_0_2(exch, method, r1, r2) \
|
---|
| 228 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
---|
| 229 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
---|
| 230 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
---|
| 231 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
---|
| 232 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
---|
| 233 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
---|
| 234 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
---|
| 235 |
|
---|
| 236 | #define async_req_1_0(exch, method, arg1) \
|
---|
| 237 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
| 238 | NULL)
|
---|
| 239 | #define async_req_1_1(exch, method, arg1, rc1) \
|
---|
| 240 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
---|
| 241 | NULL)
|
---|
| 242 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
---|
| 243 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
| 244 | NULL)
|
---|
| 245 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
---|
| 246 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 247 | NULL)
|
---|
[79ae36dd] | 248 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
| 249 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 250 | NULL)
|
---|
[79ae36dd] | 251 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 252 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 253 | rc5)
|
---|
| 254 |
|
---|
| 255 | #define async_req_2_0(exch, method, arg1, arg2) \
|
---|
| 256 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
---|
| 257 | NULL, NULL)
|
---|
| 258 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
---|
| 259 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
---|
| 260 | NULL, NULL)
|
---|
| 261 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
---|
| 262 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
[9db9b10] | 263 | NULL)
|
---|
[79ae36dd] | 264 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
| 265 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 266 | NULL)
|
---|
[79ae36dd] | 267 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
| 268 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 269 | NULL)
|
---|
[79ae36dd] | 270 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 271 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 272 | rc5)
|
---|
| 273 |
|
---|
| 274 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
---|
| 275 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
---|
[9db9b10] | 276 | NULL, NULL)
|
---|
[79ae36dd] | 277 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
---|
| 278 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
---|
[9db9b10] | 279 | NULL, NULL)
|
---|
[79ae36dd] | 280 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
| 281 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
---|
[9db9b10] | 282 | NULL, NULL)
|
---|
[79ae36dd] | 283 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
| 284 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
[9db9b10] | 285 | NULL, NULL)
|
---|
[79ae36dd] | 286 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
| 287 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 288 | rc4, NULL)
|
---|
| 289 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
| 290 | rc5) \
|
---|
| 291 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 292 | rc4, rc5)
|
---|
| 293 |
|
---|
| 294 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
---|
| 295 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
---|
[9db9b10] | 296 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 297 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
| 298 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
---|
[9db9b10] | 299 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 300 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
| 301 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
---|
| 302 | NULL, NULL)
|
---|
| 303 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
| 304 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 305 | NULL, NULL)
|
---|
| 306 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 307 | rc4) \
|
---|
[79ae36dd] | 308 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 309 | rc4, NULL)
|
---|
| 310 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 311 | rc4, rc5) \
|
---|
[79ae36dd] | 312 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 313 | rc4, rc5)
|
---|
| 314 |
|
---|
| 315 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
| 316 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
---|
| 317 | NULL, NULL, NULL, NULL)
|
---|
| 318 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
| 319 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
---|
| 320 | NULL, NULL, NULL, NULL)
|
---|
| 321 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
| 322 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 323 | NULL, NULL, NULL)
|
---|
| 324 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 325 | rc3) \
|
---|
[79ae36dd] | 326 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 327 | rc3, NULL, NULL)
|
---|
| 328 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 329 | rc3, rc4) \
|
---|
[79ae36dd] | 330 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 331 | rc3, rc4, NULL)
|
---|
| 332 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 333 | rc3, rc4, rc5) \
|
---|
[79ae36dd] | 334 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 335 | rc3, rc4, rc5)
|
---|
[fc42b28] | 336 |
|
---|
[79ae36dd] | 337 | extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[11bb813] | 338 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 339 | sysarg_t *);
|
---|
[79ae36dd] | 340 | extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 341 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 342 | sysarg_t *, sysarg_t *);
|
---|
[085bd54] | 343 |
|
---|
[6aae539d] | 344 | extern async_sess_t *async_clone_establish(exch_mgmt_t, async_exch_t *);
|
---|
[79ae36dd] | 345 | extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
|
---|
| 346 | sysarg_t, sysarg_t);
|
---|
| 347 | extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
|
---|
| 348 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 349 | extern async_sess_t *async_connect_kbox(task_id_t);
|
---|
[fc42b28] | 350 |
|
---|
[79ae36dd] | 351 | extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[b688fd8] | 352 | async_port_handler_t, void *);
|
---|
[79ae36dd] | 353 |
|
---|
| 354 | extern int async_hangup(async_sess_t *);
|
---|
[64d2b10] | 355 | extern void async_poke(void);
|
---|
[f74392f] | 356 |
|
---|
[79ae36dd] | 357 | extern async_exch_t *async_exchange_begin(async_sess_t *);
|
---|
| 358 | extern void async_exchange_end(async_exch_t *);
|
---|
| 359 |
|
---|
[93ad49a8] | 360 | /*
|
---|
| 361 | * FIXME These functions just work around problems with parallel exchange
|
---|
| 362 | * management. Proper solution needs to be implemented.
|
---|
| 363 | */
|
---|
| 364 | void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 365 |
|
---|
[0da4e41] | 366 | /*
|
---|
| 367 | * User-friendly wrappers for async_share_in_start().
|
---|
| 368 | */
|
---|
[64d2b10] | 369 |
|
---|
[fbcdeb8] | 370 | #define async_share_in_start_0_0(exch, size, dst) \
|
---|
| 371 | async_share_in_start(exch, size, 0, NULL, dst)
|
---|
| 372 | #define async_share_in_start_0_1(exch, size, flags, dst) \
|
---|
| 373 | async_share_in_start(exch, size, 0, flags, dst)
|
---|
| 374 | #define async_share_in_start_1_0(exch, size, arg, dst) \
|
---|
| 375 | async_share_in_start(exch, size, arg, NULL, dst)
|
---|
| 376 | #define async_share_in_start_1_1(exch, size, arg, flags, dst) \
|
---|
| 377 | async_share_in_start(exch, size, arg, flags, dst)
|
---|
| 378 |
|
---|
| 379 | extern int async_share_in_start(async_exch_t *, size_t, sysarg_t,
|
---|
| 380 | unsigned int *, void **);
|
---|
[47b7006] | 381 | extern bool async_share_in_receive(ipc_callid_t *, size_t *);
|
---|
| 382 | extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
|
---|
| 383 |
|
---|
[79ae36dd] | 384 | extern int async_share_out_start(async_exch_t *, void *, unsigned int);
|
---|
[47b7006] | 385 | extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
|
---|
[fbcdeb8] | 386 | extern int async_share_out_finalize(ipc_callid_t, void **);
|
---|
[b4cbef1] | 387 |
|
---|
| 388 | /*
|
---|
| 389 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
| 390 | */
|
---|
[64d2b10] | 391 |
|
---|
[79ae36dd] | 392 | #define async_data_read_forward_0_0(exch, method, answer) \
|
---|
| 393 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 394 | #define async_data_read_forward_0_1(exch, method, answer) \
|
---|
| 395 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 396 | #define async_data_read_forward_1_0(exch, method, arg1, answer) \
|
---|
| 397 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 398 | #define async_data_read_forward_1_1(exch, method, arg1, answer) \
|
---|
| 399 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 400 | #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 401 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 402 | #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 403 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 404 | #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 405 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
|
---|
| 406 | #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 407 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 408 | answer)
|
---|
| 409 | #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 410 | answer) \
|
---|
| 411 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 412 | NULL)
|
---|
[79ae36dd] | 413 | #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 414 | answer) \
|
---|
| 415 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 416 | answer)
|
---|
| 417 |
|
---|
| 418 | extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
|
---|
| 419 | extern int async_data_read_start(async_exch_t *, void *, size_t);
|
---|
[47b7006] | 420 | extern bool async_data_read_receive(ipc_callid_t *, size_t *);
|
---|
[d768d4c8] | 421 | extern bool async_data_read_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
|
---|
[0da4e41] | 422 | extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
|
---|
[eda925a] | 423 |
|
---|
[79ae36dd] | 424 | extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 425 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[b4cbef1] | 426 |
|
---|
| 427 | /*
|
---|
[eda925a] | 428 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
[b4cbef1] | 429 | */
|
---|
[64d2b10] | 430 |
|
---|
[79ae36dd] | 431 | #define async_data_write_forward_0_0(exch, method, answer) \
|
---|
| 432 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 433 | #define async_data_write_forward_0_1(exch, method, answer) \
|
---|
| 434 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 435 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
---|
| 436 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 437 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
---|
| 438 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 439 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 440 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 441 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 442 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 443 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 444 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 445 | NULL)
|
---|
| 446 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 447 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 448 | answer)
|
---|
| 449 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 450 | answer) \
|
---|
| 451 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 452 | NULL)
|
---|
[79ae36dd] | 453 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 454 | answer) \
|
---|
| 455 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 456 | answer)
|
---|
| 457 |
|
---|
| 458 | extern int async_data_write_start(async_exch_t *, const void *, size_t);
|
---|
[47b7006] | 459 | extern bool async_data_write_receive(ipc_callid_t *, size_t *);
|
---|
[5ae1c51] | 460 | extern bool async_data_write_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
|
---|
[0da4e41] | 461 | extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
|
---|
[eda925a] | 462 |
|
---|
| 463 | extern int async_data_write_accept(void **, const bool, const size_t,
|
---|
| 464 | const size_t, const size_t, size_t *);
|
---|
[47b7006] | 465 | extern void async_data_write_void(sysarg_t);
|
---|
[eda925a] | 466 |
|
---|
[79ae36dd] | 467 | extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 468 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 469 |
|
---|
| 470 | extern int async_exchange_clone(async_exch_t *, async_exch_t *);
|
---|
| 471 | extern async_sess_t *async_clone_receive(exch_mgmt_t);
|
---|
| 472 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
---|
[8869f7b] | 473 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
---|
[8aa42e3] | 474 |
|
---|
[2c4aa39] | 475 | extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
---|
| 476 | sysarg_t, async_exch_t *);
|
---|
| 477 | extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
|
---|
| 478 | sysarg_t *);
|
---|
| 479 | extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
|
---|
| 480 |
|
---|
[58cbf8d5] | 481 | extern void *async_remote_state_acquire(async_sess_t *);
|
---|
| 482 | extern void async_remote_state_update(async_sess_t *, void *);
|
---|
| 483 | extern void async_remote_state_release(async_sess_t *);
|
---|
| 484 | extern void async_remote_state_release_exchange(async_exch_t *);
|
---|
| 485 |
|
---|
[630c3a9] | 486 | #endif
|
---|
[b2951e2] | 487 |
|
---|
[fadd381] | 488 | /** @}
|
---|
[b2951e2] | 489 | */
|
---|