]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ferret/include/sensors/__llist_consumer.h
Update
[l4.git] / l4 / pkg / ferret / include / sensors / __llist_consumer.h
1 /**
2  * \internal
3  * \file   ferret/include/sensors/__llist_consumer.h
4  * \brief  locked list consumer functions.
5  *
6  * \date   2007-05-16
7  * \author Martin Pohlack  <mp26@os.inf.tu-dresden.de>
8  */
9 /*
10  * (c) 2007-2009 Technische Universität Dresden
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU General Public License 2.
13  * Please see the COPYING-GPL-2 file for details.
14  */
15 #if FERRET_LLIST_MAGIC != ahK6eeNa
16 #error Do not directly include this file, use a proper wrapper!
17 #endif
18 #undef FERRET_LLIST_MAGIC
19
20 #include <l4/sys/compiler.h>
21
22 EXTERN_C_BEGIN
23
24 /* Consumer local part of the data structure.  Allocated and
25  * initialized locally.
26  */
27 typedef struct
28 {
29     ferret_common_t        header;    // copy of the header, all
30                                       // sensors should start with
31                                       // same header
32     ferret_llist_index_t   next_read; // event to read next
33     uint64_t               lost;      // number of events lost so far
34     PREFIX(t)            * glob;      // pointer to globally shared area
35     char                 * out_buf;   // pointer to output element buffer
36 #ifdef FERRET_LLIST_HAVE_LOCAL_LOCK
37     PREFIX(local_lock_t)   llock;     // address space specific part of the lock
38 #endif
39 } PREFIX(moni_t);
40
41 /**
42  * @brief 
43  *
44  * @param  list locked list sensor to get elements from
45  * @param  el   pointer to memory area to copy retrieved element to
46  *
47  * @return - = 0 ok
48  *         - < 0 errorcode
49  */
50 int PREFIX(get)(PREFIX(moni_t) * list, ferret_list_entry_t * el);
51
52 /**
53  * @brief Setup local struct for sensor
54  *
55  * @param  addr pointer pointer to global memory area
56  * @retval addr pointer to new local area
57  */
58 void PREFIX(init_consumer)(void ** addr);
59
60 /**
61  * @brief De-allocate locale memory area
62  *
63  * @param addr  pointer pointer to local memory area
64  * @retval addr pointer to global memory
65  */
66 void PREFIX(free_consumer)(void ** addr);
67
68 EXTERN_C_END