source: rtems/testsuites/mptests/mp14/pttask1.c @ 24f8915

5
Last change on this file since 24f8915 was a00dff42, checked in by Sebastian Huber <sebastian.huber@…>, on 12/12/19 at 05:37:01

rtems: Add and use rtems_object_get_local_node()

Update #3841.

  • Property mode set to 100644
File size: 1.7 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
25rtems_task Partition_task(
26  rtems_task_argument argument
27)
28{
29  uint32_t     count;
30  rtems_status_code  status;
31  uint32_t     yield_count;
32  void              *buffer;
33
34  puts( "Getting ID of partition" );
35  while ( FOREVER ) {
36    status = rtems_partition_ident(
37      Partition_name[ 1 ],
38      RTEMS_SEARCH_ALL_NODES,
39      &Partition_id[ 1 ]
40    );
41
42    if ( status == RTEMS_SUCCESSFUL )
43      break;
44
45    puts( "rtems_partition_ident FAILED!!" );
46    rtems_task_wake_after(2);
47  }
48
49  yield_count = 100;
50
51  while ( Stop_Test == false ) {
52    for ( count=PARTITION_DOT_COUNT ; Stop_Test == false && count ; count-- ) {
53      status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer );
54      directive_failed( status, "rtems_partition_get_buffer" );
55
56      status = rtems_partition_return_buffer( Partition_id[ 1 ], buffer );
57      directive_failed( status, "rtems_partition_return_buffer" );
58
59      if (Stop_Test == false)
60        if ( rtems_object_get_local_node() == 1 && --yield_count == 0 ) {
61          status = rtems_task_wake_after( 1 );
62          directive_failed( status, "rtems_task_wake_after" );
63          yield_count = 100;
64        }
65    }
66    put_dot( 'p' );
67  }
68
69  Exit_test();
70}
Note: See TracBrowser for help on using the repository browser.