[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_)))
|
---|
[5b0cf63] | 36 | #error Do not intermix low-level IPC interface and async framework
|
---|
[64d2b10] | 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>
|
---|
[01c3bb4] | 51 | #include <abi/cap.h>
|
---|
[630c3a9] | 52 |
|
---|
[6b96dc06] | 53 | #include <_bits/__noreturn.h>
|
---|
| 54 |
|
---|
[01c3bb4] | 55 | typedef sysarg_t aid_t;
|
---|
[abf2dfd] | 56 | typedef sysarg_t port_id_t;
|
---|
[46eec3b] | 57 |
|
---|
| 58 | typedef void *(*async_client_data_ctor_t)(void);
|
---|
| 59 | typedef void (*async_client_data_dtor_t)(void *);
|
---|
| 60 |
|
---|
[b688fd8] | 61 | /** Port connection handler
|
---|
[9934f7d] | 62 | *
|
---|
[984a9ba] | 63 | * @param call Incoming call or NULL if connection initiated from inside
|
---|
| 64 | * using async_create_callback_port()
|
---|
| 65 | * @param arg Local argument.
|
---|
[f9b2cb4c] | 66 | *
|
---|
[9934f7d] | 67 | */
|
---|
[984a9ba] | 68 | typedef void (*async_port_handler_t)(ipc_call_t *, void *);
|
---|
[9934f7d] | 69 |
|
---|
[8820544] | 70 | /** Notification handler */
|
---|
[01c3bb4] | 71 | typedef void (*async_notification_handler_t)(ipc_call_t *, 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,
|
---|
[a35b458] | 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,
|
---|
[a35b458] | 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 |
|
---|
[6b96dc06] | 110 | extern __noreturn void async_manager(void);
|
---|
[9db9b10] | 111 |
|
---|
[47b7006] | 112 | #define async_get_call(data) \
|
---|
| 113 | async_get_call_timeout(data, 0)
|
---|
[440cff5] | 114 |
|
---|
[984a9ba] | 115 | extern bool 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 |
|
---|
[b7fd2a0] | 142 | extern void async_wait_for(aid_t, errno_t *);
|
---|
| 143 | extern errno_t async_wait_timeout(aid_t, errno_t *, suseconds_t);
|
---|
[47c9a8c] | 144 | extern void async_forget(aid_t);
|
---|
[440cff5] | 145 |
|
---|
[9db9b10] | 146 | extern void async_create_manager(void);
|
---|
| 147 | extern void async_destroy_manager(void);
|
---|
[01ff41c] | 148 |
|
---|
[46eec3b] | 149 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
| 150 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
[79ae36dd] | 151 | extern void *async_get_client_data(void);
|
---|
[e2ab36f1] | 152 | extern void *async_get_client_data_by_id(task_id_t);
|
---|
| 153 | extern void async_put_client_data_by_id(task_id_t);
|
---|
[23882034] | 154 |
|
---|
[b7fd2a0] | 155 | extern errno_t async_create_port(iface_t, async_port_handler_t, void *,
|
---|
[566992e1] | 156 | port_id_t *);
|
---|
[b688fd8] | 157 | extern void async_set_fallback_port_handler(async_port_handler_t, void *);
|
---|
[b7fd2a0] | 158 | extern errno_t async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
|
---|
[78bb04b] | 159 | sysarg_t, async_port_handler_t, void *, port_id_t *);
|
---|
| 160 |
|
---|
[b7fd2a0] | 161 | extern errno_t async_irq_subscribe(int, async_notification_handler_t, void *,
|
---|
[eadaeae8] | 162 | const irq_code_t *, cap_irq_handle_t *);
|
---|
| 163 | extern errno_t async_irq_unsubscribe(cap_irq_handle_t);
|
---|
[8820544] | 164 |
|
---|
[b7fd2a0] | 165 | extern errno_t async_event_subscribe(event_type_t, async_notification_handler_t,
|
---|
[8820544] | 166 | void *);
|
---|
[b7fd2a0] | 167 | extern errno_t async_event_task_subscribe(event_task_type_t,
|
---|
[8820544] | 168 | async_notification_handler_t, void *);
|
---|
[b7fd2a0] | 169 | extern errno_t async_event_unsubscribe(event_type_t);
|
---|
| 170 | extern errno_t async_event_task_unsubscribe(event_task_type_t);
|
---|
| 171 | extern errno_t async_event_unmask(event_type_t);
|
---|
| 172 | extern errno_t async_event_task_unmask(event_task_type_t);
|
---|
[0cc4313] | 173 |
|
---|
[64d2b10] | 174 | /*
|
---|
| 175 | * Wrappers for simple communication.
|
---|
| 176 | */
|
---|
| 177 |
|
---|
[79ae36dd] | 178 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
---|
| 179 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
---|
| 180 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 181 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 182 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 183 | sysarg_t);
|
---|
[79ae36dd] | 184 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 185 | sysarg_t, sysarg_t);
|
---|
[64d2b10] | 186 |
|
---|
| 187 | /*
|
---|
| 188 | * Wrappers for answer routines.
|
---|
| 189 | */
|
---|
| 190 |
|
---|
[984a9ba] | 191 | extern errno_t async_answer_0(ipc_call_t *, errno_t);
|
---|
| 192 | extern errno_t async_answer_1(ipc_call_t *, errno_t, sysarg_t);
|
---|
| 193 | extern errno_t async_answer_2(ipc_call_t *, errno_t, sysarg_t, sysarg_t);
|
---|
| 194 | extern errno_t async_answer_3(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 195 | sysarg_t);
|
---|
[984a9ba] | 196 | extern errno_t async_answer_4(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 197 | sysarg_t, sysarg_t);
|
---|
[984a9ba] | 198 | extern errno_t async_answer_5(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 199 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 200 |
|
---|
| 201 | /*
|
---|
| 202 | * Wrappers for forwarding routines.
|
---|
| 203 | */
|
---|
| 204 |
|
---|
[984a9ba] | 205 | extern errno_t async_forward_fast(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
[eadaeae8] | 206 | sysarg_t, sysarg_t, unsigned int);
|
---|
[984a9ba] | 207 | extern errno_t async_forward_slow(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
[eadaeae8] | 208 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
[0cc4313] | 209 |
|
---|
| 210 | /*
|
---|
| 211 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
| 212 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
[6b21292] | 213 | * and n is the number of return arguments. The macros decide between the fast
|
---|
[0cc4313] | 214 | * and slow verion based on m.
|
---|
| 215 | */
|
---|
[64d2b10] | 216 |
|
---|
[79ae36dd] | 217 | #define async_req_0_0(exch, method) \
|
---|
| 218 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
---|
| 219 | #define async_req_0_1(exch, method, r1) \
|
---|
| 220 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
---|
| 221 | #define async_req_0_2(exch, method, r1, r2) \
|
---|
| 222 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
---|
| 223 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
---|
| 224 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
---|
| 225 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
---|
| 226 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
---|
| 227 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
---|
| 228 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
---|
| 229 |
|
---|
| 230 | #define async_req_1_0(exch, method, arg1) \
|
---|
| 231 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
| 232 | NULL)
|
---|
| 233 | #define async_req_1_1(exch, method, arg1, rc1) \
|
---|
| 234 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
---|
| 235 | NULL)
|
---|
| 236 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
---|
| 237 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
| 238 | NULL)
|
---|
| 239 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
---|
| 240 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 241 | NULL)
|
---|
[79ae36dd] | 242 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
| 243 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 244 | NULL)
|
---|
[79ae36dd] | 245 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 246 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 247 | rc5)
|
---|
| 248 |
|
---|
| 249 | #define async_req_2_0(exch, method, arg1, arg2) \
|
---|
| 250 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
---|
| 251 | NULL, NULL)
|
---|
| 252 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
---|
| 253 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
---|
| 254 | NULL, NULL)
|
---|
| 255 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
---|
| 256 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
[9db9b10] | 257 | NULL)
|
---|
[79ae36dd] | 258 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
| 259 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 260 | NULL)
|
---|
[79ae36dd] | 261 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
| 262 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 263 | NULL)
|
---|
[79ae36dd] | 264 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 265 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 266 | rc5)
|
---|
| 267 |
|
---|
| 268 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
---|
| 269 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
---|
[9db9b10] | 270 | NULL, NULL)
|
---|
[79ae36dd] | 271 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
---|
| 272 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
---|
[9db9b10] | 273 | NULL, NULL)
|
---|
[79ae36dd] | 274 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
| 275 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
---|
[9db9b10] | 276 | NULL, NULL)
|
---|
[79ae36dd] | 277 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
| 278 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
[9db9b10] | 279 | NULL, NULL)
|
---|
[79ae36dd] | 280 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
| 281 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 282 | rc4, NULL)
|
---|
| 283 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
| 284 | rc5) \
|
---|
| 285 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 286 | rc4, rc5)
|
---|
| 287 |
|
---|
| 288 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
---|
| 289 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
---|
[9db9b10] | 290 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 291 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
| 292 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
---|
[9db9b10] | 293 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 294 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
| 295 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
---|
| 296 | NULL, NULL)
|
---|
| 297 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
| 298 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 299 | NULL, NULL)
|
---|
| 300 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 301 | rc4) \
|
---|
[79ae36dd] | 302 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 303 | rc4, NULL)
|
---|
| 304 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 305 | rc4, rc5) \
|
---|
[79ae36dd] | 306 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 307 | rc4, rc5)
|
---|
| 308 |
|
---|
| 309 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
| 310 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
---|
| 311 | NULL, NULL, NULL, NULL)
|
---|
| 312 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
| 313 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
---|
| 314 | NULL, NULL, NULL, NULL)
|
---|
| 315 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
| 316 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 317 | NULL, NULL, NULL)
|
---|
| 318 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 319 | rc3) \
|
---|
[79ae36dd] | 320 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 321 | rc3, NULL, NULL)
|
---|
| 322 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 323 | rc3, rc4) \
|
---|
[79ae36dd] | 324 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 325 | rc3, rc4, NULL)
|
---|
| 326 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 327 | rc3, rc4, rc5) \
|
---|
[79ae36dd] | 328 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 329 | rc3, rc4, rc5)
|
---|
[fc42b28] | 330 |
|
---|
[b7fd2a0] | 331 | extern errno_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[11bb813] | 332 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 333 | sysarg_t *);
|
---|
[b7fd2a0] | 334 | extern errno_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 335 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 336 | sysarg_t *, sysarg_t *);
|
---|
[085bd54] | 337 |
|
---|
[914c693] | 338 | extern async_sess_t *async_connect_me_to(async_exch_t *, iface_t, sysarg_t,
|
---|
| 339 | sysarg_t);
|
---|
| 340 | extern async_sess_t *async_connect_me_to_blocking(async_exch_t *, iface_t,
|
---|
[566992e1] | 341 | sysarg_t, sysarg_t);
|
---|
[79ae36dd] | 342 | extern async_sess_t *async_connect_kbox(task_id_t);
|
---|
[fc42b28] | 343 |
|
---|
[9b1baac] | 344 | extern errno_t async_connect_to_me(async_exch_t *, iface_t, sysarg_t, sysarg_t);
|
---|
[79ae36dd] | 345 |
|
---|
[b7fd2a0] | 346 | extern errno_t async_hangup(async_sess_t *);
|
---|
[64d2b10] | 347 | extern void async_poke(void);
|
---|
[f74392f] | 348 |
|
---|
[79ae36dd] | 349 | extern async_exch_t *async_exchange_begin(async_sess_t *);
|
---|
| 350 | extern void async_exchange_end(async_exch_t *);
|
---|
| 351 |
|
---|
[93ad49a8] | 352 | /*
|
---|
| 353 | * FIXME These functions just work around problems with parallel exchange
|
---|
| 354 | * management. Proper solution needs to be implemented.
|
---|
| 355 | */
|
---|
[914c693] | 356 | void async_sess_args_set(async_sess_t *sess, iface_t, sysarg_t, sysarg_t);
|
---|
[93ad49a8] | 357 |
|
---|
[0da4e41] | 358 | /*
|
---|
| 359 | * User-friendly wrappers for async_share_in_start().
|
---|
| 360 | */
|
---|
[64d2b10] | 361 |
|
---|
[fbcdeb8] | 362 | #define async_share_in_start_0_0(exch, size, dst) \
|
---|
| 363 | async_share_in_start(exch, size, 0, NULL, dst)
|
---|
| 364 | #define async_share_in_start_0_1(exch, size, flags, dst) \
|
---|
| 365 | async_share_in_start(exch, size, 0, flags, dst)
|
---|
| 366 | #define async_share_in_start_1_0(exch, size, arg, dst) \
|
---|
| 367 | async_share_in_start(exch, size, arg, NULL, dst)
|
---|
| 368 | #define async_share_in_start_1_1(exch, size, arg, flags, dst) \
|
---|
| 369 | async_share_in_start(exch, size, arg, flags, dst)
|
---|
| 370 |
|
---|
[b7fd2a0] | 371 | extern errno_t async_share_in_start(async_exch_t *, size_t, sysarg_t,
|
---|
[fbcdeb8] | 372 | unsigned int *, void **);
|
---|
[984a9ba] | 373 | extern bool async_share_in_receive(ipc_call_t *, size_t *);
|
---|
| 374 | extern errno_t async_share_in_finalize(ipc_call_t *, void *, unsigned int);
|
---|
[47b7006] | 375 |
|
---|
[b7fd2a0] | 376 | extern errno_t async_share_out_start(async_exch_t *, void *, unsigned int);
|
---|
[984a9ba] | 377 | extern bool async_share_out_receive(ipc_call_t *, size_t *, unsigned int *);
|
---|
| 378 | extern errno_t async_share_out_finalize(ipc_call_t *, void **);
|
---|
[b4cbef1] | 379 |
|
---|
| 380 | /*
|
---|
| 381 | * User-friendly wrappers for async_data_read_forward_fast().
|
---|
| 382 | */
|
---|
[64d2b10] | 383 |
|
---|
[79ae36dd] | 384 | #define async_data_read_forward_0_0(exch, method, answer) \
|
---|
| 385 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 386 | #define async_data_read_forward_0_1(exch, method, answer) \
|
---|
| 387 | async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 388 | #define async_data_read_forward_1_0(exch, method, arg1, answer) \
|
---|
| 389 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 390 | #define async_data_read_forward_1_1(exch, method, arg1, answer) \
|
---|
| 391 | async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 392 | #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 393 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 394 | #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 395 | async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 396 | #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 397 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
|
---|
| 398 | #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 399 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 400 | answer)
|
---|
| 401 | #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 402 | answer) \
|
---|
| 403 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 404 | NULL)
|
---|
[79ae36dd] | 405 | #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 406 | answer) \
|
---|
| 407 | async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 408 | answer)
|
---|
| 409 |
|
---|
| 410 | extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
|
---|
[b7fd2a0] | 411 | extern errno_t async_data_read_start(async_exch_t *, void *, size_t);
|
---|
[984a9ba] | 412 | extern bool async_data_read_receive(ipc_call_t *, size_t *);
|
---|
| 413 | extern errno_t async_data_read_finalize(ipc_call_t *, const void *, size_t);
|
---|
[eda925a] | 414 |
|
---|
[b7fd2a0] | 415 | extern errno_t async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 416 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[b4cbef1] | 417 |
|
---|
| 418 | /*
|
---|
[eda925a] | 419 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
[b4cbef1] | 420 | */
|
---|
[64d2b10] | 421 |
|
---|
[79ae36dd] | 422 | #define async_data_write_forward_0_0(exch, method, answer) \
|
---|
| 423 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 424 | #define async_data_write_forward_0_1(exch, method, answer) \
|
---|
| 425 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 426 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
---|
| 427 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 428 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
---|
| 429 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 430 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 431 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 432 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 433 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 434 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 435 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 436 | NULL)
|
---|
| 437 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 438 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 439 | answer)
|
---|
| 440 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 441 | answer) \
|
---|
| 442 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 443 | NULL)
|
---|
[79ae36dd] | 444 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 445 | answer) \
|
---|
| 446 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 447 | answer)
|
---|
| 448 |
|
---|
[b7fd2a0] | 449 | extern errno_t async_data_write_start(async_exch_t *, const void *, size_t);
|
---|
[984a9ba] | 450 | extern bool async_data_write_receive(ipc_call_t *, size_t *);
|
---|
| 451 | extern errno_t async_data_write_finalize(ipc_call_t *, void *, size_t);
|
---|
[eda925a] | 452 |
|
---|
[b7fd2a0] | 453 | extern errno_t async_data_write_accept(void **, const bool, const size_t,
|
---|
[eda925a] | 454 | const size_t, const size_t, size_t *);
|
---|
[b7fd2a0] | 455 | extern void async_data_write_void(errno_t);
|
---|
[eda925a] | 456 |
|
---|
[b7fd2a0] | 457 | extern errno_t async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 458 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 459 |
|
---|
| 460 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
---|
[8869f7b] | 461 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
---|
[8aa42e3] | 462 |
|
---|
[b7fd2a0] | 463 | extern errno_t async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[2c4aa39] | 464 | sysarg_t, async_exch_t *);
|
---|
[984a9ba] | 465 | extern bool async_state_change_receive(ipc_call_t *);
|
---|
| 466 | extern errno_t async_state_change_finalize(ipc_call_t *, async_exch_t *);
|
---|
[2c4aa39] | 467 |
|
---|
[58cbf8d5] | 468 | extern void *async_remote_state_acquire(async_sess_t *);
|
---|
| 469 | extern void async_remote_state_update(async_sess_t *, void *);
|
---|
| 470 | extern void async_remote_state_release(async_sess_t *);
|
---|
| 471 | extern void async_remote_state_release_exchange(async_exch_t *);
|
---|
| 472 |
|
---|
[ae6021d] | 473 | extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
|
---|
| 474 | sysarg_t, sysarg_t, sysarg_t);
|
---|
[101516d] | 475 |
|
---|
[3b1cc8d] | 476 | errno_t async_spawn_notification_handler(void);
|
---|
| 477 |
|
---|
[630c3a9] | 478 | #endif
|
---|
[b2951e2] | 479 |
|
---|
[fadd381] | 480 | /** @}
|
---|
[b2951e2] | 481 | */
|
---|