rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_id              main_task;
  int                   count;
  Objects_Control      *o;
  Objects_Locations     location;
  Objects_Id            id;
  Objects_Information  *info;

  puts( "\n\n*** TEST OBJECT GET NEXT ***" );

  info      = &_RTEMS_tasks_Information;
  main_task = rtems_task_self();

  puts( "Init - _Objects_Get_next - NULL object information" );
  o = _Objects_Get_next( NULL, main_task, &location, &id );
  rtems_test_assert( o == NULL );

  puts( "Init - _Objects_Get_next - NULL location" );
  o = _Objects_Get_next( info, main_task, NULL, &id );
  rtems_test_assert( o == NULL );

  puts( "Init - _Objects_Get_next - NULL id" );
  o = _Objects_Get_next( info, main_task, &location, NULL );
  rtems_test_assert( o == NULL );

  /* XXX push the three NULL error cases */

  /* simple case of only all tasks in the system, starting at initial */
  count = scan_objects( info, OBJECTS_ID_INITIAL_INDEX );
  printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
  rtems_test_assert( count == 1 );

  /* simple case of only 1 task in the system, starting at that task */
  count = scan_objects( info, main_task );
  printf( "%d RTEMS Task%s\n", count, ((count == 1) ? "" : "s") );
  rtems_test_assert( count == 1 );

  /* XXX create >= 1 task and make sure the counts are correct when */
  /* XXX you start the search at initial, first id, arbitrary id */

  /* XXX try with a manager with no objects created */

  puts( "*** END OF TEST OBJECT GET NEXT ***" );
  rtems_test_exit( 0 );
}
Esempio n. 2
0
static void
scan_for_lutexes(lispobj *addr, long n_words)
{
    static int initialized = 0;
    static scan_table lutex_scan_table;

    if (!initialized) {
        int i;

        /* allocate a little space to get started */
        lutex_addresses = malloc(16*sizeof(void *));
        gc_assert(lutex_addresses);
        max_lutexes = 16;

        /* initialize the mapping table */
        for(i = 0; i < ((sizeof lutex_scan_table)/(sizeof lutex_scan_table[0])); ++i) {
            lutex_scan_table[i] = default_scan_action;
        }

        lutex_scan_table[LUTEX_WIDETAG] = lutex_scan_action;

        initialized = 1;
    }

    /* do the scan */
    scan_objects(addr, n_words, lutex_scan_table);
}