Changeset 1215fd4 in rtems for cpukit/sapi
- Timestamp:
- 08/26/13 13:14:33 (11 years ago)
- Branches:
- 4.11, 5, master
- Children:
- bf30999
- Parents:
- e127c4c
- git-author:
- Sebastian Huber <sebastian.huber@…> (08/26/13 13:14:33)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (08/30/13 09:16:28)
- Location:
- cpukit/sapi
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/sapi/Makefile.am
re127c4c r1215fd4 32 32 src/chainprependnotify.c src/rbheap.c src/interrdesc.c \ 33 33 src/fatal2.c src/fatalsrcdesc.c 34 libsapi_a_SOURCES += src/chainsmp.c 34 35 libsapi_a_CPPFLAGS = $(AM_CPPFLAGS) 35 36 -
cpukit/sapi/include/rtems/chain.h
re127c4c r1215fd4 20 20 21 21 #include <rtems/score/chainimpl.h> 22 #include <rtems/score/isrlock.h> 22 23 #include <rtems/rtems/event.h> 23 24 … … 37 38 typedef Chain_Node rtems_chain_node; 38 39 39 typedef Chain_Control rtems_chain_control; 40 typedef struct { 41 Chain_Control Chain; 42 ISR_lock_Control Lock; 43 } rtems_chain_control; 40 44 41 45 /** 42 46 * @brief Chain initializer for an empty chain with designator @a name. 43 47 */ 44 #define RTEMS_CHAIN_INITIALIZER_EMPTY( name) \45 CHAIN_INITIALIZER_EMPTY(name)48 #define RTEMS_CHAIN_INITIALIZER_EMPTY( name ) \ 49 { CHAIN_INITIALIZER_EMPTY( name.Chain ), ISR_LOCK_INITIALIZER } 46 50 47 51 /** … … 51 55 */ 52 56 #define RTEMS_CHAIN_INITIALIZER_ONE_NODE( node ) \ 53 CHAIN_INITIALIZER_ONE_NODE( node )57 { CHAIN_INITIALIZER_ONE_NODE( node ), ISR_LOCK_INITIALIZER } 54 58 55 59 /** … … 59 63 */ 60 64 #define RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) \ 61 CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain )65 CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( &( chain )->Chain ) 62 66 63 67 /** 64 68 * @brief Chain definition for an empty chain with designator @a name. 65 69 */ 66 #define RTEMS_CHAIN_DEFINE_EMPTY( name) \67 CHAIN_DEFINE_EMPTY(name)70 #define RTEMS_CHAIN_DEFINE_EMPTY( name ) \ 71 rtems_chain_control name = RTEMS_CHAIN_INITIALIZER_EMPTY( name ) 68 72 69 73 /** … … 151 155 ) 152 156 { 153 _Chain_Initialize( the_chain, starting_address, number_nodes, node_size ); 157 _ISR_lock_Initialize( &the_chain->Lock ); 158 _Chain_Initialize( 159 &the_chain->Chain, 160 starting_address, 161 number_nodes, 162 node_size 163 ); 154 164 } 155 165 … … 165 175 ) 166 176 { 167 _Chain_Initialize_empty( the_chain ); 177 _ISR_lock_Initialize( &the_chain->Lock ); 178 _Chain_Initialize_empty( &the_chain->Chain ); 168 179 } 169 180 … … 231 242 ) 232 243 { 233 return _Chain_Head( the_chain );244 return _Chain_Head( &the_chain->Chain ); 234 245 } 235 246 … … 247 258 ) 248 259 { 249 return _Chain_Immutable_head( the_chain );260 return _Chain_Immutable_head( &the_chain->Chain ); 250 261 } 251 262 … … 263 274 ) 264 275 { 265 return _Chain_Tail( the_chain );276 return _Chain_Tail( &the_chain->Chain ); 266 277 } 267 278 … … 279 290 ) 280 291 { 281 return _Chain_Immutable_tail( the_chain );292 return _Chain_Immutable_tail( &the_chain->Chain ); 282 293 } 283 294 … … 296 307 ) 297 308 { 298 return _Chain_First( the_chain );309 return _Chain_First( &the_chain->Chain ); 299 310 } 300 311 … … 313 324 ) 314 325 { 315 return _Chain_Immutable_first( the_chain );326 return _Chain_Immutable_first( &the_chain->Chain ); 316 327 } 317 328 … … 330 341 ) 331 342 { 332 return _Chain_Last( the_chain );343 return _Chain_Last( &the_chain->Chain ); 333 344 } 334 345 … … 347 358 ) 348 359 { 349 return _Chain_Immutable_last( the_chain );360 return _Chain_Immutable_last( &the_chain->Chain ); 350 361 } 351 362 … … 449 460 ) 450 461 { 451 return _Chain_Is_empty( the_chain );462 return _Chain_Is_empty( &the_chain->Chain ); 452 463 } 453 464 … … 504 515 ) 505 516 { 506 return _Chain_Has_only_one_node( the_chain );517 return _Chain_Has_only_one_node( &the_chain->Chain ); 507 518 } 508 519 … … 524 535 ) 525 536 { 526 return _Chain_Is_head( the_chain, the_node );537 return _Chain_Is_head( &the_chain->Chain, the_node ); 527 538 } 528 539 … … 544 555 ) 545 556 { 546 return _Chain_Is_tail( the_chain, the_node ); 547 } 548 557 return _Chain_Is_tail( &the_chain->Chain, the_node ); 558 } 559 560 #if !defined( RTEMS_SMP ) 549 561 /** 550 562 * @brief Extract the specified node from a chain. … … 562 574 _Chain_Extract( the_node ); 563 575 } 576 #endif 577 578 #if defined( RTEMS_SMP ) 579 /** 580 * @brief Extract the specified node from a chain. 581 * 582 * @param[in,out] chain The chain containing the node. 583 * @param[in,out] node The node to extract. 584 */ 585 void rtems_chain_explicit_extract( 586 rtems_chain_control *chain, 587 rtems_chain_node *node 588 ); 589 #else 590 RTEMS_INLINE_ROUTINE void rtems_chain_explicit_extract( 591 rtems_chain_control *chain, 592 rtems_chain_node *node 593 ) 594 { 595 ( void ) chain; 596 rtems_chain_extract( node ); 597 } 598 #endif 564 599 565 600 /** … … 590 625 * NOTE: It disables interrupts to ensure the atomicity of the get operation. 591 626 */ 627 #if defined( RTEMS_SMP ) 628 rtems_chain_node *rtems_chain_get( 629 rtems_chain_control *the_chain 630 ); 631 #else 592 632 RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get( 593 633 rtems_chain_control *the_chain 594 634 ) 595 635 { 596 return _Chain_Get( the_chain ); 597 } 636 return _Chain_Get( &the_chain->Chain ); 637 } 638 #endif 598 639 599 640 /** … … 604 645 ) 605 646 { 606 return _Chain_Get_unprotected( the_chain ); 607 } 608 647 return _Chain_Get_unprotected( &the_chain->Chain ); 648 } 649 650 #if !defined( RTEMS_SMP ) 609 651 /** 610 652 * @brief Insert a node on a chain … … 623 665 _Chain_Insert( after_node, the_node ); 624 666 } 667 #endif 668 669 /** 670 * @brief Insert a node on a chain 671 * 672 * @param[in,out] chain The chain containing the after node. 673 * @param[in,out] after_node Insert the node after this node. 674 * @param[in,out] node The node to insert. 675 */ 676 #if defined( RTEMS_SMP ) 677 void rtems_chain_explicit_insert( 678 rtems_chain_control *chain, 679 rtems_chain_node *after_node, 680 rtems_chain_node *node 681 ); 682 #else 683 RTEMS_INLINE_ROUTINE void rtems_chain_explicit_insert( 684 rtems_chain_control *chain, 685 rtems_chain_node *after_node, 686 rtems_chain_node *node 687 ) 688 { 689 ( void ) chain; 690 rtems_chain_insert( after_node, node ); 691 } 692 #endif 625 693 626 694 /** … … 643 711 * append operation. 644 712 */ 713 #if defined( RTEMS_SMP ) 714 void rtems_chain_append( 715 rtems_chain_control *the_chain, 716 rtems_chain_node *the_node 717 ); 718 #else 645 719 RTEMS_INLINE_ROUTINE void rtems_chain_append( 646 720 rtems_chain_control *the_chain, … … 648 722 ) 649 723 { 650 _Chain_Append( the_chain, the_node ); 651 } 724 _Chain_Append( &the_chain->Chain, the_node ); 725 } 726 #endif 652 727 653 728 /** … … 664 739 ) 665 740 { 666 _Chain_Append_unprotected( the_chain, the_node );741 _Chain_Append_unprotected( &the_chain->Chain, the_node ); 667 742 } 668 743 … … 678 753 * prepend operation. 679 754 */ 755 #if defined( RTEMS_SMP ) 756 void rtems_chain_prepend( 757 rtems_chain_control *the_chain, 758 rtems_chain_node *the_node 759 ); 760 #else 680 761 RTEMS_INLINE_ROUTINE void rtems_chain_prepend( 681 762 rtems_chain_control *the_chain, … … 683 764 ) 684 765 { 685 _Chain_Prepend( the_chain, the_node ); 686 } 766 _Chain_Prepend( &the_chain->Chain, the_node ); 767 } 768 #endif 687 769 688 770 /** … … 702 784 ) 703 785 { 704 _Chain_Prepend_unprotected( the_chain, the_node );786 _Chain_Prepend_unprotected( &the_chain->Chain, the_node ); 705 787 } 706 788 … … 713 795 * @retval false The chain contained at least one node before the append. 714 796 */ 797 #if defined( RTEMS_SMP ) 798 bool rtems_chain_append_with_empty_check( 799 rtems_chain_control *chain, 800 rtems_chain_node *node 801 ); 802 #else 715 803 RTEMS_INLINE_ROUTINE bool rtems_chain_append_with_empty_check( 716 804 rtems_chain_control *chain, … … 718 806 ) 719 807 { 720 return _Chain_Append_with_empty_check( chain, node ); 721 } 808 return _Chain_Append_with_empty_check( &chain->Chain, node ); 809 } 810 #endif 722 811 723 812 /** … … 729 818 * @retval false The chain contained at least one node before the prepend. 730 819 */ 820 #if defined( RTEMS_SMP ) 821 bool rtems_chain_prepend_with_empty_check( 822 rtems_chain_control *chain, 823 rtems_chain_node *node 824 ); 825 #else 731 826 RTEMS_INLINE_ROUTINE bool rtems_chain_prepend_with_empty_check( 732 827 rtems_chain_control *chain, … … 734 829 ) 735 830 { 736 return _Chain_Prepend_with_empty_check( chain, node ); 737 } 831 return _Chain_Prepend_with_empty_check( &chain->Chain, node ); 832 } 833 #endif 738 834 739 835 /** … … 749 845 * @retval false The chain contained at least one node after the node removal. 750 846 */ 847 #if defined( RTEMS_SMP ) 848 bool rtems_chain_get_with_empty_check( 849 rtems_chain_control *chain, 850 rtems_chain_node **node 851 ); 852 #else 751 853 RTEMS_INLINE_ROUTINE bool rtems_chain_get_with_empty_check( 752 854 rtems_chain_control *chain, … … 754 856 ) 755 857 { 756 return _Chain_Get_with_empty_check( chain, node ); 757 } 858 return _Chain_Get_with_empty_check( &chain->Chain, node ); 859 } 860 #endif 758 861 759 862 /** … … 771 874 ) 772 875 { 773 return _Chain_Node_count_unprotected( chain );876 return _Chain_Node_count_unprotected( &chain->Chain ); 774 877 } 775 878
Note: See TracChangeset
for help on using the changeset viewer.