예제 #1
0
void buffered_io_flush(void)
{
  char ch;

  while ( !Ring_buffer_Is_empty(&Buffer) ) {
     Ring_buffer_Remove_character( &Buffer, ch );
     fprintf( stderr, "%c", ch );
  }
  FLUSH_OUTPUT();
}
예제 #2
0
rtems_task Task_1_through_5(
  rtems_task_argument argument
)
{
  rtems_id          rmid;
  rtems_id          test_rmid;
  uint32_t          index;
  uint32_t          pass;
  uint32_t          failed;
  rtems_status_code status;

  status = rtems_rate_monotonic_create( argument, &rmid );
  directive_failed( status, "rtems_rate_monotonic_create" );
  put_name( Task_name[ argument ], FALSE );
  printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", rmid );

  status = rtems_rate_monotonic_ident( argument, &test_rmid );
  directive_failed( status, "rtems_rate_monotonic_ident" );
  put_name( Task_name[ argument ], FALSE );
  printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", test_rmid );

  if ( rmid != test_rmid ) {
     printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", rmid, test_rmid );
     rtems_test_exit( 0 );
  }

  put_name( Task_name[ argument ], FALSE );
  printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", rmid, Periods[ argument ] );

  status = rtems_task_wake_after( 2 );
  directive_failed( status, "rtems_task_wake_after" );

  switch ( argument ) {
    case 1:
    case 2:
    case 3:
    case 4:
      while ( FOREVER ) {
        status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
        directive_failed( status, "rtems_rate_monotonic_period" );
        Count.count[ argument ]++;
      }
      break;
    case 5:
      pass   = 0;
      failed = 0;

      status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
      directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" );

      Get_all_counters();

      while ( FOREVER ) {
        status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
        directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" );

        Get_all_counters();

        for( index = 1 ; index <= 4 ; index++ ) {
          if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
            puts_nocr( "FAIL -- " );
            put_name ( Task_name[ index ], FALSE );
            printf   ( " Actual=%" PRIu32 ", Expected=%" PRIu32 "\n",
                       Temporary_count.count[ index ],
                       Iterations[ index ]
                     );
            failed += 1;
          }
        }

        if ( failed == 5 )
          rtems_test_exit( 0 );

        pass += 1;

        printf( "TA5 - PERIODS CHECK OK (%" PRIu32 ")\n", pass );

        FLUSH_OUTPUT();

        if ( pass == 10 ) {
          puts( "" );
          rtems_rate_monotonic_report_statistics();

          rtems_rate_monotonic_reset_statistics( rmid );
          puts( "" );
          puts( "TA5 - PERIOD STATISTICS RESET" );
          puts( "" );
          rtems_rate_monotonic_report_statistics();

          rtems_rate_monotonic_reset_all_statistics();
          puts( "" );
          puts( "TA5 - ALL PERIOD STATISTICS RESET" );
          puts( "" );
          rtems_rate_monotonic_report_statistics();

          puts( "" );
          puts( "*** END OF RATE MONOTONIC PERIOD STATISTICS TEST ***" );

          rtems_test_exit( 0 );
        }

      }
      break;
  }
}
예제 #3
0
rtems_task Task_1(
  rtems_task_argument argument
)
{
  rtems_mode        previous_mode;
  rtems_status_code status;

  puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" );
  status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) );
  directive_failed( status, "rtems_signal_catch" );

  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" );
  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 );
  directive_failed( status, "rtems_signal_send" );

  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" );
  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 );
  directive_failed( status, "rtems_signal_send" );

  puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" );
  status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR );
  directive_failed( status, "rtems_signal_catch" );

  FLUSH_OUTPUT();

rtems_test_pause();

  puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" );
  status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
  directive_failed( status, "rtems_signal_send" );

  puts( "TA1 - rtems_task_mode - disable ASRs" );
  status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode );
  directive_failed( status, "rtems_task_mode" );

  Timer_got_this_id = 0;
  Timer_got_this_pointer = NULL;

  puts( "TA1 - sending signal to RTEMS_SELF from timer" );
  status = rtems_timer_fire_after(
    Timer_id[ 1 ],
    rtems_clock_get_ticks_per_second() / 2,
    Signal_3_to_task_1,
    (void *) Task_1
  );
  directive_failed( status, "rtems_timer_fire_after" );

  puts( "TA1 - waiting for signal to arrive" );

  Signals_sent = FALSE;
  Asr_fired    = FALSE;

  while ( Signals_sent == FALSE )
    ;

  if ( Timer_got_this_id == Timer_id[ 1 ] &&
       Timer_got_this_pointer == Task_1 )
    puts( "TA1 - timer routine got the correct arguments" );
  else
    printf(
      "TA1 - timer got (0x%" PRIxrtems_id ", %p) instead of (0x%" PRIxrtems_id ", %p)!!!!\n",
      Timer_got_this_id,
      Timer_got_this_pointer,
      Timer_id[ 1 ],
      Task_1
    );

  puts( "TA1 - rtems_task_mode - enable ASRs" );
  FLUSH_OUTPUT();
  status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode );
  directive_failed( status, "rtems_task_mode" );

  status = rtems_task_wake_after(2 * rtems_clock_get_ticks_per_second());
  directive_failed( status, "rtems_task_wake_after" );

  puts( "TA1 - rtems_signal_catch - asraddr of NULL" );
  status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES );
  directive_failed( status, "rtems_signal_catch" );

  puts( "TA1 - rtems_task_delete - delete self" );
  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}