source: rtems/testsuites/samples/ticker/init.c @ 8776bb9

5
Last change on this file since 8776bb9 was af43554, checked in by Sebastian Huber <sebastian.huber@…>, on 10/26/17 at 11:59:11

tests: Remove TEST_INIT

The TEST_EXTERN is a used only by the system.h style tests and they use
CONFIGURE_INIT appropriately.

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 2.0 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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define CONFIGURE_INIT
15#include "system.h"
16
17const char rtems_test_name[] = "CLOCK TICK";
18
19/*
20 *  Keep the names and IDs in global variables so another task can use them.
21 */
22
23rtems_id   Task_id[ 4 ];         /* array of task ids */
24rtems_name Task_name[ 4 ];       /* array of task names */
25
26rtems_task Init(
27  rtems_task_argument argument
28)
29{
30  rtems_status_code status;
31  rtems_time_of_day time;
32
33  TEST_BEGIN();
34
35  time.year   = 1988;
36  time.month  = 12;
37  time.day    = 31;
38  time.hour   = 9;
39  time.minute = 0;
40  time.second = 0;
41  time.ticks  = 0;
42
43  status = rtems_clock_set( &time );
44  directive_failed( status, "clock get" );
45
46  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
47  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
48  Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
49
50  status = rtems_task_create(
51    Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
52    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
53  );
54  directive_failed( status, "create 1" );
55
56  status = rtems_task_create(
57    Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
58    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
59  );
60  directive_failed( status, "create 2" );
61
62  status = rtems_task_create(
63    Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
64    RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
65  );
66  directive_failed( status, "create 3" );
67
68  status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
69  directive_failed( status, "start 1" );
70
71  status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
72  directive_failed( status, "start 2" );
73
74  status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
75  directive_failed( status, "start 3" );
76
77  status = rtems_task_delete( RTEMS_SELF );
78  directive_failed( status, "delete" );
79}
Note: See TracBrowser for help on using the repository browser.