source: rtems/testsuites/samples/capture/init.c @ 8db468f

4.104.114.84.95
Last change on this file since 8db468f was 8db468f, checked in by Chris Johns <chrisj@…>, on 08/17/07 at 01:07:10

2007-08-17 Chris Johns <chrisj@…>

  • Makefile.am, README, configure.ac, capture/.cvsignore, capture/Makefile.am, capture/capture.doc, capture/capture.scn, capture/init.c, capture/system.h, capture/test1.c: Add a sample test for the capture engine.
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*  Init
2 *
3 *  This routine is the initialization task for this test program.
4 *  It is called from init_exec and has the responsibility for creating
5 *  and starting the tasks that make up the test.  If the time of day
6 *  clock is required for the test, it should also be set to a known
7 *  value by this function.
8 *
9 *  Input parameters:  NONE
10 *
11 *  Output parameters:  NONE
12 *
13 *  COPYRIGHT (c) 1989-1997.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may in
17 *  the file LICENSE in this distribution or at
18 *  http://www.rtems.com/license/LICENSE.
19 *
20 *  $Id$
21 */
22
23#define CONFIGURE_INIT
24
25#include "system.h"
26#include <stdio.h>
27#include <stdlib.h>
28
29#include <rtems.h>
30#include <rtems/capture-cli.h>
31#include <rtems/monitor.h>
32
33void setup_tasks_to_watch ();
34
35volatile int can_proceed = 1;
36
37rtems_task Init(
38  rtems_task_argument ignored
39)
40{
41  rtems_task_priority old_priority;
42  rtems_mode          old_mode;
43  rtems_event_set     out;
44
45  /* lower the task priority to allow created tasks to execute */
46
47  rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
48  rtems_task_mode(RTEMS_PREEMPT,  RTEMS_PREEMPT_MASK, &old_mode);
49
50  printf( "\n*** CAPTURE ENGINE TEST ***\n" );
51
52  while (!can_proceed)
53  {
54    printf ("Sleeping\n");
55    usleep (1000000);
56  }
57
58  rtems_monitor_init (0);
59  rtems_capture_cli_init (0);
60 
61  setup_tasks_to_watch ();
62
63  rtems_task_delete (RTEMS_SELF);
64
65  printf( "\nblocking main\n" );
66
67  rtems_event_receive (RTEMS_EVENT_1, RTEMS_WAIT | RTEMS_EVENT_ANY,
68                       0, &out);
69
70  printf( "\n*** END OF UNLIMITED TASK TEST ***\n" );
71  exit( 0 );
72}
73
Note: See TracBrowser for help on using the repository browser.