Changeset 3709987 in rtems


Ignore:
Timestamp:
Aug 10, 2016, 6:21:54 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
cac586e
Parents:
da15db78
git-author:
Sebastian Huber <sebastian.huber@…> (08/10/16 06:21:54)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/06/16 08:52:20)
Message:

score: Add _Chain_Initialize_one()

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/chainimpl.h

    rda15db78 r3709987  
    518518  head->previous = NULL;
    519519  tail->previous = head;
     520}
     521
     522/**
     523 * @brief Initializes this chain to contain exactly the specified node.
     524 *
     525 * @param[in] the_chain The chain control.
     526 * @param[in] the_node The one and only node.
     527 */
     528RTEMS_INLINE_ROUTINE void _Chain_Initialize_one(
     529  Chain_Control *the_chain,
     530  Chain_Node    *the_node
     531)
     532{
     533  Chain_Node *head;
     534  Chain_Node *tail;
     535
     536  _Assert( _Chain_Is_node_off_chain( the_node ) );
     537
     538  head = _Chain_Head( the_chain );
     539  tail = _Chain_Tail( the_chain );
     540
     541  the_node->next = tail;
     542  the_node->previous = head;
     543
     544  head->next = the_node;
     545  head->previous = NULL;
     546  tail->previous = the_node;
    520547}
    521548
  • testsuites/sptests/spchain/init.c

    rda15db78 r3709987  
    1616
    1717const char rtems_test_name[] = "SPCHAIN";
     18
     19static void test_chain_init_one(void)
     20{
     21  Chain_Control chain;
     22  Chain_Node    node;
     23
     24  puts( "INIT - Verify _Chain_Initialize_one" );
     25
     26  _Chain_Initialize_node( &node );
     27  _Chain_Initialize_one( &chain, &node );
     28  rtems_test_assert( !_Chain_Is_empty( &chain ) );
     29  rtems_test_assert( !_Chain_Is_node_off_chain( &node ) );
     30  rtems_test_assert( _Chain_Is_first( &node ) );
     31  rtems_test_assert( _Chain_Is_last( &node ) );
     32  rtems_test_assert( _Chain_First( &chain ) == &node );
     33  rtems_test_assert( _Chain_Last( &chain ) == &node );
     34  rtems_test_assert( _Chain_Next( &node ) == _Chain_Tail( &chain ) );
     35  rtems_test_assert( _Chain_Previous( &node ) == _Chain_Head( &chain ) );
     36
     37  _Chain_Extract_unprotected( &node );
     38  rtems_test_assert( _Chain_Is_empty( &chain ) );
     39}
    1840
    1941static void update_registry_and_extract(
     
    480502  }
    481503
     504  test_chain_init_one();
    482505  test_chain_first_and_last();
    483506  test_chain_with_empty_check();
  • testsuites/sptests/spchain/spchain.scn

    rda15db78 r3709987  
    22Init - Initialize chain empty
    33INIT - Verify rtems_chain_insert
     4INIT - Verify _Chain_Initialize_one
    45INIT - Verify rtems_chain_is_first
    56INIT - Verify rtems_chain_is_last
Note: See TracChangeset for help on using the changeset viewer.