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