OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [mptests/] [mp12/] [init.c] - Blame information for rev 623

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  Init
2
 *
3
 *  This routine is the initialization routine and test code for
4
 *  global partitions.  It creates a global partition, obtains and
5
 *  releases a buffer, and deletes the partition.  The partition
6
 *  is created on node one, and an attempt is made to delete it
7
 *  by node two.
8
 *  This routine is the initialization task for this test program.
9
 *  It is a user initialization task and has the responsibility for creating
10
 *  and starting the tasks that make up the test.  If the time of day
11
 *  clock is required for the test, it should also be set to a known
12
 *  value by this function.
13
 *
14
 *  Input parameters:
15
 *    argument - task argument
16
 *
17
 *  Output parameters:  NONE
18
 *
19
 *  COPYRIGHT (c) 1989-1999.
20
 *  On-Line Applications Research Corporation (OAR).
21
 *
22
 *  The license and distribution terms for this file may be
23
 *  found in the file LICENSE in this distribution or at
24
 *  http://www.OARcorp.com/rtems/license.html.
25
 *
26
 *  $Id: init.c,v 1.2 2001-09-27 12:02:22 chris Exp $
27
 */
28
 
29
#define TEST_INIT
30
#include "system.h"
31
 
32
rtems_unsigned8 Partition_area[ 1024 ] CPU_STRUCTURE_ALIGNMENT;
33
 
34
rtems_task Init(
35
  rtems_task_argument argument
36
)
37
{
38
  rtems_status_code  status;
39
  void              *bufaddr;
40
 
41
  printf(
42
    "\n\n*** TEST 12 -- NODE %d ***\n",
43
    Multiprocessing_configuration.node
44
   );
45
 
46
  Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
47
  Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
48
 
49
  Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' );
50
 
51
  puts( "Got to initialization task" );
52
 
53
  if ( Multiprocessing_configuration.node == 2 )  {
54
    status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
55
    directive_failed( status, "rtems_task_wake_after" );
56
 
57
    puts( "Getting ID of remote Partition (Global)" );
58
 
59
    do {
60
      status = rtems_partition_ident(
61
        Partition_name[ 1 ],
62
        RTEMS_SEARCH_ALL_NODES,
63
        &Partition_id[ 1 ]
64
      );
65
    } while ( !rtems_is_status_successful( status ) );
66
 
67
    puts( "Attempting to delete remote Partition (Global)" );
68
    status = rtems_partition_delete( Partition_id[ 1 ] );
69
    fatal_directive_status(
70
      status,
71
      RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
72
      "rtems_partition_delete"
73
    );
74
    puts(
75
     "rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
76
    );
77
 
78
    puts( "Obtaining a buffer from the global partition" );
79
    status = rtems_partition_get_buffer( Partition_id[ 1 ], &bufaddr );
80
    directive_failed( status, "rtems_partition_get_buffer" );
81
    printf( "Address returned was : 0x%p\n", bufaddr );
82
 
83
    puts( "Releasing a buffer to the global partition" );
84
    status = rtems_partition_return_buffer( Partition_id[ 1 ], bufaddr );
85
    directive_failed( status, "rtems_partition_return_buffer" );
86
 
87
    status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
88
    directive_failed( status, "rtems_task_wake_after" );
89
  }
90
  else {
91
    puts( "Creating Partition (Global)" );
92
    status = rtems_partition_create(
93
      Partition_name[ 1 ],
94
      Partition_area,
95
      128,
96
      64,
97
      RTEMS_GLOBAL,
98
      &Partition_id[ 1 ]
99
    );
100
    directive_failed( status, "rtems_partition_create" );
101
 
102
    puts( "Sleeping for two seconds" );
103
    status = rtems_task_wake_after( 2 * TICKS_PER_SECOND );
104
    directive_failed( status, "rtems_task_wake_after" );
105
 
106
    puts( "Deleting Partition (Global)" );
107
    status = rtems_partition_delete( Partition_id[ 1 ] );
108
    directive_failed( status, "rtems_partition_delete" );
109
 }
110
 puts( "*** END OF TEST 12 ***" );
111
 exit( 0 );
112
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.