/shark/trunk/ports/first/first-sync.c |
---|
74,6 → 74,8 |
local_scheduler_level = CBSSTAR_get_local_scheduler_level_from_pid(fsf_cbsstar_level, exec_shadow); |
scheduler_id = CBSSTAR_get_local_scheduler_id_from_pid(fsf_cbsstar_level, exec_shadow); |
if (proc_table[exec_shadow].task_level != local_scheduler_level) return 0; |
switch (scheduler_id) { |
case FSF_SCHEDULER_POSIX: |
budget = POSIXSTAR_getbudget(local_scheduler_level, exec_shadow); |
139,7 → 141,9 |
local_scheduler_level = CBSSTAR_get_local_scheduler_level_from_pid(fsf_cbsstar_level, exec_shadow); |
scheduler_id = CBSSTAR_get_local_scheduler_id_from_pid(fsf_cbsstar_level, exec_shadow); |
if (proc_table[exec_shadow].task_level != local_scheduler_level) return 0; |
switch (scheduler_id) { |
case FSF_SCHEDULER_POSIX: |
budget = POSIXSTAR_getbudget(local_scheduler_level, exec_shadow); |
/shark/trunk/ports/first/modules/posix.c |
---|
191,6 → 191,10 |
/* Change task level */ |
if (lev->flag[p] & POSIX_CHANGE_LEVEL) { |
#ifdef POSIX_DEBUG |
kern_printf("(P:NewLev %d)",lev->new_level[p]); |
#endif |
STD_command_message msg; |
proc_table[p].status = SLEEP; |
293,6 → 297,10 |
msg = (STD_command_message *)m; |
#ifdef POSIX_DEBUG |
kern_printf("(P:MSG %d)",msg->command); |
#endif |
switch(msg->command) { |
case STD_SET_NEW_LEVEL: |
311,7 → 319,9 |
} else { |
lev->new_slice[p] = 0; |
} |
lev->new_control[p] = 0; |
if (nrt->policy == NRT_RR_POLICY) |
lev->new_control[p] |= CONTROL_CAP; |
334,7 → 344,7 |
proc_table[p].wcet = lev->slice; |
} |
proc_table[p].control = lev->new_control[p]; |
proc_table[p].control |= lev->new_control[p]; |
POSIX_public_activate(l,p); |
/shark/trunk/ports/first/modules/edfstar.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: edfstar.c,v 1.2 2003-09-11 13:51:33 giacomo Exp $ |
CVS : $Id: edfstar.c,v 1.3 2003-09-11 15:42:01 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-09-11 13:51:33 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-09-11 15:42:01 $ |
------------ |
**/ |
300,7 → 300,7 |
private_dispatch(lev->scheduling_level,p,nostop); |
} |
static int EDFSTAR_change_level(LEVEL l, PID p) |
static int EDFSTAR_private_change_level(LEVEL l, PID p) |
{ |
EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]); |
307,12 → 307,19 |
/* Change task level */ |
if (lev->flag[p] & EDFSTAR_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]); |
EDFSTAR_check_preemption(lev); |
lev->nact[p] = 0; |
lev->budget[p] = -1; |
proc_table[p].task_level = lev->new_level[p]; |
340,7 → 347,7 |
edfstar_printf("(E:epi "); |
#endif |
if (EDFSTAR_change_level(l, p)) return; |
if (EDFSTAR_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) { |
437,6 → 444,8 |
/* Task EndCycle */ |
case (long)(NULL): |
if (EDFSTAR_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 ]-> |
448,25 → 457,6 |
/* we reset the capacity counters... */ |
proc_table[p].avail_time = proc_table[p].wcet; |
if (lev->flag[p] & EDFSTAR_CHANGE_LEVEL) { |
STD_command_message msg; |
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 0; |
} |
if (lev->nact[p] > 0) { |
#ifdef EDFSTAR_DEBUG |
515,7 → 505,11 |
default: |
msg = (STD_command_message *)m; |
#ifdef EDFSTAR_DEBUG |
edfstar_printf("(E:MSG %d)",msg->command); |
#endif |
switch(msg->command) { |
case STD_SET_NEW_MODEL: |
/* if the EDFSTAR_task_create is called, then the pclass must be a |
523,7 → 517,7 |
h=(HARD_TASK_MODEL *)(msg->param); |
/* now we know that m is a valid model */ |
lev->wcet[p]=h->wcet; |
lev->wcet[p] = h->wcet; |
lev->period[p] = h->mit; |
lev->flag[p] = 0; |
547,6 → 541,7 |
proc_table[p].avail_time = lev->wcet[p]; |
proc_table[p].wcet = lev->wcet[p]; |
proc_table[p].control |= CONTROL_CAP; |
EDFSTAR_public_activate(l, p); |
break; |
/shark/trunk/ports/first/modules/posixstar.c |
---|
237,13 → 237,10 |
} |
static void POSIXSTAR_public_epilogue(LEVEL l, PID p) |
static int POSIXSTAR_private_change_level(LEVEL l, PID p) |
{ |
POSIXSTAR_level_des *lev = (POSIXSTAR_level_des *)(level_table[l]); |
#ifdef POSIXSTAR_DEBUG |
kern_printf("(PS:Epi:%d)",p); |
#endif |
/* Change task level */ |
if (lev->flag[p] & POSIXSTAR_CHANGE_LEVEL) { |
251,15 → 248,37 |
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[lev->priority[p]]); |
POSIXSTAR_private_scheduler(lev); |
lev->nact[p] = 0; |
lev->budget[p] = -1; |
proc_table[p].task_level = lev->new_level[p]; |
msg.command = STD_ACTIVATE_TASK; |
level_table[lev->new_level[p]] -> public_message(lev->new_level[p],p,&msg); |
return; |
return 1; |
} |
return 0; |
} |
static void POSIXSTAR_public_epilogue(LEVEL l, PID p) |
{ |
POSIXSTAR_level_des *lev = (POSIXSTAR_level_des *)(level_table[l]); |
#ifdef POSIXSTAR_DEBUG |
kern_printf("(PS:Epi:%d)",p); |
#endif |
if (POSIXSTAR_private_change_level(l,p)) return; |
if (p==lev->activated) { |
if (lev->yielding) { |
lev->yielding = 0; |
381,6 → 400,8 |
/* Task EndCycle */ |
case (long)(NULL): |
if (POSIXSTAR_private_change_level(l,p)) return 0; |
if (lev->nact[p] > 0) { |
/* continue!!!! */ |
lev->nact[p]--; |
/shark/trunk/ports/first/first-server.c |
---|
191,6 → 191,10 |
/* Send change level command to posix level */ |
msg = (STD_command_message *)malloc(sizeof(STD_command_message)); |
#ifdef FSF_DEBUG |
kern_printf("(MSG EDFSTAR LEV %d SEV %d THR %d)",local_scheduler_level,server,thread); |
#endif |
msg->command = STD_SET_NEW_MODEL; |
msg->param = (void *)(rt_arg); |
level_table[local_scheduler_level]->public_message(local_scheduler_level,thread,msg); |