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