File indexing completed on 2025-05-11 08:24:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #ifdef HAVE_CONFIG_H
0047 #include "config.h"
0048 #endif
0049
0050 #define CONFIGURE_INIT
0051 #include "system.h"
0052
0053 uint8_t Partition_area[ 1024 ] CPU_STRUCTURE_ALIGNMENT;
0054
0055 rtems_task Init(
0056 rtems_task_argument argument
0057 )
0058 {
0059 rtems_status_code status;
0060 void *bufaddr;
0061
0062 printf(
0063 "\n\n*** TEST 12 -- NODE %" PRId32 " ***\n",
0064 rtems_object_get_local_node()
0065 );
0066
0067 Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
0068 Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
0069
0070 Partition_name[ 1 ] = rtems_build_name( 'P', 'A', 'R', ' ' );
0071
0072 puts( "Got to initialization task" );
0073
0074 if ( rtems_object_get_local_node() == 2 ) {
0075 status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
0076 directive_failed( status, "rtems_task_wake_after" );
0077
0078 puts( "Getting ID of remote Partition (Global)" );
0079
0080 do {
0081 status = rtems_partition_ident(
0082 Partition_name[ 1 ],
0083 RTEMS_SEARCH_ALL_NODES,
0084 &Partition_id[ 1 ]
0085 );
0086 } while ( !rtems_is_status_successful( status ) );
0087
0088 puts( "Attempting to delete remote Partition (Global)" );
0089 status = rtems_partition_delete( Partition_id[ 1 ] );
0090 fatal_directive_status(
0091 status,
0092 RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
0093 "rtems_partition_delete"
0094 );
0095 puts(
0096 "rtems_partition_delete correctly returned RTEMS_ILLEGAL_ON_REMOTE_OBJECT"
0097 );
0098
0099 puts( "Obtaining a buffer from the global partition" );
0100 status = rtems_partition_get_buffer( Partition_id[ 1 ], &bufaddr );
0101 directive_failed( status, "rtems_partition_get_buffer" );
0102 printf( "Address returned was : 0x%p\n", bufaddr );
0103
0104 puts( "Releasing a buffer to the global partition" );
0105 status = rtems_partition_return_buffer( Partition_id[ 1 ], bufaddr );
0106 directive_failed( status, "rtems_partition_return_buffer" );
0107
0108 status = rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() );
0109 directive_failed( status, "rtems_task_wake_after" );
0110 }
0111 else {
0112 puts( "Creating Partition (Global)" );
0113 status = rtems_partition_create(
0114 Partition_name[ 1 ],
0115 Partition_area,
0116 128,
0117 64,
0118 RTEMS_GLOBAL,
0119 &Partition_id[ 1 ]
0120 );
0121 directive_failed( status, "rtems_partition_create" );
0122
0123 puts( "Sleeping for two seconds" );
0124 status = rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() );
0125 directive_failed( status, "rtems_task_wake_after" );
0126
0127 puts( "Deleting Partition (Global)" );
0128 status = rtems_partition_delete( Partition_id[ 1 ] );
0129 directive_failed( status, "rtems_partition_delete" );
0130 }
0131 puts( "*** END OF TEST 12 ***" );
0132 rtems_test_exit( 0 );
0133 }