Rev 4002 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4002 | Rev 4481 | ||
---|---|---|---|
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 <task.h> |
|
38 | #include <kernel/ipc/ipc.h> |
39 | #include <kernel/ipc/ipc.h> |
39 | #include <kernel/ddi/irq.h> |
40 | #include <kernel/ddi/irq.h> |
40 | #include <sys/types.h> |
41 | #include <sys/types.h> |
41 | #include <kernel/synch/synch.h> |
42 | #include <kernel/synch/synch.h> |
42 | 43 | ||
- | 44 | #define IPC_FLAG_BLOCKING 0x01 |
|
- | 45 | ||
43 | typedef sysarg_t ipcarg_t; |
46 | typedef sysarg_t ipcarg_t; |
- | 47 | ||
44 | typedef struct { |
48 | typedef struct { |
45 | ipcarg_t args[IPC_CALL_LEN]; |
49 | ipcarg_t args[IPC_CALL_LEN]; |
46 | ipcarg_t in_phone_hash; |
50 | ipcarg_t in_phone_hash; |
47 | } ipc_call_t; |
51 | } ipc_call_t; |
- | 52 | ||
48 | typedef sysarg_t ipc_callid_t; |
53 | typedef sysarg_t ipc_callid_t; |
49 | 54 | ||
50 | typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *); |
55 | typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *); |
51 | 56 | ||
52 | /* |
57 | /* |
53 | * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow(). |
58 | * 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 |
59 | * 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 |
60 | * arguments of payload and n denotes number of return values. Whenever |
56 | * possible, the fast version is used. |
61 | * possible, the fast version is used. |
57 | */ |
62 | */ |
58 | #define ipc_call_sync_0_0(phoneid, method) \ |
63 | #define ipc_call_sync_0_0(phoneid, method) \ |
59 | ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0) |
64 | ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0) |
60 | #define ipc_call_sync_0_1(phoneid, method, res1) \ |
65 | #define ipc_call_sync_0_1(phoneid, method, res1) \ |
61 | ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0) |
66 | 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) \ |
67 | #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) |
68 | 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) \ |
69 | #define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \ |
65 | ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \ |
70 | ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \ |
66 | 0, 0) |
71 | 0, 0) |
67 | #define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \ |
72 | #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), \ |
73 | ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \ |
69 | (res4), 0) |
74 | (res4), 0) |
70 | #define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \ |
75 | #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), \ |
76 | ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \ |
72 | (res4), (res5)) |
77 | (res4), (res5)) |
- | 78 | ||
73 | #define ipc_call_sync_1_0(phoneid, method, arg1) \ |
79 | #define ipc_call_sync_1_0(phoneid, method, arg1) \ |
74 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0) |
80 | 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) \ |
81 | #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) |
82 | 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) \ |
83 | #define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \ |
78 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \ |
84 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \ |
79 | 0, 0) |
85 | 0, 0) |
80 | #define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \ |
86 | #define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \ |
81 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
87 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
82 | (res3), 0, 0) |
88 | (res3), 0, 0) |
83 | #define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \ |
89 | #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), \ |
90 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
85 | (res3), (res4), 0) |
91 | (res3), (res4), 0) |
86 | #define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \ |
92 | #define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \ |
87 | res5) \ |
93 | res5) \ |
88 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
94 | ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
89 | (res3), (res4), (res5)) |
95 | (res3), (res4), (res5)) |
- | 96 | ||
90 | #define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \ |
97 | #define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \ |
91 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \ |
98 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \ |
92 | 0, 0) |
99 | 0, 0) |
93 | #define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \ |
100 | #define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \ |
94 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \ |
101 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \ |
95 | 0, 0) |
102 | 0, 0) |
96 | #define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \ |
103 | #define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \ |
97 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
104 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
98 | (res2), 0, 0, 0) |
105 | (res2), 0, 0, 0) |
99 | #define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \ |
106 | #define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \ |
100 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
107 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
101 | (res2), (res3), 0, 0) |
108 | (res2), (res3), 0, 0) |
102 | #define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \ |
109 | #define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \ |
103 | res4) \ |
110 | res4) \ |
104 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
111 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
105 | (res2), (res3), (res4), 0) |
112 | (res2), (res3), (res4), 0) |
106 | #define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \ |
113 | #define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \ |
107 | res4, res5)\ |
114 | res4, res5)\ |
108 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
115 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
109 | (res2), (res3), (res4), (res5)) |
116 | (res2), (res3), (res4), (res5)) |
- | 117 | ||
110 | #define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \ |
118 | #define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \ |
111 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \ |
119 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \ |
112 | 0, 0) |
120 | 0, 0) |
113 | #define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \ |
121 | #define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \ |
114 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \ |
122 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \ |
115 | 0, 0, 0, 0) |
123 | 0, 0, 0, 0) |
116 | #define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \ |
124 | #define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \ |
117 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \ |
125 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \ |
118 | (res2), 0, 0, 0) |
126 | (res2), 0, 0, 0) |
119 | #define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
127 | #define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
120 | res3) \ |
128 | res3) \ |
121 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
129 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
122 | (res1), (res2), (res3), 0, 0) |
130 | (res1), (res2), (res3), 0, 0) |
123 | #define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
131 | #define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
124 | res3, res4) \ |
132 | res3, res4) \ |
125 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
133 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
126 | (res1), (res2), (res3), (res4), 0) |
134 | (res1), (res2), (res3), (res4), 0) |
127 | #define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
135 | #define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
128 | res3, res4, res5) \ |
136 | res3, res4, res5) \ |
129 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
137 | ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
130 | (res1), (res2), (res3), (res4), (res5)) |
138 | (res1), (res2), (res3), (res4), (res5)) |
- | 139 | ||
131 | #define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \ |
140 | #define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \ |
132 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \ |
141 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \ |
133 | 0, 0, 0, 0, 0) |
142 | 0, 0, 0, 0, 0) |
134 | #define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \ |
143 | #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, \ |
144 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \ |
136 | (res1), 0, 0, 0, 0) |
145 | (res1), 0, 0, 0, 0) |
137 | #define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \ |
146 | #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, \ |
147 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \ |
139 | (res1), (res2), 0, 0, 0) |
148 | (res1), (res2), 0, 0, 0) |
140 | #define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
149 | #define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
141 | res3) \ |
150 | res3) \ |
142 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
151 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
143 | (arg4), 0, (res1), (res2), (res3), 0, 0) |
152 | (arg4), 0, (res1), (res2), (res3), 0, 0) |
144 | #define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
153 | #define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
145 | res3, res4) \ |
154 | res3, res4) \ |
146 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
155 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
147 | (arg4), 0, (res1), (res2), (res3), (res4), 0) |
156 | (arg4), 0, (res1), (res2), (res3), (res4), 0) |
148 | #define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
157 | #define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
149 | res3, res4, res5) \ |
158 | res3, res4, res5) \ |
150 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
159 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
151 | (arg4), 0, (res1), (res2), (res3), (res4), (res5)) |
160 | (arg4), 0, (res1), (res2), (res3), (res4), (res5)) |
- | 161 | ||
152 | #define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \ |
162 | #define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \ |
153 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
163 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
154 | (arg5), 0, 0, 0, 0, 0) |
164 | (arg5), 0, 0, 0, 0, 0) |
155 | #define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \ |
165 | #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), \ |
166 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
157 | (arg5), (res1), 0, 0, 0, 0) |
167 | (arg5), (res1), 0, 0, 0, 0) |
158 | #define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
168 | #define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
159 | res2) \ |
169 | res2) \ |
160 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
170 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
161 | (arg4), (arg5), (res1), (res2), 0, 0, 0) |
171 | (arg4), (arg5), (res1), (res2), 0, 0, 0) |
162 | #define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
172 | #define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
163 | res2, res3) \ |
173 | res2, res3) \ |
164 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
174 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
165 | (arg4), (arg5), (res1), (res2), (res3), 0, 0) |
175 | (arg4), (arg5), (res1), (res2), (res3), 0, 0) |
166 | #define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
176 | #define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
167 | res2, res3, res4) \ |
177 | res2, res3, res4) \ |
168 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
178 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
169 | (arg4), (arg5), (res1), (res2), (res3), (res4), 0) |
179 | (arg4), (arg5), (res1), (res2), (res3), (res4), 0) |
170 | #define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
180 | #define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
171 | res2, res3, res4, res5) \ |
181 | res2, res3, res4, res5) \ |
172 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
182 | ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
173 | (arg4), (arg5), (res1), (res2), (res3), (res4), (res5)) |
183 | (arg4), (arg5), (res1), (res2), (res3), (res4), (res5)) |
174 | 184 | ||
175 | extern int ipc_call_sync_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, |
185 | 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 *); |
186 | ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *); |
177 | 187 | ||
178 | extern int ipc_call_sync_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, |
188 | 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 *, |
189 | ipcarg_t, ipcarg_t, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, |
180 | ipcarg_t *); |
190 | ipcarg_t *); |
181 | 191 | ||
182 | extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int); |
192 | 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); |
193 | extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t); |
- | 194 | ||
184 | static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data) |
195 | static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data) |
185 | { |
196 | { |
186 | return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT); |
197 | return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT); |
187 | } |
198 | } |
- | 199 | ||
188 | extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *); |
200 | extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *); |
189 | 201 | ||
190 | /* |
202 | /* |
191 | * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow(). |
203 | * 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 |
204 | * 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 |
205 | * arguments. The macros decide between the fast and the slow version according |
194 | * to m. |
206 | * to m. |
195 | */ |
207 | */ |
196 | #define ipc_answer_0(callid, retval) \ |
208 | #define ipc_answer_0(callid, retval) \ |
197 | ipc_answer_fast((callid), (retval), 0, 0, 0, 0) |
209 | ipc_answer_fast((callid), (retval), 0, 0, 0, 0) |
198 | #define ipc_answer_1(callid, retval, arg1) \ |
210 | #define ipc_answer_1(callid, retval, arg1) \ |
199 | ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0) |
211 | ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0) |
200 | #define ipc_answer_2(callid, retval, arg1, arg2) \ |
212 | #define ipc_answer_2(callid, retval, arg1, arg2) \ |
201 | ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0) |
213 | ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0) |
202 | #define ipc_answer_3(callid, retval, arg1, arg2, arg3) \ |
214 | #define ipc_answer_3(callid, retval, arg1, arg2, arg3) \ |
203 | ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0) |
215 | ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0) |
204 | #define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \ |
216 | #define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \ |
205 | ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4)) |
217 | ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4)) |
206 | #define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \ |
218 | #define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \ |
207 | ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5)) |
219 | ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5)) |
208 | 220 | ||
209 | extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t, |
221 | extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t, |
210 | ipcarg_t, ipcarg_t); |
222 | ipcarg_t, ipcarg_t); |
211 | extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t, |
223 | extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t, |
212 | ipcarg_t, ipcarg_t, ipcarg_t); |
224 | ipcarg_t, ipcarg_t, ipcarg_t); |
213 | 225 | ||
214 | /* |
226 | /* |
215 | * User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow(). |
227 | * 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 |
228 | * 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 |
229 | * arguments. The macros decide between the fast and the slow version according |
218 | * to m. |
230 | * to m. |
219 | */ |
231 | */ |
220 | #define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \ |
232 | #define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \ |
221 | ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \ |
233 | ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \ |
222 | (callback), (can_preempt)) |
234 | (callback), (can_preempt)) |
223 | #define ipc_call_async_1(phoneid, method, arg1, private, callback, \ |
235 | #define ipc_call_async_1(phoneid, method, arg1, private, callback, \ |
224 | can_preempt) \ |
236 | can_preempt) \ |
225 | ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \ |
237 | ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \ |
226 | (callback), (can_preempt)) |
238 | (callback), (can_preempt)) |
227 | #define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \ |
239 | #define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \ |
228 | can_preempt) \ |
240 | can_preempt) \ |
229 | ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \ |
241 | ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \ |
230 | (private), (callback), (can_preempt)) |
242 | (private), (callback), (can_preempt)) |
231 | #define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \ |
243 | #define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \ |
232 | can_preempt) \ |
244 | can_preempt) \ |
233 | ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \ |
245 | ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \ |
234 | (private), (callback), (can_preempt)) |
246 | (private), (callback), (can_preempt)) |
235 | #define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \ |
247 | #define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \ |
236 | callback, can_preempt) \ |
248 | callback, can_preempt) \ |
237 | ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
249 | ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
238 | (arg4), (private), (callback), (can_preempt)) |
250 | (arg4), (private), (callback), (can_preempt)) |
239 | #define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \ |
251 | #define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \ |
240 | private, callback, can_preempt) \ |
252 | private, callback, can_preempt) \ |
241 | ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
253 | ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
242 | (arg4), (arg5), (private), (callback), (can_preempt)) |
254 | (arg4), (arg5), (private), (callback), (can_preempt)) |
243 | 255 | ||
244 | extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, |
256 | extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, |
245 | ipcarg_t, void *, ipc_async_callback_t, int); |
257 | ipcarg_t, void *, ipc_async_callback_t, int); |
246 | extern void ipc_call_async_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, |
258 | 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); |
259 | ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int); |
248 | 260 | ||
249 | #define IPC_FLAG_BLOCKING 0x01 |
- | |
250 | - | ||
251 | extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *); |
261 | extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *); |
252 | extern int ipc_connect_me_to(int, int, int, int); |
262 | extern int ipc_connect_me_to(int, int, int, int); |
253 | extern int ipc_connect_me_to_blocking(int, int, int, int); |
263 | extern int ipc_connect_me_to_blocking(int, int, int, int); |
254 | extern int ipc_hangup(int); |
264 | extern int ipc_hangup(int); |
255 | extern int ipc_register_irq(int, int, int, irq_code_t *); |
265 | extern int ipc_register_irq(int, int, int, irq_code_t *); |
256 | extern int ipc_unregister_irq(int, int); |
266 | extern int ipc_unregister_irq(int, int); |
257 | extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, int); |
267 | extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, int); |
258 | extern int ipc_forward_slow(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, |
268 | extern int ipc_forward_slow(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, |
259 | ipcarg_t, ipcarg_t, ipcarg_t, int); |
269 | ipcarg_t, ipcarg_t, ipcarg_t, int); |
260 | - | ||
261 | 270 | ||
262 | /* |
271 | /* |
263 | * User-friendly wrappers for ipc_share_in_start(). |
272 | * User-friendly wrappers for ipc_share_in_start(). |
264 | */ |
273 | */ |
265 | #define ipc_share_in_start_0_0(phoneid, dst, size) \ |
274 | #define ipc_share_in_start_0_0(phoneid, dst, size) \ |
266 | ipc_share_in_start((phoneid), (dst), (size), 0, NULL) |
275 | ipc_share_in_start((phoneid), (dst), (size), 0, NULL) |
267 | #define ipc_share_in_start_0_1(phoneid, dst, size, flags) \ |
276 | #define ipc_share_in_start_0_1(phoneid, dst, size, flags) \ |
268 | ipc_share_in_start((phoneid), (dst), (size), 0, (flags)) |
277 | ipc_share_in_start((phoneid), (dst), (size), 0, (flags)) |
269 | #define ipc_share_in_start_1_0(phoneid, dst, size, arg) \ |
278 | #define ipc_share_in_start_1_0(phoneid, dst, size, arg) \ |
270 | ipc_share_in_start((phoneid), (dst), (size), (arg), NULL) |
279 | ipc_share_in_start((phoneid), (dst), (size), (arg), NULL) |
271 | #define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \ |
280 | #define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \ |
272 | ipc_share_in_start((phoneid), (dst), (size), (arg), (flags)) |
281 | ipc_share_in_start((phoneid), (dst), (size), (arg), (flags)) |
273 | 282 | ||
274 | extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *); |
283 | extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *); |
275 | extern int ipc_share_in_receive(ipc_callid_t *, size_t *); |
284 | extern int ipc_share_in_receive(ipc_callid_t *, size_t *); |
276 | extern int ipc_share_in_finalize(ipc_callid_t, void *, int ); |
285 | extern int ipc_share_in_finalize(ipc_callid_t, void *, int ); |
277 | extern int ipc_share_out_start(int, void *, int); |
286 | extern int ipc_share_out_start(int, void *, int); |
278 | extern int ipc_share_out_receive(ipc_callid_t *, size_t *, int *); |
287 | extern int ipc_share_out_receive(ipc_callid_t *, size_t *, int *); |
279 | extern int ipc_share_out_finalize(ipc_callid_t, void *); |
288 | extern int ipc_share_out_finalize(ipc_callid_t, void *); |
280 | extern int ipc_data_read_start(int, void *, size_t); |
289 | extern int ipc_data_read_start(int, void *, size_t); |
281 | extern int ipc_data_read_receive(ipc_callid_t *, size_t *); |
290 | extern int ipc_data_read_receive(ipc_callid_t *, size_t *); |
282 | extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t); |
291 | extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t); |
283 | extern int ipc_data_write_start(int, const void *, size_t); |
292 | extern int ipc_data_write_start(int, const void *, size_t); |
284 | extern int ipc_data_write_receive(ipc_callid_t *, size_t *); |
293 | extern int ipc_data_write_receive(ipc_callid_t *, size_t *); |
285 | extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t); |
294 | extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t); |
286 | 295 | ||
287 | #include <task.h> |
- | |
288 | - | ||
289 | extern int ipc_connect_kbox(task_id_t); |
296 | extern int ipc_connect_kbox(task_id_t); |
290 | 297 | ||
291 | #endif |
298 | #endif |
292 | 299 | ||
293 | /** @} |
300 | /** @} |
294 | */ |
301 | */ |
295 | 302 |