Subversion Repositories HelenOS

Rev

Rev 3536 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3536 Rev 4377
Line 45... Line 45...
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
Line 171... Line 170...
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
Line 207... Line 204...
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), \
Line 243... Line 239...
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);
-
 
248
 
253
    ipc_async_callback_t callback, int can_preempt);
249
#define IPC_FLAG_BLOCKING  0x01
254
 
250
 
255
extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, int arg3,
251
extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *);
256
    ipcarg_t *phone);
252
extern int ipc_connect_me_to(int, int, int, int);
257
extern int ipc_connect_me_to(int phoneid, int arg1, int arg2, int arg3);
253
extern int ipc_connect_me_to_blocking(int, int, int, int);
258
extern int ipc_hangup(int phoneid);
254
extern int ipc_hangup(int);
259
extern int ipc_register_irq(int inr, int devno, int method, irq_code_t *code);
255
extern int ipc_register_irq(int, int, int, irq_code_t *);
260
extern int ipc_unregister_irq(int inr, int devno);
256
extern int ipc_unregister_irq(int, int);
261
extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
257
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,
262
    ipcarg_t arg1, ipcarg_t arg2, int mode);
259
    ipcarg_t, ipcarg_t, ipcarg_t, int);
263
 
260
 
264
 
261
 
265
/*
262
/*
266
 * User-friendly wrappers for ipc_share_in_start().
263
 * User-friendly wrappers for ipc_share_in_start().
267
 */
264
 */
Line 272... Line 269...
272
#define ipc_share_in_start_1_0(phoneid, dst, size, arg) \
269
#define ipc_share_in_start_1_0(phoneid, dst, size, arg) \
273
    ipc_share_in_start((phoneid), (dst), (size), (arg), NULL)
270
    ipc_share_in_start((phoneid), (dst), (size), (arg), NULL)
274
#define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \
271
#define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags) \
275
    ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
272
    ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
276
 
273
 
277
extern int ipc_share_in_start(int phoneid, void *dst, size_t size, ipcarg_t arg,
274
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);
275
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);
276
extern int ipc_share_in_finalize(ipc_callid_t, void *, int );
281
extern int ipc_share_out_start(int phoneid, void *src, int flags);
277
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);
278
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);
279
extern int ipc_share_out_finalize(ipc_callid_t, void *);
284
extern int ipc_data_read_start(int phoneid, void *dst, size_t size);
280
extern int ipc_data_read_start(int, void *, size_t);
285
extern int ipc_data_read_receive(ipc_callid_t *callid, size_t *size);
281
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,
282
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);
283
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);
284
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);
285
extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t);
291
 
286
 
292
#include <task.h>
287
#include <task.h>
293
 
288
 
294
extern int ipc_connect_kbox(task_id_t id);
289
extern int ipc_connect_kbox(task_id_t);
295
 
290
 
296
#endif
291
#endif
297
 
292
 
298
/** @}
293
/** @}
299
 */
294
 */