Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ipc/ipc.h

    rd7978525 r6aae539d  
    4848typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *);
    4949
     50/*
     51 * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow().
     52 * They are in the form ipc_call_sync_m_n(), where m denotes the number of
     53 * arguments of payload and n denotes number of return values. Whenever
     54 * possible, the fast version is used.
     55 */
     56
     57#define ipc_call_sync_0_0(phoneid, method) \
     58        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
     59#define ipc_call_sync_0_1(phoneid, method, res1) \
     60        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
     61#define ipc_call_sync_0_2(phoneid, method, res1, res2) \
     62        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
     63#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
     64        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
     65            0, 0)
     66#define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \
     67        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
     68            (res4), 0)
     69#define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \
     70        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
     71            (res4), (res5))
     72
     73#define ipc_call_sync_1_0(phoneid, method, arg1) \
     74        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) \
     76        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) \
     78        ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \
     79            0, 0)
     80#define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \
     81        ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
     82            (res3), 0, 0)
     83#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), \
     85            (res3), (res4), 0)
     86#define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \
     87    res5) \
     88        ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
     89            (res3), (res4), (res5))
     90
     91#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
     92        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \
     93            0, 0)
     94#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
     95        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \
     96            0, 0)
     97#define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \
     98        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
     99            (res2), 0, 0, 0)
     100#define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \
     101        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
     102            (res2), (res3), 0, 0)
     103#define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \
     104    res4) \
     105        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
     106            (res2), (res3), (res4), 0)
     107#define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \
     108    res4, res5)\
     109        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
     110            (res2), (res3), (res4), (res5))
     111
     112#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
     113        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \
     114            0, 0)
     115#define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \
     116        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
     117            0, 0, 0, 0)
     118#define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \
     119        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
     120            (res2), 0, 0, 0)
     121#define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \
     122    res3) \
     123        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     124            (res1), (res2), (res3), 0, 0)
     125#define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \
     126    res3, res4) \
     127        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     128            (res1), (res2), (res3), (res4), 0)
     129#define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \
     130    res3, res4, res5) \
     131        ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     132            (res1), (res2), (res3), (res4), (res5))
     133
     134#define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
     135        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
     136            0, 0, 0, 0, 0)
     137#define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \
     138        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
     139            (res1), 0, 0, 0, 0)
     140#define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \
     141        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
     142            (res1), (res2), 0, 0, 0)
     143#define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
     144    res3) \
     145        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     146            (arg4), 0, (res1), (res2), (res3), 0, 0)
     147#define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
     148    res3, res4) \
     149        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     150            (arg4), 0, (res1), (res2), (res3), (res4), 0)
     151#define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
     152    res3, res4, res5) \
     153        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     154            (arg4), 0, (res1), (res2), (res3), (res4), (res5))
     155
     156#define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
     157        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     158            (arg5), 0, 0, 0, 0, 0)
     159#define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \
     160        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     161            (arg5), (res1), 0, 0, 0, 0)
     162#define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
     163    res2) \
     164        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     165            (arg4), (arg5), (res1), (res2), 0, 0, 0)
     166#define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
     167    res2, res3) \
     168        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     169            (arg4), (arg5), (res1), (res2), (res3), 0, 0)
     170#define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
     171    res2, res3, res4) \
     172        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     173            (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
     174#define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
     175    res2, res3, res4, res5) \
     176        ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     177            (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
     178
     179extern int ipc_call_sync_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     180    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
     181
     182extern int ipc_call_sync_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     183    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
     184    sysarg_t *);
     185
    50186extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);
    51187extern void ipc_poke(void);
     
    118254    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
    119255
     256extern int ipc_clone_establish(int);
     257extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
     258    sysarg_t *);
     259extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
     260extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
     261
    120262extern int ipc_hangup(int);
    121263
     
    125267    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    126268
     269/*
     270 * User-friendly wrappers for ipc_share_in_start().
     271 */
     272
     273#define ipc_share_in_start_0_0(phoneid, size, dst) \
     274        ipc_share_in_start((phoneid), (size), 0, NULL, (dst))
     275#define ipc_share_in_start_0_1(phoneid, size, flags, dst) \
     276        ipc_share_in_start((phoneid), (size), 0, (flags), (dst))
     277#define ipc_share_in_start_1_0(phoneid, size, arg, dst) \
     278        ipc_share_in_start((phoneid), (size), (arg), NULL, (dst))
     279#define ipc_share_in_start_1_1(phoneid, size, arg, flags, dst) \
     280        ipc_share_in_start((phoneid), (size), (arg), (flags), (dst))
     281
     282extern int ipc_share_in_start(int, size_t, sysarg_t, unsigned int *, void **);
     283extern int ipc_share_in_finalize(ipc_callid_t, void *, unsigned int);
     284extern int ipc_share_out_start(int, void *, unsigned int);
     285extern int ipc_share_out_finalize(ipc_callid_t, void **);
     286extern int ipc_data_read_start(int, void *, size_t);
     287extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t);
     288extern int ipc_data_write_start(int, const void *, size_t);
     289extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t);
     290
    127291extern int ipc_connect_kbox(task_id_t);
    128292
Note: See TracChangeset for help on using the changeset viewer.