source: rtems/testsuites/libtests/monitor/init.c @ 3ce764a

4.115
Last change on this file since 3ce764a was 11b9b5d, checked in by Sebastian Huber <sebastian.huber@…>, on 09/16/11 at 09:24:52

2011-09-16 Sebastian Huber <Sebastian.Huber@…>

  • monitor/monitor.scn, termios/termios.scn: New files.
  • monitor/init.c, termios01/init.c: Use rtems_shell_wait_for_input().
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  This is a simple test whose only purpose is to start the Monitor
3 *  task.  The Monitor task can be used to obtain information about
4 *  a variety of RTEMS objects.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifdef HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#define CONFIGURE_INIT
21#include "system.h"
22
23#include <rtems/monitor.h>
24#include <rtems/shell.h>
25
26rtems_task_priority Priorities[6] = { 0,   1,   1,   3,   4,   5 };
27
28rtems_task Task_1_through_5(
29  rtems_task_argument argument
30)
31{
32  rtems_status_code status;
33
34  for ( ; ; ) {
35    status = rtems_task_wake_after( 100 );
36    directive_failed( status, "rtems_task_wake_after" );
37  }
38}
39
40static void notification(int fd, int seconds_remaining, void *arg)
41{
42  printf(
43    "Press any key to enter monitor (%is remaining)\n",
44    seconds_remaining
45  );
46}
47
48rtems_task Init(
49  rtems_task_argument argument
50)
51{
52  uint32_t    index;
53  rtems_status_code status;
54
55  puts( "\n\n*** TEST MONITOR ***" );
56
57  Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
58  Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
59  Task_name[ 3 ] =  rtems_build_name( 'T', 'A', '3', ' ' );
60  Task_name[ 4 ] =  rtems_build_name( 'T', 'A', '4', ' ' );
61  Task_name[ 5 ] =  rtems_build_name( 'T', 'A', '5', ' ' );
62
63  for ( index = 1 ; index <= 5 ; index++ ) {
64    status = rtems_task_create(
65      Task_name[ index ],
66      Priorities[ index ],
67      RTEMS_MINIMUM_STACK_SIZE * 4,
68      RTEMS_DEFAULT_MODES,
69      (index == 5) ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
70      &Task_id[ index ]
71    );
72    directive_failed( status, "rtems_task_create loop" );
73  }
74
75  for ( index = 1 ; index <= 5 ; index++ ) {
76    status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
77    directive_failed( status, "rtems_task_start loop" );
78  }
79
80  status = rtems_shell_wait_for_input(
81    STDIN_FILENO,
82    20,
83    notification,
84    NULL
85  );
86  if (status == RTEMS_SUCCESSFUL) {
87    rtems_monitor_init( 0 );
88
89    status = rtems_task_delete( RTEMS_SELF );
90    directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
91  } else {
92    puts( "*** END OF TEST MONITOR ***" );
93
94    rtems_test_exit( 0 );
95  }
96}
Note: See TracBrowser for help on using the repository browser.