source: rtems/testsuites/sptests/sp19/fptask.c @ 1055ce20

4.104.115
Last change on this file since 1055ce20 was c87608f, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/30/04 at 11:15:35

2004-03-30 Ralf Corsepius <ralf_corsepius@…>

  • sp02/task1.c, sp04/system.h, sp04/task1.c, sp04/tswitch.c, sp05/task1.c, sp06/task1.c, sp09/screen01.c, sp09/screen07.c, sp09/screen12.c, sp09/system.h, sp09/task3.c, sp11/task1.c, sp12/pridrv.c, sp12/pritask.c, sp12/system.h, sp13/task1.c, sp13/task2.c, sp13/task3.c, sp14/system.h, sp15/system.h, sp16/system.h, sp17/system.h, sp19/first.c, sp19/fptask.c, sp19/inttest.h, sp19/system.h, sp19/task1.c, sp20/init.c, sp20/system.h, sp20/task1.c, sp23/system.h, sp24/init.c, sp25/system.h, sp30/init.c, spfatal/fatal.c, spfatal/puterr.c, spfatal/system.h, spsize/size.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*  FP_task
2 *
3 *  This routine serves as a floating point test task.  It verifies the
4 *  basic task switching capabilities of the executive when floating
5 *  point is configured.
6 *
7 *  Input parameters:
8 *    argument - task argument
9 *
10 *  Output parameters:  NONE
11 *
12 *  COPYRIGHT (c) 1989-1999.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23#include "fptest.h"
24#include "inttest.h"
25
26rtems_task FP_task(
27  rtems_task_argument argument
28)
29{
30  rtems_status_code status;
31  rtems_id          tid;
32  rtems_time_of_day time;
33  uint32_t    task_index;
34  uint32_t    previous_seconds;
35  INTEGER_DECLARE;
36  FP_DECLARE;
37
38  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
39  directive_failed( status, "rtems_task_ident of self" );
40
41  task_index = task_number( tid );
42
43  INTEGER_LOAD( INTEGER_factors[ task_index ] );
44  FP_LOAD( FP_factors[ task_index ] );
45
46  put_name( Task_name[ task_index ], FALSE );
47  printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] );
48  put_name( Task_name[ task_index ], FALSE );
49#if ( RTEMS_HAS_HARDWARE_FP == 1 )
50  printf( " - float base = (%g)\n", FP_factors[ task_index ] );
51#else
52  printf( " - float base = (NA)\n" );
53#endif
54
55  previous_seconds = -1;
56
57  while( FOREVER ) {
58
59    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
60    directive_failed( status, "rtems_clock_get" );
61
62    if ( time.second >= 16 ) {
63
64      if ( task_number( tid ) == 4 ) {
65        puts( "TA4 - rtems_task_delete - self" );
66        status = rtems_task_delete( RTEMS_SELF );
67        directive_failed( status, "rtems_task_delete of TA4" );
68      }
69      puts( "TA5 - rtems_task_delete - TA3" );
70      status = rtems_task_delete( Task_id[ 3 ] );
71      directive_failed( status, "rtems_task_delete of TA3" );
72
73      puts( "*** END OF TEST 19 *** " );
74      rtems_test_exit( 0 );
75    }
76
77    if (previous_seconds != time.second)
78    {
79      put_name( Task_name[ task_index ], FALSE );
80      print_time( " - rtems_clock_get - ", &time, "\n" );
81      previous_seconds = time.second;
82    }
83
84    INTEGER_CHECK( INTEGER_factors[ task_index ] );
85    FP_CHECK( FP_factors[ task_index ] );
86
87    /* for the first 4 seconds we spin as fast as possible
88     * so that we likely are interrupted
89     * After that, we go to sleep for a second at a time
90     */
91    if (time.second >= 4)
92    {
93      status = rtems_task_wake_after( TICKS_PER_SECOND );
94      directive_failed( status, "rtems_task_wake_after" );
95    }
96  }
97}
Note: See TracBrowser for help on using the repository browser.