File indexing completed on 2025-05-11 08:24:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifdef HAVE_CONFIG_H
0041 #include "config.h"
0042 #endif
0043
0044 #include <rtems/chain.h>
0045 #include <rtems/rtems/intr.h>
0046
0047 RTEMS_INTERRUPT_LOCK_DEFINE( static, chain_lock, "Chains" )
0048
0049 static void chain_acquire( rtems_interrupt_lock_context *lock_context )
0050 {
0051 rtems_interrupt_lock_acquire( &chain_lock, lock_context );
0052 }
0053
0054 static void chain_release( rtems_interrupt_lock_context *lock_context )
0055 {
0056 rtems_interrupt_lock_release( &chain_lock, lock_context );
0057 }
0058
0059 void rtems_chain_extract( rtems_chain_node *node )
0060 {
0061 rtems_interrupt_lock_context lock_context;
0062
0063 chain_acquire( &lock_context );
0064 _Chain_Extract_unprotected( node );
0065 chain_release( &lock_context );
0066 }
0067
0068 rtems_chain_node *rtems_chain_get( rtems_chain_control *chain )
0069 {
0070 rtems_chain_node *node;
0071 rtems_interrupt_lock_context lock_context;
0072
0073 chain_acquire( &lock_context );
0074 node = _Chain_Get_unprotected( chain );
0075 chain_release( &lock_context );
0076
0077 return node;
0078 }
0079
0080 void rtems_chain_insert( rtems_chain_node *after_node, rtems_chain_node *node )
0081 {
0082 rtems_interrupt_lock_context lock_context;
0083
0084 chain_acquire( &lock_context );
0085 _Chain_Insert_unprotected( after_node, node );
0086 chain_release( &lock_context );
0087 }
0088
0089 void rtems_chain_append(
0090 rtems_chain_control *chain,
0091 rtems_chain_node *node
0092 )
0093 {
0094 rtems_interrupt_lock_context lock_context;
0095
0096 chain_acquire( &lock_context );
0097 _Chain_Append_unprotected( chain, node );
0098 chain_release( &lock_context );
0099 }
0100
0101 void rtems_chain_prepend(
0102 rtems_chain_control *chain,
0103 rtems_chain_node *node
0104 )
0105 {
0106 rtems_interrupt_lock_context lock_context;
0107
0108 chain_acquire( &lock_context );
0109 _Chain_Prepend_unprotected( chain, node );
0110 chain_release( &lock_context );
0111 }
0112
0113 bool rtems_chain_append_with_empty_check(
0114 rtems_chain_control *chain,
0115 rtems_chain_node *node
0116 )
0117 {
0118 bool was_empty;
0119 rtems_interrupt_lock_context lock_context;
0120
0121 chain_acquire( &lock_context );
0122 was_empty = _Chain_Append_with_empty_check_unprotected( chain, node );
0123 chain_release( &lock_context );
0124
0125 return was_empty;
0126 }
0127
0128 bool rtems_chain_prepend_with_empty_check(
0129 rtems_chain_control *chain,
0130 rtems_chain_node *node
0131 )
0132 {
0133 bool was_empty;
0134 rtems_interrupt_lock_context lock_context;
0135
0136 chain_acquire( &lock_context );
0137 was_empty = _Chain_Prepend_with_empty_check_unprotected( chain, node );
0138 chain_release( &lock_context );
0139
0140 return was_empty;
0141 }
0142
0143 bool rtems_chain_get_with_empty_check(
0144 rtems_chain_control *chain,
0145 rtems_chain_node **node
0146 )
0147 {
0148 bool is_empty_now;
0149 rtems_interrupt_lock_context lock_context;
0150
0151 chain_acquire( &lock_context );
0152 is_empty_now = _Chain_Get_with_empty_check_unprotected( chain, node );
0153 chain_release( &lock_context );
0154
0155 return is_empty_now;
0156 }