File indexing completed on 2025-05-11 08:24:48
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 #ifdef HAVE_CONFIG_H
0032 #include "config.h"
0033 #endif
0034
0035 #define CONFIGURE_INIT
0036 #include "system.h"
0037
0038 #include <rtems/rtems/tasksimpl.h>
0039
0040 const char rtems_test_name[] = "SPOBJGETNEXT";
0041
0042
0043 int scan_objects(
0044 Objects_Information *information,
0045 Objects_Id start
0046 );
0047
0048 #define MAX_SCAN 10
0049
0050 int scan_objects(
0051 Objects_Information *information,
0052 Objects_Id start
0053 )
0054 {
0055 Objects_Control *o[MAX_SCAN];
0056 int i;
0057 Objects_Id id;
0058
0059 memset( o, 1, sizeof(o) );
0060
0061 id = start;
0062 for (i=0 ; i<MAX_SCAN ; i++ ) {
0063 o[i] = _Objects_Get_next(
0064 id,
0065 information,
0066 &id
0067 );
0068 if ( !o[i] )
0069 break;
0070
0071
0072
0073 }
0074 return i;
0075 }
0076
0077 rtems_task Init(
0078 rtems_task_argument argument
0079 )
0080 {
0081 rtems_id main_task;
0082 int count;
0083 Objects_Control *o;
0084 Objects_Id id;
0085 Objects_Information *info;
0086 Objects_Maximum active_count;
0087
0088 TEST_BEGIN();
0089
0090 info = &_RTEMS_tasks_Information.Objects;
0091 main_task = rtems_task_self();
0092
0093 puts( "Init - _Objects_Get_next - NULL object information" );
0094 o = _Objects_Get_next( main_task, NULL, &id );
0095 rtems_test_assert( o == NULL );
0096 rtems_test_assert( o == NULL );
0097
0098 puts( "Init - _Objects_Get_next - NULL id" );
0099 o = _Objects_Get_next( main_task, info, NULL );
0100 rtems_test_assert( o == NULL );
0101
0102
0103
0104
0105 count = scan_objects( info, OBJECTS_ID_INITIAL_INDEX );
0106 printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
0107 rtems_test_assert( count == 1 );
0108
0109
0110 count = scan_objects( info, main_task );
0111 printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
0112 rtems_test_assert( count == 1 );
0113
0114
0115
0116
0117
0118
0119 puts( "Init - _Objects_Active_count" );
0120 _Objects_Allocator_lock();
0121 active_count = _Objects_Active_count( info );
0122 _Objects_Allocator_unlock();
0123 rtems_test_assert( active_count == 1 );
0124
0125 TEST_END();
0126 rtems_test_exit( 0 );
0127 }