source: rtems/testsuites/sptests/sp19/fptask.c @ e1462e1

4.115
Last change on this file since e1462e1 was e1462e1, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 2, 2014 at 5:30:25 PM

sp19: Eliminate warnings

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include "system.h"
15#include "fptest.h"
16#include "inttest.h"
17
18rtems_task FP_task(
19  rtems_task_argument argument
20)
21{
22  rtems_status_code status;
23  rtems_id          tid;
24  rtems_time_of_day time;
25  uint32_t          task_index;
26  uint32_t          previous_seconds;
27  INTEGER_DECLARE;
28  FP_DECLARE;
29
30  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
31  directive_failed( status, "rtems_task_ident of self" );
32
33  task_index = task_number( tid );
34
35  INTEGER_LOAD( INTEGER_factors[ task_index ] );
36  FP_LOAD( FP_factors[ task_index ] );
37
38  put_name( Task_name[ task_index ], FALSE );
39  printf(
40    " - integer base = (0x%" PRIx32 ")\n",
41    INTEGER_factors[ task_index ]
42  );
43  put_name( Task_name[ task_index ], FALSE );
44  printf( " - float base = (%g)\n", FP_factors[ task_index ] );
45
46  previous_seconds = (uint32_t)-1;
47
48  while( FOREVER ) {
49
50    status = rtems_clock_get_tod( &time );
51    directive_failed( status, "rtems_clock_get_tod" );
52
53    if ( time.second >= 16 ) {
54      if ( task_number( tid ) == 4 ) {
55        puts( "TA4 - rtems_task_delete - self" );
56        status = rtems_task_delete( RTEMS_SELF );
57        directive_failed( status, "rtems_task_delete of TA4" );
58      }
59      puts( "TA5 - rtems_task_delete - TA3" );
60      status = rtems_task_delete( Task_id[ 3 ] );
61      directive_failed( status, "rtems_task_delete of TA3" );
62
63      TEST_END();
64      rtems_test_exit( 0 );
65    }
66
67    if (previous_seconds != time.second) {
68      put_name( Task_name[ task_index ], FALSE );
69      print_time( " - rtems_clock_get_tod - ", &time, "\n" );
70      previous_seconds = time.second;
71    }
72
73    INTEGER_CHECK( INTEGER_factors[ task_index ] );
74    FP_CHECK( FP_factors[ task_index ] );
75
76    /* for the first 4 seconds we spin as fast as possible
77     * so that we likely are interrupted
78     * After that, we go to sleep for a second at a time
79     */
80    if (time.second >= 4) {
81      status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
82      directive_failed( status, "rtems_task_wake_after" );
83    }
84  }
85}
Note: See TracBrowser for help on using the repository browser.