/shark/trunk/oslib/kl/advtimer.c |
---|
File deleted |
/shark/trunk/oslib/kl/time.c |
---|
21,13 → 21,6 |
/* Time management code: ll_getttime() */ |
/* Added Advanced Timer Code |
* |
* Date: 8.4.2003 |
* Author: Giacomo Guidi <giacomo@gandalf.sssup.it> |
* |
*/ |
#include <ll/i386/pit.h> |
#include <ll/i386/stdlib.h> |
#include <ll/i386/error.h> |
48,8 → 41,6 |
extern BYTE frc; |
extern int activeEvent; |
extern unsigned char use_tsc; |
FILE(Time); |
TIME ll_gettime(int mode, struct timespec *tsres) |
58,8 → 49,6 |
BYTE isr; |
struct timespec tmp; |
if (!use_tsc) { |
#if 1 |
if (activeEvent) { |
if (tsres != NULL) { |
136,69 → 125,4 |
} |
} |
return 0; |
} else { |
#if 1 |
if (activeEvent) { |
if (tsres != NULL) { |
read_timespec(tsres); |
} else { |
struct timespec tmp; |
read_timespec(&tmp); |
return TIMESPEC2USEC(&tmp); |
} |
return TIMESPEC2USEC(tsres); |
} |
#endif |
if (mode == TIME_PTICK) { |
if (timermode != LL_PERIODIC) { |
return 0; |
} |
if(tsres != NULL) { |
read_timespec(tsres); |
} else { |
struct timespec tmp; |
read_timespec(&tmp); |
return TIMESPEC2USEC(&tmp); |
} |
return TIMESPEC2USEC(tsres); |
} |
if (mode == TIME_NEW) { |
if (tsres != NULL) { |
read_timespec(tsres); |
return TIMESPEC2USEC(tsres); |
} else { |
struct timespec tmp; |
read_timespec(&tmp); |
return TIMESPEC2USEC(&tmp); |
} |
} |
if (mode == TIME_EXACT) { |
if (timermode == LL_PERIODIC) { |
if (tsres != NULL) { |
read_timespec(tsres); |
} else { |
struct timespec tmp; |
read_timespec(&tmp); |
return TIMESPEC2USEC(&tmp); |
} |
return TIMESPEC2USEC(tsres); |
} else { |
return 0; |
} |
} |
return 0; |
} |
} |
/shark/trunk/oslib/kl/event1.c |
---|
19,13 → 19,6 |
* For legalese, check out the included GPL license. |
*/ |
/* Added Advanced Timer Code |
* |
* Date: 8.4.2003 |
* Author: Giacomo Guidi <giacomo@gandalf.sssup.it> |
* |
*/ |
/* Time Event routines (one shot mode) */ |
#include <ll/i386/stdlib.h> |
52,8 → 45,6 |
extern void (*evt_prol) (void); |
extern void (*evt_epil) (void); |
extern unsigned char use_tsc; |
/* TODO: oneshot_event_delete & oneshot_event_init... */ |
/* Switched to timespec */ |
121,20 → 112,12 |
WORD tmp; |
DWORD tnext; |
if (!use_tsc) { |
tmp = pit_read(frc); |
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter); |
lastTime = tmp; |
tmp = pit_read(frc); |
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter); |
lastTime = tmp; |
PITSPEC2TIMESPEC(&globalCounter, &now); |
PITSPEC2TIMESPEC(&globalCounter, &now); |
} else { |
read_timespec(&now); |
} |
if (firstevent != NULL) { |
activeEvent = 1; |
if (TIMESPEC_A_GT_B(&now, &(firstevent->time))) { |
161,22 → 144,13 |
} |
activeInt--; |
} |
tmp = pit_read(frc); |
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter); |
lastTime = tmp; |
if (!use_tsc) { |
tmp = pit_read(frc); |
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter); |
lastTime = tmp; |
PITSPEC2TIMESPEC(&globalCounter, &now); |
PITSPEC2TIMESPEC(&globalCounter, &now); |
} else { |
read_timespec(&now); |
} |
if (TIMESPEC_A_GT_B(&now, &(firstevent->time))) { |
NULL_TIMESPEC(&ttmp); |
} else { |
/shark/trunk/oslib/kl/init.c |
---|
183,8 → 183,7 |
void abort_tail(int code) |
{ |
message("ABORT %d !!!",code); |
restore_CMOS(); |
l1_end(); |
l1_end(); |
sti(); |
l1_exit(1); |
} |
191,7 → 190,6 |
void ll_end(void) |
{ |
restore_CMOS(); |
l1_end(); |
} |
/shark/trunk/oslib/kl/event.c |
---|
19,13 → 19,6 |
* For legalese, check out the included GPL license. |
*/ |
/* Added Advanced Timer Code |
* |
* Date: 8.4.2003 |
* Author: Giacomo Guidi <giacomo@gandalf.sssup.it> |
* |
*/ |
/* Time Event routines */ |
#include <ll/i386/stdlib.h> |
68,8 → 61,6 |
extern void (*evt_prol) (void); |
extern void (*evt_epil) (void); |
extern unsigned char use_tsc; |
void event_setlasthandler(void *p) |
{ |
last_handler = p; |
161,23 → 152,17 |
struct event *p, *pp; |
WORD tmp; |
if(!use_tsc) { |
tmp = pit_read(frc); |
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter); |
lastTime = tmp; |
} |
tmp = pit_read(frc); |
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter); |
lastTime = tmp; |
activeInt++; |
if (activeInt == 1 && evt_prol != NULL) { |
evt_prol(); |
} |
if (!use_tsc) { |
ADDNANO2TIMESPEC(nts, &actTime); |
} else { |
read_timespec(&actTime); |
} |
ADDNANO2TIMESPEC(nts, &actTime); |
for (p = firstevent; p != NULL; p = pp) { |
/* |
SUBTIMESPEC(&(p->time), &actTime, &tmp); |
212,7 → 197,7 |
IDT_place(0x40,ll_timer); |
if (l->mode != LL_PERIODIC) { |
message("One-shot mode\n"); |
error("Trying one-shot!!!"); |
t = 0; |
/* Mode: Binary/Mode 4/16 bit Time_const/Counter 0 */ |
pit_init(0, TMR_MD4, 0xFFFF); /* Timer 0, Mode 4, constant 0xFFFF */ |
271,8 → 256,6 |
/* Initialization of the time variables for periodic mode */ |
nts = ticksize * 1000; |
NULL_TIMESPEC(&actTime); |
if (use_tsc) ll_init_advtimer(); |
/* Initialization of the general time variables */ |
NULLPITSPEC(&globalCounter); |
/shark/trunk/oslib/kl/makefile |
---|
24,8 → 24,7 |
aspace.o \ |
intevt.o \ |
event.o \ |
event1.o \ |
advtimer.o |
event1.o |
KL_OBJ = $(KL_C_OBJ) abort.o timeint.o |