source: rtems/testsuites/sptests/sp73/init.c @ 3c8eda7

4.115
Last change on this file since 3c8eda7 was 3c8eda7, checked in by Joel Sherrill <joel.sherrill@…>, on 05/12/12 at 16:01:26

sptests - Eliminate missing prototype warnings

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
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.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <bsp.h>
15#include <inttypes.h>
16#include "tmacros.h"
17
18/* forward declarations to avoid warnings */
19rtems_task Init(rtems_task_argument argument);
20rtems_task Test_task(rtems_task_argument argument);
21
22rtems_id   Task_id[ 4 ];         /* array of task ids */
23rtems_name Task_name[ 4 ];       /* array of task names */
24
25rtems_task Test_task(
26  rtems_task_argument arg
27)
28{
29  rtems_time_of_day time;
30  uint32_t          task_index;
31  rtems_status_code status;
32
33  task_index = arg;
34  for ( ; ; ) {
35    status = rtems_clock_get_tod( &time );
36    directive_failed( status, "get tod" );
37
38    if ( time.second >= 15 ) {
39      puts( "*** END OF SP73 (YIELD) TEST ***" );
40      rtems_test_exit( 0 );
41    }
42    put_name( Task_name[ task_index ], FALSE );
43    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
44    status = rtems_task_wake_after(
45      task_index * 5 * rtems_clock_get_ticks_per_second()
46    );
47    directive_failed( status, "wake after" );
48  }
49}
50
51rtems_task Init(
52  rtems_task_argument argument
53)
54{
55  rtems_status_code   status;
56  rtems_time_of_day   time;
57  rtems_task_priority old;
58
59  puts( "\n\n*** SP73 (YIELD) TEST ***" );
60
61  time.year   = 1988;
62  time.month  = 12;
63  time.day    = 31;
64  time.hour   = 9;
65  time.minute = 0;
66  time.second = 0;
67  time.ticks  = 0;
68
69  status = rtems_clock_set( &time );
70
71  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
72  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
73  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
74
75  status = rtems_task_create(
76    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
77    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
78  );
79  directive_failed( status, "create 1" );
80
81  status = rtems_task_create(
82    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
83    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
84  );
85  directive_failed( status, "create 2" );
86
87  status = rtems_task_create(
88    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES,
89    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
90  );
91  directive_failed( status, "create 3" );
92
93  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
94  directive_failed( status, "start 1" );
95  rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
96
97  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
98  directive_failed( status, "start 2" );
99  rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
100
101  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
102  directive_failed( status, "start 3" );
103
104  status = rtems_task_set_priority(Task_id[1], 1, &old);
105  directive_failed( status, "set priority" );
106
107  status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
108  directive_failed( status, "wake after" );
109
110  status = rtems_task_delete( RTEMS_SELF );
111  directive_failed( status, "delete" );
112}
113
114/* configuration information */
115#define CONFIGURE_SCHEDULER_SIMPLE
116#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
117#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
118
119#define CONFIGURE_MAXIMUM_TASKS           4
120
121#define CONFIGURE_INIT_TASK_PRIORITY      2
122#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
123
124#define CONFIGURE_INIT
125#include <rtems/confdefs.h>
126/* end of file */
Note: See TracBrowser for help on using the repository browser.