RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Files | Macros | Typedefs | Functions
Chains

The chain container provides data structures and directives to manage user-defined data structures in doubly-linked lists. More...

Files

file  chain.h
 This header file provides the Chains API.
 
file  chainappendnotify.c
 This source file contains the implementation of rtems_chain_append_with_notification().
 
file  chaingetnotify.c
 This source file contains the implementation of rtems_chain_get_with_notification().
 
file  chaingetwait.c
 This source file contains the implementation of rtems_chain_get_with_wait().
 
file  chainprependnotify.c
 This source file contains the implementation of rtems_chain_prepend_with_notification().
 
file  chainprotected.c
 This source file contains the implementation of rtems_chain_append(), rtems_chain_append_with_empty_check(), rtems_chain_extract(), rtems_chain_get(), rtems_chain_get_with_empty_check(), rtems_chain_insert(), rtems_chain_prepend(), and rtems_chain_prepend_with_empty_check().
 

Macros

#define RTEMS_CHAIN_INITIALIZER_EMPTY(name)    CHAIN_INITIALIZER_EMPTY( name )
 Chain initializer for an empty chain with designator name.
 
#define RTEMS_CHAIN_INITIALIZER_ONE_NODE(node)    CHAIN_INITIALIZER_ONE_NODE( node )
 Chain initializer for a chain with one node.
 
#define RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN(chain)    CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain )
 Chain node initializer for a chain containing exactly this node.
 
#define RTEMS_CHAIN_DEFINE_EMPTY(name)    rtems_chain_control name = RTEMS_CHAIN_INITIALIZER_EMPTY( name )
 Chain definition for an empty chain with designator name.
 

Typedefs

typedef Chain_Node rtems_chain_node
 
typedef Chain_Control rtems_chain_control
 

Functions

rtems_status_code rtems_chain_append_with_notification (rtems_chain_control *chain, rtems_chain_node *node, rtems_id task, rtems_event_set events)
 Appends the node to the chain and sends the events to the task if the chain was empty before the append.
 
rtems_status_code rtems_chain_prepend_with_notification (rtems_chain_control *chain, rtems_chain_node *node, rtems_id task, rtems_event_set events)
 Prepends the node to the chain and sends the events to the task if the chain was empty before the prepend.
 
rtems_status_code rtems_chain_get_with_notification (rtems_chain_control *chain, rtems_id task, rtems_event_set events, rtems_chain_node **node)
 Gets the first node of the chain and sends the events to the task if the chain is empty after the get.
 
rtems_status_code rtems_chain_get_with_wait (rtems_chain_control *chain, rtems_event_set events, rtems_interval timeout, rtems_chain_node **node)
 Gets the first node of the chain and sends the events to the task if the chain is empty afterwards.
 
void rtems_chain_extract (rtems_chain_node *the_node)
 Extract the specified node from a chain.
 
rtems_chain_nodertems_chain_get (rtems_chain_control *the_chain)
 Obtain the first node on a chain.
 
void rtems_chain_insert (rtems_chain_node *after_node, rtems_chain_node *the_node)
 Insert a node on a chain.
 
void rtems_chain_append (rtems_chain_control *the_chain, rtems_chain_node *the_node)
 Append a node on the end of a chain.
 
void rtems_chain_prepend (rtems_chain_control *the_chain, rtems_chain_node *the_node)
 Prepend a node.
 
bool rtems_chain_append_with_empty_check (rtems_chain_control *chain, rtems_chain_node *node)
 Checks if the chain is empty and appends the node.
 
bool rtems_chain_prepend_with_empty_check (rtems_chain_control *chain, rtems_chain_node *node)
 Checks if the chain is empty and prepends the node.
 
bool rtems_chain_get_with_empty_check (rtems_chain_control *chain, rtems_chain_node **node)
 Tries to get the first node and check if the chain is empty afterwards.
 

Detailed Description

The chain container provides data structures and directives to manage user-defined data structures in doubly-linked lists.

Macro Definition Documentation

◆ RTEMS_CHAIN_INITIALIZER_ONE_NODE

#define RTEMS_CHAIN_INITIALIZER_ONE_NODE (   node)     CHAIN_INITIALIZER_ONE_NODE( node )

Chain initializer for a chain with one node.

See also
RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN().

◆ RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN

#define RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN (   chain)     CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain )

Chain node initializer for a chain containing exactly this node.

See also
RTEMS_CHAIN_INITIALIZER_ONE_NODE().

Function Documentation

◆ rtems_chain_append()

void rtems_chain_append ( rtems_chain_control the_chain,
rtems_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.

◆ rtems_chain_append_with_empty_check()

bool rtems_chain_append_with_empty_check ( rtems_chain_control chain,
rtems_chain_node node 
)

Checks if the chain is empty and appends the node.

Interrupts are disabled to ensure the atomicity of the operation.

Return values
trueThe chain was empty before the append.
falseThe chain contained at least one node before the append.

◆ rtems_chain_append_with_notification()

rtems_status_code rtems_chain_append_with_notification ( rtems_chain_control chain,
rtems_chain_node node,
rtems_id  task,
rtems_event_set  events 
)

Appends the node to the chain and sends the events to the task if the chain was empty before the append.

See also
rtems_chain_append_with_empty_check() and rtems_event_send().
Return values
RTEMS_SUCCESSFULSuccessful operation.
RTEMS_INVALID_IDNo such task.

◆ rtems_chain_extract()

void rtems_chain_extract ( rtems_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.

  • the_node specifies the node to extract

◆ rtems_chain_get()

rtems_chain_node * rtems_chain_get ( rtems_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.

Returns
This method 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.

◆ rtems_chain_get_with_empty_check()

bool rtems_chain_get_with_empty_check ( rtems_chain_control chain,
rtems_chain_node **  node 
)

Tries to 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 node. If the chain is empty, then NULL is returned.

Interrupts are disabled to ensure the atomicity of the operation.

Return values
trueThe chain is empty after the node removal.
falseThe chain contained at least one node after the node removal.

◆ rtems_chain_get_with_notification()

rtems_status_code rtems_chain_get_with_notification ( rtems_chain_control chain,
rtems_id  task,
rtems_event_set  events,
rtems_chain_node **  node 
)

Gets the first node of the chain and sends the events to the task if the chain is empty after the get.

See also
rtems_chain_get_with_empty_check() and rtems_event_send().
Return values
RTEMS_SUCCESSFULSuccessful operation.
RTEMS_INVALID_IDNo such task.

◆ rtems_chain_get_with_wait()

rtems_status_code rtems_chain_get_with_wait ( rtems_chain_control chain,
rtems_event_set  events,
rtems_interval  timeout,
rtems_chain_node **  node 
)

Gets the first node of the chain and sends the events to the task if the chain is empty afterwards.

See also
rtems_chain_get() and rtems_event_receive().
Return values
RTEMS_SUCCESSFULSuccessful operation.
RTEMS_TIMEOUTTimeout.

◆ rtems_chain_insert()

void rtems_chain_insert ( rtems_chain_node after_node,
rtems_chain_node the_node 
)

Insert a node on a chain.

This routine inserts the_node on a chain immediately following after_node.

NOTE: It disables interrupts to ensure the atomicity of the extract operation.

◆ rtems_chain_prepend()

void rtems_chain_prepend ( rtems_chain_control the_chain,
rtems_chain_node the_node 
)

Prepend a node.

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.

◆ rtems_chain_prepend_with_empty_check()

bool rtems_chain_prepend_with_empty_check ( rtems_chain_control chain,
rtems_chain_node node 
)

Checks if the chain is empty and prepends the node.

Interrupts are disabled to ensure the atomicity of the operation.

Return values
trueThe chain was empty before the prepend.
falseThe chain contained at least one node before the prepend.

◆ rtems_chain_prepend_with_notification()

rtems_status_code rtems_chain_prepend_with_notification ( rtems_chain_control chain,
rtems_chain_node node,
rtems_id  task,
rtems_event_set  events 
)

Prepends the node to the chain and sends the events to the task if the chain was empty before the prepend.

See also
rtems_chain_prepend_with_empty_check() and rtems_event_send().
Return values
RTEMS_SUCCESSFULSuccessful operation.
RTEMS_INVALID_IDNo such task.