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); |