Subversion Repositories HelenOS

Rev

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

Rev 2615 Rev 2618
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 <libc.h>
-
 
41
#include <sys/types.h>
40
#include <sys/types.h>
42
#include <kernel/synch/synch.h>
41
#include <kernel/synch/synch.h>
43
 
42
 
44
typedef sysarg_t ipcarg_t;
43
typedef sysarg_t ipcarg_t;
45
typedef struct {
44
typedef struct {
46
    ipcarg_t args[IPC_CALL_LEN];
45
    ipcarg_t args[IPC_CALL_LEN];
47
    ipcarg_t in_phone_hash;
46
    ipcarg_t in_phone_hash;
48
} ipc_call_t;
47
} ipc_call_t;
49
typedef sysarg_t ipc_callid_t;
48
typedef sysarg_t ipc_callid_t;
50
 
49
 
51
typedef void (* ipc_async_callback_t)(void *private, int retval,
50
typedef void (* ipc_async_callback_t)(void *private, int retval,
52
    ipc_call_t *data);
51
    ipc_call_t *data);
53
 
52
 
54
/*
53
/*
55
 * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow().
54
 * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow().
56
 * They are in the form ipc_call_sync_m_n(), where m denotes the number of
55
 * They are in the form ipc_call_sync_m_n(), where m denotes the number of
57
 * arguments of payload and n denotes number of return values. Whenever
56
 * arguments of payload and n denotes number of return values. Whenever
58
 * possible, the fast version is used.
57
 * possible, the fast version is used.
59
 */
58
 */
60
#define ipc_call_sync_0_0(phoneid, method) \
59
#define ipc_call_sync_0_0(phoneid, method) \
61
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
60
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
62
#define ipc_call_sync_0_1(phoneid, method, res1) \
61
#define ipc_call_sync_0_1(phoneid, method, res1) \
63
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
62
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
64
#define ipc_call_sync_0_2(phoneid, method, res1, res2) \
63
#define ipc_call_sync_0_2(phoneid, method, res1, res2) \
65
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
64
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
66
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
65
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
67
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
66
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
68
        0, 0)
67
        0, 0)
69
#define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \
68
#define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \
70
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
69
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
71
        (res4), 0)
70
        (res4), 0)
72
#define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \
71
#define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \
73
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
72
    ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
74
        (res4), (res5))
73
        (res4), (res5))
75
#define ipc_call_sync_1_0(phoneid, method, arg1) \
74
#define ipc_call_sync_1_0(phoneid, method, arg1) \
76
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0)
75
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0)
77
#define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
76
#define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
78
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0)
77
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0)
79
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
78
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
80
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \
79
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \
81
    0, 0)
80
    0, 0)
82
#define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \
81
#define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \
83
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
82
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
84
    (res3), 0, 0)
83
    (res3), 0, 0)
85
#define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \
84
#define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \
86
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
85
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
87
    (res3), (res4), 0)
86
    (res3), (res4), 0)
88
#define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \
87
#define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \
89
    res5) \
88
    res5) \
90
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
89
    ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
91
        (res3), (res4), (res5))
90
        (res3), (res4), (res5))
92
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
91
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
93
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \
92
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \
94
    0, 0)
93
    0, 0)
95
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
94
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
96
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \
95
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \
97
    0, 0)
96
    0, 0)
98
#define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \
97
#define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \
99
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
98
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
100
    (res2), 0, 0, 0)
99
    (res2), 0, 0, 0)
101
#define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \
100
#define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \
102
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
101
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
103
    (res2), (res3), 0, 0)
102
    (res2), (res3), 0, 0)
104
#define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \
103
#define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \
105
    res4) \
104
    res4) \
106
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
105
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
107
        (res2), (res3), (res4), 0)
106
        (res2), (res3), (res4), 0)
108
#define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \
107
#define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \
109
    res4, res5)\
108
    res4, res5)\
110
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
109
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
111
        (res2), (res3), (res4), (res5))
110
        (res2), (res3), (res4), (res5))
112
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
111
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
113
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \
112
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \
114
    0, 0)
113
    0, 0)
115
#define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \
114
#define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \
116
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
115
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
117
    0, 0, 0, 0)
116
    0, 0, 0, 0)
118
#define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \
117
#define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \
119
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
118
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
120
    (res2), 0, 0, 0)
119
    (res2), 0, 0, 0)
121
#define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \
120
#define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \
122
    res3) \
121
    res3) \
123
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
122
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
124
        (res1), (res2), (res3), 0, 0)
123
        (res1), (res2), (res3), 0, 0)
125
#define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \
124
#define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \
126
    res3, res4) \
125
    res3, res4) \
127
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
126
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
128
        (res1), (res2), (res3), (res4), 0)
127
        (res1), (res2), (res3), (res4), 0)
129
#define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \
128
#define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \
130
    res3, res4, res5) \
129
    res3, res4, res5) \
131
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
130
    ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
132
        (res1), (res2), (res3), (res4), (res5))
131
        (res1), (res2), (res3), (res4), (res5))
133
#define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
132
#define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
134
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
133
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
135
    0, 0, 0, 0, 0)
134
    0, 0, 0, 0, 0)
136
#define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \
135
#define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \
137
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
136
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
138
    (res1), 0, 0, 0, 0)
137
    (res1), 0, 0, 0, 0)
139
#define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \
138
#define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \
140
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
139
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
141
    (res1), (res2), 0, 0, 0)
140
    (res1), (res2), 0, 0, 0)
142
#define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
141
#define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
143
    res3) \
142
    res3) \
144
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
143
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
145
        (arg4), (res1), (res2), (res3), 0, 0)
144
        (arg4), (res1), (res2), (res3), 0, 0)
146
#define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
145
#define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
147
    res3, res4) \
146
    res3, res4) \
148
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
147
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
149
        (arg4), (res1), (res2), (res3), (res4), 0)
148
        (arg4), (res1), (res2), (res3), (res4), 0)
150
#define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
149
#define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
151
    res3, res4, res5) \
150
    res3, res4, res5) \
152
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
151
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
153
        (arg4), (res1), (res2), (res3), (res4), (res5))
152
        (arg4), (res1), (res2), (res3), (res4), (res5))
154
#define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
153
#define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
155
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
154
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
156
        (arg5), 0, 0, 0, 0, 0)
155
        (arg5), 0, 0, 0, 0, 0)
157
#define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \
156
#define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \
158
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
157
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
159
        (arg5), (res1), 0, 0, 0, 0)
158
        (arg5), (res1), 0, 0, 0, 0)
160
#define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
159
#define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
161
    res2) \
160
    res2) \
162
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
161
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
163
        (arg4), (arg5), (res1), (res2), 0, 0, 0)
162
        (arg4), (arg5), (res1), (res2), 0, 0, 0)
164
#define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
163
#define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
165
    res2, res3) \
164
    res2, res3) \
166
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
165
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
167
        (arg4), (arg5), (res1), (res2), (res3), 0, 0)
166
        (arg4), (arg5), (res1), (res2), (res3), 0, 0)
168
#define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
167
#define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
169
    res2, res3, res4) \
168
    res2, res3, res4) \
170
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
169
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
171
        (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
170
        (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
172
#define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
171
#define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
173
    res2, res3, res4, res5) \
172
    res2, res3, res4, res5) \
174
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
173
    ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
175
        (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
174
        (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
176
 
175
 
177
extern int ipc_call_sync_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
176
extern int ipc_call_sync_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
178
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2,
177
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2,
179
    ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5);
178
    ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5);
180
 
179
 
181
extern int ipc_call_sync_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
180
extern int ipc_call_sync_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
182
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
181
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
183
    ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3, ipcarg_t *result4,
182
    ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3, ipcarg_t *result4,
184
    ipcarg_t *result5);
183
    ipcarg_t *result5);
185
 
184
 
186
 
-
 
187
extern ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags);
185
extern ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags);
188
extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec);
186
extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec);
189
static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
187
static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
190
{
188
{
191
    return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
189
    return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
192
}
190
}
193
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data);
191
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data);
194
 
192
 
195
#define ipc_answer_fast_0(callid, retval) \
193
#define ipc_answer_fast_0(callid, retval) \
196
    ipc_answer_fast((callid), (retval), 0, 0)
194
    ipc_answer_fast((callid), (retval), 0, 0)
197
#define ipc_answer_fast_1(callid, retval, arg1) \
195
#define ipc_answer_fast_1(callid, retval, arg1) \
198
    ipc_answer_fast((callid), (retval), (arg1), 0)
196
    ipc_answer_fast((callid), (retval), (arg1), 0)
199
extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval,
197
extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval,
200
    ipcarg_t arg1, ipcarg_t arg2);
198
    ipcarg_t arg1, ipcarg_t arg2);
201
extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call);
199
extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call);
202
 
200
 
-
 
201
/*
-
 
202
 * User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow().
-
 
203
 * They are in the form of ipc_call_async_m(), where m is the number of payload
-
 
204
 * arguments. The macros decide between the fast and the slow version according
-
 
205
 * to m.
-
 
206
 */
-
 
207
#define ipc_call_async_0(phoneid, method, private, callback, \
-
 
208
    can_preempt) \
-
 
209
    ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
-
 
210
        (callback), (can_preempt))
203
#define ipc_call_async(phoneid, method, arg1, private, callback, can_preempt) \
211
#define ipc_call_async_1(phoneid, method, arg1, private, callback, \
-
 
212
    can_preempt) \
-
 
213
    ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
-
 
214
        (callback), (can_preempt))
204
    (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt))
215
#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
-
 
216
    can_preempt) \
-
 
217
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
-
 
218
        (private), (callback), (can_preempt))
-
 
219
#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \
-
 
220
    can_preempt) \
-
 
221
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
-
 
222
        (private), (callback), (can_preempt))
-
 
223
#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \
-
 
224
    callback, can_preempt) \
-
 
225
    ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
-
 
226
        (arg4), (private), (callback), (can_preempt))
-
 
227
#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \
-
 
228
    private, callback, can_preempt) \
-
 
229
    ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
-
 
230
        (arg4), (arg5), (private), (callback), (can_preempt))
-
 
231
 
205
extern void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1,
232
extern void ipc_call_async_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
206
    ipcarg_t arg2, void *private, ipc_async_callback_t callback,
233
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, void *private,
207
    int can_preempt);
234
    ipc_async_callback_t callback, int can_preempt);
208
extern void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
235
extern void ipc_call_async_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
209
    ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback,
236
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, void *private,
210
    int can_preempt);
237
    ipc_async_callback_t callback, int can_preempt);
211
 
238
 
212
extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone);
239
extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone);
213
extern int ipc_connect_me_to(int phoneid, int arg1, int arg2);
240
extern int ipc_connect_me_to(int phoneid, int arg1, int arg2);
214
extern int ipc_hangup(int phoneid);
241
extern int ipc_hangup(int phoneid);
215
extern int ipc_register_irq(int inr, int devno, int method, irq_code_t *code);
242
extern int ipc_register_irq(int inr, int devno, int method, irq_code_t *code);
216
extern int ipc_unregister_irq(int inr, int devno);
243
extern int ipc_unregister_irq(int inr, int devno);
217
extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
244
extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
218
    ipcarg_t arg1);
245
    ipcarg_t arg1);
219
extern int ipc_data_send(int phoneid, void *src, size_t size);
246
extern int ipc_data_send(int phoneid, void *src, size_t size);
220
extern int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst,
247
extern int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst,
221
    size_t *size);
248
    size_t *size);
222
extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call,
249
extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call,
223
    void *dst, size_t size);
250
    void *dst, size_t size);
224
 
251
 
225
#endif
252
#endif
226
 
253
 
227
/** @}
254
/** @}
228
 */
255
 */
229
 
256