source: rtems/c/src/tests/samples/ticker/init.c @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/00 at 15:00:15

Merged from 4.5.0-beta3a

  • Property mode set to 100644
File size: 2.1 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.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23#define CONFIGURE_INIT
24#include "system.h"
25#include <stdio.h>
26
27/*
28 *  Keep the names and IDs in global variables so another task can use them.
29 */
30
31rtems_id   Task_id[ 4 ];         /* array of task ids */
32rtems_name Task_name[ 4 ];       /* array of task names */
33
34rtems_task Init(
35  rtems_task_argument argument
36)
37{
38  rtems_status_code status;
39  rtems_time_of_day time;
40
41  puts( "\n\n*** CLOCK TICK TEST ***" );
42
43  time.year   = 1988;
44  time.month  = 12;
45  time.day    = 31;
46  time.hour   = 9;
47  time.minute = 0;
48  time.second = 0;
49  time.ticks  = 0;
50
51  status = rtems_clock_set( &time );
52
53  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
54  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
55  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
56
57  status = rtems_task_create(
58    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
59    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
60  );
61  status = rtems_task_create(
62    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
63    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
64  );
65  status = rtems_task_create(
66    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
67    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
68  );
69
70  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
71  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
72  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
73
74  status = rtems_task_delete( RTEMS_SELF );
75}
Note: See TracBrowser for help on using the repository browser.