File indexing completed on 2025-05-11 08:24:34
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 #ifdef HAVE_CONFIG_H
0039 #include "config.h"
0040 #endif
0041
0042 #include "system.h"
0043
0044 #include <rtems/cpuuse.h>
0045
0046 uint32_t Periods[6] = { 0, 2, 2, 2, 2, 100 };
0047 uint32_t Iterations[6] = { 0, 50, 50, 50, 50, 1 };
0048 rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
0049
0050 rtems_task Task_1_through_5(
0051 rtems_task_argument argument
0052 )
0053 {
0054 rtems_id rmid;
0055 rtems_id test_rmid;
0056 uint32_t index;
0057 uint32_t pass;
0058 uint32_t failed;
0059 rtems_status_code status;
0060
0061 status = rtems_rate_monotonic_create( argument, &rmid );
0062 directive_failed( status, "rtems_rate_monotonic_create" );
0063 put_name( Task_name[ argument ], FALSE );
0064 printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", rmid );
0065
0066 status = rtems_rate_monotonic_ident( argument, &test_rmid );
0067 directive_failed( status, "rtems_rate_monotonic_ident" );
0068 put_name( Task_name[ argument ], FALSE );
0069 printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", test_rmid );
0070
0071 if ( rmid != test_rmid ) {
0072 printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", rmid, test_rmid );
0073 rtems_test_exit( 0 );
0074 }
0075
0076 put_name( Task_name[ argument ], FALSE );
0077 printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", rmid, Periods[ argument ] );
0078
0079 status = rtems_task_wake_after( 2 );
0080 directive_failed( status, "rtems_task_wake_after" );
0081
0082 switch ( argument ) {
0083 case 1:
0084 case 2:
0085 case 3:
0086 case 4:
0087 while ( FOREVER ) {
0088 status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
0089 directive_failed( status, "rtems_rate_monotonic_period" );
0090 Count.count[ argument ]++;
0091 }
0092 break;
0093 case 5:
0094 pass = 0;
0095 failed = 0;
0096
0097 status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
0098 directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" );
0099
0100 Get_all_counters();
0101
0102 while ( FOREVER ) {
0103 status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
0104 directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" );
0105
0106 Get_all_counters();
0107
0108 for( index = 1 ; index <= 4 ; index++ ) {
0109 if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
0110 puts_nocr( "FAIL -- " );
0111 put_name ( Task_name[ index ], FALSE );
0112 printf ( " Actual=%" PRIu32 ", Expected=%" PRIu32 "\n",
0113 Temporary_count.count[ index ],
0114 Iterations[ index ]
0115 );
0116 failed += 1;
0117 }
0118 }
0119
0120 if ( failed == 5 )
0121 rtems_test_exit( 0 );
0122
0123 pass += 1;
0124
0125 printf( "TA5 - PERIODS CHECK OK (%" PRIu32 ")\n", pass );
0126
0127 if ( pass == 10 ) {
0128 puts( "" );
0129 rtems_rate_monotonic_report_statistics();
0130
0131 rtems_rate_monotonic_reset_statistics( rmid );
0132 puts( "" );
0133 puts( "TA5 - PERIOD STATISTICS RESET" );
0134 puts( "" );
0135 rtems_rate_monotonic_report_statistics();
0136
0137 rtems_rate_monotonic_reset_all_statistics();
0138 puts( "" );
0139 puts( "TA5 - ALL PERIOD STATISTICS RESET" );
0140 puts( "" );
0141 rtems_rate_monotonic_report_statistics();
0142
0143 puts( "" );
0144 TEST_END();
0145
0146 rtems_test_exit( 0 );
0147 }
0148
0149 }
0150 break;
0151 }
0152 }