コード例 #1
0
rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code     sc;
  int                   resets;

  puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" );

  puts( "Init - Trying to generate timer fire from ISR while firing" );
  puts( "Init - Variation is: " TEST_STRING );

  puts( "Init - There is no way for the test to know if it hits the case" );

  #if defined(SERVER_FIRE_AFTER)
   /* initiate timer server */
    sc = rtems_timer_initiate_server(
      RTEMS_MINIMUM_PRIORITY,
      RTEMS_MINIMUM_STACK_SIZE,
      RTEMS_DEFAULT_ATTRIBUTES
    );
    directive_failed( sc, "rtems_timer_initiate_server" );
  #endif

  puts( "Init - rtems_timer_create - OK" );
  sc = rtems_timer_create( rtems_build_name( 'P', 'E', 'R', '1' ), &Timer);
  directive_failed( sc, "rtems_timer_create" );

  Main_task = rtems_task_self();

  interrupt_critical_section_test_support_initialize( test_release_from_isr );

  for (resets=0 ; resets<10 ;) {
    if ( interrupt_critical_section_test_support_delay() )
      resets++;

    sc = TEST_DIRECTIVE( Timer, 10, TimerMethod, NULL );
    directive_failed( sc, "rtems_timer_fire_after");
  }

  puts( "*** END OF TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" );
  rtems_test_exit(0);
}
コード例 #2
0
ファイル: init.c プロジェクト: aniwang2013/leon-rtems
rtems_task Init(
  rtems_task_argument argument
)
{
  uint32_t    index;
  rtems_status_code status;

  puts( "\n\n*** TEST 20 ***" );

  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
  Task_name[ 4 ] =  rtems_build_name( 'T', 'A', '4', ' ' );
  Task_name[ 5 ] =  rtems_build_name( 'T', 'A', '5', ' ' );
  Task_name[ 6 ] =  rtems_build_name( 'T', 'A', '6', ' ' );

  for ( index = 1 ; index <= 6 ; index++ ) {
    status = rtems_task_create(
      Task_name[ index ],
      Priorities[ index ],
      RTEMS_MINIMUM_STACK_SIZE * 4,
      RTEMS_DEFAULT_MODES,
      RTEMS_DEFAULT_ATTRIBUTES,
      &Task_id[ index ]
    );
    directive_failed( status, "rtems_task_create loop" );
  }

  for ( index = 1 ; index <= 6 ; index++ ) {
    status = rtems_task_start( Task_id[ index ], Task_1_through_6, index );
    directive_failed( status, "rtems_task_start loop" );
  }

  Count.count[ 1 ] = 0;
  Count.count[ 2 ] = 0;
  Count.count[ 3 ] = 0;
  Count.count[ 4 ] = 0;
  Count.count[ 5 ] = 0;
  Count.count[ 6 ] = 0;

  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
コード例 #3
0
rtems_task Task_2(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  Task_2_preempted = FALSE;

  puts( "TA2 - Suspending self" );
  status = rtems_task_suspend( RTEMS_SELF );
  directive_failed( status, "rtems_task_suspend of TA2" );

  puts( "TA2 - signal_return preempted correctly" );

  Task_2_preempted = TRUE;

  status = rtems_task_suspend( RTEMS_SELF );
  directive_failed( status, "rtems_task_suspend of TA2" );
}
コード例 #4
0
ファイル: task1.c プロジェクト: aniwang2013/leon-rtems
rtems_task Task_1(
  rtems_task_argument argument
)
{
  rtems_id          tid2;
  rtems_id          tid3;
  rtems_status_code status;
  rtems_name        tid2_name;
  uint32_t    previous_priority;

  puts( "TA1 - rtems_task_wake_after - sleep 1 second" );
  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after" );

  status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid2 );
  directive_failed( status, "rtems_task_ident of TA2" );

  printf(
    "TA1 - rtems_task_ident - tid of TA2 (0x%.8" PRIxrtems_id ")\n", tid2
  );
  status = rtems_object_get_classic_name( tid2, &tid2_name );
  directive_failed( status, "rtems_object_get_classic_name of TA2" );

  printf( "TA1 - rtems_get_classic_name - id -> name of TA2 %sOK\n",
    (tid2_name != Task_name[2]) ? "NOT " : "" );

  status = rtems_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 );
  directive_failed( status, "rtems_task_ident of TA3" );

  printf(
    "TA1 - rtems_task_ident - tid of TA3 (0x%.8" PRIxrtems_id ")\n", tid3
  );

  status = rtems_task_set_priority( tid3, 2, &previous_priority );
  directive_failed( status, "rtems_task_set_priority" );

  puts( "TA1 - rtems_task_set_priority - set TA3's priority to 2" );

  puts( "TA1 - rtems_task_suspend - suspend TA2" );
  status = rtems_task_suspend( tid2 );
  directive_failed( status, "rtems_task_suspend of TA2" );

  puts( "TA1 - rtems_task_delete - delete TA2" );
  status = rtems_task_delete( tid2 );
  directive_failed( status, "rtems_task_delete of TA2" );

  puts( "TA1 - rtems_task_wake_after - sleep for 5 seconds" );
  status = rtems_task_wake_after( 5 * rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after" );

  puts( "*** END OF TEST 2 ***" );
  rtems_test_exit( 0 );
}
コード例 #5
0
ファイル: delay.c プロジェクト: aniwang2013/leon-rtems
rtems_timer_service_routine Delayed_resume(
  rtems_id  ignored_id,
  void     *ignored_address
)
{
  rtems_status_code status;

  status = rtems_task_resume( Task_id[ 1 ] );
  directive_failed( status, "rtems_task_resume of self" );
}
コード例 #6
0
ファイル: task2.c プロジェクト: AlexShiLucky/rtems
rtems_task Task_2(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  puts( "TA2 - rtems_task_wake_after - sleep 1 minute" );
  status = rtems_task_wake_after( 60*rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after in TA2" );
}
コード例 #7
0
ファイル: first.c プロジェクト: aniwang2013/leon-rtems
rtems_task First_FP_task(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          tid;
  rtems_time_of_day time;
  uint32_t    task_index;
  INTEGER_DECLARE;
  FP_DECLARE;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "rtems_task_ident" );

  task_index = task_number( tid );

  INTEGER_LOAD( INTEGER_factors[ task_index ] );
  FP_LOAD( FP_factors[ task_index ] );

  put_name( Task_name[ task_index ], FALSE );
  printf(
    " - integer base = (0x%" PRIx32 ")\n",
    INTEGER_factors[ task_index ]
  );
  put_name( Task_name[ task_index ], FALSE );
  #if ( RTEMS_HAS_HARDWARE_FP == 1 )
    printf( " - float base = (%g)\n", FP_factors[ task_index ] );
  #else
    printf( " - float base = (NA)\n" );
  #endif

  if ( argument == 0 ) {
    status = rtems_task_restart( RTEMS_SELF, 1 );
    directive_failed( status, "rtems_task_restart of RTEMS_SELF" );
  } else {
    build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
    status = rtems_clock_set( &time );
    directive_failed( status, "rtems_clock_set" );

    status = rtems_task_delete( RTEMS_SELF );
    directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
  }
}
コード例 #8
0
rtems_task test_init(
  rtems_task_argument argument
)
{
  int                  index;
  rtems_task_entry     task_entry;
  rtems_task_priority  priority;
  rtems_id             task_id;
  rtems_status_code    status;

  status = rtems_message_queue_create(
    rtems_build_name( 'M', 'Q', '1', ' ' ),
    OPERATION_COUNT,
    MESSAGE_SIZE,
    RTEMS_DEFAULT_ATTRIBUTES,
    &Queue_id
  );
  directive_failed( status, "rtems_message_queue_create" );

  priority = RTEMS_MAXIMUM_PRIORITY - 2u;
  if ( OPERATION_COUNT > RTEMS_MAXIMUM_PRIORITY - 2u )
    operation_count =  (int) (RTEMS_MAXIMUM_PRIORITY - 2u);

  for( index = 0; index < operation_count ; index++ ) {
    status = rtems_task_create(
      rtems_build_name( 'T', 'I', 'M', 'E' ),
      priority,
      RTEMS_MINIMUM_STACK_SIZE,
      RTEMS_DEFAULT_MODES,
      RTEMS_DEFAULT_ATTRIBUTES,
      &task_id
    );
    directive_failed( status, "rtems_task_create LOOP" );

    priority--;

    if ( index==operation_count-1 ) task_entry = High_task;
    else                            task_entry = Low_tasks;

    status = rtems_task_start( task_id, task_entry, 0 );
    directive_failed( status, "rtems_task_start LOOP" );
  }
}
コード例 #9
0
ファイル: init.c プロジェクト: aniwang2013/leon-rtems
rtems_task Other_Task(rtems_task_argument ignored)
{
  rtems_status_code sc;

  puts( "Deleting task variables in another task" );
  sc = rtems_task_variable_delete(main_task, (void **)&taskvar1);
  directive_failed( sc, "delete loop for other task" );

  (void) rtems_task_delete( RTEMS_SELF );
}
コード例 #10
0
rtems_task Init(
  rtems_task_argument ignored
)
{
  rtems_status_code     sc;
  rtems_id              period1;
  rtems_id              period2;

  puts( "\n\n*** TEST 60 ***" );

  puts( "Init - rtems_rate_monotonic_create - first period" );
  sc = rtems_rate_monotonic_create(
    rtems_build_name( 'P', 'E', 'R', '1' ),
    &period1
  );
  directive_failed( sc, "rtems_rate_monotonic_create 1" );

  puts( "Init - rtems_rate_monotonic_create - second period" );
  sc = rtems_rate_monotonic_create(
    rtems_build_name( 'P', 'E', 'R', '2' ),
    &period2
  );
  directive_failed( sc, "rtems_rate_monotonic_create 1" );

  puts( "Init - rtems_rate_monotonic_period - short period" );
  sc = rtems_rate_monotonic_period(period1, RTEMS_MILLISECONDS_TO_TICKS(200) );
  directive_failed( sc, "rtems_rate_monotonic_period" );

  puts( "Init - rtems_rate_monotonic_period - long period initiated" );
  sc = rtems_rate_monotonic_period(period2, RTEMS_MILLISECONDS_TO_TICKS(1000) );
  directive_failed( sc, "rtems_rate_monotonic_period" );

  puts( "Init - rtems_rate_monotonic_period - long period block" );
  sc = rtems_rate_monotonic_period(period2, RTEMS_MILLISECONDS_TO_TICKS(1000) );
  directive_failed( sc, "rtems_rate_monotonic_period" );

  puts( "Init - rtems_rate_monotonic_period - verify long period expired" );
  sc = rtems_rate_monotonic_period(period1, RTEMS_PERIOD_STATUS );
  fatal_directive_status(sc, RTEMS_TIMEOUT, "rtems_task_period status");

  puts( "*** END OF TEST 60 ***" );
  rtems_test_exit(0);
}
コード例 #11
0
ファイル: task2.c プロジェクト: Avanznow/rtems
rtems_task Task_2(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  puts( "TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" );
  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of TA2" );
}
コード例 #12
0
ファイル: task2.c プロジェクト: kelvin17/epos_double_context
epos_task Task_2(
  epos_task_argument argument
)
{
  epos_status_code status;

  printk( "TA2 - epos_task_wake_after - sleep 1 minute" );
  status = epos_task_wake_after( 60*TICKS_PER_SECOND );
  directive_failed( status, "epos_task_wake_after in TA2" );
}
コード例 #13
0
ファイル: init.c プロジェクト: gedare/rtems
static void benchmark_barrier_delete(
  int    iteration,
  void  *argument
)
{
  rtems_status_code status;

  status = rtems_barrier_delete( barrier[iteration] );
  directive_failed(status, "rtems_barrier_delete");
}
コード例 #14
0
rtems_task_priority Get_current_pri(void)
{
  rtems_status_code status;
  rtems_task_priority pri;
  status = rtems_task_set_priority(RTEMS_SELF,
				   RTEMS_CURRENT_PRIORITY,
				   &pri);
  directive_failed( status, " rtems_task_set_priority ");
  return pri;
}
コード例 #15
0
ファイル: task1.c プロジェクト: AlexShiLucky/rtems
rtems_task Task_1(
  rtems_task_argument argument
)
{
  rtems_id          tid2;
  rtems_id          tid3;
  uint32_t    pass;
  rtems_status_code status;

  status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 );
  directive_failed( status, "rtems_task_ident of TA2" );

  status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 );
  directive_failed( status, "rtems_task_ident of TA3" );

  for ( pass=1 ; pass <= 3 ; pass++ ) {

    puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
    status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() );
    directive_failed( status, "rtems_task_wake_after of TA1" );

    puts( "TA1 - rtems_task_suspend - suspend TA3" );
    status = rtems_task_suspend( tid3 );
    if ( pass == 1 ) {
      fatal_directive_status(
         status,
         RTEMS_ALREADY_SUSPENDED,
         "rtems_task_suspend of TA3"
      );
    } else {
      directive_failed( status, "rtems_task_suspend of TA3" );
    }

    puts( "TA1 - rtems_task_resume - resume TA2" );
    status = rtems_task_resume( tid2 );
    directive_failed( status, "rtems_task_resume of TA2" );

    puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
    status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() );
    directive_failed( status, "rtems_task_wake_after" );

    puts( "TA1 - rtems_task_suspend - suspend TA2" );
    status = rtems_task_suspend( tid2 );
    directive_failed( status, "rtems_task_suspend of TA2" );

    puts( "TA1 - rtems_task_resume - resume TA3" );
    status = rtems_task_resume( tid3 );
    directive_failed( status, "rtems_task_resume" );
  }

  TEST_END();
  rtems_test_exit( 0 );
}
コード例 #16
0
ファイル: ilatency.c プロジェクト: AlexShiLucky/rtems
rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id Task_id;

  Print_Warning();

  TEST_BEGIN();

  if (
    _Scheduler_Table[ 0 ].Operations.initialize
      != _Scheduler_priority_Initialize
  ) {
    puts( "  Error ==> " );
    puts( "Test only supported for deterministic priority scheduler\n" );
    rtems_test_exit( 0 );
  }

#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
  status = rtems_task_create(
    rtems_build_name( 'T', 'A', '1', ' ' ),
    LOW_PRIORITY,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &Task_id
  );
  directive_failed( status, "rtems_task_create Task_1" );

  status = rtems_task_start( Task_id, Task_1, 0 );
  directive_failed( status, "rtems_task_start Task_1" );

  benchmark_timer_initialize();
  benchmark_timer_read();
  benchmark_timer_initialize();
  timer_overhead = benchmark_timer_read();

  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
コード例 #17
0
rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  puts( "\n\n*** TEST 23 ***" );

  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );

  status = rtems_task_create(
    Task_name[ 1 ],
    1,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &Task_id[ 1 ]
  );
  directive_failed( status, "rtems_task_create of TA1" );

  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
  directive_failed( status, "rtems_task_start of TA1" );

  Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' );

  status = rtems_port_create(
    Port_name[ 1 ],
    Internal_port_area,
    External_port_area,
    0xff,
    &Port_id[ 1 ]
  );
  directive_failed( status, "rtems_port_create of DP1" );

  printf( "INIT - rtems_port_create - DP1 - int = %p   ext = %p\n",
          Internal_port_area,
          External_port_area
  );

  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
コード例 #18
0
ファイル: taskpreempt.c プロジェクト: goetzpf/rtems
rtems_task Init( rtems_task_argument ignored )
{
    Print_Warning();

    TEST_BEGIN();

    Task_name[0] = rtems_build_name( 'T','A','0','1' );
    status = rtems_task_create(
                 Task_name[0],
                 30,               /* TA01 is low priority task */
                 RTEMS_MINIMUM_STACK_SIZE,
                 RTEMS_DEFAULT_MODES,
                 RTEMS_DEFAULT_ATTRIBUTES,
                 &Task_id[0]
             );
    directive_failed( status, "rtems_task_create of TA01");

    Task_name[1] = rtems_build_name( 'T','A','0','2' );
    status = rtems_task_create(
                 Task_name[1],
                 28,               /* TA02 is high priority task */
                 RTEMS_MINIMUM_STACK_SIZE,
                 RTEMS_DEFAULT_MODES,
                 RTEMS_DEFAULT_ATTRIBUTES,
                 &Task_id[1]
             );
    directive_failed( status, "rtems_task_create of TA02");

    /* Find loop overhead */
    benchmark_timer_initialize();
    for ( count1 = 0; count1 < ( BENCHMARKS * 2 ) - 1; count1++ );
    {
        /* rtems_task_resume( Task_id[1] ); */
    }
    tloop_overhead = benchmark_timer_read();

    status = rtems_task_start( Task_id[0], Task01, 0 );
    directive_failed( status, "rtems_task_start of TA01");

    status = rtems_task_delete( RTEMS_SELF );
    directive_failed( status, "rtems_task_delete of INIT");
}
コード例 #19
0
rtems_task Delayed_events_task(
  rtems_task_argument argument
)
{
  uint32_t    count;
  uint32_t    previous_mode;
  rtems_status_code status;
  rtems_event_set   events;

  status = rtems_task_mode(
    RTEMS_PREEMPT | RTEMS_TIMESLICE,
    RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK,
    &previous_mode
  );
  directive_failed( status, "rtems_task_mode" );

  status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
  directive_failed( status, "rtems_timer_create" );

  while ( Stop_Test == FALSE ) {
    for ( count=DELAYED_EVENT_DOT_COUNT; Stop_Test == FALSE && count; count-- ){
      status = rtems_timer_fire_after(
        Timer_id[ 1 ],
        1,
        Delayed_send_event,
        NULL
      );
      directive_failed( status, "rtems_timer_reset" );

      status = rtems_event_receive(
        RTEMS_EVENT_16,
        RTEMS_DEFAULT_OPTIONS,
        RTEMS_NO_TIMEOUT,
        &events
      );
      directive_failed( status, "rtems_event_receive" );
    }
    put_dot('.');
  }

  Exit_test();
}
コード例 #20
0
rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  puts( "\n\n*** TEST 17 ***" );

  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );

  Task_2_preempted = FALSE;

  status = rtems_task_create(
    Task_name[ 1 ],
    2,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &Task_id[ 1 ]
  );
  directive_failed( status, "rtems_task_create of TA1" );

  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
  directive_failed( status, "rtems_task_start of TA1" );

  status = rtems_task_create(
    Task_name[ 2 ],
    1,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &Task_id[ 2 ]
  );
  directive_failed( status, "rtems_task_create of TA2" );

  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
  directive_failed( status, "rtems_task_start of TA2" );

  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
コード例 #21
0
rtems_task Task_2(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  status = rtems_signal_catch( Process_asr_for_task_2, RTEMS_DEFAULT_MODES );
  directive_failed( status, "rtems_signal_catch" );

  (void) rtems_task_suspend( RTEMS_SELF );
}
コード例 #22
0
rtems_asr Process_asr_for_pass_2(
  rtems_signal_set signals
)
{
  rtems_status_code status;

  status = rtems_task_resume( Task_id[ 3 ] );
  directive_failed( status, "rtems_task_resume" );

  benchmark_timer_initialize();
}
コード例 #23
0
ファイル: task3.c プロジェクト: aniwang2013/leon-rtems
rtems_task Task_3(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  while( FOREVER ) {
    status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
    directive_failed( status, "rtems_task_wake_after" );
  }
}
コード例 #24
0
ファイル: init.c プロジェクト: greenmeent/rtems
rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code sc;
  rtems_id          mutex;

  TEST_BEGIN();

  puts( "Create semaphore - priority ceiling unlocked - invalid ceiling" );
  sc = rtems_semaphore_create(
    rtems_build_name( 'S', 'E', 'M', '1' ),
    0,
    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY,
    UINT32_MAX,
    &mutex
  );
  fatal_directive_status(sc, RTEMS_INVALID_PRIORITY, "rtems_semaphore_create");

  puts( "Create semaphore - priority ceiling locked - violate ceiling" );
  sc = rtems_semaphore_create(
    rtems_build_name( 'S', 'E', 'M', '1' ),
    0,
    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY,
    (RTEMS_MAXIMUM_PRIORITY - 4u),
    &mutex
  );
  fatal_directive_status(sc, RTEMS_INVALID_PRIORITY, "rtems_semaphore_create");

  puts( "Create semaphore - priority ceiling unlocked" );
  sc = rtems_semaphore_create(
    rtems_build_name( 'S', 'E', 'M', '1' ),
    1,
    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY,
    (RTEMS_MAXIMUM_PRIORITY - 4u),
    &mutex
  );
  directive_failed( sc, "rtems_semaphore_create" );

  puts( "Obtain semaphore -- violate ceiling" );
  sc = rtems_semaphore_obtain( mutex, RTEMS_DEFAULT_OPTIONS, 0 );
  fatal_directive_status(
    sc, RTEMS_INVALID_PRIORITY, "rtems_semaphore_obtain" );

  puts( "Release semaphore we did not obtain" );
  sc = rtems_semaphore_release( mutex );
  fatal_directive_status(
    sc, RTEMS_NOT_OWNER_OF_RESOURCE, "rtems_semaphore_release" );

  test_create_initially_locked_prio_inherit_sema();

  TEST_END();
  rtems_test_exit( 0 );
}
コード例 #25
0
ファイル: init.c プロジェクト: gedare/rtems
static void benchmark_barrier_ident(
  int    iteration,
  void  *argument
)
{
  rtems_status_code status;
  rtems_id          id;

  status = rtems_barrier_ident( iteration+1, &id );
  directive_failed(status, "rtems_barrier_ident");
}
コード例 #26
0
rtems_task Task1(rtems_task_argument ignored)
{

  rtems_status_code status;
  status =  rtems_semaphore_obtain(
			 Mutex_id[0],
			 RTEMS_WAIT,
			 0);
  printf("T1 - rtems_semaphore_obtain - S0");
  directive_failed( status," rtems_semaphore_obtain S0");
}
コード例 #27
0
void Print_time( void )
{
  rtems_time_of_day time;
  rtems_status_code status;

  status = rtems_clock_get_tod( &time );
  directive_failed( status, "rtems_clock_get_tod" );

  put_name( Task_name[ 1 ], FALSE );
  print_time( "- rtems_clock_get_tod - ", &time, "\n" );
}
コード例 #28
0
void starttask(
  int arg
)
{
  rtems_id tid;
  rtems_status_code sc;
  rtems_task_priority priority;

  rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
  sc = rtems_task_create(rtems_build_name('S', 'R', 'V', arg + 'A'),
    priority,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
    RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
    &tid);
  directive_failed( sc, "task create" );

  sc = rtems_task_start(tid, subtask, (rtems_task_argument) arg);
  directive_failed( sc, "task start" );
}
コード例 #29
0
ファイル: task1.c プロジェクト: kelvin17/epos_double_context
epos_task Task_1(
  epos_task_argument argument
)
{
  epos_id          tid2;
  epos_id          tid3;
  epos_status_code status;
  epos_name        tid2_name;
  uint32_t    previous_priority;

  printk( "TA1 - epos_task_wake_after - sleep 1 second" );
  status = epos_task_wake_after( 1*TICKS_PER_SECOND );
  directive_failed( status, "epos_task_wake_after" );

  status = epos_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid2 );
  directive_failed( status, "epos_task_ident of TA2" );

  printk( "TA1 - epos_task_ident - tid of TA2 (0x%.8x)\n", tid2 );

  status = epos_object_get_classic_name( tid2, &tid2_name );
  directive_failed( status, "epos_object_get_classic_name of TA2" );

  printk( "TA1 - epos_get_classic_name - id -> name of TA2 %sOK\n",
    (tid2_name != Task_name[2]) ? "NOT " : "" );

  status = epos_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 );
  directive_failed( status, "epos_task_ident of TA3" );

  printk( "TA1 - epos_task_ident - tid of TA3 (0x%.8x)\n", tid3 );

  status = epos_task_set_priority( tid3, 2, &previous_priority );
  directive_failed( status, "epos_task_set_priority" );

  printk( "TA1 - epos_task_set_priority - set TA3's priority to 2" );


  printk( "TA1 - epos_task_suspend - suspend TA2" );
  status = epos_task_suspend( tid2 );
  directive_failed( status, "epos_task_suspend of TA2" );

  printk( "TA1 - epos_task_delete - delete TA2" );
  status = epos_task_delete( tid2 );
  directive_failed( status, "epos_task_delete of TA2" );

  printk( "TA1 - epos_task_wake_after - sleep for 5 seconds" );
  status = epos_task_wake_after( 5*TICKS_PER_SECOND );
  directive_failed( status, "epos_task_wake_after" );

  printk( "*** END OF TEST 2 ***" );
  epos_test_exit( 0 );
}
コード例 #30
0
ファイル: task1.c プロジェクト: AlexShiLucky/rtems
rtems_task Test_task(
  rtems_task_argument argument
)
{
  rtems_status_code status;
  rtems_id          tid;
  rtems_time_of_day time;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "rtems_task_ident" );

  status = rtems_clock_get_tod( &time );
  directive_failed( status, "rtems_clock_get_tod" );

  put_name( Task_name[ task_number( tid ) ], FALSE );
  print_time( " - rtems_clock_get_tod - ", &time, "\n" );

  status = rtems_task_wake_after( task_number( tid ) * 1 * rtems_clock_get_ticks_per_second() );
  directive_failed( status, "rtems_task_wake_after" );

  status = rtems_clock_get_tod( &time );
  directive_failed( status, "rtems_clock_get_tod" );
  put_name( Task_name[ task_number( tid ) ], FALSE );
  print_time( " - rtems_clock_get_tod - ", &time, "\n" );

  if ( task_number(tid) == 1 ) {          /* TASK 1 */
    put_name( Task_name[ 1 ], FALSE );
    printf( " - deleting self\n" );
    status = rtems_task_delete( RTEMS_SELF );
    directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
  }
  else if ( task_number(tid) == 2 ) {     /* TASK 2 */
    put_name( Task_name[ 2 ], FALSE );
    printf( " - waiting to be deleted by " );
    put_name( Task_name[ 3 ], TRUE );
    while ( FOREVER );
  }
  else {                                  /* TASK 3 */
    put_name( Task_name[ 3 ], FALSE );
    printf( " - getting TID of " );
    put_name( Task_name[ 2 ], TRUE );
    do {
      status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid );
    } while ( status != RTEMS_SUCCESSFUL );
    directive_failed( status, "rtems_task_ident" );

    put_name( Task_name[ 3 ], FALSE );
    printf( " - deleting " );
    put_name( Task_name[ 2 ], TRUE );
    status = rtems_task_delete( tid );
    directive_failed( status, "rtems_task_delete of Task 2" );

    puts( "*** END OF TEST 1 ***" );
    rtems_test_exit(0);
  }
}