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
26 void test_loop ( unsigned int id, rtems_name name, unsigned int period_length, unsigned int max_j, uint32_t server)
29 rtems_status_code status;
32 unsigned int start, stop, max_i;
36 status = rtems_rate_monotonic_create( name, &period );
38 if ( status != RTEMS_SUCCESSFUL ) {
39 printf( "rtems_monotonic_create failed with status of %d.\n", status);
44 edf_deadline_init(period_length, server, NULL);
47 if (rtems_rate_monotonic_period(period,period_length)==RTEMS_TIMEOUT)
48 printf("P%u - Deadline miss", id);
50 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
51 sprintf(output1,"P%u-S ticks:%u prio:%u", id,start, (unsigned int) _Per_CPU_Information.executing->current_priority);
54 if ( start >= TEST_DURATION ) break;
56 /* active computing */
57 for ( i = 1 ; i < max_i; i++)
60 for ( j = 1; j < max_j; j++)
64 mem = _Workspace_Allocate (4);
69 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
70 sprintf(output2,"P%u-F ticks:%u",id, stop);
74 /* missed period so delete period and SELF */
75 status = rtems_rate_monotonic_delete( period );
76 edf_deadline_cancel();
77 if ( status != RTEMS_SUCCESSFUL ) {
78 printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status );
82 puts( "*** END OF TEST - edf***" );
89 rtems_task_argument argument
93 name = rtems_build_name( 'P', 'E', 'R', 'A' );
94 test_loop(1, name, T1_PER,T1_DUR,T1_SERVER);
99 rtems_task_argument argument
103 name = rtems_build_name( 'P', 'E', 'R', 'B' );
104 test_loop(2, name, T2_PER,T2_DUR,T2_SERVER);