Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 40 → Rev 120

/shark/trunk/oslib/kl/time.c
21,6 → 21,13
 
/* 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>
41,6 → 48,8
extern BYTE frc;
extern int activeEvent;
 
extern unsigned char use_tsc;
 
FILE(Time);
 
TIME ll_gettime(int mode, struct timespec *tsres)
49,6 → 58,8
BYTE isr;
struct timespec tmp;
 
if (!use_tsc) {
 
#if 1
if (activeEvent) {
if (tsres != NULL) {
125,4 → 136,69
}
}
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;
 
}
}