1 #include <system_def.h>
6 #include <rtems/untar.h>
7 #include <rtems/error.h>
8 #include <rtems/mw_uid.h>
13 #define TEST_DURATION 130
15 #define T1_DUR 400000000
16 #define T2_DUR 600000000
21 rtems_task_argument argument
26 rtems_status_code status;
29 unsigned int start, stop, period_length, max_i, max_j;
32 name = rtems_build_name( 'P', 'E', 'R', 'A' );
33 status = rtems_rate_monotonic_create( name, &period );
35 if ( status != RTEMS_SUCCESSFUL ) {
36 printf( "rtems_monotonic_create failed with status of %d.\n", status);
40 period_length = T1_PER; // duration 3 ticks
41 max_i = 10000; max_j = T1_DUR;
42 edf_deadline_init(period_length);
44 if (rtems_rate_monotonic_period(period,period_length)==RTEMS_TIMEOUT)
45 puts("P1 - Deadline miss");
47 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
48 sprintf(output1,"P1-S ticks:%u",start);
51 if ( start >= TEST_DURATION ) break;
53 /* active computing */
54 for ( i = 1 ; i < max_i; i++)
57 for ( j = 1; j < max_j; j++)
64 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
65 sprintf(output2,"P1-F ticks:%u",stop);
69 /* missed period so delete period and SELF */
70 status = rtems_rate_monotonic_delete( period );
71 edf_deadline_cancel();
72 if ( status != RTEMS_SUCCESSFUL ) {
73 printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status );
77 puts( "*** END OF TEST - edf***" );
85 rtems_task_argument argument
90 rtems_status_code status;
93 unsigned int start, stop, period_length, max_i, max_j;
96 name = rtems_build_name( 'P', 'E', 'R', 'B' );
97 status = rtems_rate_monotonic_create( name, &period );
98 if ( status != RTEMS_SUCCESSFUL ) {
99 printf( "rtems_monotonic_create failed with status of %d.\n", status );
103 period_length = T2_PER; // duration 5 ticks
104 max_i = 10000; max_j = T2_DUR;
105 edf_deadline_init(period_length);
107 if (rtems_rate_monotonic_period(period,period_length)==RTEMS_TIMEOUT)
108 puts("P2 - Deadline miss");
110 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
111 sprintf(output1,"P2-S ticks:%u",start);
114 if ( _Watchdog_Ticks_since_boot >= TEST_DURATION ) {
118 /* active computing */
120 for ( i = 1 ; i < max_i; i++)
123 for ( j = 1; j < max_j; j++)
130 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
131 sprintf(output2,"P2-F ticks:%u",stop);
135 /* missed period so delete period and SELF */
136 status = rtems_rate_monotonic_delete( period );
137 edf_deadline_cancel();
138 if ( status != RTEMS_SUCCESSFUL ) {
139 printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status );
143 puts( "*** END OF TEST - edf***" );