1 | /* Init |
---|
2 | * |
---|
3 | * This routine is the initialization task for this test program. |
---|
4 | * |
---|
5 | * Input parameters: |
---|
6 | * argument - task argument |
---|
7 | * |
---|
8 | * Output parameters: NONE |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1997 |
---|
11 | * Objective Design Systems Ltd Pty (ODS) |
---|
12 | * All rights reserved (R) Objective Design Systems Ltd Pty |
---|
13 | * |
---|
14 | * COPYRIGHT (c) 1989-1997. |
---|
15 | * On-Line Applications Research Corporation (OAR). |
---|
16 | * Copyright assigned to U.S. Government, 1994. |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may in |
---|
19 | * the file LICENSE in this distribution or at |
---|
20 | * http://www.OARcorp.com/rtems/license.html. |
---|
21 | * |
---|
22 | * $Id$ |
---|
23 | */ |
---|
24 | |
---|
25 | #define TEST_INIT |
---|
26 | #include "System.h" |
---|
27 | |
---|
28 | rtems_task Init(rtems_task_argument ) |
---|
29 | { |
---|
30 | puts( "\n\n*** RTEMS++ TEST ***" ); |
---|
31 | |
---|
32 | rtemsEvent end_me("INIT"); |
---|
33 | Task1 task_1; |
---|
34 | |
---|
35 | task_1.set_end_event(end_me); |
---|
36 | |
---|
37 | printf( "INIT - Task.create() - " ); |
---|
38 | task_1.create("TA1 ", 0, RTEMS_MINIMUM_STACK_SIZE); |
---|
39 | printf("%s\n", task_1.last_status_string()); |
---|
40 | |
---|
41 | printf( "INIT - Task.create() - " ); |
---|
42 | task_1.create("TA1 ", 10, RTEMS_MINIMUM_STACK_SIZE * 6); |
---|
43 | printf("%s\n", task_1.last_status_string()); |
---|
44 | |
---|
45 | printf( "INIT - Task.create() - " ); |
---|
46 | task_1.create("TA1 ", 10, RTEMS_MINIMUM_STACK_SIZE * 6); |
---|
47 | printf("%s\n", task_1.last_status_string()); |
---|
48 | |
---|
49 | printf( "INIT - Task.restart() - " ); |
---|
50 | task_1.restart(0); |
---|
51 | printf("%s\n", task_1.last_status_string()); |
---|
52 | |
---|
53 | printf( "INIT - Task.start(0xDEADDEAD) - " ); |
---|
54 | task_1.start(0xDEADDEAD); |
---|
55 | printf("%s\n", task_1.last_status_string()); |
---|
56 | |
---|
57 | // block waiting for any event |
---|
58 | rtems_event_set out; |
---|
59 | |
---|
60 | // wait for task1 to tell me to finish |
---|
61 | end_me.receive(RTEMS_SIGNAL_0, out); |
---|
62 | |
---|
63 | task_1.destroy(); |
---|
64 | |
---|
65 | printf("*** END OF RTEMS++ TEST ***"); |
---|
66 | |
---|
67 | // needs to be in C, no C++ object owns the Init task |
---|
68 | rtems_status_code status = rtems_task_delete( RTEMS_SELF ); |
---|
69 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | |
---|