rtems_status_code rtems_task_ident( rtems_name name, uint32_t node, rtems_id *id ) { Objects_Name_or_id_lookup_errors status; if ( !id ) return RTEMS_INVALID_ADDRESS; if ( name == OBJECTS_ID_OF_SELF ) { *id = _Thread_Get_executing()->Object.id; return RTEMS_SUCCESSFUL; } status = _Objects_Name_to_id_u32( &_RTEMS_tasks_Information.Objects, name, node, id ); return _Status_Object_name_errors_to_status[ status ]; }
rtems_status_code rtems_semaphore_ident( rtems_name name, uint32_t node, rtems_id *id ) { Objects_Name_or_id_lookup_errors status; status = _Objects_Name_to_id_u32( &_Semaphore_Information, name, node, id ); return _Status_Object_name_errors_to_status[ status ]; }
rtems_status_code rtems_timer_ident( rtems_name name, rtems_id *id ) { Objects_Name_or_id_lookup_errors status; status = _Objects_Name_to_id_u32( &_Timer_Information, name, OBJECTS_SEARCH_LOCAL_NODE, id ); return _Status_Object_name_errors_to_status[ status ]; }
rtems_status_code rtems_port_ident( rtems_name name, rtems_id *id ) { Objects_Name_or_id_lookup_errors status; status = _Objects_Name_to_id_u32( &_Dual_ported_memory_Information, name, OBJECTS_SEARCH_ALL_NODES, id ); return _Status_Object_name_errors_to_status[ status ]; }
epos_status_code epos_message_queue_ident( epos_name name, uint32_t node, epos_id *id ) { Objects_Name_or_id_lookup_errors status; status = _Objects_Name_to_id_u32( &_Message_queue_Information, name, node, id ); return _Status_Object_name_errors_to_status[ status ]; }
rtems_task Init( rtems_task_argument argument ) { rtems_status_code status; puts( "\n\n*** SIMPLE SCHEDULER 02 TEST ***" ); status = _Objects_Name_to_id_u32( &_Thread_Internal_information, rtems_build_name( 'I', 'D', 'L', 'E' ), RTEMS_SEARCH_LOCAL_NODE, &Idle_id ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); /* * Create the semaphore. Then obtain and release the * semaphore with no other tasks running. */ puts( "INIT - Create priority ceiling semaphore" ); Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); status = rtems_semaphore_create( Semaphore_name[ 1 ], 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY, 2, &Semaphore_id[ 1 ] ); directive_failed( status, "rtems_semaphore_create of SM1" ); ObtainRelease( false ); /* * Create test task and obtain release the semaphore with * one other task running. */ puts( "INIT - create task 1" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); status = rtems_task_create( Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] ); status = rtems_task_start( Task_id[ 1 ], Test_task, 1 ); ObtainRelease( false ); /* * Create a a second test task and obtain release the semaphore * with both tasks running. */ puts( "INIT - create task 2" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '2', ' ' ); status = rtems_task_create( Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] ); status = rtems_task_start( Task_id[ 2 ], Test_task, 1 ); ObtainRelease( false ); /* * Obtain and release the semaphore with the idle task suspended. */ ObtainRelease( true ); /* End the Test */ puts( "*** END OF SIMPLE SCHEDULER 02 TEST ***" ); rtems_test_exit(0); }