source: rtems/testsuites/samples/capture/init.c @ 7b00c2fa

5
Last change on this file since 7b00c2fa was 7b00c2fa, checked in by Sebastian Huber <sebastian.huber@…>, on 11/06/17 at 06:56:17

tests: Use <tmacros.h> in all tests

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 1.5 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 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
18#include <rtems.h>
19#include <rtems/capture-cli.h>
20#include <rtems/monitor.h>
21#include <rtems/shell.h>
22#include <tmacros.h>
23
24const char rtems_test_name[] = "CAPTURE ENGINE";
25
26volatile int can_proceed = 1;
27
28static void notification(int fd, int seconds_remaining, void *arg)
29{
30  printf(
31    "Press any key to start capture engine (%is remaining)\n",
32    seconds_remaining
33  );
34}
35
36rtems_task Init(
37  rtems_task_argument ignored
38)
39{
40  rtems_status_code   status;
41  rtems_task_priority old_priority;
42  rtems_mode          old_mode;
43
44  rtems_print_printer_fprintf_putc(&rtems_test_printer);
45  TEST_BEGIN();
46
47  status = rtems_shell_wait_for_input(
48    STDIN_FILENO,
49    20,
50    notification,
51    NULL
52  );
53  if (status == RTEMS_SUCCESSFUL) {
54    /* lower the task priority to allow created tasks to execute */
55
56    rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
57    rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
58
59    while (!can_proceed)
60    {
61      printf ("Sleeping\n");
62      usleep (1000000);
63    }
64
65    rtems_monitor_init (0);
66    rtems_capture_cli_init (0);
67
68    setup_tasks_to_watch ();
69
70    rtems_task_delete (RTEMS_SELF);
71  } else {
72    TEST_END();
73    rtems_test_exit( 0 );
74  }
75}
Note: See TracBrowser for help on using the repository browser.