git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel - Split per-process and per-thread data
[tpg/acess2.git]
/
Kernel
/
time.c
diff --git
a/Kernel/time.c
b/Kernel/time.c
index
c048d11
..
de43947
100644
(file)
--- a/
Kernel/time.c
+++ b/
Kernel/time.c
@@
-17,25
+17,15
@@
typedef struct sTimer {
} tTimer;
// === PROTOTYPES ===
} tTimer;
// === PROTOTYPES ===
-Sint64 now(void);
void Timer_CallTimers(void);
// === GLOBALS ===
void Timer_CallTimers(void);
// === GLOBALS ===
-
Uint64
giTicks = 0;
-
Sint64
giTimestamp = 0;
-
Uint64
giPartMiliseconds = 0;
-tTimer gTimers[NUM_TIMERS];
+
volatile Uint64
giTicks = 0;
+
volatile Sint64
giTimestamp = 0;
+
volatile Uint64
giPartMiliseconds = 0;
+tTimer gTimers[NUM_TIMERS];
// TODO: Replace by a ring-list timer
// === CODE ===
// === CODE ===
-/**
- * \fn Sint64 now()
- * \brief Return the current timestamp
- */
-Sint64 now(void)
-{
- return giTimestamp;
-}
-
/**
* \fn void Timer_CallTimers()
*/
/**
* \fn void Timer_CallTimers()
*/
@@
-43,16
+33,15
@@
void Timer_CallTimers()
{
int i;
void (*callback)(void *);
{
int i;
void (*callback)(void *);
+ void *arg;
- for(i = 0;
- i < NUM_TIMERS;
- i ++)
+ for(i = 0; i < NUM_TIMERS; i ++)
{
if(gTimers[i].Callback == NULL) continue;
if(giTimestamp < gTimers[i].FiresAfter) continue;
{
if(gTimers[i].Callback == NULL) continue;
if(giTimestamp < gTimers[i].FiresAfter) continue;
- callback = gTimers[i].Callback;
+ callback = gTimers[i].Callback;
arg = gTimers[i].Argument;
gTimers[i].Callback = NULL;
gTimers[i].Callback = NULL;
- callback(
gTimers[i].Argument
);
+ callback(
arg
);
}
}
}
}
@@
-95,12
+84,11
@@
void Time_RemoveTimer(int ID)
*/
void Time_Delay(int Delay)
{
*/
void Time_Delay(int Delay)
{
-
Sint64 dest = giTimestamp
+ Delay;
- while(dest
< giTimestamp)
Threads_Yield();
+
tTime dest = now()
+ Delay;
+ while(dest
> now())
Threads_Yield();
}
// === EXPORTS ===
}
// === EXPORTS ===
-EXPORT(now);
EXPORT(Time_CreateTimer);
EXPORT(Time_RemoveTimer);
EXPORT(Time_Delay);
EXPORT(Time_CreateTimer);
EXPORT(Time_RemoveTimer);
EXPORT(Time_Delay);
UCC
git Repository :: git.ucc.asn.au