[f37e656d] | 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 |
---|
[8f71a36] | 4 | * a variety of RTEMS objects. |
---|
[f37e656d] | 5 | * |
---|
[08311cc3] | 6 | * COPYRIGHT (c) 1989-1999. |
---|
[f37e656d] | 7 | * On-Line Applications Research Corporation (OAR). |
---|
| 8 | * |
---|
[98e4ebf5] | 9 | * The license and distribution terms for this file may be |
---|
| 10 | * found in the file LICENSE in this distribution or at |
---|
[2abdd87] | 11 | * http://www.rtems.com/license/LICENSE. |
---|
[f37e656d] | 12 | * |
---|
[6f9c75c3] | 13 | * $Id$ |
---|
[f37e656d] | 14 | */ |
---|
| 15 | |
---|
[7d3f9c6] | 16 | #ifdef HAVE_CONFIG_H |
---|
| 17 | #include "config.h" |
---|
| 18 | #endif |
---|
| 19 | |
---|
[5a8e7503] | 20 | #define CONFIGURE_INIT |
---|
[f37e656d] | 21 | #include "system.h" |
---|
| 22 | |
---|
| 23 | #include <rtems/monitor.h> |
---|
[11b9b5d] | 24 | #include <rtems/shell.h> |
---|
[f37e656d] | 25 | |
---|
| 26 | rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 }; |
---|
| 27 | |
---|
| 28 | rtems_task Task_1_through_5( |
---|
[9072167] | 29 | rtems_task_argument argument |
---|
[f37e656d] | 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 | |
---|
[11b9b5d] | 40 | static 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 | } |
---|
[f37e656d] | 47 | |
---|
| 48 | rtems_task Init( |
---|
| 49 | rtems_task_argument argument |
---|
| 50 | ) |
---|
| 51 | { |
---|
[9919946a] | 52 | uint32_t index; |
---|
[f37e656d] | 53 | rtems_status_code status; |
---|
| 54 | |
---|
[11b9b5d] | 55 | puts( "\n\n*** TEST MONITOR ***" ); |
---|
[f37e656d] | 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 | |
---|
[11b9b5d] | 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 ); |
---|
[f37e656d] | 88 | |
---|
[11b9b5d] | 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 | } |
---|
[f37e656d] | 96 | } |
---|