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>
16 #define TEST_DURATION 130
18 //utilization setup: T1 3/7, T2 5/10
27 // budget overrun signal handler
28 rtems_asr signal_handler (rtems_signal_set signals) {
29 printf("SIGNAL kill you \n");
32 void test_loop ( unsigned int id, rtems_name name, unsigned int period_length, unsigned int max_j)
35 rtems_status_code status;
38 unsigned int start, stop, max_i;
42 status = rtems_rate_monotonic_create( name, &period );
43 rtems_signal_catch(&signal_handler, RTEMS_DEFAULT_MODES);
45 if ( status != RTEMS_SUCCESSFUL ) {
46 printf( "rtems_monotonic_create failed with status of %d.\n", status);
51 edf_deadline_init(name, &period);
53 if (edf_next_period(period,period_length, 0))
54 printf("P%u - Deadline miss", id);
56 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
57 sprintf(output1,"P%u-S ticks:%u prio:%u", id,start, (unsigned int) _Per_CPU_Information.executing->current_priority);
60 if ( start >= TEST_DURATION ) break;
62 /* active computing */
63 for ( i = 1 ; i < max_i; i++)
66 for ( j = 1; j < max_j; j++)
70 mem = _Workspace_Allocate (4);
75 rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &stop);
76 sprintf(output2,"P%u-F ticks:%u",id, stop);
80 /* missed period so delete period and SELF */
81 status = edf_deadline_cancel(period);
82 if ( status != RTEMS_SUCCESSFUL ) {
83 printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status );
87 puts( "*** END OF TEST - edf***" );
94 rtems_task_argument argument
98 name = rtems_build_name( 'P', 'E', 'R', 'A' );
99 test_loop(1, name, T1_PER,T1_DUR);
104 rtems_task_argument argument
108 reps_params_t p_params;
110 name = rtems_build_name( 'P', 'E', 'R', 'B' );
111 // create a server observation
115 p_params.Q = T2_SERVER;
116 reps_create_server(&p_params, &sid);
117 if (reps_attach_thread(sid, Task_2_id) != REPS_OK)
118 printf("err: attach \n");
120 /* Objects_Locations location;
121 Thread_Control *the_thread = _Thread_Get(Task_2_id, &location);
122 RBT_Node *node = (RBT_Node*)the_thread->scheduler_info;
123 printf("task2 server params Q %d, P %d\n", node->cmp_time, node->rel_deadline);*/
125 test_loop(2, name, T2_PER,T2_DUR);