1 #include <system_def.h>
6 #include <rtems/untar.h>
7 #include <rtems/error.h>
8 #include <rtems/mw_uid.h>
11 #include <rtems/score/wkspace.h>
15 #define TEST_DURATION 130
17 //utilization setup: T1 3/7, T2 5/10
24 void test_loop ( unsigned int id, rtems_name name, unsigned int period_length, unsigned int max_j)
27 rtems_status_code status;
30 unsigned int start, stop, max_i;
34 status = rtems_rate_monotonic_create( name, &period );
36 if ( status != RTEMS_SUCCESSFUL ) {
37 printf( "rtems_monotonic_create failed with status of %d.\n", status);
42 edf_deadline_init(name, &period);
44 if (edf_next_period(period,period_length, 0))
45 printf("P%u - Deadline miss", id);
47 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
48 sprintf(output1,"P%u-S ticks:%u prio:%u", id,start, (unsigned int) _Per_CPU_Information.executing->current_priority);
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++)
61 mem = _Workspace_Allocate (4);
66 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
67 sprintf(output2,"P%u-F ticks:%u",id, stop);
71 /* missed period so delete period and SELF */
72 status = edf_deadline_cancel(period);
73 if ( status != RTEMS_SUCCESSFUL ) {
74 printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status );
78 puts( "*** END OF TEST - edf***" );
85 rtems_task_argument argument
89 name = rtems_build_name( 'P', 'E', 'R', 'A' );
90 test_loop(1, name, T1_PER,T1_DUR);
95 rtems_task_argument argument
99 name = rtems_build_name( 'P', 'E', 'R', 'B' );
100 test_loop(2, name, T2_PER,T2_DUR);