/demos/branches/pj/block/idelin.c |
---|
File deleted |
/demos/branches/pj/block/idetest3.c |
---|
File deleted |
/demos/branches/pj/block/idernd.c |
---|
File deleted |
/demos/branches/pj/block/common.c |
---|
File deleted |
/demos/branches/pj/block/readme |
---|
File deleted |
/demos/branches/pj/block/initblk.c |
---|
File deleted |
/demos/branches/pj/block/makefile |
---|
File deleted |
/demos/branches/pj/block/common.h |
---|
File deleted |
/demos/branches/pj/block/idetest0.c |
---|
File deleted |
/demos/branches/pj/block/idetest1.c |
---|
File deleted |
/demos/branches/pj/block/idetest2.c |
---|
File deleted |
/demos/branches/pj/bca/bca.h |
---|
File deleted |
/demos/branches/pj/bca/aereo.c |
---|
File deleted |
/demos/branches/pj/bca/dummy.c |
---|
File deleted |
/demos/branches/pj/bca/makefile |
---|
File deleted |
/demos/branches/pj/bca/fab_lib/fab_msg.h |
---|
File deleted |
/demos/branches/pj/bca/fab_lib/fab_grx.sys |
---|
File deleted |
/demos/branches/pj/bca/fab_lib/fab_tool.h |
---|
File deleted |
/demos/branches/pj/bca/fab_lib/fab_grx.h |
---|
File deleted |
/demos/branches/pj/bca/fab_lib/fab_show.h |
---|
File deleted |
/demos/branches/pj/bca/scenario.c |
---|
File deleted |
/demos/branches/pj/bca/initfile.c |
---|
File deleted |
/demos/branches/pj/bca/missile.c |
---|
File deleted |
/demos/branches/pj/bca/bca_lib.c |
---|
File deleted |
/demos/branches/pj/bca/readme |
---|
File deleted |
/demos/branches/pj/bca/bca_raw/aereo1_h.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/cannon_h.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/esplo1.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/aereo2_h.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/esplo2.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/esplo3.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/bca.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/esplo4.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/missile1.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/esplo5.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/missile2.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/sfondo.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/aereo1.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/cannon.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/bca_raw/aereo2.raw |
---|
File deleted |
\ No newline at end of file |
/demos/branches/pj/bca/fab_lib.c |
---|
File deleted |
/demos/branches/pj/bca/control.c |
---|
File deleted |
/demos/branches/pj/bca/cannone.c |
---|
File deleted |
/demos/branches/pj/bca/esplo.c |
---|
File deleted |
/demos/branches/pj/bca/bca.c |
---|
File deleted |
/demos/branches/pj/perf/readme |
---|
File deleted |
/demos/branches/pj/perf/makefile |
---|
File deleted |
/demos/branches/pj/perf/perf1.c |
---|
File deleted |
/demos/branches/pj/perf/perf2.c |
---|
File deleted |
/demos/branches/pj/perf/perf3.c |
---|
File deleted |
/demos/branches/pj/perf/perf4.c |
---|
File deleted |
/demos/branches/pj/perf/initfile.c |
---|
File deleted |
/demos/branches/pj/first/test5.c |
---|
File deleted |
/demos/branches/pj/first/test6.c |
---|
File deleted |
/demos/branches/pj/first/cbsstar.h |
---|
File deleted |
/demos/branches/pj/first/rmstar.c |
---|
File deleted |
/demos/branches/pj/first/testiq.c |
---|
File deleted |
/demos/branches/pj/first/rmstar.h |
---|
File deleted |
/demos/branches/pj/first/edfstar.c |
---|
File deleted |
/demos/branches/pj/first/makefile |
---|
File deleted |
/demos/branches/pj/first/iqueue.c |
---|
File deleted |
/demos/branches/pj/first/edfstar.h |
---|
File deleted |
/demos/branches/pj/first/test1.c |
---|
File deleted |
/demos/branches/pj/first/test2.c |
---|
File deleted |
/demos/branches/pj/first/cbsstar.c |
---|
File deleted |
/demos/branches/pj/first/test3.c |
---|
File deleted |
/demos/branches/pj/first/iqueue.h |
---|
File deleted |
/demos/branches/pj/first/test4.c |
---|
File deleted |
/demos/branches/pj/tracer/dfixed/dfixed.c |
---|
File deleted |
/demos/branches/pj/tracer/dfixed/initfile.c |
---|
File deleted |
/demos/branches/pj/tracer/dfixed/readme |
---|
File deleted |
/demos/branches/pj/tracer/dfixed/makefile |
---|
File deleted |
/demos/branches/pj/tracer/udp/initfile.c |
---|
File deleted |
/demos/branches/pj/tracer/udp/udptrace.c |
---|
File deleted |
/demos/branches/pj/tracer/udp/readme |
---|
File deleted |
/demos/branches/pj/tracer/udp/makefile |
---|
File deleted |
/demos/branches/pj/tracer/small/treec1.c |
---|
File deleted |
/demos/branches/pj/tracer/small/hello.c |
---|
File deleted |
/demos/branches/pj/tracer/small/treec2.c |
---|
File deleted |
/demos/branches/pj/tracer/small/hello1.c |
---|
File deleted |
/demos/branches/pj/tracer/small/hello2.c |
---|
File deleted |
/demos/branches/pj/tracer/small/treef1.c |
---|
File deleted |
/demos/branches/pj/tracer/small/common.c |
---|
File deleted |
/demos/branches/pj/tracer/small/simple.c |
---|
File deleted |
/demos/branches/pj/tracer/small/readme |
---|
File deleted |
/demos/branches/pj/tracer/small/initfs.c |
---|
File deleted |
/demos/branches/pj/tracer/small/makefile |
---|
File deleted |
/demos/branches/pj/tracer/small/common.h |
---|
File deleted |
/demos/branches/pj/tracer/small/test0.c |
---|
File deleted |
/demos/branches/pj/tracer/readme |
---|
File deleted |
/demos/branches/pj/tracer/makefile |
---|
File deleted |
/demos/branches/pj/tracer/utils/util.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/udpdump.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/jdump.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/util.h |
---|
File deleted |
/demos/branches/pj/tracer/utils/sa.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/wait.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/distr.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/road.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/types.h |
---|
File deleted |
/demos/branches/pj/tracer/utils/tdump.c |
---|
File deleted |
/demos/branches/pj/tracer/utils/readme |
---|
File deleted |
/demos/branches/pj/tracer/utils/makefile |
---|
File deleted |
/demos/branches/pj/makefile |
---|
File deleted |
/demos/branches/pj/parport/initfile.c |
---|
File deleted |
/demos/branches/pj/parport/ppdemo.c |
---|
File deleted |
/demos/branches/pj/parport/readme.txt |
---|
File deleted |
/demos/branches/pj/parport/makefile |
---|
File deleted |
/demos/branches/pj/orbit/orbit.c |
---|
18,11 → 18,11 |
/* |
------------ |
CVS : $Id: orbit.c,v 1.3 2003-01-07 17:10:17 pj Exp $ |
CVS : $Id: orbit.c,v 1.1.1.1 2002-09-02 09:37:45 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:10:17 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-09-02 09:37:45 $ |
------------ |
*/ |
185,11 → 185,12 |
/* MAIN */ |
/*--------------------------------------------------------------*/ |
int main() |
TASK main() |
{ |
HARD_TASK_MODEL m; |
char c; /* carattere letto da tastiera */ |
set_exchandler_grx(); |
sys_atrunlevel(my_fine, NULL, RUNLEVEL_BEFORE_EXIT); |
sem_init(&mutex,0,1); |
/demos/branches/pj/thdemo/demo.c |
---|
137,9 → 137,29 |
} |
void demo_exc_handler(int signo, siginfo_t *info, void *extra) |
{ |
struct timespec t; |
grx_close(); |
/* Default action for an kern exception is */ |
kern_cli(); |
ll_gettime(TIME_EXACT, &t), |
kern_printf("\nHartik Exception raised!!!" |
"\nTime (s:ns) :%ld:%ld" |
"\nException number:%d" |
"\nPID :%d\n", |
t.tv_sec, t.tv_nsec, info->si_value.sival_int, |
info->si_task); |
sys_end(); |
// ll_abort(5); |
} |
void my_close(void *arg) |
{ |
grx_close(); |
// sys_status(3); |
} |
179,6 → 199,8 |
KEY_EVT k; |
struct sigaction action; |
srand(4); |
version(); |
212,6 → 234,18 |
k.ascii = 13; |
keyb_hook(k,endfun); |
/* Init the standard Hartik exception handler */ |
/* Set the signal action */ |
action.sa_flags = SA_SIGINFO; |
action.sa_sigaction = demo_exc_handler; |
action.sa_handler = 0; |
sigfillset(&action.sa_mask); /* we block all the other signals... */ |
if (sigaction(SIGHEXC, &action, NULL) == -1) { |
perror("Error initializing signals..."); |
sys_end(); |
} |
sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT); |
/demos/branches/pj/thdemo/fftplay.c |
---|
619,6 → 619,7 |
void my_close(void *arg) |
{ |
grx_close(); |
sys_status(3); |
} |
/demos/branches/pj/simcity/keyboard.c |
---|
46,4 → 46,4 |
k.scan = KEY_D; |
k.ascii = 'd'; |
keyb_hook(k, sensor_switch); |
} |
} |
/demos/branches/pj/simcity/include/simcity.h |
---|
2,7 → 2,7 |
// global variables and tasks bodies declaration |
#include <kernel/func.h> |
#include <semaphore.h> |
#include <semaphor.h> |
#ifndef CST |
#include "constant.h" |
#endif |
/demos/branches/pj/simcity/include/keyfunct.h |
---|
7,4 → 7,4 |
void h_car_kill(KEY_EVT *); |
void endfun(KEY_EVT *); |
void refresh(KEY_EVT *); |
void sensor_switch(KEY_EVT *); |
void sensor_switch(KEY_EVT *); |
/demos/branches/pj/simcity/initfile.c |
---|
77,7 → 77,10 |
HARTPORT_init(); |
kern_printf("TIME=%d\n",sys_gettime(NULL)); |
KEYB_init(NULL); |
kern_printf("TIME=%d\n",sys_gettime(NULL)); |
KEYB_init(NULL); |
__call_main__(mb); |
/demos/branches/pj/simcity/car.c |
---|
172,4 → 172,4 |
set_spd=MAX_SPEED; |
} |
cd->speed=set_spd; |
} |
} |
/demos/branches/pj/simcity/simcity.c |
---|
6,7 → 6,7 |
#include <drivers/keyb.h> |
#include <drivers/glib.h> |
#include <kernel/kern.h> |
#include <semaphore.h> |
#include <semaphor.h> |
#include <math.h> |
#include "include/constant.h" |
#include "include/misc.h" |
76,6 → 76,23 |
cprintf("Ferrari Fabio\n"); |
} |
void demo_exc_handler(int signo, siginfo_t *info, void *extra) |
{ |
struct timespec t; |
grx_close(); |
/* Default action for an kern exception is */ |
kern_cli(); |
ll_gettime(TIME_EXACT, &t), |
kern_printf("\nS.Ha.R.K. Exception raised!!!" |
"\nTime (s:ns) :%d:%d" |
"\nException number:%d" |
"\nPID :%d\n", |
t.tv_sec, t.tv_nsec, info->si_value.sival_int, |
info->si_task); |
sys_end(); |
} |
void my_close(void *arg) |
{ |
grx_close(); |
86,9 → 103,20 |
{ |
int i; |
char tl_name[4]; |
struct sigaction action; |
version(); |
/* Init the standard Hartik exception handler */ |
/* Set the signal action */ |
action.sa_flags = SA_SIGINFO; |
action.sa_sigaction = demo_exc_handler; |
action.sa_handler = 0; |
sigfillset(&action.sa_mask); /* we block all the other signals... */ |
if (sigaction(SIGHEXC, &action, NULL) == -1) { |
perror("Error initializing signals..."); |
sys_end(); |
} |
sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT); |
//resetting kill flags |
/demos/branches/pj/simcity/tasks.c |
---|
5,7 → 5,7 |
#include <string.h> |
#include <kernel/func.h> |
#include <drivers/glib.h> |
#include <semaphore.h> |
#include <semaphor.h> |
#include <math.h> |
#include "include/simcity.h" |
#include "include/states.h" |
406,4 → 406,4 |
cd->xp=my_rint(cd->xpos); |
cd->yp=my_rint(cd->ypos); |
} |
} |
} |
/demos/branches/pj/simcity/keyfunct.c |
---|
82,4 → 82,4 |
void sensor_switch(KEY_EVT *k) { |
if(sens==0) sens=1; |
else sens=0; |
} |
} |
/demos/branches/pj/simcity/misc.c |
---|
212,4 → 212,4 |
break; |
} |
return min_tl; |
} |
} |
/demos/branches/pj/edfact/edfact.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: edfact.c,v 1.4 2003-01-07 17:10:16 pj Exp $ |
CVS : $Id: edfact.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-01-07 17:10:16 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-09-02 09:37:41 $ |
------------ |
**/ |
84,7 → 84,7 |
/*+ used to manage the JOB_TASK_MODEL and the |
periodicity +*/ |
IQUEUE ready; /*+ the ready queue +*/ |
QUEUE ready; /*+ the ready queue +*/ |
int flags; /*+ the init flags... +*/ |
95,27 → 95,35 |
static void EDFACT_timer_deadline(void *par); |
static void EDFACT_internal_activate(EDFACT_level_des *lev, PID p, |
struct timespec *t) |
static void EDFACT_internal_activate(EDFACT_level_des *lev, PID p) |
{ |
struct timespec *temp; |
TIMESPEC_ASSIGN(&proc_table[p].timespec_priority, |
&proc_table[p].request_time); |
ADDUSEC2TIMESPEC(lev->period[p], &proc_table[p].timespec_priority); |
temp = iq_query_timespec(p, &lev->ready); |
TIMESPEC_ASSIGN(temp,t); |
ADDUSEC2TIMESPEC(lev->period[p], temp); |
TIMESPEC_ASSIGN(&lev->deadline_timespec[p], |
temp); |
&proc_table[p].timespec_priority); |
/* Insert task in the correct position */ |
proc_table[p].status = EDFACT_READY; |
iq_timespec_insert(p,&lev->ready); |
q_timespec_insert(p,&lev->ready); |
/* needed because when there is a wcet miss I disable CONTROL_CAP */ |
proc_table[p].control |= CONTROL_CAP; |
} |
static char *EDFACT_status_to_a(WORD status) |
{ |
if (status < MODULE_STATUS_BASE) |
return status_to_a(status); |
switch (status) { |
case EDFACT_READY : return "EDFACT_Ready"; |
case EDFACT_IDLE : return "EDFACT_Idle"; |
default : return "EDFACT_Unknown"; |
} |
} |
static void EDFACT_timer_deadline(void *par) |
{ |
PID p = (PID) par; |
126,8 → 134,10 |
switch (proc_table[p].status) { |
case EDFACT_IDLE: |
edfact_printf("I%d",p); |
TIMESPEC_ASSIGN(&proc_table[p].request_time, |
&proc_table[p].timespec_priority); |
EDFACT_internal_activate(lev,p, &lev->deadline_timespec[p]); |
EDFACT_internal_activate(lev,p); |
event_need_reschedule(); |
break; |
159,17 → 169,93 |
kern_raise(XDEADLINE_MISS,p); |
} |
static int EDFACT_level_accept_task_model(LEVEL l, TASK_MODEL *m) |
{ |
if (m->pclass == HARD_PCLASS || m->pclass == (HARD_PCLASS | l)) { |
HARD_TASK_MODEL *h = (HARD_TASK_MODEL *)m; |
if (h->wcet && h->mit && h->periodicity == PERIODIC) |
return 0; |
} |
return -1; |
} |
static int EDFACT_level_accept_guest_model(LEVEL l, TASK_MODEL *m) |
{ |
if (m->pclass == JOB_PCLASS || m->pclass == (JOB_PCLASS | l)) |
return 0; |
else |
return -1; |
} |
static char *onoff(int i) |
{ |
if (i) |
return "On "; |
else |
return "Off"; |
} |
static void EDFACT_level_status(LEVEL l) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
PID p = lev->ready; |
kern_printf("On-line guarantee : %s\n", |
onoff(lev->flags & EDFACT_ENABLE_GUARANTEE)); |
kern_printf("Used Bandwidth : %u/%u\n", |
lev->U, MAX_BANDWIDTH); |
while (p != NIL) { |
if ((proc_table[p].pclass) == JOB_PCLASS) |
kern_printf("Pid: %2d (GUEST)\n", p); |
else |
kern_printf("Pid: %2d Name: %10s %s: %9d Dline: %9d.%6d Stat: %s\n", |
p, |
proc_table[p].name, |
"Period ", |
lev->period[p], |
proc_table[p].timespec_priority.tv_sec, |
proc_table[p].timespec_priority.tv_nsec/1000, |
EDFACT_status_to_a(proc_table[p].status)); |
p = proc_table[p].next; |
} |
for (p=0; p<MAX_PROC; p++) |
if (proc_table[p].task_level == l && proc_table[p].status != EDFACT_READY |
&& proc_table[p].status != FREE ) |
kern_printf("Pid: %2d Name: %10s %s: %9d Dline: %9d.%6d Stat: %s\n", |
p, |
proc_table[p].name, |
"Period ", |
lev->period[p], |
proc_table[p].timespec_priority.tv_sec, |
proc_table[p].timespec_priority.tv_nsec/1000, |
EDFACT_status_to_a(proc_table[p].status)); |
} |
/* The scheduler only gets the first task in the queue */ |
static PID EDFACT_public_scheduler(LEVEL l) |
static PID EDFACT_level_scheduler(LEVEL l) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
return iq_query_first(&lev->ready); |
/* { // print 4 dbg the ready queue |
PID p= lev->ready; |
kern_printf("(s"); |
while (p != NIL) { |
kern_printf("%d ",p); |
p = proc_table[p].next; |
} |
kern_printf(") "); |
} |
*/ |
return (PID)lev->ready; |
} |
/* The on-line guarantee is enabled only if the appropriate flag is set... */ |
static int EDFACT_public_guarantee(LEVEL l, bandwidth_t *freebandwidth) |
static int EDFACT_level_guarantee(LEVEL l, bandwidth_t *freebandwidth) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
187,17 → 273,14 |
} |
static int EDFACT_public_create(LEVEL l, PID p, TASK_MODEL *m) |
static int EDFACT_task_create(LEVEL l, PID p, TASK_MODEL *m) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
HARD_TASK_MODEL *h; |
/* if the EDFACT_task_create is called, then the pclass must be a |
valid pclass. */ |
if (m->pclass != HARD_PCLASS) return -1; |
if (m->level != 0 && m->level != l) return -1; |
h = (HARD_TASK_MODEL *)m; |
if (!h->wcet || !h->mit || h->periodicity != PERIODIC) return -1; |
/* now we know that m is a valid model */ |
HARD_TASK_MODEL *h = (HARD_TASK_MODEL *)m; |
lev->period[p] = h->mit; |
239,7 → 322,7 |
return 0; /* OK, also if the task cannot be guaranteed... */ |
} |
static void EDFACT_public_detach(LEVEL l, PID p) |
static void EDFACT_task_detach(LEVEL l, PID p) |
{ |
/* the EDFACT level doesn't introduce any dinamic allocated new field. |
we have only to reset the NO_GUARANTEE FIELD and decrement the allocated |
253,17 → 336,22 |
lev->U -= (MAX_BANDWIDTH / lev->period[p]) * proc_table[p].wcet; |
} |
static void EDFACT_public_dispatch(LEVEL l, PID p, int nostop) |
static int EDFACT_task_eligible(LEVEL l, PID p) |
{ |
return 0; /* if the task p is chosen, it is always eligible */ |
} |
static void EDFACT_task_dispatch(LEVEL l, PID p, int nostop) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
/* the task state is set EXE by the scheduler() |
we extract the task from the ready queue |
NB: we can't assume that p is the first task in the queue!!! */ |
iq_extract(p, &lev->ready); |
q_extract(p, &lev->ready); |
} |
static void EDFACT_public_epilogue(LEVEL l, PID p) |
static void EDFACT_task_epilogue(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
276,14 → 364,13 |
} |
/* the task it returns into the ready queue... */ |
iq_timespec_insert(p,&lev->ready); |
q_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
} |
static void EDFACT_public_activate(LEVEL l, PID p) |
static void EDFACT_task_activate(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
struct timespec t; |
/* Test if we are trying to activate a non sleeping task */ |
/* save activation (only if needed... */ |
293,9 → 380,10 |
return; |
} |
kern_gettime(&t); |
EDFACT_internal_activate(lev,p, &t); |
ll_gettime(TIME_EXACT, &proc_table[p].request_time); |
EDFACT_internal_activate(lev,p); |
/* Set the deadline timer */ |
lev->deadline_timer[p] = kern_event_post(&lev->deadline_timespec[p], |
EDFACT_timer_deadline, |
303,24 → 391,24 |
} |
static void EDFACT_public_unblock(LEVEL l, PID p) |
static void EDFACT_task_insert(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
/* Insert task in the coEDFect position */ |
proc_table[p].status = EDFACT_READY; |
iq_timespec_insert(p,&lev->ready); |
q_timespec_insert(p,&lev->ready); |
} |
static void EDFACT_public_block(LEVEL l, PID p) |
static void EDFACT_task_extract(LEVEL l, PID p) |
{ |
} |
static int EDFACT_public_message(LEVEL l, PID p, void *m) |
static void EDFACT_task_endcycle(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
struct timespec t; |
/* we reset the capacity counters... */ |
proc_table[p].avail_time = proc_table[p].wcet; |
331,14 → 419,15 |
lev->nact[p]--; |
/* see also EDFACT_timer_deadline */ |
kern_gettime(&t); |
EDFACT_internal_activate(lev,p, &t); |
ll_gettime(TIME_EXACT, &proc_table[p].request_time); |
EDFACT_internal_activate(lev,p); |
/* check if the deadline has already expired */ |
if (TIMESPEC_A_LT_B(iq_query_timespec(p, &lev->ready), &schedule_time)) { |
if (TIMESPEC_A_LT_B(&proc_table[p].timespec_priority, &schedule_time)) { |
/* count the deadline miss */ |
lev->dline_miss[p]++; |
kern_event_delete(lev->deadline_timer[p]); |
event_delete(lev->deadline_timer[p]); |
} |
} |
349,16 → 438,11 |
proc_table[p].status = EDFACT_IDLE; |
/* when the deadline timer fire, it recognize the situation and set |
correctly all the stuffs (like reactivation, etc... ) */ |
correctly all the stuffs (like reactivation, request_time, etc... ) */ |
} |
jet_update_endcycle(); /* Update the Jet data... */ |
trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */ |
return 0; |
} |
static void EDFACT_public_end(LEVEL l, PID p) |
static void EDFACT_task_end(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
366,35 → 450,35 |
/* we finally put the task in the ready queue */ |
proc_table[p].status = FREE; |
iq_insertfirst(p,&freedesc); |
q_insertfirst(p,&freedesc); |
/* and free the allocated bandwidth */ |
lev->U -= (MAX_BANDWIDTH/lev->period[p]) * proc_table[p].wcet; |
if (lev->deadline_timer[p] != -1) { |
edfact_printf("²%d",p); |
kern_event_delete(lev->deadline_timer[p]); |
event_delete(lev->deadline_timer[p]); |
} |
} |
static void EDFACT_task_sleep(LEVEL l, PID p) |
{ kern_raise(XUNVALID_TASK,exec_shadow); } |
static void EDFACT_task_delay(LEVEL l, PID p, TIME usdelay) |
{ kern_raise(XUNVALID_TASK,exec_shadow); } |
/* Guest Functions |
These functions manages a JOB_TASK_MODEL, that is used to put |
a guest task in the EDFACT ready queue. */ |
static void EDFACT_private_insert(LEVEL l, PID p, TASK_MODEL *m) |
static int EDFACT_guest_create(LEVEL l, PID p, TASK_MODEL *m) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
JOB_TASK_MODEL *job = (JOB_TASK_MODEL *)m; |
JOB_TASK_MODEL *job; |
/* if the EDFACT_guest_create is called, then the pclass must be a |
valid pclass. */ |
if (m->pclass != JOB_PCLASS || (m->level != 0 && m->level != l) ) { |
kern_raise(XINVALID_TASK, p); |
return; |
} |
job = (JOB_TASK_MODEL *)m; |
TIMESPEC_ASSIGN(iq_query_timespec(p, &lev->ready), &job->deadline); |
TIMESPEC_ASSIGN(&proc_table[p].timespec_priority, &job->deadline); |
lev->deadline_timer[p] = -1; |
lev->dline_miss[p] = 0; |
403,50 → 487,83 |
if (job->noraiseexc) |
lev->flag[p] = EDFACT_FLAG_NORAISEEXC; |
else { |
else |
lev->flag[p] = 0; |
lev->deadline_timer[p] = kern_event_post(iq_query_timespec(p, &lev->ready), |
EDFACT_timer_guest_deadline, |
(void *)p); |
} |
lev->period[p] = job->period; |
/* Insert task in the correct position */ |
iq_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
/* there is no bandwidth guarantee at this level, it is performed |
by the level that inserts guest tasks... */ |
return 0; /* OK, also if the task cannot be guaranteed... */ |
} |
static void EDFACT_private_dispatch(LEVEL l, PID p, int nostop) |
static void EDFACT_guest_detach(LEVEL l, PID p) |
{ |
/* the EDFACT level doesn't introduce any dinamic allocated new field. |
No guarantee is performed on guest tasks... so we don't have to reset |
the NO_GUARANTEE FIELD */ |
} |
static void EDFACT_guest_dispatch(LEVEL l, PID p, int nostop) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
/* the task state is set to EXE by the scheduler() |
we extract the task from the ready queue |
NB: we can't assume that p is the first task in the queue!!! */ |
iq_extract(p, &lev->ready); |
q_extract(p, &lev->ready); |
} |
static void EDFACT_private_epilogue(LEVEL l, PID p) |
static void EDFACT_guest_epilogue(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
/* the task has been preempted. it returns into the ready queue... */ |
iq_timespec_insert(p,&lev->ready); |
q_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
} |
static void EDFACT_private_extract(LEVEL l, PID p) |
static void EDFACT_guest_activate(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
/* Insert task in the correct position */ |
q_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
/* Set the deadline timer */ |
if (!(lev->flag[p] & EDFACT_FLAG_NORAISEEXC)) |
lev->deadline_timer[p] = kern_event_post(&proc_table[p].timespec_priority, |
EDFACT_timer_guest_deadline, |
(void *)p); |
} |
static void EDFACT_guest_insert(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
/* Insert task in the correct position */ |
q_timespec_insert(p,&lev->ready); |
proc_table[p].status = EDFACT_READY; |
} |
static void EDFACT_guest_extract(LEVEL l, PID p) |
{ |
} |
static void EDFACT_guest_endcycle(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void EDFACT_guest_end(LEVEL l, PID p) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
//kern_printf("EDFACT_guest_end: dline timer %d\n",lev->deadline_timer[p]); |
if (proc_table[p].status == EDFACT_READY) |
{ |
iq_extract(p, &lev->ready); |
q_extract(p, &lev->ready); |
//kern_printf("(g_end rdy extr)"); |
} |
453,17 → 570,23 |
/* we remove the deadline timer, because the slice is finished */ |
if (lev->deadline_timer[p] != NIL) { |
// kern_printf("EDFACT_guest_end: dline timer %d\n",lev->deadline_timer[p]); |
kern_event_delete(lev->deadline_timer[p]); |
event_delete(lev->deadline_timer[p]); |
lev->deadline_timer[p] = NIL; |
} |
} |
static void EDFACT_guest_sleep(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void EDFACT_guest_delay(LEVEL l, PID p, TIME usdelay) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
/* Registration functions */ |
/*+ Registration function: |
int flags the init flags ... see EDFACT.h +*/ |
LEVEL EDFACT_register_level(int flags) |
void EDFACT_register_level(int flags) |
{ |
LEVEL l; /* the level that we register */ |
EDFACT_level_des *lev; /* for readableness only */ |
472,33 → 595,58 |
printk("EDFACT_register_level\n"); |
/* request an entry in the level_table */ |
l = level_alloc_descriptor(sizeof(EDFACT_level_des)); |
l = level_alloc_descriptor(); |
lev = (EDFACT_level_des *)level_table[l]; |
printk(" alloco descrittore %d %d\n",l,(int)sizeof(EDFACT_level_des)); |
/* alloc the space needed for the EDFACT_level_des */ |
lev = (EDFACT_level_des *)kern_alloc(sizeof(EDFACT_level_des)); |
printk(" lev=%d\n",(int)lev); |
/* update the level_table with the new entry */ |
level_table[l] = (level_des *)lev; |
/* fill the standard descriptor */ |
lev->l.private_insert = EDFACT_private_insert; |
lev->l.private_extract = EDFACT_private_extract; |
lev->l.private_dispatch = EDFACT_private_dispatch; |
lev->l.private_epilogue = EDFACT_private_epilogue; |
strncpy(lev->l.level_name, EDFACT_LEVELNAME, MAX_LEVELNAME); |
lev->l.level_code = EDFACT_LEVEL_CODE; |
lev->l.level_version = EDFACT_LEVEL_VERSION; |
lev->l.public_scheduler = EDFACT_public_scheduler; |
lev->l.level_accept_task_model = EDFACT_level_accept_task_model; |
lev->l.level_accept_guest_model = EDFACT_level_accept_guest_model; |
lev->l.level_status = EDFACT_level_status; |
lev->l.level_scheduler = EDFACT_level_scheduler; |
if (flags & EDFACT_ENABLE_GUARANTEE) |
lev->l.public_guarantee = EDFACT_public_guarantee; |
lev->l.level_guarantee = EDFACT_level_guarantee; |
else |
lev->l.public_guarantee = NULL; |
lev->l.public_create = EDFACT_public_create; |
lev->l.public_detach = EDFACT_public_detach; |
lev->l.public_end = EDFACT_public_end; |
lev->l.public_dispatch = EDFACT_public_dispatch; |
lev->l.public_epilogue = EDFACT_public_epilogue; |
lev->l.public_activate = EDFACT_public_activate; |
lev->l.public_unblock = EDFACT_public_unblock; |
lev->l.public_block = EDFACT_public_block; |
lev->l.public_message = EDFACT_public_message; |
lev->l.level_guarantee = NULL; |
lev->l.task_create = EDFACT_task_create; |
lev->l.task_detach = EDFACT_task_detach; |
lev->l.task_eligible = EDFACT_task_eligible; |
lev->l.task_dispatch = EDFACT_task_dispatch; |
lev->l.task_epilogue = EDFACT_task_epilogue; |
lev->l.task_activate = EDFACT_task_activate; |
lev->l.task_insert = EDFACT_task_insert; |
lev->l.task_extract = EDFACT_task_extract; |
lev->l.task_endcycle = EDFACT_task_endcycle; |
lev->l.task_end = EDFACT_task_end; |
lev->l.task_sleep = EDFACT_task_sleep; |
lev->l.task_delay = EDFACT_task_delay; |
lev->l.guest_create = EDFACT_guest_create; |
lev->l.guest_detach = EDFACT_guest_detach; |
lev->l.guest_dispatch = EDFACT_guest_dispatch; |
lev->l.guest_epilogue = EDFACT_guest_epilogue; |
lev->l.guest_activate = EDFACT_guest_activate; |
lev->l.guest_insert = EDFACT_guest_insert; |
lev->l.guest_extract = EDFACT_guest_extract; |
lev->l.guest_endcycle = EDFACT_guest_endcycle; |
lev->l.guest_end = EDFACT_guest_end; |
lev->l.guest_sleep = EDFACT_guest_sleep; |
lev->l.guest_delay = EDFACT_guest_delay; |
/* fill the EDFACT descriptor part */ |
for(i=0; i<MAX_PROC; i++) { |
lev->period[i] = 0; |
509,18 → 657,19 |
lev->nact[i] = 0; |
} |
iq_init(&lev->ready,&freedesc, 0); |
lev->ready = NIL; |
lev->flags = flags & 0x07; |
lev->U = 0; |
return l; |
} |
bandwidth_t EDFACT_usedbandwidth(LEVEL l) |
{ |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
return lev->U; |
if (lev->l.level_code == EDFACT_LEVEL_CODE && |
lev->l.level_version == EDFACT_LEVEL_VERSION) |
return lev->U; |
else |
return 0; |
} |
int EDFACT_get_dline_miss(PID p) |
527,8 → 676,11 |
{ |
LEVEL l = proc_table[p].task_level; |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
return lev->dline_miss[p]; |
if (lev->l.level_code == EDFACT_LEVEL_CODE && |
lev->l.level_version == EDFACT_LEVEL_VERSION) |
return lev->dline_miss[p]; |
else |
return -1; |
} |
int EDFACT_get_wcet_miss(PID p) |
535,8 → 687,11 |
{ |
LEVEL l = proc_table[p].task_level; |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
return lev->wcet_miss[p]; |
if (lev->l.level_code == EDFACT_LEVEL_CODE && |
lev->l.level_version == EDFACT_LEVEL_VERSION) |
return lev->wcet_miss[p]; |
else |
return -1; |
} |
int EDFACT_get_nact(PID p) |
543,8 → 698,11 |
{ |
LEVEL l = proc_table[p].task_level; |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
return lev->nact[p]; |
if (lev->l.level_code == EDFACT_LEVEL_CODE && |
lev->l.level_version == EDFACT_LEVEL_VERSION) |
return lev->nact[p]; |
else |
return -1; |
} |
int EDFACT_reset_dline_miss(PID p) |
551,9 → 709,14 |
{ |
LEVEL l = proc_table[p].task_level; |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
lev->dline_miss[p] = 0; |
return 0; |
if (lev->l.level_code == EDFACT_LEVEL_CODE && |
lev->l.level_version == EDFACT_LEVEL_VERSION) |
{ |
lev->dline_miss[p] = 0; |
return 0; |
} |
else |
return -1; |
} |
int EDFACT_reset_wcet_miss(PID p) |
560,8 → 723,13 |
{ |
LEVEL l = proc_table[p].task_level; |
EDFACT_level_des *lev = (EDFACT_level_des *)(level_table[l]); |
lev->wcet_miss[p] = 0; |
return 0; |
if (lev->l.level_code == EDFACT_LEVEL_CODE && |
lev->l.level_version == EDFACT_LEVEL_VERSION) |
{ |
lev->wcet_miss[p] = 0; |
return 0; |
} |
else |
return -1; |
} |
/demos/branches/pj/edfact/edfact.h |
---|
20,11 → 20,11 |
/** |
------------ |
CVS : $Id: edfact.h,v 1.2 2003-01-07 17:10:16 pj Exp $ |
CVS : $Id: edfact.h,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-01-07 17:10:16 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-09-02 09:37:41 $ |
------------ |
This file contains the server EDFACT (EDF with pending activations) |
103,6 → 103,7 |
#include <kernel/config.h> |
#include <sys/types.h> |
#include <kernel/types.h> |
#include <modules/codes.h> |
131,10 → 132,8 |
/*+ Registration function: |
int flags Options to be used in this level instance... |
returns the level number at which the module has been registered. |
+*/ |
LEVEL EDFACT_register_level(int flags); |
void EDFACT_register_level(int flags); |
/*+ Returns the used bandwidth of a level +*/ |
bandwidth_t EDFACT_usedbandwidth(LEVEL l); |
/demos/branches/pj/myapp/initfile.c |
---|
0,0 → 1,66 |
/* |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include "kernel/kern.h" |
#include "mymod.h" |
#include "modules/dummy.h" |
/*+ sysyem tick in us +*/ |
#define TICK 300 |
TIME __kernel_register_levels__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
MYMOD_register_level(120); |
dummy_register_level(); |
// periodic timer |
return TICK; |
// one-shot timer |
// return 0 |
} |
TASK __init__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
__call_main__(mb); |
return (void *)0; |
} |
/demos/branches/pj/myapp/mymod.c |
---|
0,0 → 1,270 |
/* |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include "mymod.h" |
#include <ll/string.h> |
#include <kernel/model.h> |
#include <kernel/descr.h> |
#include <kernel/var.h> |
#include <kernel/func.h> |
// other include files if needed |
// NOTE: NO GLOBAL OR STATIC VARIABLES!!! |
// (put them inside the level descriptor!) |
/* Statuses used in the level */ |
#define MYMOD_READY MODULE_STATUS_BASE |
#define MYMOD_WAIT MODULE_STATUS_BASE+3 |
#define MYMOD_IDLE MODULE_STATUS_BASE+4 |
/* the level redefinition for the Module */ |
typedef struct { |
level_des l; /* the standard level descriptor */ |
int myvar[100]; /* other local (private) variables of the module */ |
} MYMOD_level_des; |
// example of OSLib event |
static void MYMOD_timer_deadline(void *par) |
{ |
// usually the void *par is a pointer to a structure or a PID |
// if it is a PID, you can do that to retrieve it and the correspondent |
// level descriptor |
PID p = (PID) par; |
MYMOD_level_des *lev; |
lev = (MYMOD_level_des *)level_table[proc_table[p].task_level]; |
// now you know the PID of the task and the level descriptor |
// ... so, you know all the things you need |
} |
static int MYMOD_level_accept_task_model(LEVEL l, TASK_MODEL *m) |
{ |
// your code here |
return 0; // dummy number |
} |
static int MYMOD_level_accept_guest_model(LEVEL l, TASK_MODEL *m) |
{ |
// your code here |
return 0; // dummy number |
} |
static void MYMOD_level_status(LEVEL l) |
{ |
} |
/* The scheduler only gets the first task in the queue */ |
static PID MYMOD_level_scheduler(LEVEL l) |
{ |
return 0; // dummy number |
} |
/* The on-line guarantee is enabled only if the appropriate flag is set... */ |
static int MYMOD_level_guarantee(LEVEL l, bandwidth_t *freebandwidth) |
{ |
return 0; // dummy number |
} |
static int MYMOD_task_create(LEVEL l, PID p, TASK_MODEL *m) |
{ |
return 0; // dummy number |
} |
static void MYMOD_task_detach(LEVEL l, PID p) |
{ |
} |
static int MYMOD_task_eligible(LEVEL l, PID p) |
{ |
return 0; // dummy number |
} |
static void MYMOD_task_dispatch(LEVEL l, PID p, int nostop) |
{ |
} |
static void MYMOD_task_epilogue(LEVEL l, PID p) |
{ |
} |
static void MYMOD_task_activate(LEVEL l, PID p) |
{ |
} |
static void MYMOD_task_insert(LEVEL l, PID p) |
{ |
} |
static void MYMOD_task_extract(LEVEL l, PID p) |
{ |
} |
static void MYMOD_task_endcycle(LEVEL l, PID p) |
{ |
} |
static void MYMOD_task_end(LEVEL l, PID p) |
{ |
} |
static void MYMOD_task_sleep(LEVEL l, PID p) |
{ |
} |
static void MYMOD_task_delay(LEVEL l, PID p, TIME usdelay) |
{ |
} |
static int MYMOD_guest_create(LEVEL l, PID p, TASK_MODEL *m) |
{ |
return 0; // dummy number |
} |
static void MYMOD_guest_detach(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_dispatch(LEVEL l, PID p, int nostop) |
{ |
} |
static void MYMOD_guest_epilogue(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_activate(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_insert(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_extract(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_endcycle(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_end(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_sleep(LEVEL l, PID p) |
{ |
} |
static void MYMOD_guest_delay(LEVEL l, PID p, TIME usdelay) |
{ |
} |
/* Registration functions */ |
/*+ Registration function: |
int flags the init flags ... see MYMOD.h +*/ |
void MYMOD_register_level(int flags) |
{ |
LEVEL l; /* the level that we register */ |
MYMOD_level_des *lev; /* for readableness only */ |
PID i; /* a counter */ |
/* request an entry in the level_table */ |
l = level_alloc_descriptor(); |
/* alloc the space needed for the MYMOD_level_des */ |
lev = (MYMOD_level_des *)kern_alloc(sizeof(MYMOD_level_des)); |
/* update the level_table with the new entry */ |
level_table[l] = (level_des *)lev; |
/* fill the standard descriptor */ |
strncpy(lev->l.level_name, MYMOD_LEVELNAME, MAX_LEVELNAME); |
lev->l.level_code = MYMOD_LEVEL_CODE; |
lev->l.level_version = MYMOD_LEVEL_VERSION; |
lev->l.level_accept_task_model = MYMOD_level_accept_task_model; |
lev->l.level_accept_guest_model = MYMOD_level_accept_guest_model; |
lev->l.level_status = MYMOD_level_status; |
lev->l.level_scheduler = MYMOD_level_scheduler; |
lev->l.level_guarantee = MYMOD_level_guarantee; |
lev->l.task_create = MYMOD_task_create; |
lev->l.task_detach = MYMOD_task_detach; |
lev->l.task_eligible = MYMOD_task_eligible; |
lev->l.task_dispatch = MYMOD_task_dispatch; |
lev->l.task_epilogue = MYMOD_task_epilogue; |
lev->l.task_activate = MYMOD_task_activate; |
lev->l.task_insert = MYMOD_task_insert; |
lev->l.task_extract = MYMOD_task_extract; |
lev->l.task_endcycle = MYMOD_task_endcycle; |
lev->l.task_end = MYMOD_task_end; |
lev->l.task_sleep = MYMOD_task_sleep; |
lev->l.task_delay = MYMOD_task_delay; |
lev->l.guest_create = MYMOD_guest_create; |
lev->l.guest_detach = MYMOD_guest_detach; |
lev->l.guest_dispatch = MYMOD_guest_dispatch; |
lev->l.guest_epilogue = MYMOD_guest_epilogue; |
lev->l.guest_activate = MYMOD_guest_activate; |
lev->l.guest_insert = MYMOD_guest_insert; |
lev->l.guest_extract = MYMOD_guest_extract; |
lev->l.guest_endcycle = MYMOD_guest_endcycle; |
lev->l.guest_end = MYMOD_guest_end; |
lev->l.guest_sleep = MYMOD_guest_sleep; |
lev->l.guest_delay = MYMOD_guest_delay; |
/* fill the MYMOD descriptor part */ |
for (i=0; i<100; i++) |
lev->myvar[i] = 0; |
} |
// put here the other interface functions added |
/demos/branches/pj/myapp/myapp.c |
---|
0,0 → 1,55 |
/* |
* Project: S.Ha.R.K. |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
// if you want to use some functions, types, task models provided |
// by your new module |
#include "mymod.h" |
// then, include any file you want here |
// then, the classic C-style function |
int main(int argc, char **argv) |
{ |
// ... your stuff here |
return 0; |
} |
/demos/branches/pj/myapp/readme.txt |
---|
0,0 → 1,7 |
This is a template application, and it DOES NOTHING!!! |
This is only an example package. |
Please refer to the How To Compile reference guide for more informations. |
Paolo |
/demos/branches/pj/myapp/mymod.h |
---|
0,0 → 1,113 |
/* |
* Project: S.Ha.R.K. |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://shark.sssup.it |
*/ |
/* put here a description of the module */ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#ifndef __MYMOD_H__ |
#define __MYMOD_H__ |
#include <kernel/model.h> |
// maybe you need here some include file |
// then... we define a new Task Model without modifying |
// the standard kernel distribution |
// pick a pclass number not used into include/kernel/model.h |
#define MY_PCLASS 0x0700 |
/* |
maybe a description of the new fields of the Model is useful here |
*/ |
typedef struct { |
TASK_MODEL t; |
int myparameter; |
} MY_TASK_MODEL; |
#define my_task_default_model(m) \ |
task_default_model((m).t,MY_PCLASS), \ |
(m).myparameter = 0 |
#define my_task_def_level(m,l) task_def_level((m).t,l) |
#define my_task_def_arg(m,a) task_def_arg((m).t,a) |
#define my_task_def_stack(m,s) task_def_stack((m).t,s) |
#define my_task_def_stackaddr(m,s) task_def_stackaddr((m).t,s) |
#define my_task_def_group(m,g) task_def_group((m).t,g) |
#define my_task_def_usemath(m) task_def_usemath((m).t) |
#define my_task_def_system(m) task_def_system((m).t) |
#define my_task_def_nokill(m) task_def_nokill((m).t) |
#define my_task_def_ctrl_jet(m) task_def_ctrl_jet((m).t) |
#define my_task_def_myparameter(m,p) (m).myparameter = (p) |
#define my_task_def_joinable(m) task_def_joinable((m).t) |
#define my_task_def_unjoinable(m) task_def_unjoinable((m).t) |
#define my_task_def_trace(m) task_def_trace((m).t) |
#define my_task_def_notrace(m) task_def_notrace((m).t) |
// pick a code and a version not used into the file include/modules/codes.h |
#define MYMOD_LEVELNAME "My new scheduling module" |
#define MYMOD_LEVEL_CODE 999 |
#define MYMOD_LEVEL_VERSION 1 |
// if the module raises some new exception list them here |
// pincking up unused numbers from include/bits/errno.h |
/*+ Registration function: |
int parameter Options to be used in this level instance... +*/ |
void MYMOD_register_level(int parameter); |
/* here you can also put some other functions similar for example |
to the EDF_usedbandwidth() in the file include/modules/edf.h */ |
#endif |
/demos/branches/pj/myapp/makefile |
---|
0,0 → 1,16 |
# |
# |
# |
ifndef BASE |
BASE=.. |
endif |
include $(BASE)/config/config.mk |
PROGS= myapp |
include $(BASE)/config/example.mk |
myapp: |
make -f $(SUBMAKE) APP=myapp INIT= OTHEROBJS="initfile.o mymod.o" |
/demos/branches/pj/static/static.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: static.c,v 1.4 2003-01-07 17:10:18 pj Exp $ |
CVS : $Id: static.c,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-01-07 17:10:18 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-09-02 09:37:48 $ |
------------ |
**/ |
68,7 → 68,7 |
typedef struct { |
level_des l; /*+ the standard level descriptor +*/ |
IQUEUE mytable; |
QUEUE mytable; |
PID currenttask; |
87,7 → 87,7 |
lev->currenttask = p; |
event_need_reschedule(); |
// STATIC_printf("(o p%d t%d)", p, (int)proc_table[p].timespec_priority.tv_sec); |
STATIC_printf("(o p%d t%d)", p, (int)proc_table[p].timespec_priority.tv_sec); |
} |
static void STATIC_activateall(STATIC_level_des *lev) |
97,15 → 97,15 |
STATIC_printf("(A "); |
for (my_table_index = iq_query_first(&lev->mytable); |
for (my_table_index = (PID)lev->mytable; |
my_table_index != NIL; |
my_table_index = iq_query_next(my_table_index, &lev->mytable)) { |
ADDTIMESPEC(&lev->ref,iq_query_timespec(my_table_index, &lev->mytable),&x); |
my_table_index = proc_table[my_table_index].next) { |
ADDTIMESPEC(&lev->ref,&proc_table[my_table_index].timespec_priority,&x); |
kern_event_post(&x, STATIC_offset_activate,(void *)my_table_index); |
STATIC_printf("|p%d t%d ", |
my_table_index, |
(int)iq_query_timespec(my_table_index, &lev->mytable)->tv_sec); |
(int)proc_table[my_table_index].timespec_priority.tv_sec); |
} |
STATIC_printf(")"); |
130,8 → 130,26 |
} |
static int STATIC_level_accept_task_model(LEVEL l, TASK_MODEL *m) |
{ |
if (m->pclass == STATIC_PCLASS || m->pclass == (STATIC_PCLASS | l)) |
return 0; |
return -1; |
} |
static int STATIC_level_accept_guest_model(LEVEL l, TASK_MODEL *m) |
{ |
return -1; |
} |
static void STATIC_level_status(LEVEL l) |
{ kern_raise(XUNVALID_TASK,exec_shadow); } |
/* The scheduler only gets the first task in the queue */ |
static PID STATIC_public_scheduler(LEVEL l) |
static PID STATIC_level_scheduler(LEVEL l) |
{ |
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]); |
138,8 → 156,14 |
return lev->currenttask; |
} |
static int STATIC_public_create(LEVEL l, PID p, TASK_MODEL *m) |
/* The on-line guarantee is enabled only if the appropriate flag is set... */ |
static int STATIC_level_guarantee(LEVEL l, bandwidth_t *freebandwidth) |
{ |
return 1; |
} |
static int STATIC_task_create(LEVEL l, PID p, TASK_MODEL *m) |
{ |
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]); |
/* if the STATIC_task_create is called, then the pclass must be a |
147,66 → 171,110 |
STATIC_TASK_MODEL *h = (STATIC_TASK_MODEL *)m; |
if (m->pclass != STATIC_PCLASS) return -1; |
if (m->level != 0 && m->level != l) return -1; |
iq_query_timespec(p, &lev->mytable)->tv_sec = h->offset.tv_sec; |
iq_query_timespec(p, &lev->mytable)->tv_nsec = h->offset.tv_nsec; |
iq_timespec_insert(p,&lev->mytable); |
proc_table[p].timespec_priority.tv_sec = h->offset.tv_sec; |
proc_table[p].timespec_priority.tv_nsec = h->offset.tv_nsec; |
q_timespec_insert(p,&lev->mytable); |
return 0; /* OK, also if the task cannot be guaranteed... */ |
} |
static void STATIC_public_dispatch(LEVEL l, PID p, int nostop) |
static void STATIC_task_detach(LEVEL l, PID p) |
{ |
} |
static void STATIC_public_epilogue(LEVEL l, PID p) |
static int STATIC_task_eligible(LEVEL l, PID p) |
{ |
return 0; /* if the task p is chosen, it is always eligible */ |
} |
static void STATIC_public_activate(LEVEL l, PID p) |
static void STATIC_task_dispatch(LEVEL l, PID p, int nostop) |
{ |
} |
static void STATIC_public_unblock(LEVEL l, PID p) |
static void STATIC_task_epilogue(LEVEL l, PID p) |
{ |
} |
static void STATIC_public_block(LEVEL l, PID p) |
static void STATIC_task_activate(LEVEL l, PID p) |
{ |
} |
static int STATIC_public_message(LEVEL l, PID p, void *m) |
static void STATIC_task_insert(LEVEL l, PID p) |
{ |
} |
static void STATIC_task_extract(LEVEL l, PID p) |
{ |
} |
static void STATIC_task_endcycle(LEVEL l, PID p) |
{ |
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]); |
lev->currenttask = NIL; |
jet_update_endcycle(); /* Update the Jet data... */ |
trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */ |
return 0; |
} |
static void STATIC_public_end(LEVEL l, PID p) |
static void STATIC_task_end(LEVEL l, PID p) |
{ |
STATIC_level_des *lev = (STATIC_level_des *)(level_table[l]); |
lev->currenttask = NIL; |
iq_extract(p,&lev->mytable); |
q_extract(p,&lev->mytable); |
/* we finally put the task in the ready queue */ |
proc_table[p].status = FREE; |
iq_insertfirst(p,&freedesc); |
q_insertfirst(p,&freedesc); |
} |
static void STATIC_task_sleep(LEVEL l, PID p) |
{ kern_raise(XUNVALID_TASK,exec_shadow); } |
static void STATIC_task_delay(LEVEL l, PID p, TIME usdelay) |
{ kern_raise(XUNVALID_TASK,exec_shadow); } |
/* Guest Functions |
These functions manages a JOB_TASK_MODEL, that is used to put |
a guest task in the STATIC ready queue. */ |
static int STATIC_guest_create(LEVEL l, PID p, TASK_MODEL *m) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); return 0; } |
static void STATIC_guest_detach(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_dispatch(LEVEL l, PID p, int nostop) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_epilogue(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_activate(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_insert(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_extract(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_endcycle(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_end(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_sleep(LEVEL l, PID p) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
static void STATIC_guest_delay(LEVEL l, PID p, TIME usdelay) |
{ kern_raise(XUNVALID_GUEST,exec_shadow); } |
/* Registration functions */ |
/*+ Registration function: |
int flags the init flags ... see STATIC.h +*/ |
LEVEL STATIC_register_level() |
void STATIC_register_level() |
{ |
LEVEL l; /* the level that we register */ |
STATIC_level_des *lev; /* for readableness only */ |
214,32 → 282,62 |
printk("STATIC_register_level\n"); |
/* request an entry in the level_table */ |
l = level_alloc_descriptor(sizeof(STATIC_level_des)); |
l = level_alloc_descriptor(); |
lev = (STATIC_level_des *)level_table[l]; |
printk(" alloco descrittore %d %d\n",l,(int)sizeof(STATIC_level_des)); |
/* alloc the space needed for the STATIC_level_des */ |
lev = (STATIC_level_des *)kern_alloc(sizeof(STATIC_level_des)); |
printk(" lev=%d\n",(int)lev); |
/* update the level_table with the new entry */ |
level_table[l] = (level_des *)lev; |
/* fill the standard descriptor */ |
lev->l.public_scheduler = STATIC_public_scheduler; |
lev->l.public_create = STATIC_public_create; |
lev->l.public_end = STATIC_public_end; |
lev->l.public_dispatch = STATIC_public_dispatch; |
lev->l.public_epilogue = STATIC_public_epilogue; |
lev->l.public_activate = STATIC_public_activate; |
lev->l.public_unblock = STATIC_public_unblock; |
lev->l.public_block = STATIC_public_block; |
lev->l.public_message = STATIC_public_message; |
strncpy(lev->l.level_name, STATIC_LEVELNAME, MAX_LEVELNAME); |
lev->l.level_code = STATIC_LEVEL_CODE; |
lev->l.level_version = STATIC_LEVEL_VERSION; |
lev->l.level_accept_task_model = STATIC_level_accept_task_model; |
lev->l.level_accept_guest_model = STATIC_level_accept_guest_model; |
lev->l.level_status = STATIC_level_status; |
lev->l.level_scheduler = STATIC_level_scheduler; |
lev->l.level_guarantee = NULL; |
lev->l.task_create = STATIC_task_create; |
lev->l.task_detach = STATIC_task_detach; |
lev->l.task_eligible = STATIC_task_eligible; |
lev->l.task_dispatch = STATIC_task_dispatch; |
lev->l.task_epilogue = STATIC_task_epilogue; |
lev->l.task_activate = STATIC_task_activate; |
lev->l.task_insert = STATIC_task_insert; |
lev->l.task_extract = STATIC_task_extract; |
lev->l.task_endcycle = STATIC_task_endcycle; |
lev->l.task_end = STATIC_task_end; |
lev->l.task_sleep = STATIC_task_sleep; |
lev->l.task_delay = STATIC_task_delay; |
lev->l.guest_create = STATIC_guest_create; |
lev->l.guest_detach = STATIC_guest_detach; |
lev->l.guest_dispatch = STATIC_guest_dispatch; |
lev->l.guest_epilogue = STATIC_guest_epilogue; |
lev->l.guest_activate = STATIC_guest_activate; |
lev->l.guest_insert = STATIC_guest_insert; |
lev->l.guest_extract = STATIC_guest_extract; |
lev->l.guest_endcycle = STATIC_guest_endcycle; |
lev->l.guest_end = STATIC_guest_end; |
lev->l.guest_sleep = STATIC_guest_sleep; |
lev->l.guest_delay = STATIC_guest_delay; |
/* fill the STATIC descriptor part */ |
iq_init(&lev->mytable, &freedesc, 0); |
lev->mytable = NIL; |
lev->currenttask = NIL; |
NULL_TIMESPEC(&lev->hp); |
NULL_TIMESPEC(&lev->ref); |
return l; |
} |
void STATIC_start(LEVEL l, struct timespec *h, struct timespec *o) |
248,7 → 346,7 |
struct timespec x; |
kern_cli(); |
kern_gettime(&x); |
ll_gettime(TIME_EXACT, &x); |
lev->hp = *h; |
ADDTIMESPEC(&x,o,&lev->ref); |
/demos/branches/pj/static/test1st.c |
---|
16,11 → 16,11 |
/** |
------------ |
CVS : $Id: test1st.c,v 1.2 2002-11-11 07:55:13 pj Exp $ |
CVS : $Id: test1st.c,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2002-11-11 07:55:13 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-09-02 09:37:48 $ |
------------ |
78,7 → 78,7 |
STATIC_TASK_MODEL m; |
struct timespec my_time, h, o; |
struct timespec my_time, h, o, fineprg; |
my_time.tv_nsec=0; |
/demos/branches/pj/static/static.h |
---|
20,11 → 20,11 |
/** |
------------ |
CVS : $Id: static.h,v 1.2 2003-01-07 17:10:18 pj Exp $ |
CVS : $Id: static.h,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $ |
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-01-07 17:10:18 $ |
Revision: $Revision: 1.1.1.1 $ |
Last update: $Date: 2002-09-02 09:37:48 $ |
------------ |
Static scheduler demo (FIRST Project Hand-off) |
58,6 → 58,7 |
#include <kernel/config.h> |
#include <sys/types.h> |
#include <kernel/types.h> |
#include <modules/codes.h> |
80,6 → 81,10 |
#define STATIC_LEVEL_VERSION 1 |
/* ----------------------------------------------------------------------- |
ELASTIC_HARD_TASK_MODEL: elastic hard Tasks |
----------------------------------------------------------------------- */ |
typedef struct { |
TASK_MODEL t; |
109,7 → 114,7 |
/*+ Registration function: |
int flags Options to be used in this level instance... |
+*/ |
LEVEL STATIC_register_level(void); |
void STATIC_register_level(void); |
void STATIC_start(LEVEL l, struct timespec *h, struct timespec *o); |
/demos/branches/pj/pse51/ptest1 |
---|
0,0 → 1,426 |
+ vììh 1# èæ Äjj èWX Äìj èb= Ä= vììh@1# èoæ Äjh, jj èÀZ Äìj è*= Ä=ÿ4 vììh2# è7æ ÄÿuÔèTO Ç$/2# è æ ¸ ÄÉÃöUåìhà.# èæ Eü$è k ÄjEüPèk ÄEøPEüPèCl ÄÿuøPh /# èÊå ¸ ÄÉÃUåì4h@/# è°å Eä$è1k ÄjEäPèKk ÄEèPEäPè7l ÄÿuðÿuìÿuèPh/# èpå ¸ Ä ÉÃöUåì4hÀ/# èTå Eä$èÕj ÄjEäPèïj ÇEØ EØÇ@ £áÄPEèPEäPèák ÄÿuðÿuìÿuèPh 0# èå ¸ Ä ÉÃUåìh@0# èèä ÄÉÃv UåVSì<h0# èÎä EÔ$èOj ÄjEÔPèij ÇEÈ |
+ uÈÇF ÇEØÐ" |