source: rtems/testsuites/samples/ticker/init.c @ f6ef96c2

4.104.115
Last change on this file since f6ef96c2 was dfc6f3dc, checked in by Joel Sherrill <joel.sherrill@…>, on 05/10/07 at 19:31:36

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

  • ticker/Makefile.am, ticker/init.c, ticker/system.h, ticker/tasks.c: Test needs clock manager. Should use rtems_test_exit() instead of exit().
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*  Init
2 *
3 *  This routine is the initialization task for this test program.
4 *  It is called from init_exec and has the responsibility for creating
5 *  and starting the tasks that make up the test.  If the time of day
6 *  clock is required for the test, it should also be set to a known
7 *  value by this function.
8 *
9 *  Input parameters:  NONE
10 *
11 *  Output parameters:  NONE
12 *
13 *  COPYRIGHT (c) 1989-1999.
14 *  On-Line Applications Research Corporation (OAR).
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.rtems.com/license/LICENSE.
19 *
20 *  $Id$
21 */
22
23#define CONFIGURE_INIT
24#include "system.h"
25
26/*
27 *  Keep the names and IDs in global variables so another task can use them.
28 */
29
30rtems_id   Task_id[ 4 ];         /* array of task ids */
31rtems_name Task_name[ 4 ];       /* array of task names */
32
33rtems_task Init(
34  rtems_task_argument argument
35)
36{
37  rtems_status_code status;
38  rtems_time_of_day time;
39
40  puts( "\n\n*** CLOCK TICK TEST ***" );
41
42  time.year   = 1988;
43  time.month  = 12;
44  time.day    = 31;
45  time.hour   = 9;
46  time.minute = 0;
47  time.second = 0;
48  time.ticks  = 0;
49
50  status = rtems_clock_set( &time );
51
52  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
53  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
54  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
55
56  status = rtems_task_create(
57    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
58    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
59  );
60  status = rtems_task_create(
61    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
62    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
63  );
64  status = rtems_task_create(
65    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
66    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
67  );
68
69  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
70  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
71  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
72
73  status = rtems_task_delete( RTEMS_SELF );
74}
Note: See TracBrowser for help on using the repository browser.