Ignore:
File:
1 edited

Legend:

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

    r63f8966 r10477601  
    3333 */
    3434
    35 #ifndef LIBIPC_IPC_H_
    36 #define LIBIPC_IPC_H_
    37 
     35#if ((defined(LIBC_ASYNC_H_)) && (!defined(LIBC_ASYNC_C_)))
     36        #error Do not intermix low-level IPC interface and async framework
     37#endif
     38
     39#ifndef LIBC_IPC_H_
     40#define LIBC_IPC_H_
     41
     42#include <sys/types.h>
     43#include <ipc/common.h>
     44#include <kernel/synch/synch.h>
    3845#include <task.h>
    39 #include <kernel/ipc/ipc.h>
    40 #include <kernel/ddi/irq.h>
    41 #include <sys/types.h>
    42 #include <kernel/synch/synch.h>
    43 
    44 #define IPC_FLAG_BLOCKING  0x01
    45 
    46 typedef sysarg_t ipcarg_t;
    47 
    48 typedef struct {
    49         ipcarg_t args[IPC_CALL_LEN];
    50         ipcarg_t in_phone_hash;
    51 } ipc_call_t;
    52 
    53 typedef sysarg_t ipc_callid_t;
    54 
    55 typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *);
     46
     47typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *);
    5648
    5749/*
     
    6153 * possible, the fast version is used.
    6254 */
     55
    6356#define ipc_call_sync_0_0(phoneid, method) \
    6457        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
     
    183176            (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
    184177
    185 extern int ipc_call_sync_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
    186     ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *);
    187 
    188 extern int ipc_call_sync_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
    189     ipcarg_t, ipcarg_t, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *,
    190     ipcarg_t *);
    191 
    192 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int);
    193 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t);
     178extern int ipc_call_sync_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     179    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
     180
     181extern int ipc_call_sync_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     182    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
     183    sysarg_t *);
     184
     185extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);
    194186extern void ipc_poke(void);
    195187
    196 static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
    197 {
    198         return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
    199 }
    200 
     188#define ipc_wait_for_call(data) \
     189        ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
     190
     191extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, sysarg_t);
    201192extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *);
    202193
     
    207198 * to m.
    208199 */
     200
    209201#define ipc_answer_0(callid, retval) \
    210202        ipc_answer_fast((callid), (retval), 0, 0, 0, 0)
     
    220212        ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5))
    221213
    222 extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
    223     ipcarg_t, ipcarg_t);
    224 extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,
    225     ipcarg_t, ipcarg_t, ipcarg_t);
     214extern sysarg_t ipc_answer_fast(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
     215    sysarg_t, sysarg_t);
     216extern sysarg_t ipc_answer_slow(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
     217    sysarg_t, sysarg_t, sysarg_t);
    226218
    227219/*
     
    231223 * to m.
    232224 */
     225
    233226#define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \
    234227        ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
     
    255248            (arg4), (arg5), (private), (callback), (can_preempt))
    256249
    257 extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
    258     ipcarg_t, void *, ipc_async_callback_t, int);
    259 extern void ipc_call_async_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
    260     ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int);
    261 
    262 extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *);
    263 extern int ipc_connect_me_to(int, int, int, int);
    264 extern int ipc_connect_me_to_blocking(int, int, int, int);
     250extern void ipc_call_async_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     251    sysarg_t, void *, ipc_async_callback_t, bool);
     252extern void ipc_call_async_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     253    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
     254
     255extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t *,
     256    sysarg_t *);
     257extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
     258extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
     259
    265260extern int ipc_hangup(int);
    266 extern int ipc_register_irq(int, int, int, irq_code_t *);
    267 extern int ipc_unregister_irq(int, int);
    268 extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t, int);
    269 extern int ipc_forward_slow(ipc_callid_t, int, int, ipcarg_t, ipcarg_t,
    270     ipcarg_t, ipcarg_t, ipcarg_t, int);
     261
     262extern int ipc_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     263    unsigned int);
     264extern int ipc_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     265    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    271266
    272267/*
    273268 * User-friendly wrappers for ipc_share_in_start().
    274269 */
     270
    275271#define ipc_share_in_start_0_0(phoneid, dst, size) \
    276272        ipc_share_in_start((phoneid), (dst), (size), 0, NULL)
     
    282278        ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
    283279
    284 extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *);
    285 extern int ipc_share_in_finalize(ipc_callid_t, void *, int );
    286 extern int ipc_share_out_start(int, void *, int);
     280extern int ipc_share_in_start(int, void *, size_t, sysarg_t, unsigned int *);
     281extern int ipc_share_in_finalize(ipc_callid_t, void *, unsigned int);
     282extern int ipc_share_out_start(int, void *, unsigned int);
    287283extern int ipc_share_out_finalize(ipc_callid_t, void *);
    288284extern int ipc_data_read_start(int, void *, size_t);
Note: See TracChangeset for help on using the changeset viewer.