Subversion Repositories HelenOS

Rev

Rev 3818 | Rev 4002 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3818 Rev 3819
1
/*
1
/*
2
 * Copyright (c) 2006 Ondrej Palkovsky
2
 * Copyright (c) 2006 Ondrej Palkovsky
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
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
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.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
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
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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
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.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup libcipc
29
/** @addtogroup libcipc
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
35
#ifndef LIBIPC_IPC_H_
35
#ifndef LIBIPC_IPC_H_
36
#define LIBIPC_IPC_H_
36
#define LIBIPC_IPC_H_
37
 
37
 
38
#include <kernel/ipc/ipc.h>
38
#include <kernel/ipc/ipc.h>
39
#include <kernel/ddi/irq.h>
39
#include <kernel/ddi/irq.h>
40
#include <sys/types.h>
40
#include <sys/types.h>
41
#include <kernel/synch/synch.h>
41
#include <kernel/synch/synch.h>
42
 
42
 
43
typedef sysarg_t ipcarg_t;
43
typedef sysarg_t ipcarg_t;
44
typedef struct {
44
typedef struct {
45
    ipcarg_t args[IPC_CALL_LEN];
45
    ipcarg_t args[IPC_CALL_LEN];
46
    ipcarg_t in_phone_hash;
46
    ipcarg_t in_phone_hash;
47
} ipc_call_t;
47
} ipc_call_t;
48
typedef sysarg_t ipc_callid_t;
48
typedef sysarg_t ipc_callid_t;
49
 
49
 
50
typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *);
50
typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *);
51
 
51
 
52
/*
52
/*
53
 * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow().
53
 * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow().
54
 * They are in the form ipc_call_sync_m_n(), where m denotes the number of
54
 * They are in the form ipc_call_sync_m_n(), where m denotes the number of
55
 * arguments of payload and n denotes number of return values. Whenever
55
 * arguments of payload and n denotes number of return values. Whenever
56
 * possible, the fast version is used.
56
 * possible, the fast version is used.
57
 */
57
 */
58
#define ipc_call_sync_0_0(phoneid, method) \
58
#define ipc_call_sync_0_0(phoneid, method) \
59
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
59
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
60
#define ipc_call_sync_0_1(phoneid, method, res1) \
60
#define ipc_call_sync_0_1(phoneid, method, res1) \
61
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
61
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
62
#define ipc_call_sync_0_2(phoneid, method, res1, res2) \
62
#define ipc_call_sync_0_2(phoneid, method, res1, res2) \
63
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
63
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
64
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
64
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
65
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
65
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
66
        0, 0)
66
        0, 0)
67
#define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \
67
#define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \
68
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
68
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
69
        (res4), 0)
69
        (res4), 0)
70
#define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \
70
#define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \
71
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
71
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
72
        (res4), (res5))
72
        (res4), (res5))
73
#define ipc_call_sync_1_0(phoneid, method, arg1) \
73
#define ipc_call_sync_1_0(phoneid, method, arg1) \
74
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0)
74
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0)
75
#define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
75
#define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
76
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0)
76
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0)
77
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
77
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
78
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \
78
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \
79
    0, 0)
79
    0, 0)
80
#define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \
80
#define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \
81
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
81
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
82
    (res3), 0, 0)
82
    (res3), 0, 0)
83
#define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \
83
#define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \
84
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
84
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
85
    (res3), (res4), 0)
85
    (res3), (res4), 0)
86
#define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \
86
#define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \
87
    res5) \
87
    res5) \
88
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
88
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
89
        (res3), (res4), (res5))
89
        (res3), (res4), (res5))
90
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
90
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
91
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \
91
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \
92
    0, 0)
92
    0, 0)
93
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
93
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
94
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \
94
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \
95
    0, 0)
95
    0, 0)
96
#define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \
96
#define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \
97
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
97
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
98
    (res2), 0, 0, 0)
98
    (res2), 0, 0, 0)
99
#define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \
99
#define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \
100
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
100
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
101
    (res2), (res3), 0, 0)
101
    (res2), (res3), 0, 0)
102
#define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \
102
#define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \
103
    res4) \
103
    res4) \
104
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
104
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
105
        (res2), (res3), (res4), 0)
105
        (res2), (res3), (res4), 0)
106
#define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \
106
#define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \
107
    res4, res5)\
107
    res4, res5)\
108
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
108
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
109
        (res2), (res3), (res4), (res5))
109
        (res2), (res3), (res4), (res5))
110
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
110
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
111
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \
111
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \
112
    0, 0)
112
    0, 0)
113
#define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \
113
#define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \
114
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
114
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
115
    0, 0, 0, 0)
115
    0, 0, 0, 0)
116
#define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \
116
#define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \
117
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
117
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
118
    (res2), 0, 0, 0)
118
    (res2), 0, 0, 0)
119
#define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \
119
#define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \
120
    res3) \
120
    res3) \
121
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
121
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
122
        (res1), (res2), (res3), 0, 0)
122
        (res1), (res2), (res3), 0, 0)
123
#define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \
123
#define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \
124
    res3, res4) \
124
    res3, res4) \
125
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
125
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
126
        (res1), (res2), (res3), (res4), 0)
126
        (res1), (res2), (res3), (res4), 0)
127
#define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \
127
#define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \
128
    res3, res4, res5) \
128
    res3, res4, res5) \
129
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
129
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
130
        (res1), (res2), (res3), (res4), (res5))
130
        (res1), (res2), (res3), (res4), (res5))
131
#define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
131
#define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
132
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
132
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
133
    0, 0, 0, 0, 0)
133
    0, 0, 0, 0, 0)
134
#define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \
134
#define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \
135
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
135
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
136
    (res1), 0, 0, 0, 0)
136
    (res1), 0, 0, 0, 0)
137
#define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \
137
#define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \
138
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
138
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
139
    (res1), (res2), 0, 0, 0)
139
    (res1), (res2), 0, 0, 0)
140
#define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
140
#define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
141
    res3) \
141
    res3) \
142
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
142
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
143
        (arg4), 0, (res1), (res2), (res3), 0, 0)
143
        (arg4), 0, (res1), (res2), (res3), 0, 0)
144
#define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
144
#define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
145
    res3, res4) \
145
    res3, res4) \
146
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
146
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
147
        (arg4), 0, (res1), (res2), (res3), (res4), 0)
147
        (arg4), 0, (res1), (res2), (res3), (res4), 0)
148
#define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
148
#define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
149
    res3, res4, res5) \
149
    res3, res4, res5) \
150
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
150
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
151
        (arg4), 0, (res1), (res2), (res3), (res4), (res5))
151
        (arg4), 0, (res1), (res2), (res3), (res4), (res5))
152
#define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
152
#define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
153
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
153
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
154
        (arg5), 0, 0, 0, 0, 0)
154
        (arg5), 0, 0, 0, 0, 0)
155
#define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \
155
#define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \
156
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
156
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
157
        (arg5), (res1), 0, 0, 0, 0)
157
        (arg5), (res1), 0, 0, 0, 0)
158
#define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
158
#define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
159
    res2) \
159
    res2) \
160
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
160
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
161
        (arg4), (arg5), (res1), (res2), 0, 0, 0)
161
        (arg4), (arg5), (res1), (res2), 0, 0, 0)
162
#define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
162
#define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
163
    res2, res3) \
163
    res2, res3) \
164
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
164
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
165
        (arg4), (arg5), (res1), (res2), (res3), 0, 0)
165
        (arg4), (arg5), (res1), (res2), (res3), 0, 0)
166
#define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
166
#define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
167
    res2, res3, res4) \
167
    res2, res3, res4) \
168
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
168
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
169
        (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
169
        (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
170
#define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
170
#define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
171
    res2, res3, res4, res5) \
171
    res2, res3, res4, res5) \
172
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
172
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
173
        (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
173
        (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
174
 
174
 
175
extern int ipc_call_sync_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
175
extern int ipc_call_sync_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
176
    ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *);
176
    ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *);
177
 
177
 
178
extern int ipc_call_sync_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
178
extern int ipc_call_sync_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
179
    ipcarg_t, ipcarg_t, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *,
179
    ipcarg_t, ipcarg_t, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *,
180
    ipcarg_t *);
180
    ipcarg_t *);
181
 
181
 
182
extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int);
182
extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int);
183
extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t);
183
extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t);
184
static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
184
static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
185
{
185
{
186
    return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
186
    return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
187
}
187
}
188
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *);
188
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *);
189
 
189
 
190
/*
190
/*
191
 * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow().
191
 * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow().
192
 * They are in the form of ipc_answer_m(), where m is the number of return
192
 * They are in the form of ipc_answer_m(), where m is the number of return
193
 * arguments. The macros decide between the fast and the slow version according
193
 * arguments. The macros decide between the fast and the slow version according
194
 * to m.
194
 * to m.
195
 */
195
 */
196
#define ipc_answer_0(callid, retval) \
196
#define ipc_answer_0(callid, retval) \
197
    ipc_answer_fast((callid), (retval), 0, 0, 0, 0)
197
    ipc_answer_fast((callid), (retval), 0, 0, 0, 0)
198
#define ipc_answer_1(callid, retval, arg1) \
198
#define ipc_answer_1(callid, retval, arg1) \
199
    ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0)
199
    ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0)
200
#define ipc_answer_2(callid, retval, arg1, arg2) \
200
#define ipc_answer_2(callid, retval, arg1, arg2) \
201
    ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0)
201
    ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0)
202
#define ipc_answer_3(callid, retval, arg1, arg2, arg3) \
202
#define ipc_answer_3(callid, retval, arg1, arg2, arg3) \
203
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0)
203
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0)
204
#define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \
204
#define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \
205
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4))
205
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4))
206
#define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \
206
#define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \
207
    ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5))
207
    ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5))
208
 
208
 
209
extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
209
extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
210
    ipcarg_t, ipcarg_t);
210
    ipcarg_t, ipcarg_t);
211
extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
211
extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
212
    ipcarg_t, ipcarg_t, ipcarg_t);
212
    ipcarg_t, ipcarg_t, ipcarg_t);
213
 
213
 
214
/*
214
/*
215
 * User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow().
215
 * User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow().
216
 * They are in the form of ipc_call_async_m(), where m is the number of payload
216
 * They are in the form of ipc_call_async_m(), where m is the number of payload
217
 * arguments. The macros decide between the fast and the slow version according
217
 * arguments. The macros decide between the fast and the slow version according
218
 * to m.
218
 * to m.
219
 */
219
 */
220
#define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \
220
#define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \
221
    ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
221
    ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
222
        (callback), (can_preempt))
222
        (callback), (can_preempt))
223
#define ipc_call_async_1(phoneid, method, arg1, private, callback, \
223
#define ipc_call_async_1(phoneid, method, arg1, private, callback, \
224
    can_preempt) \
224
    can_preempt) \
225
    ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
225
    ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
226
        (callback), (can_preempt))
226
        (callback), (can_preempt))
227
#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
227
#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
228
    can_preempt) \
228
    can_preempt) \
229
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
229
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
230
        (private), (callback), (can_preempt))
230
        (private), (callback), (can_preempt))
231
#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \
231
#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \
232
    can_preempt) \
232
    can_preempt) \
233
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
233
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
234
        (private), (callback), (can_preempt))
234
        (private), (callback), (can_preempt))
235
#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \
235
#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \
236
    callback, can_preempt) \
236
    callback, can_preempt) \
237
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
237
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
238
        (arg4), (private), (callback), (can_preempt))
238
        (arg4), (private), (callback), (can_preempt))
239
#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \
239
#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \
240
    private, callback, can_preempt) \
240
    private, callback, can_preempt) \
241
    ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
241
    ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
242
        (arg4), (arg5), (private), (callback), (can_preempt))
242
        (arg4), (arg5), (private), (callback), (can_preempt))
243
 
243
 
244
extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
244
extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
245
    ipcarg_t, void *, ipc_async_callback_t, int);
245
    ipcarg_t, void *, ipc_async_callback_t, int);
246
extern void ipc_call_async_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
246
extern void ipc_call_async_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
247
    ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int);
247
    ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int);
248
 
248
 
249
extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *);
249
extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *);
250
extern int ipc_connect_me_to(int, int, int, int);
250
extern int ipc_connect_me_to(int, int, int, int);
251
extern int ipc_hangup(int);
251
extern int ipc_hangup(int);
252
extern int ipc_register_irq(int, int, int, irq_code_t *);
252
extern int ipc_register_irq(int, int, int, irq_code_t *);
253
extern int ipc_unregister_irq(int, int);
253
extern int ipc_unregister_irq(int, int);
254
extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, int);
254
extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, int);
-
 
255
extern int ipc_forward_slow(ipc_callid_t, int, int, ipcarg_t, ipcarg_t,
-
 
256
    ipcarg_t, ipcarg_t, ipcarg_t, int);
255
 
257
 
256
 
258
 
257
/*
259
/*
258
 * User-friendly wrappers for ipc_share_in_start().
260
 * User-friendly wrappers for ipc_share_in_start().
259
 */
261
 */
260
#define ipc_share_in_start_0_0(phoneid, dst, size) \
262
#define ipc_share_in_start_0_0(phoneid, dst, size) \
261
    ipc_share_in_start((phoneid), (dst), (size), 0, NULL)
263
    ipc_share_in_start((phoneid), (dst), (size), 0, NULL)
262
#define ipc_share_in_start_0_1(phoneid, dst, size, flags) \
264
#define ipc_share_in_start_0_1(phoneid, dst, size, flags) \
263
    ipc_share_in_start((phoneid), (dst), (size), 0, (flags))
265
    ipc_share_in_start((phoneid), (dst), (size), 0, (flags))
264
#define ipc_share_in_start_1_0(phoneid, dst, size, arg) \
266
#define ipc_share_in_start_1_0(phoneid, dst, size, arg) \
265
    ipc_share_in_start((phoneid), (dst), (size), (arg), NULL)
267
    ipc_share_in_start((phoneid), (dst), (size), (arg), NULL)
266
#define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \
268
#define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \
267
    ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
269
    ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
268
 
270
 
269
extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *);
271
extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *);
270
extern int ipc_share_in_receive(ipc_callid_t *, size_t *);
272
extern int ipc_share_in_receive(ipc_callid_t *, size_t *);
271
extern int ipc_share_in_finalize(ipc_callid_t, void *, int );
273
extern int ipc_share_in_finalize(ipc_callid_t, void *, int );
272
extern int ipc_share_out_start(int, void *, int);
274
extern int ipc_share_out_start(int, void *, int);
273
extern int ipc_share_out_receive(ipc_callid_t *, size_t *, int *);
275
extern int ipc_share_out_receive(ipc_callid_t *, size_t *, int *);
274
extern int ipc_share_out_finalize(ipc_callid_t, void *);
276
extern int ipc_share_out_finalize(ipc_callid_t, void *);
275
extern int ipc_data_read_start(int, void *, size_t);
277
extern int ipc_data_read_start(int, void *, size_t);
276
extern int ipc_data_read_receive(ipc_callid_t *, size_t *);
278
extern int ipc_data_read_receive(ipc_callid_t *, size_t *);
277
extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t);
279
extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t);
278
extern int ipc_data_write_start(int, const void *, size_t);
280
extern int ipc_data_write_start(int, const void *, size_t);
279
extern int ipc_data_write_receive(ipc_callid_t *, size_t *);
281
extern int ipc_data_write_receive(ipc_callid_t *, size_t *);
280
extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t);
282
extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t);
281
 
283
 
282
#include <task.h>
284
#include <task.h>
283
 
285
 
284
extern int ipc_connect_kbox(task_id_t);
286
extern int ipc_connect_kbox(task_id_t);
285
 
287
 
286
#endif
288
#endif
287
 
289
 
288
/** @}
290
/** @}
289
 */
291
 */
290
 
292