16,16 → 16,6 |
* http://shark.sssup.it |
*/ |
|
/** |
------------ |
CVS : $Id: rmstar.c,v 1.1 2003-09-17 09:13:50 giacomo Exp $ |
|
File: $File$ |
Revision: $Revision: 1.1 $ |
Last update: $Date: 2003-09-17 09:13:50 $ |
------------ |
**/ |
|
/* |
* Copyright (C) 2001 Paolo Gai |
* |
61,8 → 51,7 |
/* #include "iqueue.h" Now iqueues are the only queue type into the kernel */ |
|
/* for BUDGET_TASK_MODEL */ |
#include "cbsstar.h" |
#include <comm_message.h> |
#include "fsf_server.h" |
|
/* |
* DEBUG stuffs begin |
224,44 → 213,6 |
#endif |
} |
|
static int RMSTAR_private_change_level(LEVEL l, PID p) |
{ |
|
RMSTAR_level_des *lev = (RMSTAR_level_des *)(level_table[l]); |
|
/* Change task level */ |
if (lev->flag[p] & RMSTAR_CHANGE_LEVEL) { |
|
STD_command_message msg; |
|
proc_table[p].status = SLEEP; |
|
level_table[lev->scheduling_level]->private_extract(lev->scheduling_level,p); |
iq_extract(p,&lev->ready); |
|
if (lev->deadline_timer[p] != -1) |
kern_event_delete(lev->deadline_timer[p]); |
|
RMSTAR_check_preemption(lev); |
|
lev->nact[p] = 0; |
lev->budget[p] = -1; |
proc_table[p].task_level = lev->new_level[p]; |
|
/* Send change level command to local scheduler */ |
|
msg.command = STD_ACTIVATE_TASK; |
msg.param = NULL; |
|
level_table[ lev->new_level[p] ]->public_message(lev->new_level[p],p,&msg); |
|
return 1; |
|
} |
|
return 0; |
|
} |
static void RMSTAR_timer_guest_deadline(void *par) |
{ |
PID p = (PID) par; |
332,8 → 283,6 |
rmstar_printf("(E:epi "); |
#endif |
|
if (RMSTAR_private_change_level(l, p)) return; |
|
/* check if the wcet is finished... */ |
if (proc_table[p].avail_time <= 0 && proc_table[p].control&CONTROL_CAP) { |
/* wcet finished: disable wcet event and count wcet miss */ |
417,8 → 366,6 |
{ |
RMSTAR_level_des *lev = (RMSTAR_level_des *)(level_table[l]); |
struct timespec temp; |
STD_command_message *msg; |
HARD_TASK_MODEL *h; |
|
#ifdef RMSTAR_DEBUG |
rmstar_printf("(E:ecy "); |
430,7 → 377,6 |
/* Task EndCycle */ |
case (long)(NULL): |
|
if (RMSTAR_private_change_level(l,p)) return 0; |
/* we call guest_end directly here because the same task may |
be reinserted in the queue before calling the preemption check! */ |
level_table[ lev->scheduling_level ]-> |
486,48 → 432,7 |
break; |
default: |
|
msg = (STD_command_message *)m; |
|
#ifdef RMSTAR_DEBUG |
rmstar_printf("(E:MSG %d)",msg->command); |
#endif |
|
switch(msg->command) { |
case STD_SET_NEW_MODEL: |
/* if the RMSTAR_task_create is called, then the pclass must be a |
valid pclass. */ |
h=(HARD_TASK_MODEL *)(msg->param); |
|
/* now we know that m is a valid model */ |
lev->wcet[p] = h->wcet; |
lev->period[p] = h->mit; |
|
lev->flag[p] = 0; |
lev->deadline_timer[p] = -1; |
lev->dline_miss[p] = 0; |
lev->wcet_miss[p] = 0; |
lev->nact[p] = 0; |
|
break; |
|
case STD_SET_NEW_LEVEL: |
|
lev->flag[p] |= RMSTAR_CHANGE_LEVEL; |
lev->new_level[p] = (int)(msg->param); |
|
break; |
|
case STD_ACTIVATE_TASK: |
|
/* Enable wcet check */ |
proc_table[p].avail_time = lev->wcet[p]; |
proc_table[p].wcet = lev->wcet[p]; |
proc_table[p].control |= CONTROL_CAP; |
|
RMSTAR_public_activate(l, p); |
|
break; |
} |
|
} |
return 0; |