/shark/trunk/drivers/newpci/pci2.h |
---|
4,7 → 4,7 |
* (c) 1999 Martin Mares <mj@ucw.cz> |
*/ |
#define DEBUG |
//#define DEBUG |
#ifdef DEBUG |
#define DBG(x...) printk(x) |
/shark/trunk/drivers/newpci/probe.c |
---|
9,7 → 9,7 |
#include <linux/slab.h> |
#include <linux/module.h> |
#define DEBUG |
//#define DEBUG |
#ifdef DEBUG |
#define DBG(x...) printk(x) |
/shark/trunk/drivers/newpci/pci.c |
---|
1,5 → 1,5 |
/* |
* $Id: pci.c,v 1.6 2004-02-26 16:57:35 giacomo Exp $ |
* $Id: pci.c,v 1.7 2004-03-19 16:30:11 giacomo Exp $ |
* |
* PCI Bus Services, see include/linux/pci.h for further explanation. |
* |
18,7 → 18,7 |
#include <linux/spinlock.h> |
#include <asm/dma.h> /* isa_dma_bridge_buggy */ |
#define DEBUG |
//#define DEBUG |
#ifdef DEBUG |
#define DBG(x...) printk(x) |
715,7 → 715,7 |
return 0; |
} |
int __devinit pci_init(void) |
{ |
struct pci_dev *dev = NULL; |
/shark/trunk/drivers/newpci/quirks.c |
---|
1,5 → 1,5 |
/* |
* $Id: quirks.c,v 1.4 2004-02-20 11:36:16 giacomo Exp $ |
* $Id: quirks.c,v 1.5 2004-03-19 16:30:12 giacomo Exp $ |
* |
* This file contains work-arounds for many known PCI hardware |
* bugs. Devices present only on certain architectures (host |
21,7 → 21,7 |
#include <linux/init.h> |
#include <linux/delay.h> |
#define DEBUG |
//#define DEBUG |
/* Deal with broken BIOS'es that neglect to enable passive release, |
which can cause problems in combination with the 82441FX/PPro MTRRs */ |
/shark/trunk/drivers/newpci/setup-bus.c |
---|
29,7 → 29,7 |
#include <linux/slab.h> |
#define DEBUG_CONFIG 1 |
#define DEBUG_CONFIG 0 |
#if DEBUG_CONFIG |
# define DBGC(args) printk args |
#else |
/shark/trunk/drivers/newpci/remove.c |
---|
4,7 → 4,7 |
#include <linux/module.h> |
#include "pci.h" |
#define DEBUG |
//#define DEBUG |
#ifdef DEBUG |
#define DBG(x...) printk(x) |
/shark/trunk/drivers/linuxc26/include/linuxcomp.h |
---|
55,8 → 55,9 |
#define jiffies26 (sys_gettime(NULL)*HZ/1000000) /* Has to be controlled... */ |
//#define jiffies26 (TIME)0 |
int shark_event_post(struct timespec *time, void (*handler)(void *p), void *par); |
int shark_event_delete(int index); |
/* Timer Manager */ |
int shark_timer_set(struct timespec *time, void *handler, void *arg); |
int shark_timer_delete(int index); |
/* Interrupt handler installation and removal */ |
int shark_handler_set(int no, void *fast, void *arg); |
/shark/trunk/drivers/linuxc26/timer.c |
---|
1,24 → 1,4 |
/* |
* Copyright (c) 1996 The University of Utah and |
* the Computer Systems Laboratory at the University of Utah (CSL). |
* All rights reserved. |
* |
* Permission to use, copy, modify and distribute this software is hereby |
* granted provided that (1) source code retains these copyright, permission, |
* and disclaimer notices, and (2) redistributions including binaries |
* reproduce the notices in supporting documentation, and (3) all advertising |
* materials mentioning features or use of this software display the following |
* acknowledgement: ``This product includes software developed by the |
* Computer Systems Laboratory at the University of Utah.'' |
* |
* THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS |
* IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF |
* ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. |
* |
* CSL requests users of this software to return to csl-dist@cs.utah.edu any |
* improvements that they make and grant CSL redistribution rights. |
*/ |
/* |
* Linux timer support. |
*/ |
30,9 → 10,6 |
//#define TIMER_DEBUG |
//#define IANPATCH |
#ifndef IANPATCH |
static inline void jiffies_to_timespec(unsigned long j, struct timespec *value) |
{ |
value->tv_nsec = (j % HZ) * (1000000000L / HZ); |
39,32 → 16,55 |
value->tv_sec = j / HZ; |
} |
extern void *int_arg_table[64]; |
extern void *int_func_table[64]; |
extern int intr_count; |
/* |
* Generic Linux time handler. |
*/ |
void linux_timer(int no) |
{ |
intr_count++; |
if (int_func_table[no] != NULL) |
(*(void (*)(void *arg))int_func_table[no])(int_arg_table[no]); |
intr_count--; |
} |
void add_timer(struct timer_list *timer) |
{ |
struct timespec timeout; |
jiffies_to_timespec(timer->expires, &timeout); |
if (timer->function) |
timer->event_timer = shark_event_post(&timeout, (void (*)(void *))timer->function, (void *)timer->data); |
if (timer->function) { |
timer->event_timer = shark_timer_set(&timeout, (void *)timer->function, (void *)timer->data); |
} |
#ifdef TIMER_DEBUG |
cprintf("Set to %ld:%ld\n",timeout.tv_sec,timeout.tv_nsec); |
#endif |
#ifdef TIMER_DEBUG |
printk("Set to %ld:%ld\n",timeout.tv_sec,timeout.tv_nsec); |
#endif |
} |
int del_timer(struct timer_list *timer) |
{ |
shark_event_delete(timer->event_timer); |
return 0; /* TODO */ |
shark_timer_delete(timer->event_timer); |
return 0; |
} |
int mod_timer(struct timer_list *timer, unsigned long expires) |
{ |
shark_event_delete(timer->event_timer); |
shark_timer_delete(timer->event_timer); |
timer->expires = expires; |
add_timer(timer); |
return 0; /* TODO */ |
return 0; |
} |
void init_timer(struct timer_list * timer) |
77,75 → 77,3 |
return timer->event_timer != -1; |
} |
#else |
/* CHECK!!!! */ |
#include <pthread.h> |
/*Needs to have this sort of thing in the initfile |
* PTHREAD_register_module(1, 0, 1); |
* |
* TIMER_register_module(); |
* PI_register_module(); |
* PC_register_module(); |
*/ |
pthread_attr_t task_attr; /* attributtes for the task doing the callback*/ |
static inline void |
jiffies_to_timespec(unsigned long j, struct timespec *value) |
{ |
value->tv_nsec = (j % HZ) * (1000000000L / HZ); |
value->tv_sec = j / HZ; |
} |
int add_timer(struct timer_list *timer) |
{ |
int err; |
struct sigevent ev; |
struct sched_param task_param; |
struct itimerspec timeout; |
ev.sigev_notify = SIGEV_THREAD; |
ev.sigev_value.sival_int = timer->data; |
ev.sigev_notify_function = timer->function; |
ev.sigev_notify_attributes = &task_attr; |
pthread_attr_init(&task_attr); |
pthread_attr_setdetachstate(&task_attr, PTHREAD_CREATE_DETACHED); |
pthread_attr_setschedpolicy(&task_attr, SCHED_RR); |
task_param.sched_priority = 10; |
pthread_attr_setschedparam(&task_attr, &task_param); |
err =timer_create(CLOCK_REALTIME, &ev, &(timer->sharktimer)); |
if (err !=0 ) { cprintf("timer: unable to create timer\n"); } |
timeout.it_interval.tv_sec=0; |
timeout.it_interval.tv_nsec=0; |
jiffies_to_timespec(timer->expires, &(timeout.it_value)); |
err = timer_settime(timer->sharktimer, 0, &timeout, NULL); |
if (err !=0 ) { cprintf("timer: unable to timer_settime\n"); } |
return err; |
} |
void del_timer(struct timer_list *timer) |
{ |
timer_delete(timer->sharktimer); |
} |
void mod_timer(struct timer_list *timer, unsigned long expires) |
{ |
timer_delete(timer->sharktimer); |
timer->expires=expires; |
add_timer(timer); |
} |
void init_timer(struct timer_list * timer) |
{ |
} |
#endif |
/shark/trunk/drivers/linuxc26/shark_glue.c |
---|
7,9 → 7,12 |
#define MAX_INT_LIST 50 |
void *int_arg_table[16]; |
void *int_func_table[16]; |
/* 1-15 for IRQ and 16-63 for timers */ |
void *int_arg_table[64]; |
void *int_func_table[64]; |
int timer_table[64]; |
int int_list[MAX_INT_LIST]; |
int next_free_int = 0; |
int next_execute_int = 0; |
47,8 → 50,25 |
} |
int get_free_timer_slot() |
{ |
int i = 16; |
while(timer_table[i] != -1) |
if (i < 64) i++; else return -1; |
return i; |
} |
extern void linux_intr(int no); |
extern void linux_timer(int no); |
/* The Interrupt TASK is an aperiodic task designed for |
the INTDRIVE module. */ |
TASK Interrupt_Server(void *arg) |
{ |
57,9 → 77,17 |
while(1) { |
no = get_interrupt_job(); |
if (no != -1) |
linux_intr(no); |
if (no != -1 && no < 16) |
linux_intr(no); |
if (no != -1 && no >= 16) { |
linux_timer(no); |
timer_table[no] = -1; |
int_func_table[no] = NULL; |
int_arg_table[no] = NULL; |
} |
task_endcycle(); |
} |
71,22 → 99,23 |
HARD_TASK_MODEL ht; |
int i; |
for(i=0;i<16;i++) { |
for(i=0;i<64;i++) { |
int_arg_table[i] = NULL; |
int_func_table[i] = NULL; |
timer_table[i] = -1; |
} |
hard_task_default_model(ht); |
hard_task_def_wcet(ht,10000); |
hard_task_def_interrupt(ht); |
intr_server = task_create("Interrupt Server",Interrupt_Server,&ht,NULL); |
if (intr_server != NIL) |
return 0; |
else |
if (intr_server == NIL) |
return -1; |
return 0; |
} |
void shark_internal_sem_create(void **sem, int init) { |
102,19 → 131,77 |
internal_sem_post((internal_sem_t *)(sem)); |
} |
int shark_event_post(const struct timespec *time, void (*handler)(void *p), void *par) |
/* Timers */ |
void fast_call_timer(void *arg) |
{ |
return event_post(*time, handler, par); |
int no = (int)arg,res; |
res = add_interrupt_job(no); |
if (intr_server != NIL && res == 0) |
task_activate(intr_server); |
} |
int shark_event_delete(int index) |
int shark_timer_set(const struct timespec *time, void *handler, void *arg) |
{ |
return event_delete(index); |
SYS_FLAGS f; |
int i; |
f = kern_fsave(); |
i = get_free_timer_slot(); |
if (i == -1) { |
kern_frestore(f); |
return -1; |
} |
int_func_table[i] = handler; |
int_arg_table[i] = arg; |
timer_table[i] = kern_event_post(time,fast_call_timer,(void *)(i)); |
if (timer_table[i] == -1) { |
kern_frestore(f); |
return -1; |
} |
kern_frestore(f); |
return i; |
} |
void fast_call(int no) |
int shark_timer_delete(int index) |
{ |
SYS_FLAGS f; |
f = kern_fsave(); |
if (timer_table[index] != -1) { |
int_func_table[index] = NULL; |
int_arg_table[index] = NULL; |
kern_event_delete(timer_table[index]); |
timer_table[index] = -1; |
} |
kern_frestore(f); |
return 0; |
} |
/* Interrupt */ |
void fast_call_intr(int no) |
{ |
int res; |
res = add_interrupt_job(no); |
125,10 → 212,10 |
int shark_handler_set(int no, void *fast, void *arg){ |
if (no >= 1 && no < 16) { |
if (no >= 1 && no < 16 && int_func_table[no] == NULL) { |
int_arg_table[no] = arg; |
int_func_table[no] = fast; |
return handler_set(no, fast_call, NIL, TRUE); |
return handler_set(no, fast_call_intr, NIL, TRUE); |
} else { |
return -1; |
} |
136,6 → 223,11 |
} |
int shark_handler_remove(int no){ |
return handler_remove(no); |
int_func_table[no] = NULL; |
int_arg_table[no] = NULL; |
handler_remove(no); |
return 0; |
} |
/shark/trunk/drivers/linuxc26/int.c |
---|
4,8 → 4,8 |
#include <asm-generic/errno-base.h> |
#include <linux/kernel.h> |
extern void *int_arg_table[16]; |
extern void *int_func_table[16]; |
extern void *int_arg_table[64]; |
extern void *int_func_table[64]; |
int intr_count = 0; |
/* |