[b419162] | 1 | /*
|
---|
[df4ed85] | 2 | * Copyright (c) 2006 Ondrej Palkovsky
|
---|
[b419162] | 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.
|
---|
[b2951e2] | 27 | */
|
---|
| 28 |
|
---|
[fadd381] | 29 | /** @addtogroup libcipc
|
---|
[b2951e2] | 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
[ca3ba3a] | 33 | */
|
---|
[b419162] | 34 |
|
---|
[4805495] | 35 | #if ((defined(_LIBC_ASYNC_H_)) && (!defined(_LIBC_ASYNC_C_)))
|
---|
[5b0cf63] | 36 | #error Do not intermix low-level IPC interface and async framework
|
---|
[64d2b10] | 37 | #endif
|
---|
| 38 |
|
---|
[4805495] | 39 | #ifndef _LIBC_IPC_H_
|
---|
| 40 | #define _LIBC_IPC_H_
|
---|
[b419162] | 41 |
|
---|
[64d2b10] | 42 | #include <ipc/common.h>
|
---|
[c0699467] | 43 | #include <abi/ipc/methods.h>
|
---|
| 44 | #include <abi/synch.h>
|
---|
[1c635d6] | 45 | #include <abi/proc/task.h>
|
---|
[01c3bb4] | 46 | #include <abi/cap.h>
|
---|
[b419162] | 47 |
|
---|
[d054ad3] | 48 | extern errno_t ipc_wait(ipc_call_t *, sysarg_t, unsigned int);
|
---|
[057d21a] | 49 | extern void ipc_poke(void);
|
---|
[ca3ba3a] | 50 |
|
---|
[b74959bd] | 51 | /*
|
---|
| 52 | * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow().
|
---|
| 53 | * They are in the form of ipc_answer_m(), where m is the number of return
|
---|
| 54 | * arguments. The macros decide between the fast and the slow version according
|
---|
| 55 | * to m.
|
---|
| 56 | */
|
---|
[10477601] | 57 |
|
---|
[01c3bb4] | 58 | #define ipc_answer_0(chandle, retval) \
|
---|
| 59 | ipc_answer_fast((chandle), (retval), 0, 0, 0, 0)
|
---|
| 60 | #define ipc_answer_1(chandle, retval, arg1) \
|
---|
| 61 | ipc_answer_fast((chandle), (retval), (arg1), 0, 0, 0)
|
---|
| 62 | #define ipc_answer_2(chandle, retval, arg1, arg2) \
|
---|
| 63 | ipc_answer_fast((chandle), (retval), (arg1), (arg2), 0, 0)
|
---|
| 64 | #define ipc_answer_3(chandle, retval, arg1, arg2, arg3) \
|
---|
| 65 | ipc_answer_fast((chandle), (retval), (arg1), (arg2), (arg3), 0)
|
---|
| 66 | #define ipc_answer_4(chandle, retval, arg1, arg2, arg3, arg4) \
|
---|
| 67 | ipc_answer_fast((chandle), (retval), (arg1), (arg2), (arg3), (arg4))
|
---|
| 68 | #define ipc_answer_5(chandle, retval, arg1, arg2, arg3, arg4, arg5) \
|
---|
| 69 | ipc_answer_slow((chandle), (retval), (arg1), (arg2), (arg3), (arg4), \
|
---|
| 70 | (arg5))
|
---|
| 71 |
|
---|
[eadaeae8] | 72 | extern errno_t ipc_answer_fast(cap_call_handle_t, errno_t, sysarg_t, sysarg_t,
|
---|
[96b02eb9] | 73 | sysarg_t, sysarg_t);
|
---|
[eadaeae8] | 74 | extern errno_t ipc_answer_slow(cap_call_handle_t, errno_t, sysarg_t, sysarg_t,
|
---|
[96b02eb9] | 75 | sysarg_t, sysarg_t, sysarg_t);
|
---|
[b419162] | 76 |
|
---|
[3209923] | 77 | /*
|
---|
| 78 | * User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow().
|
---|
| 79 | * They are in the form of ipc_call_async_m(), where m is the number of payload
|
---|
| 80 | * arguments. The macros decide between the fast and the slow version according
|
---|
| 81 | * to m.
|
---|
| 82 | */
|
---|
[10477601] | 83 |
|
---|
[d054ad3] | 84 | #define ipc_call_async_0(phandle, method, label) \
|
---|
| 85 | ipc_call_async_fast((phandle), (method), 0, 0, 0, (label))
|
---|
| 86 | #define ipc_call_async_1(phandle, method, arg1, label) \
|
---|
| 87 | ipc_call_async_fast((phandle), (method), (arg1), 0, 0, (label))
|
---|
| 88 | #define ipc_call_async_2(phandle, method, arg1, arg2, label) \
|
---|
| 89 | ipc_call_async_fast((phandle), (method), (arg1), (arg2), 0, (label))
|
---|
| 90 | #define ipc_call_async_3(phandle, method, arg1, arg2, arg3, label) \
|
---|
[01c3bb4] | 91 | ipc_call_async_fast((phandle), (method), (arg1), (arg2), (arg3), \
|
---|
[d054ad3] | 92 | (label))
|
---|
| 93 | #define ipc_call_async_4(phandle, method, arg1, arg2, arg3, arg4, label) \
|
---|
[01c3bb4] | 94 | ipc_call_async_slow((phandle), (method), (arg1), (arg2), (arg3), \
|
---|
[d054ad3] | 95 | (arg4), 0, (label))
|
---|
[01c3bb4] | 96 | #define ipc_call_async_5(phandle, method, arg1, arg2, arg3, arg4, arg5, \
|
---|
[d054ad3] | 97 | label) \
|
---|
[01c3bb4] | 98 | ipc_call_async_slow((phandle), (method), (arg1), (arg2), (arg3), \
|
---|
[d054ad3] | 99 | (arg4), (arg5), (label))
|
---|
[3209923] | 100 |
|
---|
[d054ad3] | 101 | extern errno_t ipc_call_async_fast(cap_phone_handle_t, sysarg_t, sysarg_t,
|
---|
| 102 | sysarg_t, sysarg_t, void *);
|
---|
| 103 | extern errno_t ipc_call_async_slow(cap_phone_handle_t, sysarg_t, sysarg_t,
|
---|
| 104 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, void *);
|
---|
[10477601] | 105 |
|
---|
[eadaeae8] | 106 | extern errno_t ipc_hangup(cap_phone_handle_t);
|
---|
[10477601] | 107 |
|
---|
[eadaeae8] | 108 | extern errno_t ipc_forward_fast(cap_call_handle_t, cap_phone_handle_t, sysarg_t,
|
---|
| 109 | sysarg_t, sysarg_t, unsigned int);
|
---|
| 110 | extern errno_t ipc_forward_slow(cap_call_handle_t, cap_phone_handle_t, sysarg_t,
|
---|
| 111 | sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
|
---|
[a55d5f9f] | 112 |
|
---|
[eadaeae8] | 113 | extern errno_t ipc_connect_kbox(task_id_t, cap_phone_handle_t *);
|
---|
[9a1b20c] | 114 |
|
---|
[b419162] | 115 | #endif
|
---|
[b2951e2] | 116 |
|
---|
[fadd381] | 117 | /** @}
|
---|
[b2951e2] | 118 | */
|
---|