00001
00005 #ifndef __L4SYS__INCLUDE__L4API_FIASCO__IPC_H__
00006 #define __L4SYS__INCLUDE__L4API_FIASCO__IPC_H__
00007
00008 #include <l4/sys/types.h>
00009
00015 #define L4_IPC_NIL_DESCRIPTOR (~0UL)
00016
00022 #define L4_IPC_SHORT_MSG 0
00023
00030 #define L4_IPC_SHORT_FPAGE ((void *)2)
00031
00032 #define L4_IPC_STRING_SHIFT 8
00033 #define L4_IPC_DWORD_SHIFT 13
00035 #define L4_IPC_FLAG_NEXT_PERIOD 0x10000
00036
00037
00045 #define L4_IPC_DOPE(dwords, strings) \
00046 ( (l4_msgdope_t) {md: {0, 0, 0, 0, 0, 0, strings, dwords }})
00047
00048
00057 #define L4_IPC_MAPMSG(address, size) \
00058 ((void *)(l4_umword_t)( ((address) & L4_PAGEMASK) | ((size) << 2) \
00059 | (unsigned long)L4_IPC_SHORT_FPAGE))
00060
00069 #define L4_IPC_IOMAPMSG(port, iosize) \
00070 ((void *)(l4_umword_t)( L4_IPC_IOMAPMSG_BASE | ((port) << 12) | ((iosize) << 2) \
00071 | (unsigned long)L4_IPC_SHORT_FPAGE))
00072
00081 #define L4_IPC_CAPMAPMSG(taskno, order) \
00082 ((void *)(l4_umword_t)( L4_IPC_CAPMAPMSG_BASE | ((taskno) << 12) | ((order) << 2) \
00083 | (unsigned long)L4_IPC_SHORT_FPAGE))
00084
00085
00086
00087
00088
00089 #define L4_IPC_ERROR_MASK 0xF0
00090 #define L4_IPC_DECEIT_MASK 0x01
00091 #define L4_IPC_FPAGE_MASK 0x02
00092 #define L4_IPC_REDIRECT_MASK 0x04
00093 #define L4_IPC_SRC_MASK 0x08
00094 #define L4_IPC_SND_ERR_MASK 0x10
00104 #define L4_IPC_IS_ERROR(x) (((x).msgdope) & L4_IPC_ERROR_MASK)
00105
00114 #define L4_IPC_MSG_DECEITED(x) (((x).msgdope) & L4_IPC_DECEIT_MASK)
00115
00124 #define L4_IPC_MSG_REDIRECTED(x) (((x).msgdope) & L4_IPC_REDIRECT_MASK)
00125
00135 #define L4_IPC_SRC_INSIDE(x) (((x).msgdope) & L4_IPC_SRC_MASK)
00136
00145 #define L4_IPC_SND_ERROR(x) (((x).msgdope) & L4_IPC_SND_ERR_MASK)
00146
00147
00148
00149
00150
00151
00159 #define L4_IPC_ERROR(x) (((x).msgdope) & L4_IPC_ERROR_MASK)
00160
00161 #define L4_IPC_ENOT_EXISTENT 0x10
00164 #define L4_IPC_RETIMEOUT 0x20
00167 #define L4_IPC_SETIMEOUT 0x30
00170 #define L4_IPC_RECANCELED 0x40
00173 #define L4_IPC_SECANCELED 0x50
00176 #define L4_IPC_REMAPFAILED 0x60
00180 #define L4_IPC_SEMAPFAILED 0x70
00183 #define L4_IPC_RESNDPFTO 0x80
00187 #define L4_IPC_SESNDPFTO 0x90
00191 #define L4_IPC_RERCVPFTO 0xA0
00195 #define L4_IPC_SERCVPFTO 0xB0
00199 #define L4_IPC_REABORTED 0xC0
00202 #define L4_IPC_SEABORTED 0xD0
00205 #define L4_IPC_REMSGCUT 0xE0
00212 #define L4_IPC_SEMSGCUT 0xF0
00224 #define L4_IPC_SHORT_MSG_NODONATE ((void*)((unsigned)L4_IPC_SHORT_MSG|\
00225 L4_IPC_DECEIT_MASK))
00226
00227
00228
00229
00230
00231
00236 typedef struct {
00237 l4_fpage_t fpage;
00238 l4_msgdope_t size;
00239 l4_msgdope_t send;
00240 l4_umword_t word[1];
00241 } l4_msg_t;
00242
00243
00249 typedef struct {
00250 l4_threadid_t dest;
00251 l4_threadid_t true_src;
00252 } l4_ipc_deceit_ids_t;
00253
00254
00255
00256
00257
00258
00339 L4_INLINE int
00340 l4_ipc_call_tag(l4_threadid_t dest,
00341 const void *snd_msg,
00342 l4_umword_t snd_dword0,
00343 l4_umword_t snd_dword1,
00344 l4_msgtag_t tag,
00345 void *rcv_msg,
00346 l4_umword_t *rcv_dword0,
00347 l4_umword_t *rcv_dword1,
00348 l4_timeout_t timeout,
00349 l4_msgdope_t *result,
00350 l4_msgtag_t *rtag);
00351
00358 L4_INLINE int
00359 l4_ipc_call(l4_threadid_t dest,
00360 const void *snd_msg,
00361 l4_umword_t snd_dword0,
00362 l4_umword_t snd_dword1,
00363 void *rcv_msg,
00364 l4_umword_t *rcv_dword0,
00365 l4_umword_t *rcv_dword1,
00366 l4_timeout_t timeout,
00367 l4_msgdope_t *result);
00368
00369
00449 L4_INLINE int
00450 l4_ipc_reply_and_wait_tag(l4_threadid_t dest,
00451 const void *snd_msg,
00452 l4_umword_t snd_dword0,
00453 l4_umword_t snd_dword1,
00454 l4_msgtag_t tag,
00455 l4_threadid_t *src,
00456 void *rcv_msg,
00457 l4_umword_t *rcv_dword0,
00458 l4_umword_t *rcv_dword1,
00459 l4_timeout_t timeout,
00460 l4_msgdope_t *result,
00461 l4_msgtag_t *rtag);
00462
00469 L4_INLINE int
00470 l4_ipc_reply_and_wait(l4_threadid_t dest,
00471 const void *snd_msg,
00472 l4_umword_t snd_dword0,
00473 l4_umword_t snd_dword1,
00474 l4_threadid_t *src,
00475 void *rcv_msg,
00476 l4_umword_t *rcv_dword0,
00477 l4_umword_t *rcv_dword1,
00478 l4_timeout_t timeout,
00479 l4_msgdope_t *result);
00480
00481
00486 L4_INLINE int
00487 l4_ipc_wait_next_period(l4_threadid_t *src,
00488 void *rcv_msg,
00489 l4_umword_t *rcv_dword0,
00490 l4_umword_t *rcv_dword1,
00491 l4_timeout_t timeout,
00492 l4_msgdope_t *result);
00493
00494
00543 L4_INLINE int
00544 l4_ipc_send_tag(l4_threadid_t dest,
00545 const void *snd_msg,
00546 l4_umword_t snd_dword0,
00547 l4_umword_t snd_dword1,
00548 l4_msgtag_t tag,
00549 l4_timeout_t timeout,
00550 l4_msgdope_t *result);
00551
00558 L4_INLINE int
00559 l4_ipc_send(l4_threadid_t dest,
00560 const void *snd_msg,
00561 l4_umword_t snd_dword0,
00562 l4_umword_t snd_dword1,
00563 l4_timeout_t timeout,
00564 l4_msgdope_t *result);
00565
00620 L4_INLINE int
00621 l4_ipc_wait_tag(l4_threadid_t *src,
00622 void *rcv_msg,
00623 l4_umword_t *rcv_dword0,
00624 l4_umword_t *rcv_dword1,
00625 l4_timeout_t timeout,
00626 l4_msgdope_t *result,
00627 l4_msgtag_t *tag);
00628
00635 L4_INLINE int
00636 l4_ipc_wait(l4_threadid_t *src,
00637 void *rcv_msg,
00638 l4_umword_t *rcv_dword0,
00639 l4_umword_t *rcv_dword1,
00640 l4_timeout_t timeout,
00641 l4_msgdope_t *result);
00642
00643
00699 L4_INLINE int
00700 l4_ipc_receive_tag(l4_threadid_t src,
00701 void *rcv_msg,
00702 l4_umword_t *rcv_dword0,
00703 l4_umword_t *rcv_dword1,
00704 l4_timeout_t timeout,
00705 l4_msgdope_t *result,
00706 l4_msgtag_t *tag);
00713 L4_INLINE int
00714 l4_ipc_receive(l4_threadid_t src,
00715 void *rcv_msg,
00716 l4_umword_t *rcv_dword0,
00717 l4_umword_t *rcv_dword1,
00718 l4_timeout_t timeout,
00719 l4_msgdope_t *result);
00720
00721
00736 L4_INLINE int
00737 l4_ipc_sleep(l4_timeout_t timeout);
00738
00746 L4_INLINE int
00747 l4_ipc_fpage_received(l4_msgdope_t msgdope);
00748
00756 L4_INLINE int
00757 l4_ipc_is_fpage_granted(l4_fpage_t fp);
00758
00766 L4_INLINE int
00767 l4_ipc_is_fpage_writable(l4_fpage_t fp);
00768
00776 L4_INLINE long
00777 l4_is_rcv_map_descr(const void *msg);
00778
00786 L4_INLINE long
00787 l4_is_long_rcv_descr(const void *msg);
00788
00796 L4_INLINE long
00797 l4_is_long_snd_descr(const void *msg);
00798
00806 L4_INLINE const l4_msg_t *
00807 l4_get_snd_msg_from_descr(const void *msg);
00808
00816 L4_INLINE l4_msg_t *
00817 l4_get_rcv_msg_from_descr(void *msg);
00818
00819
00820
00821
00822
00823 #define L4_IPC_DECEIT 1
00824 #define L4_IPC_OPEN_IPC 1
00825
00826 #endif