source: rtems/testsuites/mptests/mp14/pttask1.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*  Partition_task
2 *
3 *  This task continuously gets a buffer from and returns that buffer
4 *  to a global partition.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include "system.h"
24
25extern rtems_multiprocessing_table Multiprocessing_configuration;
26
27rtems_task Partition_task(
28  rtems_task_argument argument
29)
30{
31  uint32_t     count;
32  rtems_status_code  status;
33  uint32_t     yield_count;
34  void              *buffer;
35
36  puts( "Getting ID of partition" );
37  while ( FOREVER ) {
38    status = rtems_partition_ident(
39      Partition_name[ 1 ],
40      RTEMS_SEARCH_ALL_NODES,
41      &Partition_id[ 1 ]
42    );
43
44    if ( status == RTEMS_SUCCESSFUL )
45      break;
46
47    puts( "rtems_partition_ident FAILED!!" );
48    rtems_task_wake_after(2);
49  }
50
51  yield_count = 100;
52
53  while ( Stop_Test == false ) {
54    for ( count=PARTITION_DOT_COUNT ; Stop_Test == false && count ; count-- ) {
55      status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer );
56      directive_failed( status, "rtems_partition_get_buffer" );
57
58      status = rtems_partition_return_buffer( Partition_id[ 1 ], buffer );
59      directive_failed( status, "rtems_partition_return_buffer" );
60
61      if (Stop_Test == false)
62        if ( Multiprocessing_configuration.node == 1 && --yield_count == 0 ) {
63          status = rtems_task_wake_after( 1 );
64          directive_failed( status, "rtems_task_wake_after" );
65          yield_count = 100;
66        }
67    }
68    put_dot( 'p' );
69  }
70
71  Exit_test();
72}
Note: See TracBrowser for help on using the repository browser.