46,7 → 46,7 |
|
#include <intdrive/intdrive/inttask.h> |
|
//#define DEBUG_SHARK_GLUE |
#define DEBUG_SHARK_GLUE |
|
PID intr_server = NIL; |
void (*noint_handler)(int n); |
105,25 → 105,42 |
/* The Interrupt TASK is an aperiodic task designed for |
the INTDRIVE module. */ |
|
TASK Interrupt_Server(void *arg) |
void interrupt_job() |
{ |
void (*tmp_fast)(int n); |
int no; |
|
n_intact++; |
|
no = get_interrupt_job(); |
|
if (no != -1 && no < 16) { |
tmp_fast = handler_get_intdrive(no); |
(tmp_fast)(no); |
irq_unmask(no); |
} |
|
if (no != -1 && no >= 16) { |
(noint_handler)(no); |
} |
} |
|
TASK Interrupt_Server(void *arg) |
{ |
while(1) { |
n_intact++; |
interrupt_job(); |
|
no = get_interrupt_job(); |
task_endcycle(); |
} |
|
if (no != -1 && no < 16) { |
tmp_fast = handler_get_intdrive(no); |
(tmp_fast)(no); |
irq_unmask(no); |
} |
} |
|
if (no != -1 && no >= 16) { |
(noint_handler)(no); |
} |
TASK Interrupt_Server_Prot(void *arg) |
{ |
while(1) { |
task_nopreempt(); |
interrupt_job(); |
task_preempt(); |
|
task_endcycle(); |
} |
130,10 → 147,11 |
|
} |
|
int intdrive_taskinit(int wcet) |
int intdrive_taskinit(int level, int wcet) |
{ |
HARD_TASK_MODEL ht; |
|
|
hard_task_default_model(ht); |
hard_task_def_wcet(ht, wcet); |
hard_task_def_interrupt(ht); |
140,12 → 158,18 |
hard_task_def_system(ht); |
hard_task_def_nokill(ht); |
|
intr_server = task_create("Interrupt Server",Interrupt_Server,&ht,NULL); |
if (level >= 0) |
intr_server = task_create("Interrupt Server (Protected)",Interrupt_Server_Prot,&ht,NULL); |
else |
intr_server = task_create("Interrupt Server",Interrupt_Server,&ht,NULL); |
|
if (intr_server == NIL) |
return -1; |
|
return 0; |
} |
|
void set_noint_handler(void * new_handler) |
{ |
noint_handler = new_handler; |
} |
} |