Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1017 → Rev 1018

/shark/trunk/kernel/signal.c
18,11 → 18,11
 
/**
------------
CVS : $Id: signal.c,v 1.13 2005-05-10 17:14:51 mauro Exp $
CVS : $Id: signal.c,v 1.14 2006-03-03 17:14:47 mauro Exp $
 
File: $File$
Revision: $Revision: 1.13 $
Last update: $Date: 2005-05-10 17:14:51 $
Revision: $Revision: 1.14 $
Last update: $Date: 2006-03-03 17:14:47 $
------------
 
This file contains:
1396,12 → 1396,14
/* The fast handler is a standard piece of code which runs with */
/* interrupts enabled to allow interrupt nesting */
 
extern int add_interrupt_job(int no);
 
void irq_fasthandler(void *n)
{
int no = *(int *)n;
PID p;
 
//kern_printf("(irq_fasthandler: no %d)",no);
kern_printf("(irq_fasthandler: no %d)",no);
/* tracer stuff */
TRACER_LOGEVENT(FTrace_EVT_interrupt_start,(unsigned short int)no,0);
1414,7 → 1416,7
}
 
if (int_table[no].intdrv != NULL) {
add_interrupt_job(no, int_table[no].intdrv);
add_interrupt_job(no);
}
 
TRACER_LOGEVENT(FTrace_EVT_interrupt_end,(unsigned short int)no,0);
1433,18 → 1435,18
int handler_set(int no, void (*fast)(int n), BYTE lock, PID pi, void (*intdrv)(int n))
{
SYS_FLAGS f;
 
if ((no < 1) || (no > 15)) {
errno = EWRONG_INT_NO;
return -1;
errno = EWRONG_INT_NO;
return -1;
}
 
f = kern_fsave();
//kern_printf("(handler_set: no %d pid %d)",no, pi);
kern_printf("(handler_set: no %d pid %d)",no, pi);
if (int_table[no].isUsed == TRUE) {
kern_frestore(f);
errno = EUSED_INT_NO;
return -1;
kern_frestore(f);
errno = EUSED_INT_NO;
return -1;
}
int_table[no].fast = fast;
int_table[no].intdrv = intdrv;
1464,16 → 1466,16
SYS_FLAGS f;
 
if (no < 1 || no > 15) {
errno = EWRONG_INT_NO;
return -1;
errno = EWRONG_INT_NO;
return -1;
}
 
f = kern_fsave();
//kern_printf("(handler_remove: no %d )",no);
kern_printf("(handler_remove: no %d )",no);
if (int_table[no].isUsed == FALSE) {
kern_frestore(f);
errno = EUNUSED_INT_NO;
return -1;
kern_frestore(f);
errno = EUNUSED_INT_NO;
return -1;
}
 
int_table[no].fast = NULL;
/shark/trunk/modules/intdrive/intdrive/inttask.h
42,7 → 42,7
__BEGIN_DECLS
 
int add_interrupt_job(int no);
int intdrive_taskinit(int wcet);
int intdrive_taskinit(int level, int wcet);
void set_noint_handler(void * new_handler);
 
__END_DECLS
/shark/trunk/modules/intdrive/intdrive.c
38,6 → 38,7
/* Interrupt Driver Module */
 
#include <intdrive/intdrive/intdrive.h>
#include <intdrive/intdrive/inttask.h>
#include <kernel/model.h>
#include <kernel/descr.h>
#include <kernel/var.h>
188,7 → 189,7
if (proc_table[INTDRIVE_task].wcet < TIMESPEC2USEC(&time)) {
kern_raise(XWCET_VIOLATION,INTDRIVE_task);
}
}
}
 
static void INTDRIVE_public_activate(LEVEL l, PID p, struct timespec *t)
268,7 → 269,7
//lev->avail -= TIMESPEC2USEC(&time);
 
TRACER_LOGEVENT(FTrace_EVT_user_event_0, 0, lev->avail + INT_MAX);
 
#ifdef INTDRIVE_DEBUG
kern_printf("(INTD:AV:%d)",(int)(lev->avail));
#endif
369,9 → 370,9
lev->avail = 0;
lev->q_theta = q_theta;
mul32div32to32(MAX_BANDWIDTH,U,10000,lev->U);
 
//!!!calcolare parametro
intdrive_taskinit(10000);
intdrive_taskinit(l, 10000);
 
return l;
}
/shark/trunk/modules/intdrive/inttask.c
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;
}
}
/shark/trunk/drivers/linuxc26/shark_glue.c
12,7 → 12,7
 
extern int intr_count;
 
//#define DEBUG_SHARK_GLUE
#define DEBUG_SHARK_GLUE
 
/* 1-15 for IRQ and 16-63 for timers */
void *timer_arg_table[MAX_TIMER_TABLE];
102,10 → 102,6
 
f = kern_fsave();
 
#ifdef DEBUG_SHARK_GLUE
cprintf("(Timer Set %d)", no);
#endif
 
i = get_free_timer_slot();
 
if (i == -1) {
131,7 → 127,7
int shark_timer_delete(int index)
{
SYS_FLAGS f;
 
f = kern_fsave();
 
if (index <= 0 || index >= MAX_TIMER_TABLE) {
140,16 → 136,16
}
 
#ifdef DEBUG_SHARK_GLUE
cprintf("(Timer Del %d)", no);
cprintf("(Timer Del %d)", index);
#endif
 
if (timer_table[index] != -1 && timer_table[index] != -2) {
timer_func_table[index] = NULL;
timer_arg_table[index] = NULL;
 
kern_event_delete(timer_table[index]);
timer_table[index] = -1;
}
}
kern_frestore(f);
 
return 0;