Subversion Repositories HelenOS

Rev

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

Rev 3488 Rev 3818
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 *private, int retval,
50
typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *);
51
    ipc_call_t *data);
-
 
52
 
51
 
53
/*
52
/*
54
 * 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().
55
 * 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
56
 * arguments of payload and n denotes number of return values. Whenever
55
 * arguments of payload and n denotes number of return values. Whenever
57
 * possible, the fast version is used.
56
 * possible, the fast version is used.
58
 */
57
 */
59
#define ipc_call_sync_0_0(phoneid, method) \
58
#define ipc_call_sync_0_0(phoneid, method) \
60
    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)
61
#define ipc_call_sync_0_1(phoneid, method, res1) \
60
#define ipc_call_sync_0_1(phoneid, method, res1) \
62
    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)
63
#define ipc_call_sync_0_2(phoneid, method, res1, res2) \
62
#define ipc_call_sync_0_2(phoneid, method, res1, res2) \
64
    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)
65
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
64
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
66
    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), \
67
        0, 0)
66
        0, 0)
68
#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) \
69
    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), \
70
        (res4), 0)
69
        (res4), 0)
71
#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) \
72
    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), \
73
        (res4), (res5))
72
        (res4), (res5))
74
#define ipc_call_sync_1_0(phoneid, method, arg1) \
73
#define ipc_call_sync_1_0(phoneid, method, arg1) \
75
    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)
76
#define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
75
#define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
77
    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)
78
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
77
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
79
    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, \
80
    0, 0)
79
    0, 0)
81
#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) \
82
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
81
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
83
    (res3), 0, 0)
82
    (res3), 0, 0)
84
#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) \
85
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
84
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
86
    (res3), (res4), 0)
85
    (res3), (res4), 0)
87
#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, \
88
    res5) \
87
    res5) \
89
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
88
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
90
        (res3), (res4), (res5))
89
        (res3), (res4), (res5))
91
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
90
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
92
    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, \
93
    0, 0)
92
    0, 0)
94
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
93
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
95
    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, \
96
    0, 0)
95
    0, 0)
97
#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) \
98
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
97
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
99
    (res2), 0, 0, 0)
98
    (res2), 0, 0, 0)
100
#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) \
101
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
100
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
102
    (res2), (res3), 0, 0)
101
    (res2), (res3), 0, 0)
103
#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, \
104
    res4) \
103
    res4) \
105
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
104
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
106
        (res2), (res3), (res4), 0)
105
        (res2), (res3), (res4), 0)
107
#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, \
108
    res4, res5)\
107
    res4, res5)\
109
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
108
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
110
        (res2), (res3), (res4), (res5))
109
        (res2), (res3), (res4), (res5))
111
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
110
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
112
    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, \
113
    0, 0)
112
    0, 0)
114
#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) \
115
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
114
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
116
    0, 0, 0, 0)
115
    0, 0, 0, 0)
117
#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) \
118
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
117
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
119
    (res2), 0, 0, 0)
118
    (res2), 0, 0, 0)
120
#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, \
121
    res3) \
120
    res3) \
122
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
121
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
123
        (res1), (res2), (res3), 0, 0)
122
        (res1), (res2), (res3), 0, 0)
124
#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, \
125
    res3, res4) \
124
    res3, res4) \
126
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
125
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
127
        (res1), (res2), (res3), (res4), 0)
126
        (res1), (res2), (res3), (res4), 0)
128
#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, \
129
    res3, res4, res5) \
128
    res3, res4, res5) \
130
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
129
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
131
        (res1), (res2), (res3), (res4), (res5))
130
        (res1), (res2), (res3), (res4), (res5))
132
#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) \
133
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
132
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
134
    0, 0, 0, 0, 0)
133
    0, 0, 0, 0, 0)
135
#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) \
136
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
135
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
137
    (res1), 0, 0, 0, 0)
136
    (res1), 0, 0, 0, 0)
138
#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) \
139
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
138
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
140
    (res1), (res2), 0, 0, 0)
139
    (res1), (res2), 0, 0, 0)
141
#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, \
142
    res3) \
141
    res3) \
143
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
142
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
144
        (arg4), 0, (res1), (res2), (res3), 0, 0)
143
        (arg4), 0, (res1), (res2), (res3), 0, 0)
145
#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, \
146
    res3, res4) \
145
    res3, res4) \
147
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
146
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
148
        (arg4), 0, (res1), (res2), (res3), (res4), 0)
147
        (arg4), 0, (res1), (res2), (res3), (res4), 0)
149
#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, \
150
    res3, res4, res5) \
149
    res3, res4, res5) \
151
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
150
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
152
        (arg4), 0, (res1), (res2), (res3), (res4), (res5))
151
        (arg4), 0, (res1), (res2), (res3), (res4), (res5))
153
#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) \
154
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
153
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
155
        (arg5), 0, 0, 0, 0, 0)
154
        (arg5), 0, 0, 0, 0, 0)
156
#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) \
157
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
156
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
158
        (arg5), (res1), 0, 0, 0, 0)
157
        (arg5), (res1), 0, 0, 0, 0)
159
#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, \
160
    res2) \
159
    res2) \
161
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
160
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
162
        (arg4), (arg5), (res1), (res2), 0, 0, 0)
161
        (arg4), (arg5), (res1), (res2), 0, 0, 0)
163
#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, \
164
    res2, res3) \
163
    res2, res3) \
165
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
164
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
166
        (arg4), (arg5), (res1), (res2), (res3), 0, 0)
165
        (arg4), (arg5), (res1), (res2), (res3), 0, 0)
167
#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, \
168
    res2, res3, res4) \
167
    res2, res3, res4) \
169
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
168
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
170
        (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
169
        (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
171
#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, \
172
    res2, res3, res4, res5) \
171
    res2, res3, res4, res5) \
173
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
172
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
174
        (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
173
        (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
175
 
174
 
176
extern int ipc_call_sync_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
175
extern int ipc_call_sync_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
177
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2,
-
 
178
    ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5);
-
 
179
 
-
 
180
extern int ipc_call_sync_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
-
 
181
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
176
    ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *);
182
    ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3, ipcarg_t *result4,
-
 
183
    ipcarg_t *result5);
-
 
184
 
177
 
-
 
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 *,
-
 
180
    ipcarg_t *);
-
 
181
 
185
extern ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags);
182
extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int);
186
extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec);
183
extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t);
187
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)
188
{
185
{
189
    return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
186
    return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
190
}
187
}
191
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data);
188
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *);
192
 
189
 
193
/*
190
/*
194
 * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow().
191
 * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow().
195
 * 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
196
 * 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
197
 * to m.
194
 * to m.
198
 */
195
 */
199
#define ipc_answer_0(callid, retval) \
196
#define ipc_answer_0(callid, retval) \
200
    ipc_answer_fast((callid), (retval), 0, 0, 0, 0)
197
    ipc_answer_fast((callid), (retval), 0, 0, 0, 0)
201
#define ipc_answer_1(callid, retval, arg1) \
198
#define ipc_answer_1(callid, retval, arg1) \
202
    ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0)
199
    ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0)
203
#define ipc_answer_2(callid, retval, arg1, arg2) \
200
#define ipc_answer_2(callid, retval, arg1, arg2) \
204
    ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0)
201
    ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0)
205
#define ipc_answer_3(callid, retval, arg1, arg2, arg3) \
202
#define ipc_answer_3(callid, retval, arg1, arg2, arg3) \
206
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0)
203
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0)
207
#define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \
204
#define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \
208
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4))
205
    ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4))
209
#define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \
206
#define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \
210
    ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5))
207
    ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5))
211
 
208
 
212
extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval,
209
extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
213
    ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4);
210
    ipcarg_t, ipcarg_t);
214
extern ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval,
211
extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
215
    ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5);
212
    ipcarg_t, ipcarg_t, ipcarg_t);
216
 
213
 
217
/*
214
/*
218
 * 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().
219
 * 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
220
 * 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
221
 * to m.
218
 * to m.
222
 */
219
 */
223
#define ipc_call_async_0(phoneid, method, private, callback, \
220
#define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \
224
    can_preempt) \
-
 
225
    ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
221
    ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
226
        (callback), (can_preempt))
222
        (callback), (can_preempt))
227
#define ipc_call_async_1(phoneid, method, arg1, private, callback, \
223
#define ipc_call_async_1(phoneid, method, arg1, private, callback, \
228
    can_preempt) \
224
    can_preempt) \
229
    ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
225
    ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
230
        (callback), (can_preempt))
226
        (callback), (can_preempt))
231
#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
227
#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
232
    can_preempt) \
228
    can_preempt) \
233
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
229
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
234
        (private), (callback), (can_preempt))
230
        (private), (callback), (can_preempt))
235
#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, \
236
    can_preempt) \
232
    can_preempt) \
237
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
233
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
238
        (private), (callback), (can_preempt))
234
        (private), (callback), (can_preempt))
239
#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, \
240
    callback, can_preempt) \
236
    callback, can_preempt) \
241
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
237
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
242
        (arg4), (private), (callback), (can_preempt))
238
        (arg4), (private), (callback), (can_preempt))
243
#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, \
244
    private, callback, can_preempt) \
240
    private, callback, can_preempt) \
245
    ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
241
    ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
246
        (arg4), (arg5), (private), (callback), (can_preempt))
242
        (arg4), (arg5), (private), (callback), (can_preempt))
247
 
243
 
248
extern void ipc_call_async_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
244
extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
249
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, void *private,
245
    ipcarg_t, void *, ipc_async_callback_t, int);
250
    ipc_async_callback_t callback, int can_preempt);
-
 
251
extern void ipc_call_async_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
246
extern void ipc_call_async_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
252
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, void *private,
247
    ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int);
253
    ipc_async_callback_t callback, int can_preempt);
-
 
254
 
248
 
255
extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, int arg3,
249
extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *);
256
    ipcarg_t *phone);
-
 
257
extern int ipc_connect_me_to(int phoneid, int arg1, int arg2, int arg3);
250
extern int ipc_connect_me_to(int, int, int, int);
258
extern int ipc_hangup(int phoneid);
251
extern int ipc_hangup(int);
259
extern int ipc_register_irq(int inr, int devno, int method, irq_code_t *code);
252
extern int ipc_register_irq(int, int, int, irq_code_t *);
260
extern int ipc_unregister_irq(int inr, int devno);
253
extern int ipc_unregister_irq(int, int);
261
extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
254
extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, int);
262
    ipcarg_t arg1, ipcarg_t arg2, int mode);
-
 
263
 
255
 
264
 
256
 
265
/*
257
/*
266
 * User-friendly wrappers for ipc_share_in_start().
258
 * User-friendly wrappers for ipc_share_in_start().
267
 */
259
 */
268
#define ipc_share_in_start_0_0(phoneid, dst, size) \
260
#define ipc_share_in_start_0_0(phoneid, dst, size) \
269
    ipc_share_in_start((phoneid), (dst), (size), 0, NULL)
261
    ipc_share_in_start((phoneid), (dst), (size), 0, NULL)
270
#define ipc_share_in_start_0_1(phoneid, dst, size, flags) \
262
#define ipc_share_in_start_0_1(phoneid, dst, size, flags) \
271
    ipc_share_in_start((phoneid), (dst), (size), 0, (flags))
263
    ipc_share_in_start((phoneid), (dst), (size), 0, (flags))
272
#define ipc_share_in_start_1_0(phoneid, dst, size, arg) \
264
#define ipc_share_in_start_1_0(phoneid, dst, size, arg) \
273
    ipc_share_in_start((phoneid), (dst), (size), (arg), NULL)
265
    ipc_share_in_start((phoneid), (dst), (size), (arg), NULL)
274
#define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \
266
#define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \
275
    ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
267
    ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
276
 
268
 
277
extern int ipc_share_in_start(int phoneid, void *dst, size_t size, ipcarg_t arg,
269
extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *);
278
    int *flags);
-
 
279
extern int ipc_share_in_receive(ipc_callid_t *callid, size_t *size);
270
extern int ipc_share_in_receive(ipc_callid_t *, size_t *);
280
extern int ipc_share_in_finalize(ipc_callid_t callid, void *src, int flags);
271
extern int ipc_share_in_finalize(ipc_callid_t, void *, int );
281
extern int ipc_share_out_start(int phoneid, void *src, int flags);
272
extern int ipc_share_out_start(int, void *, int);
282
extern int ipc_share_out_receive(ipc_callid_t *callid, size_t *size, int *flags);
273
extern int ipc_share_out_receive(ipc_callid_t *, size_t *, int *);
283
extern int ipc_share_out_finalize(ipc_callid_t callid, void *dst);
274
extern int ipc_share_out_finalize(ipc_callid_t, void *);
284
extern int ipc_data_read_start(int phoneid, void *dst, size_t size);
275
extern int ipc_data_read_start(int, void *, size_t);
285
extern int ipc_data_read_receive(ipc_callid_t *callid, size_t *size);
276
extern int ipc_data_read_receive(ipc_callid_t *, size_t *);
286
extern int ipc_data_read_finalize(ipc_callid_t callid, const void *src,
277
extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t);
287
    size_t size);
-
 
288
extern int ipc_data_write_start(int phoneid, const void *src, size_t size);
278
extern int ipc_data_write_start(int, const void *, size_t);
289
extern int ipc_data_write_receive(ipc_callid_t *callid, size_t *size);
279
extern int ipc_data_write_receive(ipc_callid_t *, size_t *);
290
extern int ipc_data_write_finalize(ipc_callid_t callid, void *dst, size_t size);
280
extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t);
291
 
281
 
292
#include <task.h>
282
#include <task.h>
293
 
283
 
294
extern int ipc_connect_kbox(task_id_t id);
284
extern int ipc_connect_kbox(task_id_t);
295
 
285
 
296
#endif
286
#endif
297
 
287
 
298
/** @}
288
/** @}
299
 */
289
 */
300
 
290