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-1997. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may in |
---|
17 | * 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 | |
---|
25 | #ifdef HAVE_CONFIG_H |
---|
26 | #include "config.h" |
---|
27 | #endif |
---|
28 | |
---|
29 | #include "system.h" |
---|
30 | #include <stdio.h> |
---|
31 | #include <stdlib.h> |
---|
32 | |
---|
33 | #include <rtems.h> |
---|
34 | #include <rtems/capture-cli.h> |
---|
35 | #include <rtems/monitor.h> |
---|
36 | #include <rtems/shell.h> |
---|
37 | |
---|
38 | volatile int can_proceed = 1; |
---|
39 | |
---|
40 | static void notification(int fd, int seconds_remaining, void *arg) |
---|
41 | { |
---|
42 | printf( |
---|
43 | "Press any key to start capture engine (%is remaining)\n", |
---|
44 | seconds_remaining |
---|
45 | ); |
---|
46 | } |
---|
47 | |
---|
48 | rtems_task Init( |
---|
49 | rtems_task_argument ignored |
---|
50 | ) |
---|
51 | { |
---|
52 | #if BSP_SMALL_MEMORY |
---|
53 | printf("NO Capture Engine. MEMORY TOO SMALL"); |
---|
54 | #else |
---|
55 | rtems_status_code status; |
---|
56 | rtems_task_priority old_priority; |
---|
57 | rtems_mode old_mode; |
---|
58 | |
---|
59 | puts( "\n\n*** TEST CAPTURE ENGINE ***" ); |
---|
60 | |
---|
61 | status = rtems_shell_wait_for_input( |
---|
62 | STDIN_FILENO, |
---|
63 | 20, |
---|
64 | notification, |
---|
65 | NULL |
---|
66 | ); |
---|
67 | if (status == RTEMS_SUCCESSFUL) { |
---|
68 | /* lower the task priority to allow created tasks to execute */ |
---|
69 | |
---|
70 | rtems_task_set_priority(RTEMS_SELF, 20, &old_priority); |
---|
71 | rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode); |
---|
72 | |
---|
73 | while (!can_proceed) |
---|
74 | { |
---|
75 | printf ("Sleeping\n"); |
---|
76 | usleep (1000000); |
---|
77 | } |
---|
78 | |
---|
79 | rtems_monitor_init (0); |
---|
80 | rtems_capture_cli_init (0); |
---|
81 | |
---|
82 | setup_tasks_to_watch (); |
---|
83 | |
---|
84 | rtems_task_delete (RTEMS_SELF); |
---|
85 | } else { |
---|
86 | puts( "*** END OF TEST CAPTURE ENGINE ***" ); |
---|
87 | |
---|
88 | exit( 0 ); |
---|
89 | } |
---|
90 | #endif |
---|
91 | } |
---|