RTEMS CPU Kit with SuperCore  4.11.2
Files | Data Structures | Macros | Typedefs | Functions
Chain Handler

The Chain Handler is used to manage sets of entities. More...

Collaboration diagram for Chain Handler:

Files

file  chain.h
 Chain Handler API.
 
file  chain.c
 Initialize a Chain Header.
 
file  chainappend.c
 Append a Node on the End of a Chain.
 
file  chainappendempty.c
 _Chain_Append_with_empty_check() implementation.
 
file  chainextract.c
 Extracts a Node from a Chain.
 
file  chainget.c
 Get the First Node.
 
file  chaingetempty.c
 _Chain_Get_with_empty_check() implementation.
 
file  chaininsert.c
 Extracts a node from a given chain.
 
file  chainprependempty.c
 _Chain_Prepend_with_empty_check() implementation.
 

Data Structures

struct  Chain_Node_struct
 This is used to manage each element (node) which is placed on a chain. More...
 
struct  Chain_Control
 This is used to manage a chain. More...
 

Macros

#define CHAIN_INITIALIZER_EMPTY(name)   { { { &(name).Tail.Node, NULL }, &(name).Head.Node } }
 Chain initializer for an empty chain with designator name.
 
#define CHAIN_INITIALIZER_ONE_NODE(node)   { { { (node), NULL }, (node) } }
 Chain initializer for a chain with one node. More...
 
#define CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN(chain)   { &(chain)->Tail.Node, &(chain)->Head.Node }
 Chain node initializer for a chain containing exactly this node. More...
 
#define CHAIN_DEFINE_EMPTY(name)   Chain_Control name = CHAIN_INITIALIZER_EMPTY(name)
 Chain definition for an empty chain with designator name.
 

Typedefs

typedef struct Chain_Node_struct Chain_Node
 This type definition promotes the name for the Chain Node used by all RTEMS code. More...
 
typedef bool(* Chain_Node_order) (const Chain_Node *left, const Chain_Node *right)
 Chain node order. More...
 

Functions

void _Chain_Initialize (Chain_Control *the_chain, void *starting_address, size_t number_nodes, size_t node_size)
 Initialize a chain header. More...
 
void _Chain_Extract (Chain_Node *the_node)
 Extract the specified node from a chain. More...
 
Chain_Node_Chain_Get (Chain_Control *the_chain)
 Obtain the first node on a chain. More...
 
void _Chain_Insert (Chain_Node *after_node, Chain_Node *the_node)
 Insert a node on a chain. More...
 
void _Chain_Append (Chain_Control *the_chain, Chain_Node *the_node)
 Append a node on the end of a chain. More...
 
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. More...
 
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. More...
 
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. More...
 
size_t _Chain_Node_count_unprotected (const Chain_Control *chain)
 Returns the node count of the chain. More...
 
RTEMS_INLINE_ROUTINE void _Chain_Set_off_chain (Chain_Node *node)
 Set off chain. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Is_node_off_chain (const Chain_Node *node)
 Is the node off chain. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Are_nodes_equal (const Chain_Node *left, const Chain_Node *right)
 Are two nodes equal. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Is_null_node (const Chain_Node *the_node)
 Is the chain node pointer NULL. More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_Head (Chain_Control *the_chain)
 Return pointer to chain head. More...
 
RTEMS_INLINE_ROUTINE const Chain_Node_Chain_Immutable_head (const Chain_Control *the_chain)
 Return pointer to immutable chain head. More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_Tail (Chain_Control *the_chain)
 Return pointer to chain tail. More...
 
RTEMS_INLINE_ROUTINE const Chain_Node_Chain_Immutable_tail (const Chain_Control *the_chain)
 Return pointer to immutable chain tail. More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_First (Chain_Control *the_chain)
 Return pointer to chain's first node. More...
 
RTEMS_INLINE_ROUTINE const Chain_Node_Chain_Immutable_first (const Chain_Control *the_chain)
 Return pointer to immutable chain's first node. More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_Last (Chain_Control *the_chain)
 Return pointer to chain's last node. More...
 
RTEMS_INLINE_ROUTINE const Chain_Node_Chain_Immutable_last (const Chain_Control *the_chain)
 Return pointer to immutable chain's last node. More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_Next (Chain_Node *the_node)
 Return pointer the next node from this node. More...
 
RTEMS_INLINE_ROUTINE const Chain_Node_Chain_Immutable_next (const Chain_Node *the_node)
 Return pointer the immutable next node from this node. More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_Previous (Chain_Node *the_node)
 Return pointer the previous node from this node. More...
 
RTEMS_INLINE_ROUTINE const Chain_Node_Chain_Immutable_previous (const Chain_Node *the_node)
 Return pointer the immutable previous node from this node. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Is_empty (const Chain_Control *the_chain)
 Is the chain empty. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Is_first (const Chain_Node *the_node)
 Is this the first node on the chain. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Is_last (const Chain_Node *the_node)
 Is this the last node on the chain. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Has_only_one_node (const Chain_Control *the_chain)
 Does this chain have only one node. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Is_head (const Chain_Control *the_chain, const Chain_Node *the_node)
 Is this node the chain head. More...
 
RTEMS_INLINE_ROUTINE bool _Chain_Is_tail (const Chain_Control *the_chain, const Chain_Node *the_node)
 Is this node the chail tail. More...
 
RTEMS_INLINE_ROUTINE void _Chain_Initialize_empty (Chain_Control *the_chain)
 Initialize this chain as empty. More...
 
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected (Chain_Node *the_node)
 Extract this node (unprotected). More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_Get_first_unprotected (Chain_Control *the_chain)
 Get the first node (unprotected). More...
 
RTEMS_INLINE_ROUTINE Chain_Node_Chain_Get_unprotected (Chain_Control *the_chain)
 Get the first node (unprotected). More...
 
RTEMS_INLINE_ROUTINE void _Chain_Insert_unprotected (Chain_Node *after_node, Chain_Node *the_node)
 Insert a node (unprotected). More...
 
RTEMS_INLINE_ROUTINE void _Chain_Append_unprotected (Chain_Control *the_chain, Chain_Node *the_node)
 Append a node (unprotected). More...
 
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). More...
 
RTEMS_INLINE_ROUTINE void _Chain_Prepend_unprotected (Chain_Control *the_chain, Chain_Node *the_node)
 Prepend a node (unprotected). More...
 
RTEMS_INLINE_ROUTINE void _Chain_Prepend (Chain_Control *the_chain, Chain_Node *the_node)
 Prepend a node (protected). More...
 
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). More...
 
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). More...
 
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). More...
 
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. More...
 

Detailed Description

The Chain Handler is used to manage sets of entities.

This handler provides two data structures. The Chain Node data structure is included as the first part of every data structure that will be placed on a chain. The second data structure is Chain Control which is used to manage a set of Chain Nodes.

Macro Definition Documentation

◆ CHAIN_INITIALIZER_ONE_NODE

#define CHAIN_INITIALIZER_ONE_NODE (   node)    { { { (node), NULL }, (node) } }

Chain initializer for a chain with one node.

See also
CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN().

◆ CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN

#define CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN (   chain)    { &(chain)->Tail.Node, &(chain)->Head.Node }

Chain node initializer for a chain containing exactly this node.

See also
CHAIN_INITIALIZER_ONE_NODE().

Typedef Documentation

◆ Chain_Node

This type definition promotes the name for the Chain Node used by all RTEMS code.

It is a separate type definition because a forward reference is required to define it. See Chain_Node_struct for detailed information.

◆ Chain_Node_order

typedef bool( * Chain_Node_order) (const Chain_Node *left, const Chain_Node *right)

Chain node order.

Parameters
[in]leftThe left node.
[in]rightThe right node.
Return values
trueAccording to the order the left node precedes the right node.
falseOtherwise.

Function Documentation

◆ _Chain_Append()

void _Chain_Append ( Chain_Control the_chain,
Chain_Node the_node 
)

Append a node on the end of a chain.

This routine appends the_node onto the end of the_chain.

Note
It disables interrupts to ensure the atomicity of the append operation.

References _Chain_Append_unprotected(), _ISR_Disable, and _ISR_Enable.

Referenced by _API_extensions_Add(), _Objects_MP_Free_global_object(), _Partition_Free_buffer(), _Thread_MP_Free_proxy(), and rtems_chain_append().

◆ _Chain_Append_if_is_off_chain_unprotected()

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).

Note
It does NOT disable interrupts to ensure the atomicity of the append operation.
See also
_Chain_Append_unprotected() and _Chain_Is_node_off_chain().

References _Chain_Append_unprotected(), and _Chain_Is_node_off_chain().

◆ _Chain_Append_unprotected()

RTEMS_INLINE_ROUTINE void _Chain_Append_unprotected ( Chain_Control the_chain,
Chain_Node the_node 
)

Append a node (unprotected).

This routine appends the_node onto the end of the_chain.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to be appended.
Note
It does NOT disable interrupts to ensure the atomicity of the append operation.

References _Chain_Tail(), Chain_Node_struct::next, and Chain_Node_struct::previous.

Referenced by _Chain_Append(), _Chain_Append_if_is_off_chain_unprotected(), _Chain_Append_with_empty_check_unprotected(), _CORE_message_queue_Free_message_buffer(), _Objects_Free(), _Scheduler_priority_Ready_queue_enqueue(), and rtems_chain_append_unprotected().

◆ _Chain_Append_with_empty_check()

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.

This routine appends the_node onto the end of the_chain.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to be appended.
Note
It disables interrupts to ensure the atomicity of the append operation.
Return values
trueThe chain was empty before.
falseThe chain contained at least one node before.

References _Chain_Append_with_empty_check_unprotected(), _ISR_Disable, and _ISR_Enable.

Referenced by rtems_chain_append_with_empty_check().

◆ _Chain_Append_with_empty_check_unprotected()

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).

This routine appends the_node onto the end of the_chain.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to be appended.
Note
It does NOT disable interrupts to ensure the atomicity of the append operation.
Return values
trueThe chain was empty before.
falseThe chain contained at least one node before.

References _Chain_Append_unprotected(), and _Chain_Is_empty().

Referenced by _Chain_Append_with_empty_check().

◆ _Chain_Are_nodes_equal()

RTEMS_INLINE_ROUTINE bool _Chain_Are_nodes_equal ( const Chain_Node left,
const Chain_Node right 
)

Are two nodes equal.

This function returns true if left and right are equal, and false otherwise.

Parameters
[in]leftis the node on the left hand side of the comparison.
[in]rightis the node on the left hand side of the comparison.
Return values
trueleft and right are equal.
falseleft and right are not equal.

◆ _Chain_Extract()

void _Chain_Extract ( Chain_Node the_node)

Extract the specified node from a chain.

This routine extracts the_node from the chain on which it resides. It disables interrupts to ensure the atomicity of the extract operation.

Parameters
[in]the_nodeis the node to be extracted
  • INTERRUPT LATENCY:
    • single case

References _Chain_Extract_unprotected(), _ISR_Disable, and _ISR_Enable.

Referenced by _Objects_MP_Close(), _Thread_MP_Free_proxy(), and rtems_chain_extract().

◆ _Chain_Extract_unprotected()

RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected ( Chain_Node the_node)

Extract this node (unprotected).

This routine extracts the_node from the chain on which it resides. It does NOT disable interrupts to ensure the atomicity of the extract operation.

Parameters
[in]the_nodeis the node to be extracted.

Referenced by _Chain_Extract(), _POSIX_Threads_cancel_run(), and rtems_chain_extract_unprotected().

◆ _Chain_First()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_First ( Chain_Control the_chain)

Return pointer to chain's first node.

This function returns a pointer to the first node on the chain after the head.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the first node of the chain.

References _Chain_Head(), and Chain_Node_struct::next.

Referenced by _API_extensions_Add(), _API_extensions_Run_postdriver(), _Objects_MP_Close(), _Thread_MP_Find_proxy(), _Watchdog_First(), and rtems_chain_first().

◆ _Chain_Get()

Chain_Node* _Chain_Get ( Chain_Control the_chain)

Obtain the first node on a chain.

This function removes the first node from the_chain and returns a pointer to that node. If the_chain is empty, then NULL is returned.

Return values
Thismethod returns a pointer a node. If a node was removed, then a pointer to that node is returned. If the_chain was empty, then NULL is returned.
Note
It disables interrupts to ensure the atomicity of the get operation.

References _Chain_Get_first_unprotected(), _Chain_Is_empty(), _ISR_Disable, and _ISR_Enable.

Referenced by _Objects_MP_Allocate_global_object(), _Partition_Allocate_buffer(), _Thread_MP_Allocate_proxy(), and rtems_chain_get().

◆ _Chain_Get_first_unprotected()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_Get_first_unprotected ( Chain_Control the_chain)

Get the first node (unprotected).

This function removes the first node from the_chain and returns a pointer to that node. It does NOT disable interrupts to ensure the atomicity of the get operation.

Parameters
[in]the_chainis the chain to attempt to get the first node from.
Returns
This method returns the first node on the chain even if it is the Chain Tail.
Note
This routine assumes that there is at least one node on the chain and always returns a node even if it is the Chain Tail.

References _Chain_Head(), Chain_Node_struct::next, and Chain_Node_struct::previous.

Referenced by _Chain_Get(), and _Chain_Get_unprotected().

◆ _Chain_Get_unprotected()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_Get_unprotected ( Chain_Control the_chain)

Get the first node (unprotected).

This function removes the first node from the_chain and returns a pointer to that node. If the_chain is empty, then NULL is returned.

Parameters
[in]the_chainis the chain to attempt to get the first node from.
Returns
This method returns the first node on the chain or NULL if the chain is empty.
Note
It does NOT disable interrupts to ensure the atomicity of the get operation.

References _Chain_Get_first_unprotected(), and _Chain_Is_empty().

Referenced by _CORE_message_queue_Allocate_message_buffer(), _CORE_message_queue_Get_pending_message(), _Freechain_Get(), and rtems_chain_get_unprotected().

◆ _Chain_Get_with_empty_check()

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.

This function removes the first node from the_chain and returns a pointer to that node in the_node. If the_chain is empty, then NULL is returned.

Parameters
[in]the_chainis the chain to attempt to get the first node from.
[out]the_nodeis the first node on the chain or NULL if the chain is empty.
Note
It disables interrupts to ensure the atomicity of the append operation.
Return values
trueThe chain is empty now.
falseThe chain contains at least one node now.
  • INTERRUPT LATENCY:
    • single case

References _Chain_Get_with_empty_check_unprotected(), _ISR_Disable, and _ISR_Enable.

Referenced by rtems_chain_get_with_empty_check().

◆ _Chain_Get_with_empty_check_unprotected()

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).

This function removes the first node from the_chain and returns a pointer to that node in the_node. If the_chain is empty, then NULL is returned.

Parameters
[in]the_chainis the chain to attempt to get the first node from.
[out]the_nodeis the first node on the chain or NULL if the chain is empty.
Note
It does NOT disable interrupts to ensure the atomicity of the get operation.
Return values
trueThe chain is empty now.
falseThe chain contains at least one node now.

References _Chain_Head(), _Chain_Tail(), Chain_Node_struct::next, and Chain_Node_struct::previous.

Referenced by _Chain_Get_with_empty_check().

◆ _Chain_Has_only_one_node()

RTEMS_INLINE_ROUTINE bool _Chain_Has_only_one_node ( const Chain_Control the_chain)

Does this chain have only one node.

This function returns true if there is only one node on the_chain and false otherwise.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This function returns true if there is only one node on the_chain and false otherwise.
Return values
trueThere is only one node on the_chain.
falseThere is more than one node on the_chain.

References _Chain_Immutable_first(), and _Chain_Immutable_last().

Referenced by _Scheduler_priority_Ready_queue_extract(), and rtems_chain_has_only_one_node().

◆ _Chain_Head()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_Head ( Chain_Control the_chain)

Return pointer to chain head.

This function returns a pointer to the head node on the chain.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the permanent head node of the chain.

Referenced by _Chain_First(), _Chain_Get_first_unprotected(), _Chain_Get_with_empty_check_unprotected(), _Chain_Initialize(), _Chain_Initialize_empty(), _Chain_Prepend(), _Chain_Prepend_unprotected(), and rtems_chain_head().

◆ _Chain_Immutable_first()

RTEMS_INLINE_ROUTINE const Chain_Node* _Chain_Immutable_first ( const Chain_Control the_chain)

Return pointer to immutable chain's first node.

This function returns a pointer to the first node on the chain after the head.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the first node of the chain.

References _Chain_Immutable_head(), and Chain_Node_struct::next.

Referenced by _Chain_Has_only_one_node(), _Chain_Is_empty(), _Chain_Node_count_unprotected(), _Resource_Is_most_recently_obtained(), and rtems_chain_immutable_first().

◆ _Chain_Immutable_head()

RTEMS_INLINE_ROUTINE const Chain_Node* _Chain_Immutable_head ( const Chain_Control the_chain)

Return pointer to immutable chain head.

This function returns a pointer to the head node on the chain.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the permanent head node of the chain.

Referenced by _Chain_Immutable_first(), _Chain_Is_head(), and rtems_chain_immutable_head().

◆ _Chain_Immutable_last()

RTEMS_INLINE_ROUTINE const Chain_Node* _Chain_Immutable_last ( const Chain_Control the_chain)

Return pointer to immutable chain's last node.

This function returns a pointer to the last node on the chain just before the tail.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the last node of the chain.

References _Chain_Immutable_tail(), and Chain_Node_struct::previous.

Referenced by _Chain_Has_only_one_node(), and rtems_chain_immutable_last().

◆ _Chain_Immutable_next()

RTEMS_INLINE_ROUTINE const Chain_Node* _Chain_Immutable_next ( const Chain_Node the_node)

Return pointer the immutable next node from this node.

This function returns a pointer to the next node after this node.

Parameters
[in]the_nodeis the node to be operated upon.
Returns
This method returns the next node on the chain.

References Chain_Node_struct::next.

Referenced by _Chain_Node_count_unprotected(), and rtems_chain_immutable_next().

◆ _Chain_Immutable_previous()

RTEMS_INLINE_ROUTINE const Chain_Node* _Chain_Immutable_previous ( const Chain_Node the_node)

Return pointer the immutable previous node from this node.

This function returns a pointer to the previous node on this chain.

Parameters
[in]the_nodeis the node to be operated upon.
Returns
This method returns the previous node on the chain.

References Chain_Node_struct::previous.

Referenced by rtems_chain_immutable_previous().

◆ _Chain_Immutable_tail()

RTEMS_INLINE_ROUTINE const Chain_Node* _Chain_Immutable_tail ( const Chain_Control the_chain)

Return pointer to immutable chain tail.

This function returns a pointer to the tail node on the chain.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the permanent tail node of the chain.

Referenced by _Chain_Immutable_last(), _Chain_Insert_ordered_unprotected(), _Chain_Is_empty(), _Chain_Is_tail(), _Chain_Node_count_unprotected(), and rtems_chain_immutable_tail().

◆ _Chain_Initialize()

void _Chain_Initialize ( Chain_Control the_chain,
void *  starting_address,
size_t  number_nodes,
size_t  node_size 
)

Initialize a chain header.

This routine initializes the_chain structure to manage the contiguous array of number_nodes nodes which starts at starting_address. Each node is of node_size bytes.

Parameters
[in]the_chainspecifies the chain to initialize
[in]starting_addressis the starting address of the array of elements
[in]number_nodesis the numebr of nodes that will be in the chain
[in]node_sizeis the size of each node

References _Chain_Head(), and _Chain_Tail().

Referenced by _Freechain_Get(), _Freechain_Initialize(), _Objects_MP_Handler_initialization(), _Thread_MP_Handler_initialization(), and rtems_chain_initialize().

◆ _Chain_Initialize_empty()

RTEMS_INLINE_ROUTINE void _Chain_Initialize_empty ( Chain_Control the_chain)

Initialize this chain as empty.

This routine initializes the specified chain to contain zero nodes.

Parameters
[in]the_chainis the chain to be initialized.

References _Assert, _Chain_Head(), _Chain_Tail(), Chain_Node_struct::next, and Chain_Node_struct::previous.

Referenced by _API_extensions_Initialization(), _Objects_MP_Handler_initialization(), _Scheduler_priority_Ready_queue_extract(), _Thread_MP_Handler_initialization(), and rtems_chain_initialize_empty().

◆ _Chain_Insert()

void _Chain_Insert ( Chain_Node after_node,
Chain_Node the_node 
)

Insert a node on a chain.

This routine inserts the_node on a chain immediately following after_node.

Parameters
[in]after_nodeis the pointer to the node in chain to be inserted after
[in]the_nodeis the pointer to the node to be inserted
Note
It disables interrupts to ensure the atomicity of the insert operation.
  • INTERRUPT LATENCY:
    • single case

References _Chain_Insert_unprotected(), _ISR_Disable, and _ISR_Enable.

Referenced by _Chain_Prepend(), and rtems_chain_insert().

◆ _Chain_Insert_ordered_unprotected()

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.

After the operation the chain contains the node to insert and the order relation holds for all nodes from the head up to the inserted node. Nodes after the inserted node are not moved.

Parameters
[in,out]chainThe chain.
[in,out]to_insertThe node to insert.
[in]orderThe order relation.

References _Chain_Immutable_tail().

◆ _Chain_Insert_unprotected()

RTEMS_INLINE_ROUTINE void _Chain_Insert_unprotected ( Chain_Node after_node,
Chain_Node the_node 
)

Insert a node (unprotected).

This routine inserts the_node on a chain immediately following after_node.

Parameters
[in]after_nodeis the node which will precede the_node on the chain.
[in]the_nodeis the node to be inserted.
Note
It does NOT disable interrupts to ensure the atomicity of the extract operation.

References Chain_Node_struct::next, and Chain_Node_struct::previous.

Referenced by _Chain_Insert(), _Chain_Prepend_unprotected(), and rtems_chain_insert_unprotected().

◆ _Chain_Is_empty()

RTEMS_INLINE_ROUTINE bool _Chain_Is_empty ( const Chain_Control the_chain)

Is the chain empty.

This function returns true if there a no nodes on the_chain and false otherwise.

Parameters
[in]the_chainis the chain to be operated upon.
Return values
trueThere are no nodes on the_chain.
falseThere are nodes on the_chain.

References _Chain_Immutable_first(), and _Chain_Immutable_tail().

Referenced by _Chain_Append_with_empty_check_unprotected(), _Chain_Get(), _Chain_Get_unprotected(), _Chain_Prepend_with_empty_check_unprotected(), _Freechain_Get(), _POSIX_Threads_cancel_run(), and rtems_chain_is_empty().

◆ _Chain_Is_first()

RTEMS_INLINE_ROUTINE bool _Chain_Is_first ( const Chain_Node the_node)

Is this the first node on the chain.

This function returns true if the_node is the first node on a chain and false otherwise.

Parameters
[in]the_nodeis the node the caller wants to know if it is the first node on a chain.
Return values
truethe_node is the first node on a chain.
falsethe_node is not the first node on a chain.

References Chain_Node_struct::previous.

Referenced by rtems_chain_is_first().

◆ _Chain_Is_head()

RTEMS_INLINE_ROUTINE bool _Chain_Is_head ( const Chain_Control the_chain,
const Chain_Node the_node 
)

Is this node the chain head.

This function returns true if the_node is the head of the_chain and false otherwise.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to check for being the Chain Head.
Return values
truethe_node is the head of the_chain.
falsethe_node is not the head of the_chain.

References _Chain_Immutable_head().

Referenced by rtems_chain_is_head().

◆ _Chain_Is_last()

RTEMS_INLINE_ROUTINE bool _Chain_Is_last ( const Chain_Node the_node)

Is this the last node on the chain.

This function returns true if the_node is the last node on a chain and false otherwise.

Parameters
[in]the_nodeis the node to check as the last node.
Return values
truethe_node is the last node on a chain.
falsethe_node is not the last node on a chain.

References Chain_Node_struct::next.

Referenced by rtems_chain_is_last().

◆ _Chain_Is_node_off_chain()

RTEMS_INLINE_ROUTINE bool _Chain_Is_node_off_chain ( const Chain_Node node)

Is the node off chain.

This function returns true if the node is not on a chain. A node is off chain if the next field is set to NULL.

Parameters
[in]nodeis the node off chain.
Return values
trueThe node is off chain.
falseThe node is not off chain.

References Chain_Node_struct::next.

Referenced by _Chain_Append_if_is_off_chain_unprotected(), and rtems_chain_is_node_off_chain().

◆ _Chain_Is_null_node()

RTEMS_INLINE_ROUTINE bool _Chain_Is_null_node ( const Chain_Node the_node)

Is the chain node pointer NULL.

This function returns true if the_node is NULL and false otherwise.

Parameters
[in]the_nodeis the node pointer to check.
Return values
truethe_node is NULL.
falsethe_node is not NULL.

Referenced by rtems_chain_is_null_node().

◆ _Chain_Is_tail()

RTEMS_INLINE_ROUTINE bool _Chain_Is_tail ( const Chain_Control the_chain,
const Chain_Node the_node 
)

Is this node the chail tail.

This function returns true if the_node is the tail of the_chain and false otherwise.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to check for being the Chain Tail.
Return values
truethe_node is the tail of the_chain.
falsethe_node is not the tail of the_chain.

References _Chain_Immutable_tail().

Referenced by _API_extensions_Add(), _API_extensions_Run_postdriver(), _Objects_MP_Close(), _Thread_MP_Find_proxy(), and rtems_chain_is_tail().

◆ _Chain_Last()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_Last ( Chain_Control the_chain)

Return pointer to chain's last node.

This function returns a pointer to the last node on the chain just before the tail.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the last node of the chain.

References _Chain_Tail(), and Chain_Node_struct::previous.

Referenced by _Watchdog_Last(), and rtems_chain_last().

◆ _Chain_Next()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_Next ( Chain_Node the_node)

Return pointer the next node from this node.

This function returns a pointer to the next node after this node.

Parameters
[in]the_nodeis the node to be operated upon.
Returns
This method returns the next node on the chain.

References Chain_Node_struct::next.

Referenced by _Objects_MP_Close(), and rtems_chain_next().

◆ _Chain_Node_count_unprotected()

size_t _Chain_Node_count_unprotected ( const Chain_Control chain)

Returns the node count of the chain.

Parameters
[in]chainThe chain.
Note
It does NOT disable interrupts to ensure the atomicity of the operation.
Return values
Thenode count of the chain.

References _Chain_Immutable_first(), _Chain_Immutable_next(), and _Chain_Immutable_tail().

Referenced by _Objects_Active_count(), and rtems_chain_node_count_unprotected().

◆ _Chain_Prepend()

RTEMS_INLINE_ROUTINE void _Chain_Prepend ( Chain_Control the_chain,
Chain_Node the_node 
)

Prepend a node (protected).

This routine prepends the_node onto the front of the_chain.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to be prepended.
Note
It disables interrupts to ensure the atomicity of the prepend operation.

References _Chain_Head(), and _Chain_Insert().

Referenced by _Objects_MP_Open(), and rtems_chain_prepend().

◆ _Chain_Prepend_unprotected()

RTEMS_INLINE_ROUTINE void _Chain_Prepend_unprotected ( Chain_Control the_chain,
Chain_Node the_node 
)

Prepend a node (unprotected).

This routine prepends the_node onto the front of the_chain.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to be prepended.
Note
It does NOT disable interrupts to ensure the atomicity of the prepend operation.

References _Chain_Head(), and _Chain_Insert_unprotected().

Referenced by _Chain_Prepend_with_empty_check_unprotected(), _CORE_mutex_Initialize(), _CORE_mutex_Seize_interrupt_trylock_body(), _Freechain_Put(), _Scheduler_priority_Ready_queue_enqueue_first(), and rtems_chain_prepend_unprotected().

◆ _Chain_Prepend_with_empty_check()

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.

This routine prepends the_node onto the front of the_chain.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to be prepended.
Note
It disables interrupts to ensure the atomicity of the append operation.
Return values
trueThe chain was empty before.
falseThe chain contained at least one node before.

References _Chain_Prepend_with_empty_check_unprotected(), _ISR_Disable, and _ISR_Enable.

Referenced by rtems_chain_prepend_with_empty_check().

◆ _Chain_Prepend_with_empty_check_unprotected()

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).

This routine prepends the_node onto the front of the_chain.

Parameters
[in]the_chainis the chain to be operated upon.
[in]the_nodeis the node to be prepended.
Note
It does NOT disable interrupts to ensure the atomicity of the prepend operation.
Return values
trueThe chain was empty before.
falseThe chain contained at least one node before.

References _Chain_Is_empty(), and _Chain_Prepend_unprotected().

Referenced by _Chain_Prepend_with_empty_check().

◆ _Chain_Previous()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_Previous ( Chain_Node the_node)

Return pointer the previous node from this node.

This function returns a pointer to the previous node on this chain.

Parameters
[in]the_nodeis the node to be operated upon.
Returns
This method returns the previous node on the chain.

References Chain_Node_struct::previous.

Referenced by rtems_chain_previous().

◆ _Chain_Set_off_chain()

RTEMS_INLINE_ROUTINE void _Chain_Set_off_chain ( Chain_Node node)

Set off chain.

This function sets the next field of the node to NULL indicating the node is not part of a chain.

Parameters
[in]nodethe node set to off chain.

References Chain_Node_struct::next.

Referenced by rtems_chain_set_off_chain().

◆ _Chain_Tail()

RTEMS_INLINE_ROUTINE Chain_Node* _Chain_Tail ( Chain_Control the_chain)

Return pointer to chain tail.

This function returns a pointer to the tail node on the chain.

Parameters
[in]the_chainis the chain to be operated upon.
Returns
This method returns the permanent tail node of the chain.

Referenced by _Chain_Append_unprotected(), _Chain_Get_with_empty_check_unprotected(), _Chain_Initialize(), _Chain_Initialize_empty(), _Chain_Last(), _POSIX_Threads_cancel_run(), and rtems_chain_tail().