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

4.115
Last change on this file since 5f0cd34 was 5f0cd34, checked in by Joel Sherrill <joel.sherrill@…>, on 05/12/12 at 16:12:57

samples - Eliminate missing prototype warnings

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[5f0cd34]1/*
2 *  COPYRIGHT (c) 1989-2012.
[a23427e]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
[e313551]12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
[a23427e]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>
[7c9d27e]23#include <rtems/shell.h>
[a23427e]24
[5f0cd34]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
[a23427e]31volatile int can_proceed = 1;
32
[16b1599f]33#if !BSP_SMALL_MEMORY
[7c9d27e]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}
[16b1599f]41#endif
[7c9d27e]42
[a23427e]43rtems_task Init(
44  rtems_task_argument ignored
45)
46{
[cdf44d93]47#if BSP_SMALL_MEMORY
48  printf("NO Capture Engine. MEMORY TOO SMALL");
49#else
[7c9d27e]50  rtems_status_code   status;
[a23427e]51  rtems_task_priority old_priority;
52  rtems_mode          old_mode;
53
[7c9d27e]54  puts( "\n\n*** TEST CAPTURE ENGINE ***" );
[a23427e]55
[7c9d27e]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 */
[a23427e]64
[7c9d27e]65    rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
66    rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
[a23427e]67
[7c9d27e]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);
[a23427e]76
[7c9d27e]77    setup_tasks_to_watch ();
[b1274bd9]78
[7c9d27e]79    rtems_task_delete (RTEMS_SELF);
80  } else {
81    puts( "*** END OF TEST CAPTURE ENGINE ***" );
[a23427e]82
[7c9d27e]83    exit( 0 );
84  }
[cdf44d93]85#endif
[a23427e]86}
Note: See TracBrowser for help on using the repository browser.