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-1998. |
---|
13 | * On-Line Applications Research Corporation (OAR). |
---|
14 | * Copyright assigned to U.S. Government, 1994. |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.OARcorp.com/rtems/license.html. |
---|
19 | * |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | #include "system.h" |
---|
24 | #include "fptest.h" |
---|
25 | #include "inttest.h" |
---|
26 | |
---|
27 | rtems_task FP_task( |
---|
28 | rtems_task_argument argument |
---|
29 | ) |
---|
30 | { |
---|
31 | rtems_status_code status; |
---|
32 | rtems_id tid; |
---|
33 | rtems_time_of_day time; |
---|
34 | rtems_unsigned32 task_index; |
---|
35 | rtems_unsigned32 previous_seconds; |
---|
36 | INTEGER_DECLARE; |
---|
37 | FP_DECLARE; |
---|
38 | |
---|
39 | status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); |
---|
40 | directive_failed( status, "rtems_task_ident of self" ); |
---|
41 | |
---|
42 | task_index = task_number( tid ); |
---|
43 | |
---|
44 | INTEGER_LOAD( INTEGER_factors[ task_index ] ); |
---|
45 | FP_LOAD( FP_factors[ task_index ] ); |
---|
46 | |
---|
47 | put_name( Task_name[ task_index ], FALSE ); |
---|
48 | printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] ); |
---|
49 | put_name( Task_name[ task_index ], FALSE ); |
---|
50 | #if ( RTEMS_HAS_HARDWARE_FP == 1 ) |
---|
51 | printf( " - float base = (%g)\n", FP_factors[ task_index ] ); |
---|
52 | #else |
---|
53 | printf( " - float base = (NA)\n" ); |
---|
54 | #endif |
---|
55 | |
---|
56 | previous_seconds = -1; |
---|
57 | |
---|
58 | while( FOREVER ) { |
---|
59 | |
---|
60 | status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); |
---|
61 | directive_failed( status, "rtems_clock_get" ); |
---|
62 | |
---|
63 | if ( time.second >= 16 ) { |
---|
64 | |
---|
65 | if ( task_number( tid ) == 4 ) { |
---|
66 | puts( "TA4 - rtems_task_delete - self" ); |
---|
67 | status = rtems_task_delete( RTEMS_SELF ); |
---|
68 | directive_failed( status, "rtems_task_delete of TA4" ); |
---|
69 | } |
---|
70 | puts( "TA5 - rtems_task_delete - TA3" ); |
---|
71 | status = rtems_task_delete( Task_id[ 3 ] ); |
---|
72 | directive_failed( status, "rtems_task_delete of TA3" ); |
---|
73 | |
---|
74 | puts( "*** END OF TEST 19 *** " ); |
---|
75 | exit( 0 ); |
---|
76 | } |
---|
77 | |
---|
78 | if (previous_seconds != time.second) |
---|
79 | { |
---|
80 | put_name( Task_name[ task_index ], FALSE ); |
---|
81 | print_time( " - rtems_clock_get - ", &time, "\n" ); |
---|
82 | previous_seconds = time.second; |
---|
83 | } |
---|
84 | |
---|
85 | INTEGER_CHECK( INTEGER_factors[ task_index ] ); |
---|
86 | FP_CHECK( FP_factors[ task_index ] ); |
---|
87 | |
---|
88 | /* for the first 4 seconds we spin as fast as possible |
---|
89 | * so that we likely are interrupted |
---|
90 | * After that, we go to sleep for a second at a time |
---|
91 | */ |
---|
92 | if (time.second >= 4) |
---|
93 | { |
---|
94 | status = rtems_task_wake_after( TICKS_PER_SECOND ); |
---|
95 | directive_failed( status, "rtems_task_wake_after" ); |
---|
96 | } |
---|
97 | } |
---|
98 | } |
---|