Rev 1343 | Rev 1351 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1343 | Rev 1350 | ||
---|---|---|---|
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 | #include <ipc.h> |
29 | #include <ipc.h> |
30 | #include <libc.h> |
30 | #include <libc.h> |
31 | #include <malloc.h> |
31 | #include <malloc.h> |
32 | #include <errno.h> |
32 | #include <errno.h> |
33 | #include <list.h> |
33 | #include <list.h> |
34 | #include <stdio.h> |
34 | #include <stdio.h> |
35 | #include <unistd.h> |
35 | #include <unistd.h> |
- | 36 | #include <futex.h> |
|
36 | 37 | ||
37 | /** Structure used for keeping track of sent async msgs |
38 | /** Structure used for keeping track of sent async msgs |
38 | * and queing unsent msgs |
39 | * and queing unsent msgs |
39 | * |
40 | * |
40 | */ |
41 | */ |
41 | typedef struct { |
42 | typedef struct { |
42 | link_t list; |
43 | link_t list; |
43 | 44 | ||
44 | ipc_async_callback_t callback; |
45 | ipc_async_callback_t callback; |
45 | void *private; |
46 | void *private; |
46 | union { |
47 | union { |
47 | ipc_callid_t callid; |
48 | ipc_callid_t callid; |
48 | struct { |
49 | struct { |
49 | ipc_call_t data; |
50 | ipc_call_t data; |
50 | int phoneid; |
51 | int phoneid; |
51 | } msg; |
52 | } msg; |
52 | }u; |
53 | }u; |
53 | } async_call_t; |
54 | } async_call_t; |
54 | 55 | ||
55 | LIST_INITIALIZE(dispatched_calls); |
56 | LIST_INITIALIZE(dispatched_calls); |
56 | LIST_INITIALIZE(queued_calls); |
57 | LIST_INITIALIZE(queued_calls); |
57 | 58 | ||
- | 59 | static atomic_t ipc_futex; |
|
- | 60 | ||
- | 61 | void _ipc_init(void) |
|
- | 62 | { |
|
- | 63 | futex_initialize(&ipc_futex, 1); |
|
- | 64 | } |
|
- | 65 | ||
58 | int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, |
66 | int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, |
59 | ipcarg_t *result) |
67 | ipcarg_t *result) |
60 | { |
68 | { |
61 | ipc_call_t resdata; |
69 | ipc_call_t resdata; |
62 | int callres; |
70 | int callres; |
63 | 71 | ||
64 | callres = __SYSCALL4(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1, |
72 | callres = __SYSCALL4(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1, |
65 | (sysarg_t)&resdata); |
73 | (sysarg_t)&resdata); |
66 | if (callres) |
74 | if (callres) |
67 | return callres; |
75 | return callres; |
68 | if (result) |
76 | if (result) |
69 | *result = IPC_GET_ARG1(resdata); |
77 | *result = IPC_GET_ARG1(resdata); |
70 | return IPC_GET_RETVAL(resdata); |
78 | return IPC_GET_RETVAL(resdata); |
71 | } |
79 | } |
72 | 80 | ||
73 | int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1, |
81 | int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1, |
74 | ipcarg_t arg2, ipcarg_t arg3, |
82 | ipcarg_t arg2, ipcarg_t arg3, |
75 | ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3) |
83 | ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3) |
76 | { |
84 | { |
77 | ipc_call_t data; |
85 | ipc_call_t data; |
78 | int callres; |
86 | int callres; |
79 | 87 | ||
80 | IPC_SET_METHOD(data, method); |
88 | IPC_SET_METHOD(data, method); |
81 | IPC_SET_ARG1(data, arg1); |
89 | IPC_SET_ARG1(data, arg1); |
82 | IPC_SET_ARG2(data, arg2); |
90 | IPC_SET_ARG2(data, arg2); |
83 | IPC_SET_ARG3(data, arg3); |
91 | IPC_SET_ARG3(data, arg3); |
84 | 92 | ||
85 | callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t)&data, |
93 | callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t)&data, |
86 | (sysarg_t)&data); |
94 | (sysarg_t)&data); |
87 | if (callres) |
95 | if (callres) |
88 | return callres; |
96 | return callres; |
89 | 97 | ||
90 | if (result1) |
98 | if (result1) |
91 | *result1 = IPC_GET_ARG1(data); |
99 | *result1 = IPC_GET_ARG1(data); |
92 | if (result2) |
100 | if (result2) |
93 | *result2 = IPC_GET_ARG2(data); |
101 | *result2 = IPC_GET_ARG2(data); |
94 | if (result3) |
102 | if (result3) |
95 | *result3 = IPC_GET_ARG3(data); |
103 | *result3 = IPC_GET_ARG3(data); |
96 | return IPC_GET_RETVAL(data); |
104 | return IPC_GET_RETVAL(data); |
97 | } |
105 | } |
98 | 106 | ||
99 | /** Syscall to send asynchronous message */ |
107 | /** Syscall to send asynchronous message */ |
100 | static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data) |
108 | static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data) |
101 | { |
109 | { |
102 | return __SYSCALL2(SYS_IPC_CALL_ASYNC, phoneid, (sysarg_t)data); |
110 | return __SYSCALL2(SYS_IPC_CALL_ASYNC, phoneid, (sysarg_t)data); |
103 | } |
111 | } |
104 | 112 | ||
105 | /** Send asynchronous message |
113 | /** Send asynchronous message |
106 | * |
114 | * |
107 | * - if fatal error, call callback handler with proper error code |
115 | * - if fatal error, call callback handler with proper error code |
108 | * - if message cannot be temporarily sent, add to queue |
116 | * - if message cannot be temporarily sent, add to queue |
109 | */ |
117 | */ |
110 | void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1, |
118 | void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1, |
111 | ipcarg_t arg2, void *private, |
119 | ipcarg_t arg2, void *private, |
112 | ipc_async_callback_t callback) |
120 | ipc_async_callback_t callback) |
113 | { |
121 | { |
114 | async_call_t *call; |
122 | async_call_t *call; |
115 | ipc_callid_t callid; |
123 | ipc_callid_t callid; |
116 | 124 | ||
117 | call = malloc(sizeof(*call)); |
125 | call = malloc(sizeof(*call)); |
118 | if (!call) { |
126 | if (!call) { |
119 | callback(private, ENOMEM, NULL); |
127 | callback(private, ENOMEM, NULL); |
120 | return; |
128 | return; |
121 | } |
129 | } |
122 | 130 | ||
123 | callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2); |
131 | callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2); |
124 | if (callid == IPC_CALLRET_FATAL) { |
132 | if (callid == IPC_CALLRET_FATAL) { |
125 | /* Call asynchronous handler with error code */ |
133 | /* Call asynchronous handler with error code */ |
126 | callback(private, ENOENT, NULL); |
134 | callback(private, ENOENT, NULL); |
127 | free(call); |
135 | free(call); |
128 | return; |
136 | return; |
129 | } |
137 | } |
130 | 138 | ||
131 | call->callback = callback; |
139 | call->callback = callback; |
132 | call->private = private; |
140 | call->private = private; |
133 | 141 | ||
134 | if (callid == IPC_CALLRET_TEMPORARY) { |
142 | if (callid == IPC_CALLRET_TEMPORARY) { |
135 | /* Add asynchronous call to queue of non-dispatched async calls */ |
143 | /* Add asynchronous call to queue of non-dispatched async calls */ |
136 | call->u.msg.phoneid = phoneid; |
144 | call->u.msg.phoneid = phoneid; |
137 | IPC_SET_METHOD(call->u.msg.data, method); |
145 | IPC_SET_METHOD(call->u.msg.data, method); |
138 | IPC_SET_ARG1(call->u.msg.data, arg1); |
146 | IPC_SET_ARG1(call->u.msg.data, arg1); |
139 | IPC_SET_ARG2(call->u.msg.data, arg2); |
147 | IPC_SET_ARG2(call->u.msg.data, arg2); |
140 | 148 | ||
- | 149 | futex_down(&ipc_futex); |
|
141 | list_append(&call->list, &queued_calls); |
150 | list_append(&call->list, &queued_calls); |
- | 151 | futex_up(&ipc_futex); |
|
142 | return; |
152 | return; |
143 | } |
153 | } |
144 | call->u.callid = callid; |
154 | call->u.callid = callid; |
145 | /* Add call to list of dispatched calls */ |
155 | /* Add call to list of dispatched calls */ |
- | 156 | futex_down(&ipc_futex); |
|
146 | list_append(&call->list, &dispatched_calls); |
157 | list_append(&call->list, &dispatched_calls); |
- | 158 | futex_up(&ipc_futex); |
|
147 | } |
159 | } |
148 | 160 | ||
149 | 161 | ||
150 | /** Send a fast answer to a received call. |
162 | /** Send a fast answer to a received call. |
151 | * |
163 | * |
152 | * The fast answer makes use of passing retval and first two arguments in registers. |
164 | * The fast answer makes use of passing retval and first two arguments in registers. |
153 | * If you need to return more, use the ipc_answer() instead. |
165 | * If you need to return more, use the ipc_answer() instead. |
154 | * |
166 | * |
155 | * @param callid ID of the call being answered. |
167 | * @param callid ID of the call being answered. |
156 | * @param retval Return value. |
168 | * @param retval Return value. |
157 | * @param arg1 First return argument. |
169 | * @param arg1 First return argument. |
158 | * @param arg2 Second return argument. |
170 | * @param arg2 Second return argument. |
159 | * |
171 | * |
160 | * @return Zero on success or a value from @ref errno.h on failure. |
172 | * @return Zero on success or a value from @ref errno.h on failure. |
161 | */ |
173 | */ |
162 | ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, |
174 | ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, |
163 | ipcarg_t arg2) |
175 | ipcarg_t arg2) |
164 | { |
176 | { |
165 | return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2); |
177 | return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2); |
166 | } |
178 | } |
167 | 179 | ||
168 | /** Send a full answer to a received call. |
180 | /** Send a full answer to a received call. |
169 | * |
181 | * |
170 | * @param callid ID of the call being answered. |
182 | * @param callid ID of the call being answered. |
171 | * @param call Call data. Must be already initialized by the responder. |
183 | * @param call Call data. Must be already initialized by the responder. |
172 | * |
184 | * |
173 | * @return Zero on success or a value from @ref errno.h on failure. |
185 | * @return Zero on success or a value from @ref errno.h on failure. |
174 | */ |
186 | */ |
175 | ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call) |
187 | ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call) |
176 | { |
188 | { |
177 | return __SYSCALL2(SYS_IPC_ANSWER, callid, (sysarg_t) call); |
189 | return __SYSCALL2(SYS_IPC_ANSWER, callid, (sysarg_t) call); |
178 | } |
190 | } |
179 | 191 | ||
180 | 192 | ||
181 | /** Try to dispatch queed calls from async queue */ |
193 | /** Try to dispatch queed calls from async queue */ |
182 | static void try_dispatch_queued_calls(void) |
194 | static void try_dispatch_queued_calls(void) |
183 | { |
195 | { |
184 | async_call_t *call; |
196 | async_call_t *call; |
185 | ipc_callid_t callid; |
197 | ipc_callid_t callid; |
186 | 198 | ||
- | 199 | futex_down(&ipc_futex); |
|
187 | while (!list_empty(&queued_calls)) { |
200 | while (!list_empty(&queued_calls)) { |
188 | call = list_get_instance(queued_calls.next, async_call_t, |
201 | call = list_get_instance(queued_calls.next, async_call_t, |
189 | list); |
202 | list); |
190 | 203 | ||
191 | callid = _ipc_call_async(call->u.msg.phoneid, |
204 | callid = _ipc_call_async(call->u.msg.phoneid, |
192 | &call->u.msg.data); |
205 | &call->u.msg.data); |
193 | if (callid == IPC_CALLRET_TEMPORARY) |
206 | if (callid == IPC_CALLRET_TEMPORARY) |
194 | break; |
207 | break; |
195 | list_remove(&call->list); |
208 | list_remove(&call->list); |
- | 209 | ||
196 | if (callid == IPC_CALLRET_FATAL) { |
210 | if (callid == IPC_CALLRET_FATAL) { |
- | 211 | futex_up(&ipc_futex); |
|
197 | call->callback(call->private, ENOENT, NULL); |
212 | call->callback(call->private, ENOENT, NULL); |
198 | free(call); |
213 | free(call); |
- | 214 | futex_down(&ipc_futex); |
|
199 | } else { |
215 | } else { |
200 | call->u.callid = callid; |
216 | call->u.callid = callid; |
201 | list_append(&call->list, &dispatched_calls); |
217 | list_append(&call->list, &dispatched_calls); |
202 | } |
218 | } |
203 | } |
219 | } |
- | 220 | futex_up(&ipc_futex); |
|
204 | } |
221 | } |
205 | 222 | ||
206 | /** Handle received answer |
223 | /** Handle received answer |
207 | * |
224 | * |
208 | * TODO: Make it use hash table |
225 | * TODO: Make it use hash table |
209 | * |
226 | * |
210 | * @param callid Callid (with first bit set) of the answered call |
227 | * @param callid Callid (with first bit set) of the answered call |
211 | */ |
228 | */ |
212 | static void handle_answer(ipc_callid_t callid, ipc_call_t *data) |
229 | static void handle_answer(ipc_callid_t callid, ipc_call_t *data) |
213 | { |
230 | { |
214 | link_t *item; |
231 | link_t *item; |
215 | async_call_t *call; |
232 | async_call_t *call; |
216 | 233 | ||
217 | callid &= ~IPC_CALLID_ANSWERED; |
234 | callid &= ~IPC_CALLID_ANSWERED; |
218 | 235 | ||
- | 236 | futex_down(&ipc_futex); |
|
219 | for (item = dispatched_calls.next; item != &dispatched_calls; |
237 | for (item = dispatched_calls.next; item != &dispatched_calls; |
220 | item = item->next) { |
238 | item = item->next) { |
221 | call = list_get_instance(item, async_call_t, list); |
239 | call = list_get_instance(item, async_call_t, list); |
222 | if (call->u.callid == callid) { |
240 | if (call->u.callid == callid) { |
223 | list_remove(&call->list); |
241 | list_remove(&call->list); |
- | 242 | futex_up(&ipc_futex); |
|
224 | call->callback(call->private, |
243 | call->callback(call->private, |
225 | IPC_GET_RETVAL(*data), |
244 | IPC_GET_RETVAL(*data), |
226 | data); |
245 | data); |
227 | return; |
246 | return; |
228 | } |
247 | } |
229 | } |
248 | } |
- | 249 | futex_up(&ipc_futex); |
|
230 | printf("Received unidentified answer: %P!!!\n", callid); |
250 | printf("Received unidentified answer: %P!!!\n", callid); |
231 | } |
251 | } |
232 | 252 | ||
233 | 253 | ||
234 | /** Wait for IPC call and return |
254 | /** Wait for IPC call and return |
235 | * |
255 | * |
236 | * - dispatch ASYNC reoutines in the background |
256 | * - dispatch ASYNC reoutines in the background |
237 | * @param data Space where the message is stored |
257 | * @param data Space where the message is stored |
238 | * @return Callid or 0 if nothing available and started with |
258 | * @return Callid or 0 if nothing available and started with |
239 | * IPC_WAIT_NONBLOCKING |
259 | * IPC_WAIT_NONBLOCKING |
240 | */ |
260 | */ |
241 | ipc_callid_t ipc_wait_for_call(ipc_call_t *call, int flags) |
261 | ipc_callid_t ipc_wait_for_call(ipc_call_t *call, int flags) |
242 | { |
262 | { |
243 | ipc_callid_t callid; |
263 | ipc_callid_t callid; |
244 | 264 | ||
245 | do { |
265 | do { |
246 | try_dispatch_queued_calls(); |
266 | try_dispatch_queued_calls(); |
247 | 267 | ||
248 | callid = __SYSCALL2(SYS_IPC_WAIT, (sysarg_t)call, flags); |
268 | callid = __SYSCALL2(SYS_IPC_WAIT, (sysarg_t)call, flags); |
249 | /* Handle received answers */ |
269 | /* Handle received answers */ |
250 | if (callid & IPC_CALLID_ANSWERED) |
270 | if (callid & IPC_CALLID_ANSWERED) |
251 | handle_answer(callid, call); |
271 | handle_answer(callid, call); |
252 | } while (callid & IPC_CALLID_ANSWERED); |
272 | } while (callid & IPC_CALLID_ANSWERED); |
253 | 273 | ||
254 | return callid; |
274 | return callid; |
255 | } |
275 | } |
256 | 276 | ||
257 | /** Ask destination to do a callback connection |
277 | /** Ask destination to do a callback connection |
258 | * |
278 | * |
259 | * @return 0 - OK, error code |
279 | * @return 0 - OK, error code |
260 | */ |
280 | */ |
261 | int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone) |
281 | int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone) |
262 | { |
282 | { |
263 | return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, |
283 | return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, |
264 | arg2, 0, 0, 0, phone); |
284 | arg2, 0, 0, 0, phone); |
265 | } |
285 | } |
266 | 286 | ||
267 | /** Ask through phone for a new connection to some service |
287 | /** Ask through phone for a new connection to some service |
268 | * |
288 | * |
269 | * @return new phoneid - OK, error code |
289 | * @return new phoneid - OK, error code |
270 | */ |
290 | */ |
271 | int ipc_connect_me_to(int phoneid, int arg1, int arg2) |
291 | int ipc_connect_me_to(int phoneid, int arg1, int arg2) |
272 | { |
292 | { |
273 | ipcarg_t newphid; |
293 | ipcarg_t newphid; |
274 | int res; |
294 | int res; |
275 | 295 | ||
276 | res = ipc_call_sync_3(phoneid, IPC_M_CONNECT_ME_TO, arg1, |
296 | res = ipc_call_sync_3(phoneid, IPC_M_CONNECT_ME_TO, arg1, |
277 | arg2, 0, 0, 0, &newphid); |
297 | arg2, 0, 0, 0, &newphid); |
278 | if (res) |
298 | if (res) |
279 | return res; |
299 | return res; |
280 | return newphid; |
300 | return newphid; |
281 | } |
301 | } |
282 | 302 | ||
283 | /* Hang up specified phone */ |
303 | /* Hang up specified phone */ |
284 | int ipc_hangup(int phoneid) |
304 | int ipc_hangup(int phoneid) |
285 | { |
305 | { |
286 | return __SYSCALL1(SYS_IPC_HANGUP, phoneid); |
306 | return __SYSCALL1(SYS_IPC_HANGUP, phoneid); |
287 | } |
307 | } |
288 | 308 | ||
289 | int ipc_register_irq(int irq, irq_code_t *ucode) |
309 | int ipc_register_irq(int irq, irq_code_t *ucode) |
290 | { |
310 | { |
291 | return __SYSCALL2(SYS_IPC_REGISTER_IRQ, irq, (sysarg_t) ucode); |
311 | return __SYSCALL2(SYS_IPC_REGISTER_IRQ, irq, (sysarg_t) ucode); |
292 | } |
312 | } |
293 | 313 | ||
294 | int ipc_unregister_irq(int irq) |
314 | int ipc_unregister_irq(int irq) |
295 | { |
315 | { |
296 | return __SYSCALL1(SYS_IPC_UNREGISTER_IRQ, irq); |
316 | return __SYSCALL1(SYS_IPC_UNREGISTER_IRQ, irq); |
297 | } |
317 | } |
298 | 318 | ||
299 | int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1) |
319 | int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1) |
300 | { |
320 | { |
301 | return __SYSCALL4(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1); |
321 | return __SYSCALL4(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1); |
302 | } |
322 | } |
303 | 323 | ||
- | 324 | ||
- | 325 | /** Open shared memory connection over specified phoneid |
|
- | 326 | * |
|
- | 327 | * |
|
- | 328 | * Allocates AS_area, notify the other side about our intention |
|
- | 329 | * to open the connection |
|
- | 330 | * |
|
- | 331 | * @return Connection id identifying this connection |
|
- | 332 | */ |
|
- | 333 | //int ipc_dgr_open(int pohoneid, size_t bufsize) |
|
- | 334 | //{ |
|
- | 335 | /* Find new file descriptor in local descriptor table */ |
|
- | 336 | /* Create AS_area, initialize structures */ |
|
- | 337 | /* Send AS to other side, handle error states */ |
|
- | 338 | ||
- | 339 | //} |
|
304 | /* |
340 | /* |
305 | int ipc_open_dgrconn(int pohoneid, size_t max_dgram) |
341 | void ipc_dgr_close(int cid) |
306 | { |
342 | { |
307 | |
- | |
308 | } |
343 | } |
309 | 344 | ||
- | 345 | void * ipc_dgr_alloc(int cid, size_t size) |
|
- | 346 | { |
|
- | 347 | } |
|
- | 348 | ||
- | 349 | void ipc_dgr_free(int cid, void *area) |
|
- | 350 | { |
|
- | 351 | ||
- | 352 | } |
|
- | 353 | ||
- | 354 | int ipc_dgr_send(int cid, void *area) |
|
- | 355 | { |
|
- | 356 | } |
|
- | 357 | ||
- | 358 | ||
- | 359 | int ipc_dgr_send_data(int cid, void *data, size_t size) |
|
- | 360 | { |
|
- | 361 | } |
|
310 | 362 | ||
311 | */ |
363 | */ |
312 | 364 |