Introduction   Client Library API Reference   Demo1   Demo2   Demo3   File List   Index  

events.h

Go to the documentation of this file.
00001 
00010 /* (c) 2003 Technische Universitaet Dresden
00011  * This file is part of DROPS, which is distributed under the terms of the
00012  * GNU General Public License 2. Please see the COPYING file for details.
00013  */
00014 #ifndef __LIBEVENTS_H
00015 #define __LIBEVENTS_H
00016 
00017 #include <l4/sys/compiler.h>
00018 #include <l4/sys/l4int.h>
00019 #include <l4/sys/types.h>
00020 
00021 
00022 EXTERN_C_BEGIN
00023 
00024 /* name used for registering at names server */
00025 #define L4EVENTS_SERVER_NAME      "event_server"
00026 
00027 
00028 /*****************************************************************************/
00034 /*****************************************************************************/
00040 #define L4EVENTS_OK       0
00041 
00049 #define L4EVENTS_WARNING_TASK_REGISTERED  0xf1
00050 
00058 #define L4EVENTS_WARNING_TASK_NOT_REGISTERED  0xf2
00059 
00068 #define L4EVENTS_WARNING_EVENTS_DELETED   0xf3
00069 
00078 #define L4EVENTS_WARNING_EVENTTYP_NOT_REGISTERED 0xf4
00079 
00087 #define L4EVENTS_WARNING_NO_EVENT_TO_RECEIVE  0xf5
00088 
00096 #define L4EVENTS_WARNING_EVENT_PENDING    0xf6
00097 
00104 #define L4EVENTS_WARNING_INVALID_EVENTNR  0xf7
00105 
00112 #define L4EVENTS_ERROR_INTERNAL     0xf8
00113 
00121 #define L4EVENTS_ERROR_IPC      0xf9
00122 
00131 #define L4EVENTS_ERROR_TIMEOUT      0xfa
00132 
00139 #define L4EVENTS_ERROR_INVALID_COMMAND    0xfb
00140 
00143 #define L4EVENTS_ERROR_OTHER      0xfc
00144 
00147 #define L4EVENTS_RECV_OTHER     0xfd
00148 
00151 #define L4EVENTS_ERROR_NOT_EXISTS               0xfe
00152 
00153 #define L4EVENTS_ERRSTRINGS_DEFINE          \
00154   { L4EVENTS_WARNING_TASK_REGISTERED,         \
00155     "EVENTS: Task is already registered" },       \
00156   { L4EVENTS_WARNING_TASK_NOT_REGISTERED,       \
00157     "EVENTS: Task is not registered" } ,        \
00158   { L4EVENTS_WARNING_EVENTS_DELETED,          \
00159     "EVENTS: Task lost pending events deleted during unregister" }, \
00160   { L4EVENTS_WARNING_EVENTTYP_NOT_REGISTERED,       \
00161     "EVENTS: There is no registered task for this channel" },   \
00162   { L4EVENTS_WARNING_NO_EVENT_TO_RECEIVE,       \
00163     "EVENTS: No event to receive" },          \
00164   { L4EVENTS_WARNING_EVENT_PENDING,         \
00165     "EVENTS: Some registered task has not received this event" }, \
00166   { L4EVENTS_WARNING_INVALID_EVENTNR,         \
00167     "EVENTS: Acknowledge: Event-number doesn't exist" },    \
00168   { L4EVENTS_ERROR_INTERNAL,            \
00169     "EVENTS: Internal server error occured" },        \
00170   { L4EVENTS_ERROR_IPC,             \
00171     "EVENTS: IPC error occured" },          \
00172   { L4EVENTS_ERROR_TIMEOUT,           \
00173     "EVENTS: IPC timeout occured" },          \
00174   { L4EVENTS_ERROR_INVALID_COMMAND,         \
00175     "EVENTS: Unknown command was sent " },        \
00176   { L4EVENTS_ERROR_OTHER,           \
00177     "EVENTS: Undefined error occured" },        \
00178   { L4EVENTS_RECV_OTHER,            \
00179     "EVENTS: Unknown server replied to open wait" }
00180 
00181 /****************************************************************************
00182  * \anchor receive and send options
00183  * 
00184  ****************************************************************************/
00185 
00196 #define L4EVENTS_ASYNC    1
00197 
00208 #define L4EVENTS_SEND_ACK 2
00209 
00221 #define L4EVENTS_RECV_ACK 4
00222 
00229 #define L4EVENTS_GIVE_ACK 8
00230 
00237 #define L4EVENTS_RECV_SHORT 16
00238 
00240 typedef l4_uint16_t l4events_ch_t;
00241 
00243 #define L4EVENTS_NO_CHANNEL 0
00244 
00246 #define L4EVENTS_EXIT_CHANNEL 1
00247 
00249 #define L4EVENTS_MAX_BUFFER_SIZE  60
00250 
00252 #define L4EVENTS_MAX_PRIORITY 15
00253 
00254 /*****************************************************************************/
00257 /*****************************************************************************/
00258 typedef struct {
00259   int len;        
00260   char  str[L4EVENTS_MAX_BUFFER_SIZE];  
00261 } l4events_event_t;
00262 
00264 typedef l4_umword_t l4events_nr_t;
00265 
00266 typedef l4_int8_t l4events_pr_t;
00267 
00269 #define L4EVENTS_NO_NR  0
00270 
00271 /*****************************************************************************/
00277 /*****************************************************************************/
00278 L4_CV int
00279 l4events_init(void);
00280 
00281 /*****************************************************************************/
00297 /*****************************************************************************/
00298 L4_CV long
00299 l4events_register(const l4events_ch_t event_ch, 
00300           const l4events_pr_t priority);
00301 
00302 /*****************************************************************************/
00311 /*****************************************************************************/
00312 L4_CV long
00313 l4events_unregister(const l4events_ch_t event_ch);
00314 
00315 /*****************************************************************************/
00322 /*****************************************************************************/
00323 L4_CV long
00324 l4events_unregister_all(void);
00325 
00326 /*****************************************************************************/
00338 /*****************************************************************************/
00339 L4_CV long
00340 l4events_send(const l4events_ch_t event_ch, 
00341                   l4events_event_t *event,
00342               l4events_nr_t *event_nr,
00343         const int opt);
00344 
00345 /*****************************************************************************/
00361 /*****************************************************************************/
00362 L4_CV long
00363 l4events_receive(l4events_ch_t *event_ch, 
00364          l4events_event_t *event,
00365      l4events_nr_t *event_nr,
00366      l4_timeout_t timeout,
00367      const int opt);
00368 
00369 /*****************************************************************************/
00385 /*****************************************************************************/
00386 L4_CV long
00387 l4events_give_ack_and_receive(l4events_ch_t *event_ch,
00388         l4events_event_t *event,
00389         l4events_nr_t *event_nr,
00390         l4_timeout_t timeout,
00391         const int opt);
00392 
00393 /*****************************************************************************/
00403 /*****************************************************************************/
00404 L4_CV int
00405 l4events_dump(void);
00406 
00413 typedef L4_CV void (*l4events_recv_function_t)(l4events_ch_t, l4events_event_t *);
00414 
00415 /*****************************************************************************/
00424 /*****************************************************************************/
00425 L4_CV void
00426 l4events_wait(int threadno, l4events_ch_t event_ch,
00427         l4events_recv_function_t function);
00428 
00429 
00430 /*****************************************************************************/
00440 /*****************************************************************************/
00441 L4_CV long
00442 l4events_get_ack(l4events_nr_t *event_nr, l4_timeout_t timeout);
00443 
00444 /*****************************************************************************/
00458 /*****************************************************************************/
00459 L4_CV long
00460 l4events_get_ack_open(l4events_nr_t *event_nr, l4_threadid_t *id,
00461               l4_umword_t *w1, l4_umword_t *w2, l4_timeout_t timeout);
00462 
00463 /*****************************************************************************/
00473 /*****************************************************************************/
00474 L4_CV long
00475 l4events_give_ack(l4events_nr_t event_nr);
00476 
00477 asm(".globl l4events_err_strings_sym; .type l4events_err_strings_sym,%object");
00478 
00479 EXTERN_C_END
00480 
00481 #endif

Events Reference Manual, written by Torsten Frenzel  © 2003