00001
00011
00012
00013
00014
00015
00016 #include <l4/sys/ipc.h>
00017 #include <l4/sys/types.h>
00018 #include "l4/events/events.h"
00019
00020
00021 #define REGISTER_EVENT 1
00022 #define UNREGISTER_EVENT 2
00023 #define UNREGISTER_ALL_EVENTS 3
00024 #define SEND_EVENT 4
00025 #define ASYNC_SEND_EVENT 5
00026 #define ACK_SEND_EVENT 6
00027 #define ASYNC_ACK_SEND_EVENT 7
00029 #define RECEIVE_EVENT 8
00030 #define ACK_RECEIVE_EVENT 9
00031 #define GET_ACK 10
00032 #define GIVE_ACK 11
00033 #define GIVE_ACK_AND_RECEIVE_EVENT \
00034 12
00036 #define GIVE_ACK_AND_ACK_RECEIVE_EVENT \
00037 13
00039 #define TIMEOUT 14
00041 #define SERVER_DUMP 15
00045 #define SHORT_BUFFER_SIZE 4
00046
00047
00050 typedef struct {
00051 l4_fpage_t fpage;
00052 l4_msgdope_t size_dope;
00053 l4_msgdope_t send_dope;
00054
00056 l4_umword_t cr;
00057
00059 union
00060 {
00061 l4_umword_t w1;
00062 l4_strdope_t string;
00063 } str;
00064 } message_t;
00065
00066 void copy_evt_to_msg(const l4events_event_t evt, message_t *msg);
00067 void copy_msg_to_evt(const message_t msg, l4events_event_t *evt);
00068
00071 static inline void init_message(message_t* msg, l4events_event_t* evt)
00072 {
00073 msg->fpage.fpage = 0;
00074 msg->size_dope = L4_IPC_DOPE(1,1);
00075 msg->send_dope = L4_IPC_DOPE(1,1);
00076
00077 msg->cr = 0;
00078
00079 msg->str.string.snd_str = (l4_umword_t) evt->str;
00080 msg->str.string.rcv_str = (l4_umword_t) evt->str;
00081 msg->str.string.snd_size = L4EVENTS_MAX_BUFFER_SIZE;
00082 msg->str.string.rcv_size = L4EVENTS_MAX_BUFFER_SIZE;
00083 };
00084
00087 static inline l4_umword_t get_first_word(l4events_event_t *event)
00088 {
00089 return *(l4_umword_t*)event->str;
00090 }
00091
00094 static inline void set_first_word(l4_umword_t word, l4events_event_t *event)
00095 {
00096 *(l4_umword_t*)event->str = word;
00097 }
00098
00102 #define create_control_word_for_call(cmd, len, event_ch, event_nr) \
00103 ((((((cmd & 0xf) << 8) | \
00104 (len & 0xff)) << 8) | \
00105 (event_ch & 0xff)) << 12) | \
00106 (event_nr & 0xfff)
00107
00111
00112 #define create_control_word_for_reply(res, len, event_ch, event_nr) \
00113 ((((((res & 0xf) << 8) | \
00114 (len & 0xff)) << 8) | \
00115 (event_ch & 0xff)) << 12) | \
00116 (event_nr & 0xfff)
00117
00120 #define get_cmd(word) \
00121 ((word >> 28) & 0xf)
00122
00125
00126 #define get_res(word) \
00127 (((word >> 28) & 0xf) ? ((word >> 28) & 0xf) | 0xf0 : 0)
00128
00131 #define get_len(word) \
00132 ((word >> 20) & 0xff)
00133
00136 #define get_event_ch(word) \
00137 ((word >> 12) & 0xff)
00138
00141 #define get_event_nr(word) \
00142 (word & 0xfff)
00143
00144