source: rtems/testsuites/samples/capture/init.c @ 3324383c

4.115
Last change on this file since 3324383c was 3324383c, checked in by Joel Sherrill <joel.sherrill@…>, on 05/05/14 at 14:47:30

testsuites: Remove BSP_SMALL_MEMORY

  • Property mode set to 100644
File size: 1.6 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#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 */
26rtems_task Init(rtems_task_argument argument);
27static void notification(int fd, int seconds_remaining, void *arg);
28
29const char rtems_test_name[] = "CAPTURE ENGINE";
30
31volatile int can_proceed = 1;
32
33static 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
41rtems_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}
Note: See TracBrowser for help on using the repository browser.