1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Chain API |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * Copyright (c) 2010 embedded brains GmbH. |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989-2008. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_CHAIN_H |
---|
19 | #define _RTEMS_CHAIN_H |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/score/chain.h> |
---|
23 | #include <rtems/rtems/event.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | /** |
---|
30 | * @defgroup ClassicChains Chains |
---|
31 | * |
---|
32 | * @ingroup ClassicRTEMS |
---|
33 | * |
---|
34 | * @brief Chain API |
---|
35 | */ |
---|
36 | /**@{**/ |
---|
37 | |
---|
38 | typedef Chain_Node rtems_chain_node; |
---|
39 | |
---|
40 | typedef Chain_Control rtems_chain_control; |
---|
41 | |
---|
42 | /** |
---|
43 | * @brief Chain initializer for an empty chain with designator @a name. |
---|
44 | */ |
---|
45 | #define RTEMS_CHAIN_INITIALIZER_EMPTY(name) \ |
---|
46 | CHAIN_INITIALIZER_EMPTY(name) |
---|
47 | |
---|
48 | /** |
---|
49 | * @brief Chain definition for an empty chain with designator @a name. |
---|
50 | */ |
---|
51 | #define RTEMS_CHAIN_DEFINE_EMPTY(name) \ |
---|
52 | CHAIN_DEFINE_EMPTY(name) |
---|
53 | |
---|
54 | /** @} */ |
---|
55 | |
---|
56 | #include <rtems/chain.inl> |
---|
57 | |
---|
58 | /** |
---|
59 | * @addtogroup ClassicChains |
---|
60 | */ |
---|
61 | /**@{**/ |
---|
62 | |
---|
63 | /** |
---|
64 | * @brief Appends the @a node to the @a chain and sends the @a events to the |
---|
65 | * @a task if the @a chain was empty before the append. |
---|
66 | * |
---|
67 | * @see rtems_chain_append_with_empty_check() and rtems_event_send(). |
---|
68 | * |
---|
69 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
70 | * @retval RTEMS_INVALID_ID No such task. |
---|
71 | */ |
---|
72 | rtems_status_code rtems_chain_append_with_notification( |
---|
73 | rtems_chain_control *chain, |
---|
74 | rtems_chain_node *node, |
---|
75 | rtems_id task, |
---|
76 | rtems_event_set events |
---|
77 | ); |
---|
78 | |
---|
79 | /** |
---|
80 | * @brief Prepends the @a node to the @a chain and sends the @a events to the |
---|
81 | * @a task if the @a chain was empty before the prepend. |
---|
82 | * |
---|
83 | * @see rtems_chain_prepend_with_empty_check() and rtems_event_send(). |
---|
84 | * |
---|
85 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
86 | * @retval RTEMS_INVALID_ID No such task. |
---|
87 | */ |
---|
88 | rtems_status_code rtems_chain_prepend_with_notification( |
---|
89 | rtems_chain_control *chain, |
---|
90 | rtems_chain_node *node, |
---|
91 | rtems_id task, |
---|
92 | rtems_event_set events |
---|
93 | ); |
---|
94 | |
---|
95 | /** |
---|
96 | * @brief Gets the first @a node of the @a chain and sends the @a events to the |
---|
97 | * @a task if the @a chain is empty after the get. |
---|
98 | * |
---|
99 | * @see rtems_chain_get_with_empty_check() and rtems_event_send(). |
---|
100 | * |
---|
101 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
102 | * @retval RTEMS_INVALID_ID No such task. |
---|
103 | */ |
---|
104 | rtems_status_code rtems_chain_get_with_notification( |
---|
105 | rtems_chain_control *chain, |
---|
106 | rtems_id task, |
---|
107 | rtems_event_set events, |
---|
108 | rtems_chain_node **node |
---|
109 | ); |
---|
110 | |
---|
111 | /** |
---|
112 | * @brief Gets the first @a node of the @a chain and sends the @a events to the |
---|
113 | * @a task if the @a chain is empty afterwards. |
---|
114 | * |
---|
115 | * @see rtems_chain_get() and rtems_event_receive(). |
---|
116 | * |
---|
117 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
118 | * @retval RTEMS_TIMEOUT Timeout. |
---|
119 | */ |
---|
120 | rtems_status_code rtems_chain_get_with_wait( |
---|
121 | rtems_chain_control *chain, |
---|
122 | rtems_event_set events, |
---|
123 | rtems_interval timeout, |
---|
124 | rtems_chain_node **node |
---|
125 | ); |
---|
126 | |
---|
127 | /** @} */ |
---|
128 | |
---|
129 | #ifdef __cplusplus |
---|
130 | } |
---|
131 | #endif |
---|
132 | |
---|
133 | #endif |
---|
134 | /* end of include file */ |
---|