OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [tests/] [samples/] [ticker/] [init.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 158 chris
/*  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 208 chris
 *  $Id: init.c,v 1.2 2001-09-27 12:02:29 chris Exp $
21 158 chris
 */
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
 
31
rtems_id   Task_id[ 4 ];         /* array of task ids */
32
rtems_name Task_name[ 4 ];       /* array of task names */
33
 
34
rtems_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.