rtems_task Task5( rtems_task_argument argument ) { void *segment_address_1; void *segment_address_2; rtems_status_code status; puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); status = rtems_region_get_segment( Region_id[ 1 ], 1536, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &segment_address_1 ); directive_failed( status, "rtems_region_get_segment" ); status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); directive_failed( status, "rtems_region_return_segment" ); puts_nocr( "TA5 - got and returned " ); Put_address_from_area_1( segment_address_1 ); new_line; /* * Use TOD_MICROSECONDS_TO_TICKS not RTEMS_MICROSECONDS_TO_TICKS to * test C implementation in SuperCore -- not macro version used * everywhere else. */ status = rtems_task_wake_after( TOD_MICROSECONDS_TO_TICKS( 1000000 ) ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" ); status = rtems_region_get_segment( Region_id[ 1 ], 3072, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &segment_address_2 ); puts_nocr( "TA5 - got segment from region 1 - " ); Put_address_from_area_1( segment_address_2 ); new_line; status = rtems_region_return_segment( Region_id[ 1 ], segment_address_2 ); puts_nocr( "TA5 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( segment_address_2 ); new_line; puts( "TA5 - rtems_task_delete - delete self" ); status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); }
rtems_task Task_1( rtems_task_argument argument ) { void *address_1; void *address_2; void *address_3; void *address_4; void *address_5; void *address_6; void *address_7; void *address_8; rtems_id region_id; Heap_Information_block region_info; uintptr_t segment_size; rtems_status_code status; /* Obtain the region id */ status = rtems_region_ident(Region_name[ 1 ], ®ion_id); printf( "TA1 - rtems_region_ident - 0x%08" PRIxrtems_id "\n", region_id ); directive_failed(status, "rtems_region_ident of RN01"); /* Get a 64 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 64, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_1 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_1 ); new_line; /* Get the size of segment_1 */ puts_nocr( "TA1 - rtems_region_get_segment_size from - " ); Put_address_from_area_1( address_1 ); new_line; status = rtems_region_get_segment_size(region_id, address_1, &segment_size); directive_failed(status, "rtems_region_get_segment_size of segment 1"); printf( "TA1 - got segment size of %" PRIuPTR "\n", segment_size ); /* Get a 128 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 128, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_2 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_2 ); new_line; /* Get a 256 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 256, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_3 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_3 ); new_line; /* Get a 512 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 512, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_4 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_4 ); new_line; /* Get a 1024 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 1024, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_5 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_5 ); new_line; /* Get a 2048 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 2048, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_6 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_6 ); new_line; /* Get a 4096 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 4096, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_7 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_7 ); new_line; /* Get a 8192 byte segment from the region */ puts( "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 8192, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_8 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_8 ); new_line; /* Get the size of segment_8 */ puts_nocr( "TA1 - rtems_region_get_segment_size from - " ); Put_address_from_area_1( address_8 ); new_line; status = rtems_region_get_segment_size(region_id, address_8, &segment_size); directive_failed(status, "rtems_region_get_segment_size of segment 8"); printf( "TA1 - got segment size of %" PRIuPTR "\n", segment_size ); /* Get information about the region */ printf( "TA1 - rtems_region_get_information - 0x%08" PRIxrtems_id "\n", region_id ); status = rtems_region_get_information(region_id, ®ion_info); directive_failed(status, "rtems_region_get_information of RN01"); printf( "TA1 - got information - free = %" PRIu32 ", used = %" PRIu32 "\n", region_info.Free.number, region_info.Used.number ); printf( "TA1 - rtems_region_get_free_information - 0x%08" PRIxrtems_id "\n", region_id ); status = rtems_region_get_free_information(region_id, ®ion_info); directive_failed(status, "rtems_region_get_free_information of RN01"); printf( "TA1 - got free information - free = %" PRIu32 ", used = %" PRIu32 "\n", region_info.Free.number, region_info.Used.number ); rtems_test_pause(); puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_3 ); status = rtems_region_return_segment( Region_id[ 1 ], address_3 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_3 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_4 ); status = rtems_region_return_segment( Region_id[ 1 ], address_4 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_4 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_1 ); status = rtems_region_return_segment( Region_id[ 1 ], address_1 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_1 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_2 ); status = rtems_region_return_segment( Region_id[ 1 ], address_2 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_2 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_7 ); status = rtems_region_return_segment( Region_id[ 1 ], address_7 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_7 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_6 ); status = rtems_region_return_segment( Region_id[ 1 ], address_6 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_6 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_8 ); status = rtems_region_return_segment( Region_id[ 1 ], address_8 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_8 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_5 ); status = rtems_region_return_segment( Region_id[ 1 ], address_5 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_5 = 0; puts( "TA1 - rtems_region_delete - walks heap if debug enabled" ); rtems_region_delete(Region_id[ 1 ]); puts( "*** END OF TEST 25 ***" ); rtems_test_exit( 0 ); }
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( "%08x\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( "%08x\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" ); puts( "*** END OF TEST 15 ***" ); rtems_test_exit( 0 ); }
rtems_task Task_1( rtems_task_argument argument ) { rtems_id rnid; void *segment_address_1; void *segment_address_2; void *segment_address_3; void *segment_address_4; rtems_status_code status; status = rtems_region_ident( Region_name[ 1 ], &rnid ); printf( "TA1 - rtems_region_ident - rnid => %08" PRIxrtems_id "\n", rnid ); directive_failed( status, "rtems_region_ident of RN1" ); puts( "TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2" ); status = rtems_region_get_segment( Region_id[ 2 ], 100, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &segment_address_1 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 2 - " ); Put_address_from_area_2( segment_address_1 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 3K segment from region 3" ); status = rtems_region_get_segment( Region_id[ 3 ], 3072, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &segment_address_2 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 3 - " ); Put_address_from_area_3( segment_address_2 ); new_line; puts_nocr( "TA1 - rtems_region_get_segment - get 3080 byte segment " ); puts ( "from region 1 - NO_WAIT" ); status = rtems_region_get_segment( Region_id[ 1 ], 3080, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &segment_address_3 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( segment_address_3 ); new_line; puts( "TA1 - rtems_task_wake_after - yield processor" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); rtems_test_pause(); puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( segment_address_3 ); status = rtems_region_return_segment( Region_id[ 1 ], segment_address_3 ); directive_failed( status, "rtems_region_return_segment" ); new_line; puts( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " "segment from region 1" ); status = rtems_region_get_segment( Region_id[ 1 ], 3072, RTEMS_DEFAULT_OPTIONS, 10 * rtems_clock_get_ticks_per_second(), &segment_address_4 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( segment_address_4 ); new_line; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 2 - " ); Put_address_from_area_2( segment_address_1 ); new_line; status = rtems_region_return_segment( Region_id[ 2 ], segment_address_1 ); directive_failed( status, "rtems_region_return_segment" ); puts( "TA1 - rtems_task_wake_after - yield processor" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA1 - rtems_task_delete - delete TA3" ); status = rtems_task_delete( Task_id[ 3 ] ); directive_failed( status, "rtems_task_delete of TA3" ); rtems_test_pause(); status = rtems_task_create( Task_name[ 4 ], BASE_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 4 ] ); directive_failed( status, "rtems_task_create of TA4" ); status = rtems_task_create( Task_name[ 5 ], BASE_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 5 ] ); directive_failed( status, "rtems_task_create of TA5" ); status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); directive_failed( status, "rtems_task_start of TA4" ); status = rtems_task_start( Task_id[ 5 ], Task5, 0 ); directive_failed( status, "rtems_task_start of TA5" ); puts( "TA1 - rtems_task_wake_after - yield processor" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( segment_address_4 ); status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 ); directive_failed( status, "rtems_region_return_segment" ); new_line; puts( "TA1 - rtems_task_wake_after - yield processor" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); puts_nocr( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " ); puts ( "segment from region 1"); status = rtems_region_get_segment( Region_id[ 1 ], 3072, RTEMS_DEFAULT_OPTIONS, 10 * rtems_clock_get_ticks_per_second(), &segment_address_4 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( segment_address_4 ); new_line; puts( "TA1 - rtems_task_wake_after - yield processor" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA1 - rtems_task_delete - delete TA4" ); status = rtems_task_delete( Task_id[ 4 ] ); directive_failed( status, "rtems_task_delete of TA4" ); puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( segment_address_4 ); status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 ); directive_failed( status, "rtems_region_return_segment" ); new_line; puts( "TA1 - rtems_task_wake_after - yield processor" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); puts( "TA1 - rtems_region_delete - delete region 1" ); status = rtems_region_delete( Region_id[ 1 ] ); directive_failed( status, "rtems_region_delete" ); puts( "TA1 - rtems_region_get_segment - get 3K segment from region 4" ); status = rtems_region_get_segment( Region_id[ 4 ], 3072, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &segment_address_1 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 4 - " ); Put_address_from_area_4( segment_address_1 ); new_line; puts( "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" ); status = rtems_region_get_segment( Region_id[ 4 ], 3072, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &segment_address_2 ); fatal_directive_status( status, RTEMS_UNSATISFIED, "rtems_task_get_segment with no memory left" ); puts( "TA1 - rtems_task_get_segment - RTEMS_UNSATISFIED" ); puts( "TA1 - rtems_region_extend - extend region 4 by 4K" ); status = rtems_region_extend( Region_id[ 4 ], &Area_4[4096], 4096 ); directive_failed( status, "rtems_region_extend" ); puts( "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" ); status = rtems_region_get_segment( Region_id[ 4 ], 3072, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &segment_address_3 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got 3K segment from region 4 - " ); Put_address_from_area_4( segment_address_3 ); new_line; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 4 - " ); Put_address_from_area_4( segment_address_1 ); status = rtems_region_return_segment( Region_id[ 4 ], segment_address_1 ); directive_failed( status, "rtems_region_return_segment" ); new_line; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 4 - " ); Put_address_from_area_4( segment_address_3 ); status = rtems_region_return_segment( Region_id[ 4 ], segment_address_3 ); directive_failed( status, "rtems_region_return_segment" ); new_line; puts( "TA1 - rtems_region_delete - delete region 4" ); status = rtems_region_delete( Region_id[ 4 ] ); directive_failed( status, "rtems_region_delete" ); puts( "*** END OF TEST 16 ***" ); rtems_test_exit( 0 ); }
rtems_task Task_2( rtems_task_argument argument ) { rtems_status_code status; rtems_task_priority previous_priority; void *segment_address_1; void *segment_address_2; puts( "TA2 - rtems_region_get_segment - wait on 2K segment from region 1" ); status = rtems_region_get_segment( Region_id[ 1 ], 2048, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &segment_address_1 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA2 - got segment from region 1 - " ); Put_address_from_area_1( segment_address_1 ); new_line; puts_nocr( "TA2 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( segment_address_1 ); status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); directive_failed( status, "rtems_region_return_segment" ); new_line; puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); status = rtems_task_set_priority( RTEMS_SELF, BASE_PRIORITY-1, &previous_priority ); directive_failed( status, "rtems_task_set_priority" ); puts("TA2 - rtems_region_get_segment - wait on 3750 byte segment"); status = rtems_region_get_segment( Region_id[ 2 ], 3750, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &segment_address_2 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA2 - got segment from region 2 - "); Put_address_from_area_2( segment_address_2 ); new_line; puts_nocr( "TA2 - rtems_region_return_segment - return segment to region 2 - " ); Put_address_from_area_2( segment_address_2 ); status = rtems_region_return_segment( Region_id[ 2 ], segment_address_2 ); directive_failed( status, "rtems_region_return_segment" ); new_line; puts( "TA2 - rtems_task_delete - delete self" ); status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); }
epos_task Task_1( epos_task_argument argument ) { epos_id ptid_1; epos_id ptid_2; void *buffer_address_1; void *buffer_address_2; void *buffer_address_3; void *buffer_address_4; void *buffer_address_5; epos_status_code status; puts( "TA1 - rtems_partition_ident - partition 1 id = " ); status = epos_partition_ident( Partition_name[ 1 ], RTEMS_SEARCH_ALL_NODES, &ptid_1 ); //directive_failed( status, "rtems_partition_ident of PT1" ); directive_suc(status); printf( "%08" PRIxepos_id "\n", ptid_1 ); puts( "TA1 - rtems_partition_ident - partition 2 id = " ); status = epos_partition_ident( Partition_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &ptid_2 ); directive_suc(status); printf( "%08" PRIxepos_id "\n", ptid_2 ); puts( "TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - " ); status = epos_partition_get_buffer( ptid_1, &buffer_address_1 ); //directive_failed( status, "rtems_partition_get_buffer" ); directive_suc(status); Put_address_from_area_1( buffer_address_1 ); new_line; puts( "TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - " ); status = epos_partition_get_buffer( ptid_1, &buffer_address_2 ); //directive_failed( status, "rtems_partition_get_buffer" ); directive_suc(status); Put_address_from_area_1( buffer_address_2 ); new_line; puts( "TA1 - rtems_partition_get_buffer - buffer 3 from partition 2 - " ); status = epos_partition_get_buffer( ptid_2, &buffer_address_3 ); //directive_failed( status, "rtems_partition_get_buffer" ); directive_suc(status); Put_address_from_area_2( buffer_address_3 ); new_line; puts( "TA1 - rtems_partition_get_buffer - buffer 4 from partition 2 - " ); status = epos_partition_get_buffer( ptid_2, &buffer_address_4 ); //directive_failed( status, "rtems_partition_get_buffer" ); directive_suc(status); Put_address_from_area_2( buffer_address_4 ); new_line; puts( "TA1 - rtems_partition_get_buffer - attempt to get buffer 5 from partition 2" ); status = epos_partition_get_buffer( ptid_2, &buffer_address_5 ); //directive_failed( status, "rtems_partition_get_buffer" ); if(status == RTEMS_UNSATISFIED)printf("Error code :RTEMS_UNSATISFIED.For all buffers are allocated!\n"); puts( "TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - " ); Put_address_from_area_1( buffer_address_1 ); new_line; status = epos_partition_return_buffer( ptid_1, buffer_address_1 ); //directive_failed( status, "rtems_partition_return_buffer" ); directive_suc(status); puts( "TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - " ); Put_address_from_area_1( buffer_address_2 ); new_line; status = epos_partition_return_buffer( ptid_1, buffer_address_2 ); //directive_failed( status, "rtems_partition_return_buffer" ); directive_suc(status); puts( "TA1 - rtems_partition_return_buffer - buffer 3 to partition 2 - " ); Put_address_from_area_2( buffer_address_3 ); new_line; status = epos_partition_return_buffer( ptid_2, buffer_address_3 ); //directive_failed( status, "rtems_partition_return_buffer" ); directive_suc(status); puts( "TA1 - rtems_partition_return_buffer - buffer 4 to partition 2 - " ); Put_address_from_area_2( buffer_address_4 ); new_line; status = epos_partition_return_buffer( ptid_2, buffer_address_4 ); //directive_failed( status, "rtems_partition_return_buffer" ); directive_suc(status); puts( "TA1 - rtems_partition_delete - delete partition 1" ); status = epos_partition_delete( ptid_1 ); //directive_failed( status, "rtems_partition_delete" ); directive_suc(status); puts( "TA1 - rtems_partition_delete - delete partition 2" ); status = epos_partition_delete( ptid_2 ); //directive_failed( status, "rtems_partition_delete" ); directive_suc(status); puts( "*** END OF TEST Partition ***" ); // epos_test_exit(0); }
rtems_task Task_1( rtems_task_argument argument ) { void *address_1; void *address_2; void *address_3; void *address_4; void *address_5; void *address_6; void *address_7; void *address_8; rtems_status_code status; rtems_id region_id; status = rtems_region_ident(Region_name[ 1 ], ®ion_id); printf( "TA1 - rtems_region_ident - 0x%08x\n", region_id ); directive_failed(status, "rtems_region_ident of RN01"); puts( "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 64, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_1 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_1 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 128, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_2 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_2 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 256, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_3 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_3 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 512, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_4 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_4 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 1024, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_5 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_5 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 2048, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_6 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_6 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 4096, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_7 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_7 ); new_line; puts( "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1" ); rtems_region_get_segment( Region_id[ 1 ], 8192, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &address_8 ); directive_failed( status, "rtems_region_get_segment" ); puts_nocr( "TA1 - got segment from region 1 - " ); Put_address_from_area_1( address_8 ); new_line; rtems_test_pause(); puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_3 ); status = rtems_region_return_segment( Region_id[ 1 ], address_3 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_3 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_4 ); status = rtems_region_return_segment( Region_id[ 1 ], address_4 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_4 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_1 ); status = rtems_region_return_segment( Region_id[ 1 ], address_1 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_1 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_2 ); status = rtems_region_return_segment( Region_id[ 1 ], address_2 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_2 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_7 ); status = rtems_region_return_segment( Region_id[ 1 ], address_7 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_7 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_6 ); status = rtems_region_return_segment( Region_id[ 1 ], address_6 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_6 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_8 ); status = rtems_region_return_segment( Region_id[ 1 ], address_8 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_8 = 0; puts_nocr( "TA1 - rtems_region_return_segment - return segment to region 1 - " ); Put_address_from_area_1( address_5 ); status = rtems_region_return_segment( Region_id[ 1 ], address_5 ); directive_failed( status, "rtems_region_return_segment" ); new_line; address_5 = 0; puts( "TA1 - rtems_region_delete - walks heap if debug enabled" ); rtems_region_delete(Region_id[ 1 ]); puts( "*** END OF TEST 25 ***" ); rtems_test_exit( 0 ); }