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