source: rtems/cpukit/sapi/src/chainprotected.c @ c130387

5
Last change on this file since c130387 was c130387, checked in by Sebastian Huber <sebastian.huber@…>, on 04/04/16 at 07:24:47

score: Delete _Chain_Prepend_with_empty_check()

This function is not used in the score.

Update #2555.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 * Copyright (c) 2013, 2016 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include <rtems/chain.h>
20#include <rtems/rtems/intr.h>
21
22RTEMS_INTERRUPT_LOCK_DEFINE( static, chain_lock, "Chains" )
23
24static void chain_acquire( rtems_interrupt_lock_context *lock_context )
25{
26  rtems_interrupt_lock_acquire( &chain_lock, lock_context );
27}
28
29static void chain_release( rtems_interrupt_lock_context *lock_context )
30{
31  rtems_interrupt_lock_release( &chain_lock, lock_context );
32}
33
34#if defined( RTEMS_SMP )
35
36void rtems_chain_extract( rtems_chain_node *node )
37{
38  rtems_interrupt_lock_context lock_context;
39
40  chain_acquire( &lock_context );
41  _Chain_Extract_unprotected( node );
42  chain_release( &lock_context );
43}
44
45rtems_chain_node *rtems_chain_get( rtems_chain_control *chain )
46{
47  rtems_chain_node *node;
48  rtems_interrupt_lock_context lock_context;
49
50  chain_acquire( &lock_context );
51  node = _Chain_Get_unprotected( chain );
52  chain_release( &lock_context );
53
54  return node;
55}
56
57void rtems_chain_insert( rtems_chain_node *after_node, rtems_chain_node *node )
58{
59  rtems_interrupt_lock_context lock_context;
60
61  chain_acquire( &lock_context );
62  _Chain_Insert_unprotected( after_node, node );
63  chain_release( &lock_context );
64}
65
66void rtems_chain_append(
67  rtems_chain_control *chain,
68  rtems_chain_node *node
69)
70{
71  rtems_interrupt_lock_context lock_context;
72
73  chain_acquire( &lock_context );
74  _Chain_Append_unprotected( chain, node );
75  chain_release( &lock_context );
76}
77
78#endif /* defined( RTEMS_SMP ) */
79
80void rtems_chain_prepend(
81  rtems_chain_control *chain,
82  rtems_chain_node *node
83)
84{
85  rtems_interrupt_lock_context lock_context;
86
87  chain_acquire( &lock_context );
88  _Chain_Prepend_unprotected( chain, node );
89  chain_release( &lock_context );
90}
91
92bool rtems_chain_append_with_empty_check(
93  rtems_chain_control *chain,
94  rtems_chain_node *node
95)
96{
97  bool was_empty;
98  rtems_interrupt_lock_context lock_context;
99
100  chain_acquire( &lock_context );
101  was_empty = _Chain_Append_with_empty_check_unprotected( chain, node );
102  chain_release( &lock_context );
103
104  return was_empty;
105}
106
107bool rtems_chain_prepend_with_empty_check(
108  rtems_chain_control *chain,
109  rtems_chain_node *node
110)
111{
112  bool was_empty;
113  rtems_interrupt_lock_context lock_context;
114
115  chain_acquire( &lock_context );
116  was_empty = _Chain_Prepend_with_empty_check_unprotected( chain, node );
117  chain_release( &lock_context );
118
119  return was_empty;
120}
121
122#if defined( RTEMS_SMP )
123
124bool rtems_chain_get_with_empty_check(
125  rtems_chain_control *chain,
126  rtems_chain_node **node
127)
128{
129  bool is_empty_now;
130  rtems_interrupt_lock_context lock_context;
131
132  chain_acquire( &lock_context );
133  is_empty_now = _Chain_Get_with_empty_check_unprotected( chain, node );
134  chain_release( &lock_context );
135
136  return is_empty_now;
137}
138
139#endif /* defined( RTEMS_SMP ) */
Note: See TracBrowser for help on using the repository browser.