diff options
Diffstat (limited to 'cpukit/include/rtems/chain.h')
-rw-r--r-- | cpukit/include/rtems/chain.h | 91 |
1 files changed, 55 insertions, 36 deletions
diff --git a/cpukit/include/rtems/chain.h b/cpukit/include/rtems/chain.h index 03177834a9..4f9f9495d5 100644 --- a/cpukit/include/rtems/chain.h +++ b/cpukit/include/rtems/chain.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -7,14 +9,31 @@ */ /* - * Copyright (c) 2010-2014 embedded brains GmbH. + * Copyright (C) 2010, 2014 embedded brains GmbH & Co. KG * * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RTEMS_CHAIN_H @@ -147,7 +166,7 @@ rtems_status_code rtems_chain_get_with_wait( * @param[in] number_nodes is the number of nodes that will be in the chain * @param[in] node_size is the size of each node */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize( +static inline void rtems_chain_initialize( rtems_chain_control *the_chain, void *starting_address, size_t number_nodes, @@ -169,7 +188,7 @@ RTEMS_INLINE_ROUTINE void rtems_chain_initialize( * * @param[in] the_chain is the chain to be initialized. */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize_empty( +static inline void rtems_chain_initialize_empty( rtems_chain_control *the_chain ) { @@ -184,7 +203,7 @@ RTEMS_INLINE_ROUTINE void rtems_chain_initialize_empty( * * @param[in] node the node set to off chain. */ -RTEMS_INLINE_ROUTINE void rtems_chain_set_off_chain( +static inline void rtems_chain_set_off_chain( rtems_chain_node *node ) { @@ -199,7 +218,7 @@ RTEMS_INLINE_ROUTINE void rtems_chain_set_off_chain( * * @param[in] the_node The chain node to initialize. */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize_node( +static inline void rtems_chain_initialize_node( rtems_chain_node *node ) { @@ -217,7 +236,7 @@ RTEMS_INLINE_ROUTINE void rtems_chain_initialize_node( * @retval true The node is off chain. * @retval false The node is not off chain. */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_node_off_chain( +static inline bool rtems_chain_is_node_off_chain( const rtems_chain_node *node ) { @@ -234,7 +253,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_node_off_chain( * @retval true The chain node pointer is NULL. * @retval false The chain node pointer is not NULL. */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_null_node( +static inline bool rtems_chain_is_null_node( const rtems_chain_node *the_node ) { @@ -250,7 +269,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_null_node( * * @return This method returns the permanent node of the chain. */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_head( +static inline rtems_chain_node *rtems_chain_head( rtems_chain_control *the_chain ) { @@ -266,7 +285,7 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_head( * * @return This method returns the permanent head node of the chain. */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_head( +static inline const rtems_chain_node *rtems_chain_immutable_head( const rtems_chain_control *the_chain ) { @@ -282,7 +301,7 @@ RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_head( * * @return This method returns the permanent tail node of the chain. */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_tail( +static inline rtems_chain_node *rtems_chain_tail( rtems_chain_control *the_chain ) { @@ -298,7 +317,7 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_tail( * * @return This method returns the permanent tail node of the chain. */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_tail( +static inline const rtems_chain_node *rtems_chain_immutable_tail( const rtems_chain_control *the_chain ) { @@ -315,7 +334,7 @@ RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_tail( * * @return This method returns the first node of the chain. */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_first( +static inline rtems_chain_node *rtems_chain_first( const rtems_chain_control *the_chain ) { @@ -332,7 +351,7 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_first( * * @return This method returns the first node of the chain. */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_first( +static inline const rtems_chain_node *rtems_chain_immutable_first( const rtems_chain_control *the_chain ) { @@ -349,7 +368,7 @@ RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_first( * * @return This method returns the last node of the chain. */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_last( +static inline rtems_chain_node *rtems_chain_last( const rtems_chain_control *the_chain ) { @@ -366,7 +385,7 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_last( * * @return This method returns the last node of the chain. */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_last( +static inline const rtems_chain_node *rtems_chain_immutable_last( const rtems_chain_control *the_chain ) { @@ -382,7 +401,7 @@ RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_last( * * @return This method returns the next node on the chain. */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_next( +static inline rtems_chain_node *rtems_chain_next( const rtems_chain_node *the_node ) { @@ -398,7 +417,7 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_next( * * @return This method returns the next node on the chain. */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_next( +static inline const rtems_chain_node *rtems_chain_immutable_next( const rtems_chain_node *the_node ) { @@ -414,7 +433,7 @@ RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_next( * * @return This method returns the previous node on the chain. */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_previous( +static inline rtems_chain_node *rtems_chain_previous( const rtems_chain_node *the_node ) { @@ -430,7 +449,7 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_previous( * * @return This method returns the previous node on the chain. */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_previous( +static inline const rtems_chain_node *rtems_chain_immutable_previous( const rtems_chain_node *the_node ) { @@ -449,7 +468,7 @@ RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_previous( * @retval true @a left is equal to @a right. * @retval false @a left is not equal to @a right */ -RTEMS_INLINE_ROUTINE bool rtems_chain_are_nodes_equal( +static inline bool rtems_chain_are_nodes_equal( const rtems_chain_node *left, const rtems_chain_node *right ) @@ -468,7 +487,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_are_nodes_equal( * @retval true The chain is empty. * @retval false The chain is not empty. */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_empty( +static inline bool rtems_chain_is_empty( const rtems_chain_control *the_chain ) { @@ -487,7 +506,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_empty( * @retval true @a the_node is the first node on a chain. * @retval false @a the_node is not the first node on a chain. */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_first( +static inline bool rtems_chain_is_first( const rtems_chain_node *the_node ) { @@ -505,7 +524,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_first( * @retval true @a the_node is the last node on a chain. * @retval false @a the_node is not the last node on a chain */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_last( +static inline bool rtems_chain_is_last( const rtems_chain_node *the_node ) { @@ -523,7 +542,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_last( * @retval true The chain has only one node. * @retval false The chain has more than one nodes. */ -RTEMS_INLINE_ROUTINE bool rtems_chain_has_only_one_node( +static inline bool rtems_chain_has_only_one_node( const rtems_chain_control *the_chain ) { @@ -542,7 +561,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_has_only_one_node( * @retval true @a the_node is the head of @a the_chain. * @retval false @a the_node is not the head of @a the_chain. */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_head( +static inline bool rtems_chain_is_head( const rtems_chain_control *the_chain, const rtems_chain_node *the_node ) @@ -562,7 +581,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_head( * @retval true @a the_node is the tail of @a the_chain. * @retval false @a the_node is not the tail of @a the_chain. */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_tail( +static inline bool rtems_chain_is_tail( const rtems_chain_control *the_chain, const rtems_chain_node *the_node ) @@ -591,7 +610,7 @@ void rtems_chain_extract( * NOTE: It does NOT disable interrupts to ensure the atomicity of the * append operation. */ -RTEMS_INLINE_ROUTINE void rtems_chain_extract_unprotected( +static inline void rtems_chain_extract_unprotected( rtems_chain_node *the_node ) { @@ -617,7 +636,7 @@ rtems_chain_node *rtems_chain_get( /** * @brief See _Chain_Get_unprotected(). */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get_unprotected( +static inline rtems_chain_node *rtems_chain_get_unprotected( rtems_chain_control *the_chain ) { @@ -627,7 +646,7 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get_unprotected( /** * @brief See _Chain_Get_first_unprotected(). */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get_first_unprotected( +static inline rtems_chain_node *rtems_chain_get_first_unprotected( rtems_chain_control *the_chain ) { @@ -651,7 +670,7 @@ void rtems_chain_insert( /** * @brief See _Chain_Insert_unprotected(). */ -RTEMS_INLINE_ROUTINE void rtems_chain_insert_unprotected( +static inline void rtems_chain_insert_unprotected( rtems_chain_node *after_node, rtems_chain_node *the_node ) @@ -680,7 +699,7 @@ void rtems_chain_append( * NOTE: It does NOT disable interrupts to ensure the atomicity of the * append operation. */ -RTEMS_INLINE_ROUTINE void rtems_chain_append_unprotected( +static inline void rtems_chain_append_unprotected( rtems_chain_control *the_chain, rtems_chain_node *the_node ) @@ -715,7 +734,7 @@ void rtems_chain_prepend( * NOTE: It does NOT disable interrupts to ensure the atomicity of the * prepend operation. */ -RTEMS_INLINE_ROUTINE void rtems_chain_prepend_unprotected( +static inline void rtems_chain_prepend_unprotected( rtems_chain_control *the_chain, rtems_chain_node *the_node ) @@ -776,7 +795,7 @@ bool rtems_chain_get_with_empty_check( * * @return The node count of the chain. */ -RTEMS_INLINE_ROUTINE size_t rtems_chain_node_count_unprotected( +static inline size_t rtems_chain_node_count_unprotected( const rtems_chain_control *chain ) { |