[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 |
|
---|
[11bb813] | 146 | extern void async_usleep(suseconds_t);
|
---|
[39026d7c] | 147 | extern void async_sleep(unsigned int);
|
---|
| 148 |
|
---|
[9db9b10] | 149 | extern void async_create_manager(void);
|
---|
| 150 | extern void async_destroy_manager(void);
|
---|
[01ff41c] | 151 |
|
---|
[46eec3b] | 152 | extern void async_set_client_data_constructor(async_client_data_ctor_t);
|
---|
| 153 | extern void async_set_client_data_destructor(async_client_data_dtor_t);
|
---|
[79ae36dd] | 154 | extern void *async_get_client_data(void);
|
---|
[e2ab36f1] | 155 | extern void *async_get_client_data_by_id(task_id_t);
|
---|
| 156 | extern void async_put_client_data_by_id(task_id_t);
|
---|
[23882034] | 157 |
|
---|
[b7fd2a0] | 158 | extern errno_t async_create_port(iface_t, async_port_handler_t, void *,
|
---|
[566992e1] | 159 | port_id_t *);
|
---|
[b688fd8] | 160 | extern void async_set_fallback_port_handler(async_port_handler_t, void *);
|
---|
[b7fd2a0] | 161 | extern errno_t async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
|
---|
[78bb04b] | 162 | sysarg_t, async_port_handler_t, void *, port_id_t *);
|
---|
| 163 |
|
---|
[b7fd2a0] | 164 | extern errno_t async_irq_subscribe(int, async_notification_handler_t, void *,
|
---|
[eadaeae8] | 165 | const irq_code_t *, cap_irq_handle_t *);
|
---|
| 166 | extern errno_t async_irq_unsubscribe(cap_irq_handle_t);
|
---|
[8820544] | 167 |
|
---|
[b7fd2a0] | 168 | extern errno_t async_event_subscribe(event_type_t, async_notification_handler_t,
|
---|
[8820544] | 169 | void *);
|
---|
[b7fd2a0] | 170 | extern errno_t async_event_task_subscribe(event_task_type_t,
|
---|
[8820544] | 171 | async_notification_handler_t, void *);
|
---|
[b7fd2a0] | 172 | extern errno_t async_event_unsubscribe(event_type_t);
|
---|
| 173 | extern errno_t async_event_task_unsubscribe(event_task_type_t);
|
---|
| 174 | extern errno_t async_event_unmask(event_type_t);
|
---|
| 175 | extern errno_t async_event_task_unmask(event_task_type_t);
|
---|
[0cc4313] | 176 |
|
---|
[64d2b10] | 177 | /*
|
---|
| 178 | * Wrappers for simple communication.
|
---|
| 179 | */
|
---|
| 180 |
|
---|
[79ae36dd] | 181 | extern void async_msg_0(async_exch_t *, sysarg_t);
|
---|
| 182 | extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
|
---|
| 183 | extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 184 | extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
|
---|
| 185 | extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 186 | sysarg_t);
|
---|
[79ae36dd] | 187 | extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
|
---|
| 188 | sysarg_t, sysarg_t);
|
---|
[64d2b10] | 189 |
|
---|
| 190 | /*
|
---|
| 191 | * Wrappers for answer routines.
|
---|
| 192 | */
|
---|
| 193 |
|
---|
[984a9ba] | 194 | extern errno_t async_answer_0(ipc_call_t *, errno_t);
|
---|
| 195 | extern errno_t async_answer_1(ipc_call_t *, errno_t, sysarg_t);
|
---|
| 196 | extern errno_t async_answer_2(ipc_call_t *, errno_t, sysarg_t, sysarg_t);
|
---|
| 197 | extern errno_t async_answer_3(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 198 | sysarg_t);
|
---|
[984a9ba] | 199 | extern errno_t async_answer_4(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 200 | sysarg_t, sysarg_t);
|
---|
[984a9ba] | 201 | extern errno_t async_answer_5(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
|
---|
[64d2b10] | 202 | sysarg_t, sysarg_t, sysarg_t);
|
---|
| 203 |
|
---|
| 204 | /*
|
---|
| 205 | * Wrappers for forwarding routines.
|
---|
| 206 | */
|
---|
| 207 |
|
---|
[984a9ba] | 208 | extern errno_t async_forward_fast(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
[eadaeae8] | 209 | sysarg_t, sysarg_t, unsigned int);
|
---|
[984a9ba] | 210 | extern errno_t async_forward_slow(ipc_call_t *, async_exch_t *, sysarg_t,
|
---|
[eadaeae8] | 211 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
[0cc4313] | 212 |
|
---|
| 213 | /*
|
---|
| 214 | * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros
|
---|
| 215 | * are in the form async_req_m_n(), where m is the number of payload arguments
|
---|
[6b21292] | 216 | * and n is the number of return arguments. The macros decide between the fast
|
---|
[0cc4313] | 217 | * and slow verion based on m.
|
---|
| 218 | */
|
---|
[64d2b10] | 219 |
|
---|
[79ae36dd] | 220 | #define async_req_0_0(exch, method) \
|
---|
| 221 | async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
|
---|
| 222 | #define async_req_0_1(exch, method, r1) \
|
---|
| 223 | async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
|
---|
| 224 | #define async_req_0_2(exch, method, r1, r2) \
|
---|
| 225 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
|
---|
| 226 | #define async_req_0_3(exch, method, r1, r2, r3) \
|
---|
| 227 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
|
---|
| 228 | #define async_req_0_4(exch, method, r1, r2, r3, r4) \
|
---|
| 229 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
|
---|
| 230 | #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
|
---|
| 231 | async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
|
---|
| 232 |
|
---|
| 233 | #define async_req_1_0(exch, method, arg1) \
|
---|
| 234 | async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
|
---|
| 235 | NULL)
|
---|
| 236 | #define async_req_1_1(exch, method, arg1, rc1) \
|
---|
| 237 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
|
---|
| 238 | NULL)
|
---|
| 239 | #define async_req_1_2(exch, method, arg1, rc1, rc2) \
|
---|
| 240 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
| 241 | NULL)
|
---|
| 242 | #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
|
---|
| 243 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 244 | NULL)
|
---|
[79ae36dd] | 245 | #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
|
---|
| 246 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 247 | NULL)
|
---|
[79ae36dd] | 248 | #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 249 | async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 250 | rc5)
|
---|
| 251 |
|
---|
| 252 | #define async_req_2_0(exch, method, arg1, arg2) \
|
---|
| 253 | async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
|
---|
| 254 | NULL, NULL)
|
---|
| 255 | #define async_req_2_1(exch, method, arg1, arg2, rc1) \
|
---|
| 256 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
|
---|
| 257 | NULL, NULL)
|
---|
| 258 | #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
|
---|
| 259 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
|
---|
[9db9b10] | 260 | NULL)
|
---|
[79ae36dd] | 261 | #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
|
---|
| 262 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
|
---|
[9db9b10] | 263 | NULL)
|
---|
[79ae36dd] | 264 | #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
|
---|
| 265 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
[9db9b10] | 266 | NULL)
|
---|
[79ae36dd] | 267 | #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
|
---|
| 268 | async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
|
---|
| 269 | rc5)
|
---|
| 270 |
|
---|
| 271 | #define async_req_3_0(exch, method, arg1, arg2, arg3) \
|
---|
| 272 | async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
|
---|
[9db9b10] | 273 | NULL, NULL)
|
---|
[79ae36dd] | 274 | #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
|
---|
| 275 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
|
---|
[9db9b10] | 276 | NULL, NULL)
|
---|
[79ae36dd] | 277 | #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
|
---|
| 278 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
|
---|
[9db9b10] | 279 | NULL, NULL)
|
---|
[79ae36dd] | 280 | #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
|
---|
| 281 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
[9db9b10] | 282 | NULL, NULL)
|
---|
[79ae36dd] | 283 | #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
|
---|
| 284 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 285 | rc4, NULL)
|
---|
| 286 | #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
|
---|
| 287 | rc5) \
|
---|
| 288 | async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
|
---|
| 289 | rc4, rc5)
|
---|
| 290 |
|
---|
| 291 | #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
|
---|
| 292 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
|
---|
[9db9b10] | 293 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 294 | #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
|
---|
| 295 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
|
---|
[9db9b10] | 296 | NULL, NULL, NULL)
|
---|
[79ae36dd] | 297 | #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
|
---|
| 298 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
|
---|
| 299 | NULL, NULL)
|
---|
| 300 | #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
|
---|
| 301 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 302 | NULL, NULL)
|
---|
| 303 | #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 304 | rc4) \
|
---|
[79ae36dd] | 305 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 306 | rc4, NULL)
|
---|
| 307 | #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
[0cc4313] | 308 | rc4, rc5) \
|
---|
[79ae36dd] | 309 | async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
|
---|
| 310 | rc4, rc5)
|
---|
| 311 |
|
---|
| 312 | #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
|
---|
| 313 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
|
---|
| 314 | NULL, NULL, NULL, NULL)
|
---|
| 315 | #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
|
---|
| 316 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
|
---|
| 317 | NULL, NULL, NULL, NULL)
|
---|
| 318 | #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
|
---|
| 319 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 320 | NULL, NULL, NULL)
|
---|
| 321 | #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 322 | rc3) \
|
---|
[79ae36dd] | 323 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 324 | rc3, NULL, NULL)
|
---|
| 325 | #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 326 | rc3, rc4) \
|
---|
[79ae36dd] | 327 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 328 | rc3, rc4, NULL)
|
---|
| 329 | #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
[0cc4313] | 330 | rc3, rc4, rc5) \
|
---|
[79ae36dd] | 331 | async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
|
---|
| 332 | rc3, rc4, rc5)
|
---|
[fc42b28] | 333 |
|
---|
[b7fd2a0] | 334 | extern errno_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[11bb813] | 335 | sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 336 | sysarg_t *);
|
---|
[b7fd2a0] | 337 | extern errno_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 338 | sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
|
---|
| 339 | sysarg_t *, sysarg_t *);
|
---|
[085bd54] | 340 |
|
---|
[914c693] | 341 | extern async_sess_t *async_connect_me_to(async_exch_t *, iface_t, sysarg_t,
|
---|
| 342 | sysarg_t);
|
---|
| 343 | extern async_sess_t *async_connect_me_to_blocking(async_exch_t *, iface_t,
|
---|
[566992e1] | 344 | sysarg_t, sysarg_t);
|
---|
[79ae36dd] | 345 | extern async_sess_t *async_connect_kbox(task_id_t);
|
---|
[fc42b28] | 346 |
|
---|
[b7fd2a0] | 347 | extern errno_t async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
|
---|
[79ae36dd] | 348 |
|
---|
[b7fd2a0] | 349 | extern errno_t 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 | */
|
---|
[914c693] | 359 | void async_sess_args_set(async_sess_t *sess, iface_t, sysarg_t, sysarg_t);
|
---|
[93ad49a8] | 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 |
|
---|
[b7fd2a0] | 374 | extern errno_t async_share_in_start(async_exch_t *, size_t, sysarg_t,
|
---|
[fbcdeb8] | 375 | unsigned int *, void **);
|
---|
[984a9ba] | 376 | extern bool async_share_in_receive(ipc_call_t *, size_t *);
|
---|
| 377 | extern errno_t async_share_in_finalize(ipc_call_t *, void *, unsigned int);
|
---|
[47b7006] | 378 |
|
---|
[b7fd2a0] | 379 | extern errno_t async_share_out_start(async_exch_t *, void *, unsigned int);
|
---|
[984a9ba] | 380 | extern bool async_share_out_receive(ipc_call_t *, size_t *, unsigned int *);
|
---|
| 381 | extern errno_t async_share_out_finalize(ipc_call_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 *);
|
---|
[b7fd2a0] | 414 | extern errno_t async_data_read_start(async_exch_t *, void *, size_t);
|
---|
[984a9ba] | 415 | extern bool async_data_read_receive(ipc_call_t *, size_t *);
|
---|
| 416 | extern errno_t async_data_read_finalize(ipc_call_t *, const void *, size_t);
|
---|
[eda925a] | 417 |
|
---|
[b7fd2a0] | 418 | extern errno_t async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 419 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
[b4cbef1] | 420 |
|
---|
| 421 | /*
|
---|
[eda925a] | 422 | * User-friendly wrappers for async_data_write_forward_fast().
|
---|
[b4cbef1] | 423 | */
|
---|
[64d2b10] | 424 |
|
---|
[79ae36dd] | 425 | #define async_data_write_forward_0_0(exch, method, answer) \
|
---|
| 426 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
|
---|
| 427 | #define async_data_write_forward_0_1(exch, method, answer) \
|
---|
| 428 | async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
|
---|
| 429 | #define async_data_write_forward_1_0(exch, method, arg1, answer) \
|
---|
| 430 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
|
---|
| 431 | #define async_data_write_forward_1_1(exch, method, arg1, answer) \
|
---|
| 432 | async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
|
---|
| 433 | #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
|
---|
| 434 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
|
---|
| 435 | #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
|
---|
| 436 | async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
|
---|
| 437 | #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 438 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 439 | NULL)
|
---|
| 440 | #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
|
---|
| 441 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
|
---|
| 442 | answer)
|
---|
| 443 | #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 444 | answer) \
|
---|
| 445 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
[b4cbef1] | 446 | NULL)
|
---|
[79ae36dd] | 447 | #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 448 | answer) \
|
---|
| 449 | async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
|
---|
| 450 | answer)
|
---|
| 451 |
|
---|
[b7fd2a0] | 452 | extern errno_t async_data_write_start(async_exch_t *, const void *, size_t);
|
---|
[984a9ba] | 453 | extern bool async_data_write_receive(ipc_call_t *, size_t *);
|
---|
| 454 | extern errno_t async_data_write_finalize(ipc_call_t *, void *, size_t);
|
---|
[eda925a] | 455 |
|
---|
[b7fd2a0] | 456 | extern errno_t async_data_write_accept(void **, const bool, const size_t,
|
---|
[eda925a] | 457 | const size_t, const size_t, size_t *);
|
---|
[b7fd2a0] | 458 | extern void async_data_write_void(errno_t);
|
---|
[eda925a] | 459 |
|
---|
[b7fd2a0] | 460 | extern errno_t async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[79ae36dd] | 461 | sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
|
---|
| 462 |
|
---|
| 463 | extern async_sess_t *async_callback_receive(exch_mgmt_t);
|
---|
[8869f7b] | 464 | extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
|
---|
[8aa42e3] | 465 |
|
---|
[b7fd2a0] | 466 | extern errno_t async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
|
---|
[2c4aa39] | 467 | sysarg_t, async_exch_t *);
|
---|
[984a9ba] | 468 | extern bool async_state_change_receive(ipc_call_t *);
|
---|
| 469 | extern errno_t async_state_change_finalize(ipc_call_t *, async_exch_t *);
|
---|
[2c4aa39] | 470 |
|
---|
[58cbf8d5] | 471 | extern void *async_remote_state_acquire(async_sess_t *);
|
---|
| 472 | extern void async_remote_state_update(async_sess_t *, void *);
|
---|
| 473 | extern void async_remote_state_release(async_sess_t *);
|
---|
| 474 | extern void async_remote_state_release_exchange(async_exch_t *);
|
---|
| 475 |
|
---|
[ae6021d] | 476 | extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
|
---|
| 477 | sysarg_t, sysarg_t, sysarg_t);
|
---|
[101516d] | 478 |
|
---|
[3b1cc8d] | 479 | errno_t async_spawn_notification_handler(void);
|
---|
| 480 |
|
---|
[630c3a9] | 481 | #endif
|
---|
[b2951e2] | 482 |
|
---|
[fadd381] | 483 | /** @}
|
---|
[b2951e2] | 484 | */
|
---|