summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp15/task1.c
blob: 609d37fc2e59ccb9328bb3c884777f455c8a0917 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*  Task_1
 *
 *  This routine serves as a test task.  It tests the partition manager.
 *
 *  Input parameters:
 *    argument - task argument
 *
 *  Output parameters:  NONE
 *
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "system.h"

rtems_task Task_1(
  rtems_task_argument argument
)
{
  rtems_id           ptid_1;
  rtems_id           ptid_2;
  void              *buffer_address_1;
  void              *buffer_address_2;
  void              *buffer_address_3;
  void              *buffer_address_4;
  rtems_status_code  status;

  puts_nocr( "TA1 - rtems_partition_ident - partition 1 id = " );
  status = rtems_partition_ident(
    Partition_name[ 1 ],
    RTEMS_SEARCH_ALL_NODES,
    &ptid_1
  );
  directive_failed( status, "rtems_partition_ident of PT1" );
  printf( "%08" PRIxrtems_id "\n", ptid_1 );

  puts_nocr( "TA1 - rtems_partition_ident - partition 2 id = " );
  status = rtems_partition_ident(
    Partition_name[ 2 ],
    RTEMS_SEARCH_ALL_NODES,
    &ptid_2
  );
  directive_failed( status, "rtems_partition_ident of PT2" );
  printf( "%08" PRIxrtems_id "\n", ptid_2 );

  puts_nocr(
    "TA1 - rtems_partition_get_buffer - buffer 1 from partition 1  - "
  );
  status = rtems_partition_get_buffer( ptid_1, &buffer_address_1 );
  directive_failed( status, "rtems_partition_get_buffer" );
  Put_address_from_area_1( buffer_address_1 );
  new_line;

  puts_nocr(
    "TA1 - rtems_partition_get_buffer - buffer 2 from partition 1  - "
  );
  status = rtems_partition_get_buffer( ptid_1, &buffer_address_2 );
  directive_failed( status, "rtems_partition_get_buffer" );
  Put_address_from_area_1( buffer_address_2 );
  new_line;

  puts_nocr(
    "TA1 - rtems_partition_get_buffer - buffer 1 from partition 2  - "
  );
  status = rtems_partition_get_buffer( ptid_2, &buffer_address_3 );
  directive_failed( status, "rtems_partition_get_buffer" );
  Put_address_from_area_2( buffer_address_3 );
  new_line;

  puts_nocr(
    "TA1 - rtems_partition_get_buffer - buffer 2 from partition 2  - "
  );
  status = rtems_partition_get_buffer( ptid_2, &buffer_address_4 );
  directive_failed( status, "rtems_partition_get_buffer" );
  Put_address_from_area_2( buffer_address_4 );
  new_line;

  puts_nocr(
    "TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - "
  );
  Put_address_from_area_1( buffer_address_1 );
  new_line;
  status = rtems_partition_return_buffer( ptid_1, buffer_address_1 );
  directive_failed( status, "rtems_partition_return_buffer" );

  puts_nocr(
    "TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - "
  );
  Put_address_from_area_1( buffer_address_2 );
  new_line;
  status = rtems_partition_return_buffer( ptid_1, buffer_address_2 );
  directive_failed( status, "rtems_partition_return_buffer" );

  puts_nocr(
    "TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - "
  );
  Put_address_from_area_2( buffer_address_3 );
  new_line;
  status = rtems_partition_return_buffer( ptid_2, buffer_address_3 );
  directive_failed( status, "rtems_partition_return_buffer" );

  puts_nocr(
    "TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - "
  );
  Put_address_from_area_2( buffer_address_4 );
  new_line;
  status = rtems_partition_return_buffer( ptid_2, buffer_address_4 );
  directive_failed( status, "rtems_partition_return_buffer" );

  puts( "TA1 - rtems_partition_delete - delete partition 1"
  );
  status = rtems_partition_delete( ptid_1 );
  directive_failed( status, "rtems_partition_delete" );

  puts( "TA1 - rtems_partition_delete - delete partition 2"
  );
  status = rtems_partition_delete( ptid_2 );
  directive_failed( status, "rtems_partition_delete" );

  TEST_END();
  rtems_test_exit( 0 );
}