source: rtems/testsuites/sptests/sp19/fptask.c @ 072d2a09

4.104.115
Last change on this file since 072d2a09 was b84f1fdc, checked in by Joel Sherrill <joel.sherrill@…>, on 05/10/09 at 14:39:46

2009-05-10 Joel Sherrill <joel.sherrill@…>

  • sp04/system.h, sp04/task1.c, sp04/tswitch.c, sp07/init.c, sp12/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c, sp15/init.c, sp16/system.h, sp19/fptask.c, sp25/system.h, sp26/task1.c, sp27/init.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp33/init.c, sp34/changepri.c, sp35/priinv.c, sp37/init.c, sp38/init.c, sp39/init.c, sp41/init.c, sp42/init.c, sp43/init.c, sp44/init.c, sp45/init.c, sp46/init.c, sp47/init.c, sp48/init.c, spfatal03/testcase.h, spfatal05/testcase.h, spfatal06/testcase.h, spfatal_support/system.h, spobjgetnext/init.c, spsize/getint.c, spsize/size.c: Fix warnings.
  • 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-2009.
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 = (uint32_t)-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.