/shark/trunk/kernel/signal.c |
---|
18,11 → 18,11 |
/** |
------------ |
CVS : $Id: signal.c,v 1.8 2003-12-10 16:54:59 giacomo Exp $ |
CVS : $Id: signal.c,v 1.9 2004-03-09 08:53:18 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.8 $ |
Last update: $Date: 2003-12-10 16:54:59 $ |
Revision: $Revision: 1.9 $ |
Last update: $Date: 2004-03-09 08:53:18 $ |
------------ |
This file contains: |
107,8 → 107,7 |
/* |
* A queue of all threads waiting in sigwait. |
* It is not static because it is used into the task_kill...ð |
*/ |
* It is not static because it is used into the task_kill...� */ |
static IQUEUE sigwaiters; |
1385,9 → 1384,10 |
/* Interrupt handling table */ |
static struct int_des { |
void (*fast)(int n); |
PID proc_index; |
BYTE isUsed; |
void (*fast)(int n); |
PID proc_index; |
BYTE isUsed; |
BYTE irqLock; |
} int_table[16]; |
/* Warning the interrupt can cause a preemption! */ |
1396,23 → 1396,25 |
void irq_fasthandler(void *n) |
{ |
int no = *(int *)n; |
PID p; |
int no = *(int *)n; |
PID p; |
/* tracer stuff */ |
TRACER_LOGEVENT(FTrace_EVT_interrupt_start,1,no,0); |
/* tracer stuff */ |
TRACER_LOGEVENT(FTrace_EVT_interrupt_start,1,no,0); |
if (int_table[no].fast != NULL) { |
kern_sti(); |
(int_table[no].fast)(no); |
kern_cli(); |
} |
if (int_table[no].fast != NULL) { |
if (int_table[no].irqLock == FALSE) |
kern_sti(); |
(int_table[no].fast)(no); |
if (int_table[no].irqLock == FALSE) |
kern_cli(); |
} |
TRACER_LOGEVENT(FTrace_EVT_interrupt_end,1,no,0); |
TRACER_LOGEVENT(FTrace_EVT_interrupt_end,1,no,0); |
/* If a sporadic process is linked,activate it */ |
p = int_table[no].proc_index; |
task_activate(p); // no problem if p == nil |
/* If a sporadic process is linked,activate it */ |
p = int_table[no].proc_index; |
task_activate(p); // no problem if p == nil |
} |
/*----------------------------------------------------------------------*/ |
1421,59 → 1423,60 |
/* If the fast parameter is NULL, no handler is called. */ |
/* If the pi parameter is NIL no task is installed */ |
/*----------------------------------------------------------------------*/ |
int handler_set(int no, void (*fast)(int n), PID pi) |
int handler_set(int no, void (*fast)(int n), PID pi, BYTE lock) |
{ |
SYS_FLAGS f; |
SYS_FLAGS f; |
if ((no < 1) || (no > 15)) { |
if ((no < 1) || (no > 15)) { |
errno = EWRONG_INT_NO; |
return -1; |
} |
} |
f = kern_fsave(); |
//kern_printf("handler_set: no %d pid %d\n",no, pi); |
if (int_table[no].isUsed == TRUE) { |
f = kern_fsave(); |
//kern_printf("handler_set: no %d pid %d\n",no, pi); |
if (int_table[no].isUsed == TRUE) { |
kern_frestore(f); |
errno = EUSED_INT_NO; |
return -1; |
} |
int_table[no].fast = fast; |
int_table[no].proc_index = pi; |
int_table[no].isUsed = TRUE; |
} |
int_table[no].fast = fast; |
int_table[no].proc_index = pi; |
int_table[no].isUsed = TRUE; |
int_table[no].irqLock = lock; |
irq_bind(no, irq_fasthandler, INT_FORCE); |
irq_unmask(no); |
kern_frestore(f); |
irq_bind(no, irq_fasthandler, INT_FORCE); |
irq_unmask(no); |
kern_frestore(f); |
return 1; |
return 1; |
} |
int handler_remove(int no) |
{ |
SYS_FLAGS f; |
SYS_FLAGS f; |
if (no < 1 || no > 15) { |
if (no < 1 || no > 15) { |
errno = EWRONG_INT_NO; |
return -1; |
} |
} |
f = kern_fsave(); |
if (int_table[no].isUsed == FALSE) { |
f = kern_fsave(); |
if (int_table[no].isUsed == FALSE) { |
kern_frestore(f); |
errno = EUNUSED_INT_NO; |
return -1; |
} |
} |
int_table[no].fast = NULL; |
int_table[no].proc_index = NIL; |
int_table[no].isUsed = FALSE; |
int_table[no].fast = NULL; |
int_table[no].proc_index = NIL; |
int_table[no].isUsed = FALSE; |
int_table[no].irqLock = FALSE; |
irq_bind(no,NULL, INT_PREEMPTABLE); |
irq_mask(no); |
kern_frestore(f); |
irq_bind(no,NULL, INT_PREEMPTABLE); |
irq_mask(no); |
kern_frestore(f); |
return 1; |
return 1; |
} |
/* this is the test that is done when a task is being killed |
1480,32 → 1483,29 |
and it is waiting on a sigwait */ |
static int signal_cancellation_point(PID i, void *arg) |
{ |
LEVEL l; |
LEVEL l; |
if (proc_table[i].status == WAIT_SIG) { |
if (proc_table[i].status == WAIT_SIG) { |
if (proc_table[i].delay_timer != -1) { |
kern_event_delete(proc_table[i].delay_timer); |
proc_table[i].delay_timer = -1; |
} |
if (proc_table[i].delay_timer != -1) { |
kern_event_delete(proc_table[i].delay_timer); |
proc_table[i].delay_timer = -1; |
} |
iq_extract(i, &sigwaiters); |
iq_extract(i, &sigwaiters); |
l = proc_table[i].task_level; |
level_table[l]->public_unblock(l,i); |
l = proc_table[i].task_level; |
level_table[l]->public_unblock(l,i); |
return 1; |
} |
else if (proc_table[i].status == WAIT_SIGSUSPEND) { |
return 1; |
} else if (proc_table[i].status == WAIT_SIGSUSPEND) { |
l = proc_table[i].task_level; |
level_table[l]->public_unblock(l,i); |
l = proc_table[i].task_level; |
level_table[l]->public_unblock(l,i); |
return 1; |
} |
return 1; |
} |
return 0; |
return 0; |
} |
void signals_init() |
1512,38 → 1512,38 |
{ |
int i; |
/* Initialize the default signal actions and the signal |
queue headers. */ |
/* Initialize the default signal actions and the signal queue headers. */ |
for (i = 0; i < SIG_MAX; i++) { |
sigactions[i].sa_handler = SIG_DFL; |
sigactions[i].sa_flags = 0; |
sigactions[i].sa_mask = 0; |
sigactions[i].sa_sigaction = 0; |
sigqueued[i] = -1; |
} |
sigactions[i].sa_handler = SIG_DFL; |
sigactions[i].sa_flags = 0; |
sigactions[i].sa_mask = 0; |
sigactions[i].sa_sigaction = 0; |
sigqueued[i] = -1; |
} |
/* Initialize the signal queue */ |
for (i=0; i < SIGQUEUE_MAX-1; i++) { |
sig_queue[i].next = i+1; |
sig_queue[i].flags = 0; |
} |
sig_queue[SIGQUEUE_MAX-1].next = NIL; |
sig_queue[SIGQUEUE_MAX-1].flags = 0; |
sigqueue_free = 0; |
/* Initialize the signal queue */ |
for (i=0; i < SIGQUEUE_MAX-1; i++) { |
sig_queue[i].next = i+1; |
sig_queue[i].flags = 0; |
} |
sig_queue[SIGQUEUE_MAX-1].next = NIL; |
sig_queue[SIGQUEUE_MAX-1].flags = 0; |
sigqueue_free = 0; |
procsigpending = 0; |
procsigpending = 0; |
iq_init(&sigwaiters, &freedesc, 0); |
alarm_timer = -1; |
iq_init(&sigwaiters, &freedesc, 0); |
alarm_timer = -1; |
/* Interrupt handling init */ |
for (i=0; i<16; i++) { |
int_table[i].fast = NULL; |
int_table[i].proc_index = NIL; |
int_table[i].isUsed = FALSE; |
} |
/* Interrupt handling init */ |
for (i=0; i<16; i++) { |
int_table[i].fast = NULL; |
int_table[i].proc_index = NIL; |
int_table[i].isUsed = FALSE; |
int_table[i].irqLock = FALSE; |
} |
register_cancellation_point(signal_cancellation_point, NULL); |
register_cancellation_point(signal_cancellation_point, NULL); |
} |
/shark/trunk/include/kernel/func.h |
---|
21,11 → 21,11 |
/** |
------------ |
CVS : $Id: func.h,v 1.10 2004-01-12 17:23:44 giacomo Exp $ |
CVS : $Id: func.h,v 1.11 2004-03-09 08:53:17 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.10 $ |
Last update: $Date: 2004-01-12 17:23:44 $ |
Revision: $Revision: 1.11 $ |
Last update: $Date: 2004-03-09 08:53:17 $ |
------------ |
Kernel functions: |
281,7 → 281,7 |
/*---------------------------------------------------------------------*/ |
/*+ Interrupt handler installation +*/ |
int handler_set(int no, void (*fast)(int), PID pi); |
int handler_set(int no, void (*fast)(int), PID pi, BYTE lock); |
/*+ Interrupt handler removal +*/ |
int handler_remove(int no); |
/shark/trunk/roadmap.txt |
---|
4,15 → 4,15 |
- DRIVERS - |
- Linux 2.6 Interface Layer ***** |
Developing at ReTiS Lab - Pontedera |
Testing at ReTiS Lab - Pontedera |
Giacomo Guidi <giacomo@gandalf.sssup.it> |
- New PCI Driver (From Linux 2.6) **** |
Developing at ReTiS Lab - Pontedera |
Testing at ReTiS Lab - Pontedera |
Giacomo Guidi <giacomo@gandalf.sssup.it> |
- New SVGA Lib (From Linux 2.6) *** |
Developing as ReTis Lab - Pontedera |
- New FrameBuffer (From Linux 2.6) *** |
Testing as ReTis Lab - Pontedera |
Giacomo Guidi <giacomo@gandalf.sssup.it> |
- New Network layer (From Linux 2.6) ***** |
31,7 → 31,7 |
- New File System (From Linux 2.6) **** |
- RAM-Disk Driver *** |
- RAM-Disk Driver/Loopback *** |
- New IDE/FLOPPY/CDROM Driver (From Linux 2.6) **** |
40,6 → 40,8 |
- EXT2/EXT3 Support *** |
- New Keyboard and Mouse drivers *** |
Testing at Robotic Lab - Pavia |
Mauro Marinoni <thenino@tipiloschi.net> |
- New RS232 and parallel port drivers ** |
/shark/trunk/config/libdep.mk |
---|
184,6 → 184,20 |
LIB_DEP += $(LIB_PATH)/libc.a |
endif |
# linuxComp |
# ---------------------------------------------------------------- |
ifeq ($(findstring __LINUXC26__,$(USELIB)) , __LINUXC26__) |
INCL += -I$(BASE)/drivers/linuxc26/include |
# Linux Emulation Layer 2.6 |
ifeq ($(LIB_PATH)/libcomp26.a,$(wildcard $(LIB_PATH)/libcomp26.a)) |
LINK_LIB += -lcomp26 |
LIB_DEP += $(LIB_PATH)/libcomp26.a |
endif |
else |
# comp |
ifeq ($(LIB_PATH)/libcomp.a,$(wildcard $(LIB_PATH)/libcomp.a)) |
LINK_LIB += -lcomp |
190,11 → 204,8 |
LIB_DEP += $(LIB_PATH)/libcomp.a |
endif |
# Linux Emulation Layer 2.6 |
ifeq ($(LIB_PATH)/libcomp26.a,$(wildcard $(LIB_PATH)/libcomp26.a)) |
LINK_LIB += -lcomp26 |
LIB_DEP += $(LIB_PATH)/libcomp26.a |
endif |
# ---------------------------------------------------------------- |
# mpeg |
ifeq ($(LIB_PATH)/libmpeg.a,$(wildcard $(LIB_PATH)/libmpeg.a)) |
444,3 → 455,16 |
endif |
# INPUT |
# ---------------------------------------------------------------- |
ifeq ($(findstring __INPUT__, $(USELIB)), __INPUT__) |
INCL += -I$(BASE)/drivers/input/include |
# JOY |
ifeq ($(LIB_PATH)/libinput.a,$(wildcard $(LIB_PATH)/libinput.a)) |
LINK_LIB += -linput |
LINK_DEP += $(LIB_PATH)/libinput.a |
endif |
endif |
/shark/trunk/shark.cfg |
---|
9,7 → 9,7 |
# Enable timer interrupt through P6 APIC instead of PIT |
# Only P6 or higher CPU class, TSC support must be enabled |
APIC = TRUE |
APIC = FALSE |
#Enable Read Timer Optimization |
#TIMER_OPT = 1000 (For CPU < 1 GHz - Wraparound 585 years) |
/shark/trunk/oslib/kl/event.c |
---|
149,6 → 149,9 |
TRACER_LOGEVENT(FTrace_EVT_timer_delete, 0, 0, 0); |
if (index == -1) |
return -1; |
t = NULL; |
/* walk through list, finding spot, adjusting ticks parameter */ |
for (p1 = firstevent; (p1) && (index != p1->index); p1 = t->next) { |
/shark/trunk/oslib/kl/event1.c |
---|
237,6 → 237,8 |
TRACER_LOGEVENT(FTrace_EVT_timer_delete, 0, 0, 0); |
if (index == -1) |
return -1; |
t = NULL; |
/* walk through list, finding spot, adjusting ticks parameter */ |
/shark/trunk/drivers/oldsnd/sound.c |
---|
329,7 → 329,7 |
return ESRCH; |
} |
//sb_dev.period = period; |
handler_set(sb_dev.IntLine, sb_handler, p_sb); |
handler_set(sb_dev.IntLine, sb_handler, p_sb, FALSE); |
return 0; |
} |
/shark/trunk/drivers/net/int.c |
---|
54,7 → 54,7 |
handlers[irq].flags = flags; |
handlers[irq].data = dev_id; |
handler_set(irq, linux_intr, NIL); |
handler_set(irq, linux_intr, NIL, TRUE); |
/*if (fdev_intr_alloc(irq, linux_intr, (void *)irq, 0)) { |
handlers[irq].func = 0; |
return (-EBUSY); |
/shark/trunk/drivers/block/ideglue.c |
---|
21,11 → 21,11 |
/*************************************** |
CVS : $Id: ideglue.c,v 1.1.1.1 2002-03-29 14:12:49 pj Exp $ |
CVS : $Id: ideglue.c,v 1.2 2004-03-09 08:49:12 giacomo Exp $ |
Revision: $Revision: 1.1.1.1 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2002-03-29 14:12:49 $ |
Last update: $Date: 2004-03-09 08:49:12 $ |
This module is used to link the low-level IDE module with |
some kernel specific and particular functionality (it is included |
122,7 → 122,6 |
TASK ide_dummy(int x) |
{ |
for (;;) { |
cprintf("²"); |
task_endcycle(); |
} |
return NULL; |
173,7 → 172,7 |
task_activate(ide[ideif].server); |
/* associate an IRQ handler */ |
handler_set(ide[ideif].irq,NULL,ide[ideif].server); |
handler_set(ide[ideif].irq,NULL,ide[ideif].server, FALSE); |
return 0; |
} |
/shark/trunk/drivers/pxc/pxc.c |
---|
9,11 → 9,11 |
*/ |
/* |
Note : |
Il seguente modulo permette in grado di supportare ogni frame grabber |
Il seguente modulo permette in grado di supportare ogni frame grabber |
dotato del controllore single-chip Bt848/Bt848A/Bt849 della BrookTree (ora |
Conexant) |
Per variare la risoluzione di acquisizione o il formato dei dati in ingresso |
vanno variati i parametri contenuti nel seguente modulo , il quale |
vanno variati i parametri contenuti nel seguente modulo , il quale |
specifico per immagini di 384x288 pixel codificate a 8 livelli di grigio |
Le modifiche possono essere effettuate consultando il manuale di descrizione del |
chip Bt848 disponibile al sito www.Conexant.com |
168,7 → 168,7 |
} |
/**************************************************************************/ |
void PXC_Start(void) { |
handler_set(IntLine, (void (*)(int))PXC_fast, NIL); |
handler_set(IntLine, (void (*)(int))PXC_fast, NIL, FALSE); |
lmempokew((void *)(BaseAddr+PXC_GPIO_DMA_CTL),0x0000); |
lmempokew((void *)(BaseAddr+PXC_GPIO_DMA_CTL),0x0003); |
} |
182,7 → 182,7 |
if (l == NIL) return 0; |
if (Lista.Top == PXC_MAX_LISTENERS) { |
errore=4; |
return 0; // Non vi sono pi elementi liberi |
return 0; // Non vi sono pi elementi liberi |
} |
189,7 → 189,7 |
pele = Lista.Top; |
Lista.Top++; |
// Setta tutto ci che serve per il nuovo elemento |
// Setta tutto ci che serve per il nuovo elemento |
Lista.Elementi[pele].proc=l; |
Lista.Elementi[pele].DRel = drel; |
270,7 → 270,7 |
} else { |
// C' un errore nell' acquisizione, per ora non lo trattiamo |
// C' un errore nell' acquisizione, per ora non lo trattiamo |
} |
lmempoked((void *)(BaseAddr+PXC_INT_STAT),pen); // EOI al Bt848 |
285,7 → 285,7 |
// Definizione del programma all' interno dello spazio di memoria puntato |
// da Programma , va DWORD aligned , quindi prima lo allineamo, poi |
// andiamo a scriverci dentro il programma, il quale pu essere variabile |
// andiamo a scriverci dentro il programma, il quale pu essere variabile |
// in funzione delle opzioni di ingresso |
Corpo = V_Corpo; |
Programma = appl2linear(Corpo); |
/shark/trunk/drivers/linuxcom/auto_irq.c |
---|
23,7 → 23,7 |
handled = 0; |
for (i = 0; i < 16; i++) { |
if (handler_set(i, autoirq_probe, NIL) == 1) { |
if (handler_set(i, autoirq_probe, NIL, TRUE) == 1) { |
set_bit(i, (void *)&handled); |
} |
} |
/shark/trunk/drivers/linuxc26/include/linuxcomp.h |
---|
56,7 → 56,7 |
int shark_event_delete(int index); |
/* Interrupt handler installation and removal */ |
int shark_handler_set(int no, void (*fast)(int), int pi); |
int shark_handler_set(int no, void (*fast)(int), int pi, BYTE lock); |
int shark_handler_remove(int no); |
#endif |
/shark/trunk/drivers/linuxc26/shark_glue.c |
---|
1,21 → 1,36 |
#include <kernel/int_sem.h> |
#include <stdlib.h> |
#include <kernel/func.h> |
#include <ll/sys/ll/event.h> |
void shark_internal_sem_create(void **sem, int init) { |
*sem = (void *)malloc(sizeof(internal_sem_t)); |
internal_sem_init((internal_sem_t *)(*sem),init); |
*sem = (void *)malloc(sizeof(internal_sem_t)); |
internal_sem_init((internal_sem_t *)(*sem),init); |
} |
void shark_internal_sem_wait(void *sem) { |
internal_sem_wait((internal_sem_t *)(sem)); |
} |
internal_sem_wait((internal_sem_t *)(sem)); |
void shark_internal_sem_post(void *sem) { |
internal_sem_post((internal_sem_t *)(sem)); |
} |
int shark_event_post(const struct timespec *time, void (*handler)(void *p), void *par) |
{ |
return event_post(*time, handler, par); |
} |
void shark_internal_sem_post(void *sem) { |
int shark_event_delete(int index) |
{ |
return event_delete(index); |
} |
internal_sem_post((internal_sem_t *)(sem)); |
int shark_handler_set(int no, void (*fast)(int), int pi, BYTE lock){ |
return handler_set(no, fast, (PID)pi, lock); |
} |
int shark_handler_remove(int no){ |
return handler_remove(no); |
} |
/shark/trunk/drivers/oldchar/scom.c |
---|
20,11 → 20,11 |
/** |
------------ |
CVS : $Id: scom.c,v 1.1 2003-03-24 10:54:17 pj Exp $ |
CVS : $Id: scom.c,v 1.2 2004-03-09 08:49:13 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.1 $ |
Last update: $Date: 2003-03-24 10:54:17 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2004-03-09 08:49:13 $ |
------------ |
Author: Massimiliano Giorgi |
265,7 → 265,7 |
if (!(com_link[port].status & FAST_INSTALLED)) { |
bit_on(com_link[port].status,FAST_INSTALLED); |
bit_on(com_link[shared].status,FAST_INSTALLED); |
handler_set(hndl,com_fast,NIL); |
handler_set(hndl,com_fast,NIL, TRUE); |
#ifdef __DEBUG_SERIAL__ |
cputs("Handler OK\n"); |
#endif |
/shark/trunk/drivers/oldchar/8042.c |
---|
20,11 → 20,11 |
/** |
------------ |
CVS : $Id: 8042.c,v 1.4 2003-09-12 10:09:55 giacomo Exp $ |
CVS : $Id: 8042.c,v 1.5 2004-03-09 08:49:13 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.4 $ |
Last update: $Date: 2003-09-12 10:09:55 $ |
Revision: $Revision: 1.5 $ |
Last update: $Date: 2004-03-09 08:49:13 $ |
------------ |
8042.h |
876,7 → 876,7 |
if (status) return status; |
/* set fast handler and task */ |
handler_set(C8042_KEYBOARDIRQ,keyb_handler,task); |
handler_set(C8042_KEYBOARDIRQ,keyb_handler,task,TRUE); |
return 0; |
} |
902,7 → 902,7 |
if (!ps2mouse_present) return -20; |
/* set fast handler and task */ |
handler_set(C8042_PS2IRQ,ps2mouse_handler,NIL); |
handler_set(C8042_PS2IRQ,ps2mouse_handler,NIL,TRUE); |
/* OK, now ps/2 mouse port is active! */ |
ps2mouse_active=1; |
/shark/trunk/drivers/i2c/i2c-dev.c |
---|
140,7 → 140,7 |
return -ENOMEM; |
pr_debug("i2c-dev.o: i2c-%d reading %d bytes.\n", |
iminor(file->f_dentry->d_inode), count); |
(int)iminor(file->f_dentry->d_inode), (int)count); |
ret = i2c_master_recv(client,tmp,count); |
if (ret >= 0) |
168,7 → 168,7 |
} |
pr_debug("i2c-dev.o: i2c-%d writing %d bytes.\n", |
iminor(file->f_dentry->d_inode), count); |
(int)iminor(file->f_dentry->d_inode), (int)count); |
ret = i2c_master_send(client,tmp,count); |
kfree(tmp); |