Subversion Repositories shark

Compare Revisions

Regard whitespace Rev 618 → Rev 619

/shark/trunk/oslib/kl/event1.c/event1.c
62,10 → 62,10
extern void (*evt_epil) (void);
 
extern unsigned int apic_clk_per_msec;
extern unsigned char use_tsc, use_apic;
 
/* Switched to timespec */
int oneshot_event_post(struct timespec time, void (*handler) (void *p),
void *par)
int oneshot_event_post(struct timespec time, void (*handler) (void *p), void *par)
{
struct event *p;
struct event *p1, *t;
107,11 → 107,11
} else {
firstevent = p;
if (!activeEvent) {
#ifndef __TSC__
if (!use_tsc) {
ll_gettime(TIME_NEW, &now);
#else
} else {
ll_read_timespec(&now);
#endif
}
if (TIMESPEC_A_GT_B(&now, &(firstevent->time))) {
NULL_TIMESPEC(&tmp);
} else {
118,47 → 118,40
SUBTIMESPEC(&(firstevent->time), &now, &tmp);
}
tnext = TIMESPEC2USEC(&tmp);
#ifndef __APIC__
if (!use_apic) {
mul32div32to32(tnext,1193182,1000000,tnext);
pit_setconstant(0, tnext);
#else
} else {
mul32div32to32(tnext,apic_clk_per_msec,1000,tnext);
set_APIC_timer(tnext);
#endif
}
}
}
p->next = p1;
 
return p->index;
}
 
 
 
void oneshot_wake_up(void)
{ /* CHANGE the NAME, please... */
{
/* CHANGE the NAME, please... */
struct event *p = NULL, *pp;
struct timespec now, ttmp;
#ifndef __TSC__
WORD tmp;
#endif
DWORD tnext;
 
TRACER_LOGEVENT(FTrace_EVT_timer_wakeup_start, 0, 0);
 
#ifndef __TSC__
if (!use_tsc) {
tmp = pit_read(frc);
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter);
lastTime = tmp;
 
PITSPEC2TIMESPEC(&globalCounter, &now);
 
#else
 
} else {
ll_read_timespec(&now);
}
 
#endif
 
if (firstevent != NULL) {
activeEvent = 1;
if (TIMESPEC_A_GT_B(&now, &(firstevent->time))) {
186,21 → 179,16
activeInt--;
}
 
#ifndef __TSC__
if (!use_tsc) {
tmp = pit_read(frc);
ADDPITSPEC((WORD) (lastTime - tmp), &globalCounter);
lastTime = tmp;
 
PITSPEC2TIMESPEC(&globalCounter, &now);
 
#else
 
} else {
ll_read_timespec(&now);
}
 
#endif
 
 
if (TIMESPEC_A_GT_B(&now, &(firstevent->time))) {
NULL_TIMESPEC(&ttmp);
} else {
208,24 → 196,22
}
/* SUBTIMESPEC(&(firstevent->time), &now, &ttmp); */
tnext = TIMESPEC2USEC(&ttmp);
#ifndef __APIC__
if (!use_apic) {
mul32div32to32(tnext,1193182,1000000,tnext);
pit_setconstant(0, tnext);
#else
} else {
mul32div32to32(tnext,apic_clk_per_msec,1000,tnext);
set_APIC_timer(tnext);
#endif
}
activeEvent = 0;
} else {
#ifndef __APIC__
if (!use_apic)
pit_setconstant(0, 0xFFFF);
#else
else
set_APIC_timer(0xFFFFFFFF);
#endif
}
 
TRACER_LOGEVENT(FTrace_EVT_timer_wakeup_end, (unsigned short int)currCtx, 0);
 
}
 
int oneshot_event_delete(int index)
261,18 → 247,16
 
if (!activeEvent) {
if (firstevent == NULL) {
#ifndef __APIC__
if (!use_apic)
pit_setconstant(0, 0xFFFF);
#else
else
set_APIC_timer(0xFFFFFFFF);
#endif
} else {
if (firstdeleted) {
#ifndef __TSC__
if (!use_tsc)
ll_gettime(TIME_NEW, &now);
#else
else
ll_read_timespec(&now);
#endif
if (TIMESPEC_A_GT_B(&now, &(firstevent->time))) {
NULL_TIMESPEC(&tmp);
} else {
280,15 → 264,15
}
/*SUBTIMESPEC(&now, &(firstevent->time), &tmp); */
tnext = TIMESPEC2USEC(&tmp);
#ifndef __APIC__
if (!use_apic) {
mul32div32to32(tnext,1193182,1000000,tnext);
pit_setconstant(0, tnext);
#else
} else {
mul32div32to32(tnext,apic_clk_per_msec,1000,tnext);
set_APIC_timer(tnext);
#endif
}
}
}
}
return 1;
}