source: rtems/testsuites/samples/capture/init.c @ 5f0cd34

4.11
Last change on this file since 5f0cd34 was 5f0cd34, checked in by Joel Sherrill <joel.sherrill@…>, on May 12, 2012 at 4:12:57 PM

samples - Eliminate missing prototype warnings

  • Property mode set to 100644
File size: 1.8 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.com/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);
27#if !BSP_SMALL_MEMORY
28  static void notification(int fd, int seconds_remaining, void *arg);
29#endif
30
31volatile int can_proceed = 1;
32
33#if !BSP_SMALL_MEMORY
34static void notification(int fd, int seconds_remaining, void *arg)
35{
36  printf(
37    "Press any key to start capture engine (%is remaining)\n",
38    seconds_remaining
39  );
40}
41#endif
42
43rtems_task Init(
44  rtems_task_argument ignored
45)
46{
47#if BSP_SMALL_MEMORY
48  printf("NO Capture Engine. MEMORY TOO SMALL");
49#else
50  rtems_status_code   status;
51  rtems_task_priority old_priority;
52  rtems_mode          old_mode;
53
54  puts( "\n\n*** TEST CAPTURE ENGINE ***" );
55
56  status = rtems_shell_wait_for_input(
57    STDIN_FILENO,
58    20,
59    notification,
60    NULL
61  );
62  if (status == RTEMS_SUCCESSFUL) {
63    /* lower the task priority to allow created tasks to execute */
64
65    rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
66    rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
67
68    while (!can_proceed)
69    {
70      printf ("Sleeping\n");
71      usleep (1000000);
72    }
73
74    rtems_monitor_init (0);
75    rtems_capture_cli_init (0);
76
77    setup_tasks_to_watch ();
78
79    rtems_task_delete (RTEMS_SELF);
80  } else {
81    puts( "*** END OF TEST CAPTURE ENGINE ***" );
82
83    exit( 0 );
84  }
85#endif
86}
Note: See TracBrowser for help on using the repository browser.