Subversion Repositories HelenOS

Rev

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

Rev 2615 Rev 2618
Line 35... Line 35...
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 {
Line 181... Line 180...
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);