31,6 → 31,7 |
#include <ll/i386/stdlib.h> |
#include <ll/i386/mem.h> |
#include <ll/i386/pit.h> |
#include <ll/i386/apic.h> |
#include <ll/i386/advtimer.h> |
|
#include <ll/sys/ll/ll-data.h> |
55,6 → 56,8 |
extern void (*evt_epil) (void); |
|
extern unsigned char use_tsc; |
extern unsigned int use_apic; |
extern unsigned int apic_clk_per_msec; |
|
/* TODO: oneshot_event_delete & oneshot_event_init... */ |
|
105,10 → 108,15 |
SUBTIMESPEC(&(firstevent->time), &now, &tmp); |
} |
tnext = TIMESPEC2USEC(&tmp); |
if (!use_apic) { |
tnext = (signed long long)(tnext) * 1193182 / 1000000; |
pit_setconstant(0, tnext); |
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
setup_APIC_LVTT(tnext); |
} |
} |
} |
p->next = p1; |
|
return p->index; |
186,14 → 194,22 |
} |
/* SUBTIMESPEC(&(firstevent->time), &now, &ttmp); */ |
tnext = TIMESPEC2USEC(&ttmp); |
if (!use_apic) { |
tnext = (signed long long)(tnext) * 1193182 / 1000000; |
pit_setconstant(0, tnext); |
|
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
setup_APIC_LVTT(tnext); |
} |
activeEvent = 0; |
} else { |
if (!use_apic) { |
pit_setconstant(0, 0xFFFF); |
} else { |
setup_APIC_LVTT(0xFFFFFFFF); |
} |
} |
} |
|
int oneshot_event_delete(int index) |
{ |
224,8 → 240,12 |
|
if (!activeEvent) { |
if (firstevent == NULL) { |
if (!use_apic) { |
pit_setconstant(0, 0xFFFF); |
} else { |
setup_APIC_LVTT(0xFFFFFFFF); |
} |
} else { |
if (firstdeleted) { |
ll_gettime(TIME_NEW, &now); |
if (TIMESPEC_A_GT_B(&now, &(firstevent->time))) { |
235,10 → 255,15 |
} |
/*SUBTIMESPEC(&now, &(firstevent->time), &tmp); */ |
tnext = TIMESPEC2USEC(&tmp); |
if (!use_apic) { |
tnext = (signed long long)(tnext) * 1193182 / 1000000; |
pit_setconstant(0, tnext); |
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
setup_APIC_LVTT(tnext); |
} |
} |
} |
} |
return 1; |
} |