File indexing completed on 2025-05-11 08:24:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 #ifdef HAVE_CONFIG_H
0040 #include "config.h"
0041 #endif
0042
0043 #define CONFIGURE_INIT
0044 #include "system.h"
0045
0046 #include <rtems/shell.h>
0047
0048 const char rtems_test_name[] = "TOP";
0049
0050
0051
0052
0053
0054
0055
0056 void add_some(
0057 uint32_t per_loop,
0058 uint32_t *sum,
0059 uint32_t *next
0060 )
0061 {
0062 int i;
0063
0064 for ( i=0 ; i<per_loop ; i++ ) {
0065 *sum += *next;
0066 *next += 1;
0067 }
0068 }
0069
0070 static void notification(int fd, int seconds_remaining, void *arg)
0071 {
0072 printf(
0073 "Press any key to enter top test (%is remaining)\n",
0074 seconds_remaining
0075 );
0076 }
0077
0078 rtems_task Init(
0079 rtems_task_argument argument
0080 )
0081 {
0082 rtems_status_code status;
0083 rtems_time_of_day time;
0084
0085 TEST_BEGIN();
0086
0087 status = rtems_shell_wait_for_input(
0088 STDIN_FILENO,
0089 20,
0090 notification,
0091 NULL
0092 );
0093 if ( status != RTEMS_SUCCESSFUL ) {
0094 TEST_END();
0095
0096 rtems_test_exit( 0 );
0097 }
0098
0099 build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
0100
0101 status = rtems_clock_set( &time );
0102 directive_failed( status, "rtems_clock_set" );
0103
0104 TicksPerSecond = rtems_clock_get_ticks_per_second();
0105 if (TicksPerSecond <= 0) {
0106 printf(
0107 "Invalid ticks per second: %" PRIdrtems_interval "\n",
0108 TicksPerSecond
0109 );
0110 exit (1);
0111 }
0112
0113
0114 Task_name[ 2 ] = rtems_build_name( 'T', 'A', '0', '2' );
0115 status = rtems_task_create(
0116 Task_name[ 2 ],
0117 2,
0118 RTEMS_MINIMUM_STACK_SIZE,
0119 RTEMS_TIMESLICE,
0120 RTEMS_FLOATING_POINT,
0121 &Task_id[ 2 ]
0122 );
0123 directive_failed( status, "rtems_task_create of TA02" );
0124 status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
0125 directive_failed( status, "rtems_task_start of TA2" );
0126
0127
0128 Task_name[ 1 ] = rtems_build_name( 'T', 'A', '0', '1' );
0129 status = rtems_task_create(
0130 Task_name[ 1 ],
0131 2,
0132 RTEMS_MINIMUM_STACK_SIZE,
0133 RTEMS_TIMESLICE,
0134 RTEMS_FLOATING_POINT,
0135 &Task_id[ 1 ]
0136 );
0137 directive_failed( status, "rtems_task_create of TA01" );
0138 status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
0139 directive_failed( status, "rtems_task_start of TA01" );
0140
0141
0142
0143
0144
0145 status = rtems_task_suspend( RTEMS_SELF );
0146 directive_failed( status, "rtems_task_suspend of RTEMS_SELF" );
0147 }