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