18 #ifndef _RTEMS_SCORE_CHAINIMPL_H 19 #define _RTEMS_SCORE_CHAINIMPL_H 37 #define CHAIN_INITIALIZER_EMPTY(name) \ 38 { { { &(name).Tail.Node, NULL }, &(name).Head.Node } } 45 #define CHAIN_INITIALIZER_ONE_NODE( node ) \ 46 { { { (node), NULL }, (node) } } 53 #define CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) \ 54 { &(chain)->Tail.Node, &(chain)->Head.Node } 59 #define CHAIN_DEFINE_EMPTY(name) \ 60 Chain_Control name = CHAIN_INITIALIZER_EMPTY(name) 77 void *starting_address,
252 return node->
next == NULL;
272 return left == right;
289 return (the_node == NULL);
305 return &the_chain->Head.Node;
321 return &the_chain->Head.Node;
337 return &the_chain->Tail.Node;
353 return &the_chain->Tail.Node;
437 return the_node->
next;
453 return the_node->
next;
541 return (the_node->
next->
next == NULL);
646 next = the_node->
next;
649 previous->
next = next;
675 head->
next = new_first;
726 before_node = after_node->
next;
727 after_node->
next = the_node;
728 the_node->
next = before_node;
751 the_node->
next = tail;
753 old_last->
next = the_node;
889 bool is_empty_now =
true;
894 if ( old_first != tail ) {
897 head->
next = new_first;
900 *the_node = old_first;
902 is_empty_now = new_first == tail;
943 while ( next != tail && !( *order )( to_insert, next ) ) {
RTEMS_INLINE_ROUTINE void _Chain_Prepend(Chain_Control *the_chain, Chain_Node *the_node)
Prepend a node (protected).
Definition: chainimpl.h:806
RTEMS_INLINE_ROUTINE void _Chain_Append_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Append a node (unprotected).
Definition: chainimpl.h:743
This is used to manage each element (node) which is placed on a chain.
Definition: chain.h:65
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Head(Chain_Control *the_chain)
Return pointer to chain head.
Definition: chainimpl.h:301
Chain_Node * previous
This points to the node immediate prior to this one on this chain.
Definition: chain.h:69
Chain_Node * _Chain_Get(Chain_Control *the_chain)
Obtain the first node on a chain.
Definition: chainget.c:26
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Next(Chain_Node *the_node)
Return pointer the next node from this node.
Definition: chainimpl.h:433
void _Chain_Initialize(Chain_Control *the_chain, void *starting_address, size_t number_nodes, size_t node_size)
Initialize a chain header.
Definition: chain.c:26
bool _Chain_Prepend_with_empty_check(Chain_Control *the_chain, Chain_Node *the_node)
Prepend a node and check if the chain was empty before.
Definition: chainprependempty.c:31
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Previous(Chain_Node *the_node)
Return pointer the previous node from this node.
Definition: chainimpl.h:465
RTEMS_INLINE_ROUTINE bool _Chain_Prepend_with_empty_check_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Prepend a node and check if the chain was empty before (unprotected).
Definition: chainimpl.h:854
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
void _Chain_Extract(Chain_Node *the_node)
Extract the specified node from a chain.
Definition: chainextract.c:27
This is used to manage a chain.
Definition: chain.h:83
RTEMS_INLINE_ROUTINE bool _Chain_Are_nodes_equal(const Chain_Node *left, const Chain_Node *right)
Are two nodes equal.
Definition: chainimpl.h:267
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_head(const Chain_Control *the_chain)
Return pointer to immutable chain head.
Definition: chainimpl.h:317
RTEMS_INLINE_ROUTINE bool _Chain_Is_node_off_chain(const Chain_Node *node)
Is the node off chain.
Definition: chainimpl.h:248
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected(Chain_Node *the_node)
Extract this node (unprotected).
Definition: chainimpl.h:639
bool(* Chain_Node_order)(const Chain_Node *left, const Chain_Node *right)
Chain node order.
Definition: chainimpl.h:918
RTEMS_INLINE_ROUTINE void _Chain_Initialize_empty(Chain_Control *the_chain)
Initialize this chain as empty.
Definition: chainimpl.h:613
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_previous(const Chain_Node *the_node)
Return pointer the immutable previous node from this node.
Definition: chainimpl.h:481
RTEMS_INLINE_ROUTINE bool _Chain_Is_empty(const Chain_Control *the_chain)
Is the chain empty.
Definition: chainimpl.h:499
Chain_Node * next
This points to the node after this one on this chain.
Definition: chain.h:67
RTEMS_INLINE_ROUTINE bool _Chain_Has_only_one_node(const Chain_Control *the_chain)
Does this chain have only one node.
Definition: chainimpl.h:558
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Get_unprotected(Chain_Control *the_chain)
Get the first node (unprotected).
Definition: chainimpl.h:695
RTEMS_INLINE_ROUTINE bool _Chain_Get_with_empty_check_unprotected(Chain_Control *the_chain, Chain_Node **the_node)
Get the first node and check if the chain is empty afterwards (unprotected).
Definition: chainimpl.h:884
Information Required to Manipulate Physical Addresses.
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Last(Chain_Control *the_chain)
Return pointer to chain's last node.
Definition: chainimpl.h:400
RTEMS_INLINE_ROUTINE bool _Chain_Append_with_empty_check_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Append a node and check if the chain was empty before (unprotected).
Definition: chainimpl.h:828
size_t _Chain_Node_count_unprotected(const Chain_Control *chain)
Returns the node count of the chain.
Definition: chainnodecount.c:22
RTEMS_INLINE_ROUTINE bool _Chain_Is_last(const Chain_Node *the_node)
Is this the last node on the chain.
Definition: chainimpl.h:537
void _Chain_Insert(Chain_Node *after_node, Chain_Node *the_node)
Insert a node on a chain.
Definition: chaininsert.c:43
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:83
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_first(const Chain_Control *the_chain)
Return pointer to immutable chain's first node.
Definition: chainimpl.h:383
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Tail(Chain_Control *the_chain)
Return pointer to chain tail.
Definition: chainimpl.h:333
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_next(const Chain_Node *the_node)
Return pointer the immutable next node from this node.
Definition: chainimpl.h:449
bool _Chain_Append_with_empty_check(Chain_Control *the_chain, Chain_Node *the_node)
Append a node and check if the chain was empty before.
Definition: chainappendempty.c:31
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_First(Chain_Control *the_chain)
Return pointer to chain's first node.
Definition: chainimpl.h:366
RTEMS_INLINE_ROUTINE void _Chain_Insert_unprotected(Chain_Node *after_node, Chain_Node *the_node)
Insert a node (unprotected).
Definition: chainimpl.h:718
bool _Chain_Get_with_empty_check(Chain_Control *the_chain, Chain_Node **the_node)
Get the first node and check if the chain is empty afterwards.
Definition: chaingetempty.c:31
void _Chain_Append(Chain_Control *the_chain, Chain_Node *the_node)
Append a node on the end of a chain.
Definition: chainappend.c:41
RTEMS_INLINE_ROUTINE bool _Chain_Is_tail(const Chain_Control *the_chain, const Chain_Node *the_node)
Is this node the chail tail.
Definition: chainimpl.h:598
RTEMS_INLINE_ROUTINE bool _Chain_Is_first(const Chain_Node *the_node)
Is this the first node on the chain.
Definition: chainimpl.h:519
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Get_first_unprotected(Chain_Control *the_chain)
Get the first node (unprotected).
Definition: chainimpl.h:667
RTEMS_INLINE_ROUTINE void _Chain_Set_off_chain(Chain_Node *node)
Set off chain.
Definition: chainimpl.h:230
RTEMS_INLINE_ROUTINE void _Chain_Insert_ordered_unprotected(Chain_Control *chain, Chain_Node *to_insert, Chain_Node_order order)
Inserts a node into the chain according to the order relation.
Definition: chainimpl.h:934
RTEMS_INLINE_ROUTINE bool _Chain_Is_null_node(const Chain_Node *the_node)
Is the chain node pointer NULL.
Definition: chainimpl.h:285
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_tail(const Chain_Control *the_chain)
Return pointer to immutable chain tail.
Definition: chainimpl.h:349
RTEMS_INLINE_ROUTINE bool _Chain_Is_head(const Chain_Control *the_chain, const Chain_Node *the_node)
Is this node the chain head.
Definition: chainimpl.h:578
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_last(const Chain_Control *the_chain)
Return pointer to immutable chain's last node.
Definition: chainimpl.h:417
RTEMS_INLINE_ROUTINE void _Chain_Append_if_is_off_chain_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Append a node on the end of a chain if the node is in the off chain state (unprotected).
Definition: chainimpl.h:766
RTEMS_INLINE_ROUTINE void _Chain_Prepend_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Prepend a node (unprotected).
Definition: chainimpl.h:787