1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2012. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may in |
---|
6 | * the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #define CONFIGURE_INIT |
---|
11 | |
---|
12 | #ifdef HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include "system.h" |
---|
17 | #include <stdio.h> |
---|
18 | #include <stdlib.h> |
---|
19 | |
---|
20 | #include <rtems.h> |
---|
21 | #include <rtems/capture-cli.h> |
---|
22 | #include <rtems/monitor.h> |
---|
23 | #include <rtems/shell.h> |
---|
24 | |
---|
25 | /* forward declarations to avoid warnings */ |
---|
26 | rtems_task Init(rtems_task_argument argument); |
---|
27 | static void notification(int fd, int seconds_remaining, void *arg); |
---|
28 | |
---|
29 | const char rtems_test_name[] = "CAPTURE ENGINE"; |
---|
30 | |
---|
31 | volatile int can_proceed = 1; |
---|
32 | |
---|
33 | static void notification(int fd, int seconds_remaining, void *arg) |
---|
34 | { |
---|
35 | printf( |
---|
36 | "Press any key to start capture engine (%is remaining)\n", |
---|
37 | seconds_remaining |
---|
38 | ); |
---|
39 | } |
---|
40 | |
---|
41 | rtems_task Init( |
---|
42 | rtems_task_argument ignored |
---|
43 | ) |
---|
44 | { |
---|
45 | rtems_status_code status; |
---|
46 | rtems_task_priority old_priority; |
---|
47 | rtems_mode old_mode; |
---|
48 | |
---|
49 | rtems_test_begin(); |
---|
50 | |
---|
51 | status = rtems_shell_wait_for_input( |
---|
52 | STDIN_FILENO, |
---|
53 | 20, |
---|
54 | notification, |
---|
55 | NULL |
---|
56 | ); |
---|
57 | if (status == RTEMS_SUCCESSFUL) { |
---|
58 | /* lower the task priority to allow created tasks to execute */ |
---|
59 | |
---|
60 | rtems_task_set_priority(RTEMS_SELF, 20, &old_priority); |
---|
61 | rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode); |
---|
62 | |
---|
63 | while (!can_proceed) |
---|
64 | { |
---|
65 | printf ("Sleeping\n"); |
---|
66 | usleep (1000000); |
---|
67 | } |
---|
68 | |
---|
69 | rtems_monitor_init (0); |
---|
70 | rtems_capture_cli_init (0); |
---|
71 | |
---|
72 | setup_tasks_to_watch (); |
---|
73 | |
---|
74 | rtems_task_delete (RTEMS_SELF); |
---|
75 | } else { |
---|
76 | rtems_test_end(); |
---|
77 | |
---|
78 | exit( 0 ); |
---|
79 | } |
---|
80 | } |
---|