File indexing completed on 2025-05-11 08:24:45
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 #ifdef HAVE_CONFIG_H
0030 #include "config.h"
0031 #endif
0032
0033 #include <tmacros.h>
0034
0035 const char rtems_test_name[] = "SP 59";
0036
0037
0038 rtems_task Init(rtems_task_argument argument);
0039 rtems_task Blocking_task(rtems_task_argument ignored);
0040
0041 uint8_t Region_Memory[512] CPU_STRUCTURE_ALIGNMENT;
0042 #define ALLOC_SIZE ( sizeof( Region_Memory ) / 2 )
0043 rtems_id Region;
0044
0045 rtems_task Blocking_task(
0046 rtems_task_argument ignored
0047 )
0048 {
0049 rtems_status_code status;
0050 void *address_1;
0051
0052 puts( "Blocking_task - wait for memory" );
0053 status = rtems_region_get_segment(
0054 Region,
0055 ALLOC_SIZE,
0056 RTEMS_DEFAULT_OPTIONS,
0057 RTEMS_NO_TIMEOUT,
0058 &address_1
0059 );
0060 directive_failed( status, "rtems_region_get_segment" );
0061
0062 puts( "Blocking_task - Got memory segment after freed" );
0063
0064 puts( "Blocking_task - delete self" );
0065 rtems_task_exit();
0066 }
0067
0068 rtems_task Init(
0069 rtems_task_argument ignored
0070 )
0071 {
0072 rtems_status_code status;
0073 rtems_id task_id;
0074 void *address_1;
0075 rtems_task_priority priority;
0076
0077 TEST_BEGIN();
0078
0079 priority = RTEMS_MAXIMUM_PRIORITY / 4;
0080 priority = (priority * 3) + (priority / 2);
0081 printf(
0082 "Init - blocking task priority will be %" PRIdrtems_task_priority "\n",
0083 priority
0084 );
0085
0086 puts( "Init - rtems_task_create - delay task - OK" );
0087 status = rtems_task_create(
0088 rtems_build_name( 'T', 'A', '1', ' ' ),
0089 priority,
0090 RTEMS_MINIMUM_STACK_SIZE,
0091 RTEMS_DEFAULT_OPTIONS,
0092 RTEMS_DEFAULT_ATTRIBUTES,
0093 &task_id
0094 );
0095 directive_failed( status, "rtems_task_create" );
0096
0097 puts( "Init - rtems_task_start - delay task - OK" );
0098 status = rtems_task_start( task_id, Blocking_task, 0 );
0099 directive_failed( status, "rtems_task_start" );
0100
0101 puts( "Init - rtems_region_create - OK" );
0102 status = rtems_region_create(
0103 rtems_build_name('R', 'N', '0', '1'),
0104 Region_Memory,
0105 sizeof( Region_Memory ),
0106 64,
0107 RTEMS_PRIORITY,
0108 &Region
0109 );
0110 directive_failed( status, "rtems_region_create of RN1" );
0111
0112 puts( "Init - rtems_region_get_segment - get segment to consume memory" );
0113 rtems_region_get_segment(
0114 Region,
0115 ALLOC_SIZE,
0116 RTEMS_DEFAULT_OPTIONS,
0117 RTEMS_NO_TIMEOUT,
0118 &address_1
0119 );
0120 directive_failed( status, "rtems_region_get_segment" );
0121
0122 puts( "Init - rtems_task_wake_after - let other task block - OK" );
0123 status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) );
0124 directive_failed( status, "rtems_task_wake_after" );
0125
0126 puts( "Init - rtems_region_return_segment - return segment" );
0127 status = rtems_region_return_segment( Region, address_1 );
0128 directive_failed( status, "rtems_region_return_segment" );
0129
0130 puts( "Init - rtems_task_wake_after - let other task run again - OK" );
0131 status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) );
0132 directive_failed( status, "rtems_task_wake_after" );
0133
0134 TEST_END();
0135 rtems_test_exit(0);
0136 }
0137
0138
0139
0140 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
0141 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
0142
0143 #define CONFIGURE_MAXIMUM_TASKS 2
0144 #define CONFIGURE_MAXIMUM_REGIONS 1
0145 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
0146
0147 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
0148
0149 #define CONFIGURE_INIT
0150 #include <rtems/confdefs.h>
0151
0152