#include <errno.h>
#include <stdint.h>
#include <rtems/score/wkspace.h>
+#include <reps_lib.h>
#define T1_SERVER 0
#define T2_SERVER 2
-rtems_asr overrun_handler (rtems_signal_set signals) {
+// budget overrun signal handler
+rtems_asr signal_handler (rtems_signal_set signals) {
printf("SIGNAL kill you \n");
}
-void test_loop ( unsigned int id, rtems_name name, unsigned int period_length, unsigned int max_j, uint32_t server, rtems_asr_entry handler)
+void test_loop ( unsigned int id, rtems_name name, unsigned int period_length, unsigned int max_j)
{
rtems_id period;
rtems_status_code status;
void *mem;
status = rtems_rate_monotonic_create( name, &period );
+ rtems_signal_catch(&signal_handler, RTEMS_DEFAULT_MODES);
if ( status != RTEMS_SUCCESSFUL ) {
printf( "rtems_monotonic_create failed with status of %d.\n", status);
}
max_i = 1000;
- edf_deadline_init(period_length, server, handler);
+ edf_deadline_init(name, &period);
while ( 1 ) {
- edf_next_period();
- if (rtems_rate_monotonic_period(period,period_length)==RTEMS_TIMEOUT)
+ if (edf_next_period(period,period_length, 0))
printf("P%u - Deadline miss", id);
rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
}
/* missed period so delete period and SELF */
- status = rtems_rate_monotonic_delete( period );
- edf_deadline_cancel();
+ status = edf_deadline_cancel(period);
if ( status != RTEMS_SUCCESSFUL ) {
printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status );
exit( 0 );
{
rtems_name name;
name = rtems_build_name( 'P', 'E', 'R', 'A' );
- test_loop(1, name, T1_PER,T1_DUR,T1_SERVER, NULL);
+ test_loop(1, name, T1_PER,T1_DUR);
}
rtems_task_argument argument
)
{
+ rtems_id sid;
+ reps_params_t p_params;
rtems_name name;
name = rtems_build_name( 'P', 'E', 'R', 'B' );
- test_loop(2, name, T2_PER,T2_DUR,T2_SERVER, overrun_handler);
+ // create a server observation
+
+ reps_init();
+ p_params.P = T2_PER;
+ p_params.Q = T2_SERVER;
+ reps_create_server(&p_params, &sid);
+ if (reps_attach_thread(sid, Task_2_id) != REPS_OK)
+ printf("err: attach \n");
+
+/* Objects_Locations location;
+ Thread_Control *the_thread = _Thread_Get(Task_2_id, &location);
+ RBT_Node *node = (RBT_Node*)the_thread->scheduler_info;
+ printf("task2 server params Q %d, P %d\n", node->cmp_time, node->rel_deadline);*/
+
+ test_loop(2, name, T2_PER,T2_DUR);
}