OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [sptests/] [sp19/] [fptask.c] - Diff between revs 30 and 173

Only display areas with differences | Details | Blame | View Log

Rev 30 Rev 173
/*  FP_task
/*  FP_task
 *
 *
 *  This routine serves as a floating point test task.  It verifies the
 *  This routine serves as a floating point test task.  It verifies the
 *  basic task switching capabilities of the executive when floating
 *  basic task switching capabilities of the executive when floating
 *  point is configured.
 *  point is configured.
 *
 *
 *  Input parameters:
 *  Input parameters:
 *    argument - task argument
 *    argument - task argument
 *
 *
 *  Output parameters:  NONE
 *  Output parameters:  NONE
 *
 *
 *  COPYRIGHT (c) 1989-1999.
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *  On-Line Applications Research Corporation (OAR).
 *
 *
 *  The license and distribution terms for this file may be
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *
 *  $Id: fptask.c,v 1.2 2001-09-27 12:02:34 chris Exp $
 *  $Id: fptask.c,v 1.2 2001-09-27 12:02:34 chris Exp $
 */
 */
 
 
#include "system.h"
#include "system.h"
#include "fptest.h"
#include "fptest.h"
#include "inttest.h"
#include "inttest.h"
 
 
rtems_task FP_task(
rtems_task FP_task(
  rtems_task_argument argument
  rtems_task_argument argument
)
)
{
{
  rtems_status_code status;
  rtems_status_code status;
  rtems_id          tid;
  rtems_id          tid;
  rtems_time_of_day time;
  rtems_time_of_day time;
  rtems_unsigned32  task_index;
  rtems_unsigned32  task_index;
  rtems_unsigned32  previous_seconds;
  rtems_unsigned32  previous_seconds;
  INTEGER_DECLARE;
  INTEGER_DECLARE;
  FP_DECLARE;
  FP_DECLARE;
 
 
  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  directive_failed( status, "rtems_task_ident of self" );
  directive_failed( status, "rtems_task_ident of self" );
 
 
  task_index = task_number( tid );
  task_index = task_number( tid );
 
 
  INTEGER_LOAD( INTEGER_factors[ task_index ] );
  INTEGER_LOAD( INTEGER_factors[ task_index ] );
  FP_LOAD( FP_factors[ task_index ] );
  FP_LOAD( FP_factors[ task_index ] );
 
 
  put_name( Task_name[ task_index ], FALSE );
  put_name( Task_name[ task_index ], FALSE );
  printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
  printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
  put_name( Task_name[ task_index ], FALSE );
  put_name( Task_name[ task_index ], FALSE );
#if ( RTEMS_HAS_HARDWARE_FP == 1 )
#if ( RTEMS_HAS_HARDWARE_FP == 1 )
  printf( " - float base = (%g)\n", FP_factors[ task_index ] );
  printf( " - float base = (%g)\n", FP_factors[ task_index ] );
#else
#else
  printf( " - float base = (NA)\n" );
  printf( " - float base = (NA)\n" );
#endif
#endif
 
 
  previous_seconds = -1;
  previous_seconds = -1;
 
 
  while( FOREVER ) {
  while( FOREVER ) {
 
 
    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
    directive_failed( status, "rtems_clock_get" );
    directive_failed( status, "rtems_clock_get" );
 
 
    if ( time.second >= 16 ) {
    if ( time.second >= 16 ) {
 
 
      if ( task_number( tid ) == 4 ) {
      if ( task_number( tid ) == 4 ) {
        puts( "TA4 - rtems_task_delete - self" );
        puts( "TA4 - rtems_task_delete - self" );
        status = rtems_task_delete( RTEMS_SELF );
        status = rtems_task_delete( RTEMS_SELF );
        directive_failed( status, "rtems_task_delete of TA4" );
        directive_failed( status, "rtems_task_delete of TA4" );
      }
      }
      puts( "TA5 - rtems_task_delete - TA3" );
      puts( "TA5 - rtems_task_delete - TA3" );
      status = rtems_task_delete( Task_id[ 3 ] );
      status = rtems_task_delete( Task_id[ 3 ] );
      directive_failed( status, "rtems_task_delete of TA3" );
      directive_failed( status, "rtems_task_delete of TA3" );
 
 
      puts( "*** END OF TEST 19 *** " );
      puts( "*** END OF TEST 19 *** " );
      exit( 0 );
      exit( 0 );
    }
    }
 
 
    if (previous_seconds != time.second)
    if (previous_seconds != time.second)
    {
    {
      put_name( Task_name[ task_index ], FALSE );
      put_name( Task_name[ task_index ], FALSE );
      print_time( " - rtems_clock_get - ", &time, "\n" );
      print_time( " - rtems_clock_get - ", &time, "\n" );
      previous_seconds = time.second;
      previous_seconds = time.second;
    }
    }
 
 
    INTEGER_CHECK( INTEGER_factors[ task_index ] );
    INTEGER_CHECK( INTEGER_factors[ task_index ] );
    FP_CHECK( FP_factors[ task_index ] );
    FP_CHECK( FP_factors[ task_index ] );
 
 
    /* for the first 4 seconds we spin as fast as possible
    /* for the first 4 seconds we spin as fast as possible
     * so that we likely are interrupted
     * so that we likely are interrupted
     * After that, we go to sleep for a second at a time
     * After that, we go to sleep for a second at a time
     */
     */
    if (time.second >= 4)
    if (time.second >= 4)
    {
    {
      status = rtems_task_wake_after( TICKS_PER_SECOND );
      status = rtems_task_wake_after( TICKS_PER_SECOND );
      directive_failed( status, "rtems_task_wake_after" );
      directive_failed( status, "rtems_task_wake_after" );
    }
    }
  }
  }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.