Changeset 1215fd4 in rtems
- Timestamp:
- Aug 26, 2013, 1:14:33 PM (7 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)
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c
re127c4c r1215fd4 276 276 277 277 mpc55xx_edma_release_channel_by_tcd(ctx->edma_tcd); 278 rtems_chain_ex tract(&ctx->node);278 rtems_chain_explicit_extract(&edma_channel_chain, &ctx->node); 279 279 280 280 sc = rtems_interrupt_handler_remove( -
c/src/libchip/ide/ata.c
re127c4c r1215fd4 492 492 493 493 ATA_EXEC_CALLBACK(areq, status); 494 rtems_chain_ex tract(&areq->link);494 rtems_chain_explicit_extract(&ata_ide_ctrls[ctrl_minor].reqs, &areq->link); 495 495 496 496 if (!rtems_chain_is_empty(&ata_ide_ctrls[ctrl_minor].reqs)) -
cpukit/posix/src/aio_cancel.c
re127c4c r1215fd4 27 27 int aio_cancel(int fildes, struct aiocb *aiocbp) 28 28 { 29 rtems_chain_control *idle_req_chain = &aio_request_queue.idle_req; 30 rtems_chain_control *work_req_chain = &aio_request_queue.work_req; 29 31 rtems_aio_request_chain *r_chain; 30 32 int result; … … 41 43 AIO_printf ("Cancel all requests\n"); 42 44 43 r_chain = rtems_aio_search_fd ( &aio_request_queue.work_req, fildes, 0);45 r_chain = rtems_aio_search_fd (work_req_chain, fildes, 0); 44 46 if (r_chain == NULL) { 45 47 AIO_printf ("Request chain not on [WQ]\n"); 46 48 47 if (!rtems_chain_is_empty ( &aio_request_queue.idle_req)) {48 r_chain = rtems_aio_search_fd ( &aio_request_queue.idle_req, fildes, 0);49 if (!rtems_chain_is_empty (idle_req_chain)) { 50 r_chain = rtems_aio_search_fd (idle_req_chain, fildes, 0); 49 51 if (r_chain == NULL) { 50 52 pthread_mutex_unlock(&aio_request_queue.mutex); … … 54 56 AIO_printf ("Request chain on [IQ]\n"); 55 57 56 rtems_chain_ex tract (&r_chain->next_fd);58 rtems_chain_explicit_extract (idle_req_chain, &r_chain->next_fd); 57 59 rtems_aio_remove_fd (r_chain); 58 60 pthread_mutex_destroy (&r_chain->mutex); … … 71 73 72 74 pthread_mutex_lock (&r_chain->mutex); 73 rtems_chain_ex tract (&r_chain->next_fd);75 rtems_chain_explicit_extract (work_req_chain, &r_chain->next_fd); 74 76 rtems_aio_remove_fd (r_chain); 75 77 pthread_mutex_unlock (&r_chain->mutex); … … 84 86 } 85 87 86 r_chain = rtems_aio_search_fd ( &aio_request_queue.work_req, fildes, 0);88 r_chain = rtems_aio_search_fd (work_req_chain, fildes, 0); 87 89 if (r_chain == NULL) { 88 if (!rtems_chain_is_empty ( &aio_request_queue.idle_req)) {89 r_chain = rtems_aio_search_fd ( &aio_request_queue.idle_req, fildes, 0);90 if (!rtems_chain_is_empty (idle_req_chain)) { 91 r_chain = rtems_aio_search_fd (idle_req_chain, fildes, 0); 90 92 if (r_chain == NULL) { 91 93 pthread_mutex_unlock (&aio_request_queue.mutex); -
cpukit/posix/src/aio_misc.c
re127c4c r1215fd4 121 121 rtems_chain_prepend (chain, &r_chain->next_fd); 122 122 else 123 rtems_chain_insert (rtems_chain_previous (node), &r_chain->next_fd); 123 rtems_chain_explicit_insert (chain, 124 rtems_chain_previous (node), 125 &r_chain->next_fd); 124 126 125 127 r_chain->new_fd = 1; … … 145 147 rtems_aio_move_to_work (rtems_aio_request_chain *r_chain) 146 148 { 149 rtems_chain_control *work_req_chain = &aio_request_queue.work_req; 147 150 rtems_aio_request_chain *temp; 148 151 rtems_chain_node *node; 149 150 node = rtems_chain_first ( &aio_request_queue.work_req);152 153 node = rtems_chain_first (work_req_chain); 151 154 temp = (rtems_aio_request_chain *) node; 152 155 153 while (temp->fildes < r_chain->fildes && 154 !rtems_chain_is_tail ( &aio_request_queue.work_req, node)) {156 while (temp->fildes < r_chain->fildes && 157 !rtems_chain_is_tail (work_req_chain, node)) { 155 158 node = rtems_chain_next (node); 156 159 temp = (rtems_aio_request_chain *) node; 157 160 } 158 159 rtems_chain_insert (rtems_chain_previous (node), &r_chain->next_fd); 161 162 rtems_chain_explicit_insert (work_req_chain, 163 rtems_chain_previous (node), 164 &r_chain->next_fd); 160 165 } 161 166 … … 196 201 } 197 202 198 rtems_chain_ insert (node->previous, &req->next_prio);203 rtems_chain_explicit_insert (chain, node->previous, &req->next_prio); 199 204 200 205 } … … 222 227 while (!rtems_chain_is_tail (chain, node)) 223 228 { 224 rtems_chain_ex tract (node);229 rtems_chain_explicit_extract (chain, node); 225 230 rtems_aio_request *req = (rtems_aio_request *) node; 226 231 node = rtems_chain_next (node); … … 266 271 else 267 272 { 268 rtems_chain_ex tract (node);273 rtems_chain_explicit_extract (chain, node); 269 274 current->aiocbp->error_code = ECANCELED; 270 275 current->aiocbp->return_value = -1; … … 441 446 pthread_setschedparam (pthread_self(), req->policy, ¶m); 442 447 443 rtems_chain_ex tract (node);448 rtems_chain_explicit_extract (chain, node); 444 449 445 450 pthread_mutex_unlock (&r_chain->mutex); … … 507 512 the queue and start working with idle fd chains */ 508 513 if (result == ETIMEDOUT) { 509 rtems_chain_extract (&r_chain->next_fd); 514 rtems_chain_explicit_extract (&aio_request_queue.work_req, 515 &r_chain->next_fd); 510 516 pthread_mutex_destroy (&r_chain->mutex); 511 517 pthread_cond_destroy (&r_chain->cond); … … 543 549 544 550 node = rtems_chain_first (&aio_request_queue.idle_req); 545 rtems_chain_ex tract (node);551 rtems_chain_explicit_extract (&aio_request_queue.idle_req, node); 546 552 547 553 r_chain = (rtems_aio_request_chain *) node; -
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 -
testsuites/libtests/block06/init.c
re127c4c r1215fd4 1131 1131 bd = (rtems_bdbuf_buffer*) node; 1132 1132 pnode = node->previous; 1133 rtems_chain_ex tract (node);1133 rtems_chain_explicit_extract (&buffers, node); 1134 1134 node = pnode; 1135 1135 bdbuf_test_printf ("%s: rtems_bdbuf_release_modified[4]: ", tc->name); … … 1138 1138 bd = (rtems_bdbuf_buffer*) node; 1139 1139 pnode = node->previous; 1140 rtems_chain_ex tract (node);1140 rtems_chain_explicit_extract (&buffers, node); 1141 1141 node = pnode; 1142 1142 bdbuf_test_printf ("%s: rtems_bdbuf_release_modified[3]: ", tc->name); -
testsuites/sptests/spchain/init.c
re127c4c r1215fd4 61 61 static void test_chain_control_layout(void) 62 62 { 63 rtems_chain_control chain; 63 Chain_Control chain; 64 64 65 puts( "INIT - Verify rtems_chain_control layout" ); 65 rtems_test_assert( 66 sizeof(rtems_chain_control) 67 == sizeof(rtems_chain_node) + sizeof(rtems_chain_node *) 68 ); 69 rtems_test_assert( 70 sizeof(rtems_chain_control) 71 == 3 * sizeof(rtems_chain_node *) 72 ); 73 rtems_test_assert( &chain.Head.Node.previous == &chain.Tail.Node.next ); 66 67 rtems_test_assert( 68 sizeof(Chain_Control) 69 == sizeof(Chain_Node) + sizeof(Chain_Node *) 70 ); 71 rtems_test_assert( 72 sizeof(Chain_Control) 73 == 3 * sizeof(Chain_Node *) 74 ); 75 rtems_test_assert( 76 _Chain_Previous( _Chain_Head( &chain ) ) 77 == _Chain_Next( _Chain_Tail( &chain ) ) 78 ); 79 80 #if !defined( RTEMS_SMP ) 81 rtems_test_assert( 82 sizeof(Chain_Control) 83 == sizeof(rtems_chain_control) 84 ); 85 #endif 74 86 } 75 87 … … 95 107 rtems_chain_initialize_empty( &chain ); 96 108 rtems_chain_append( &chain, &node1 ); 97 rtems_chain_ insert(&node1, &node2 );109 rtems_chain_explicit_insert( &chain, &node1, &node2 ); 98 110 99 111 puts( "INIT - Verify rtems_chain_is_first" ); … … 297 309 node2.id = 2; 298 310 rtems_chain_append( &chain1, &node1.Node ); 299 rtems_chain_ insert(&node1.Node, &node2.Node );311 rtems_chain_explicit_insert( &chain1, &node1.Node, &node2.Node ); 300 312 301 313 for ( p = rtems_chain_first(&chain1), id = 1 ;
Note: See TracChangeset
for help on using the changeset viewer.