1 |
|
/* |
2 |
|
* timer_amiga.cpp - Time Manager emulation, AmigaOS specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2001 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
20 |
|
|
21 |
|
#include <exec/types.h> |
22 |
|
#include <devices/timer.h> |
23 |
+ |
#define __USE_SYSBASE |
24 |
|
#include <proto/timer.h> |
25 |
|
#include <proto/intuition.h> |
26 |
+ |
#include <inline/timer.h> |
27 |
+ |
#include <inline/intuition.h> |
28 |
|
|
29 |
|
#include "sysdeps.h" |
30 |
|
#include "timer.h" |
33 |
|
#include "debug.h" |
34 |
|
|
35 |
|
|
33 |
– |
// Assembly functions |
34 |
– |
extern "C" ULONG TimevalTo64(struct timeval *, ULONG *); |
35 |
– |
extern "C" LONG TimevalToMacTime(struct timeval *); |
36 |
– |
|
37 |
– |
|
36 |
|
/* |
37 |
|
* Return microseconds since boot (64 bit) |
38 |
|
*/ |
42 |
|
D(bug("Microseconds\n")); |
43 |
|
struct timeval tv; |
44 |
|
GetSysTime(&tv); |
45 |
< |
lo = TimevalTo64(&tv, &hi); |
45 |
> |
uint64 tl = (uint64)tv.tv_secs * 1000000 + tv.tv_micro; |
46 |
> |
hi = tl >> 32; |
47 |
> |
lo = tl; |
48 |
|
} |
49 |
|
|
50 |
|
|
54 |
|
|
55 |
|
uint32 TimerDateTime(void) |
56 |
|
{ |
57 |
< |
ULONG secs; |
58 |
< |
ULONG mics; |
57 |
> |
ULONG secs, mics; |
58 |
|
CurrentTime(&secs, &mics); |
59 |
< |
return secs + TIME_OFFSET; |
59 |
> |
return secs + 0x8b31ef80; |
60 |
|
} |
61 |
|
|
62 |
|
|
128 |
|
{ |
129 |
|
if (hosttime.tv_secs < 0) |
130 |
|
return 0; |
131 |
< |
else |
132 |
< |
return TimevalToMacTime(&hosttime); |
131 |
> |
else { |
132 |
> |
uint64 t = (uint64)hosttime.tv_secs * 1000000 + hosttime.tv_micro; |
133 |
> |
if (t > 0x7fffffff) |
134 |
> |
return t / 1000; // Time in milliseconds |
135 |
> |
else |
136 |
> |
return -t; // Time in negative microseconds |
137 |
> |
} |
138 |
> |
} |
139 |
> |
|
140 |
> |
|
141 |
> |
/* |
142 |
> |
* Suspend emulator thread, virtual CPU in idle mode |
143 |
> |
*/ |
144 |
> |
|
145 |
> |
void idle_wait(void) |
146 |
> |
{ |
147 |
> |
// XXX if you implement this make sure to call idle_resume() from TriggerInterrupt() |
148 |
> |
} |
149 |
> |
|
150 |
> |
|
151 |
> |
/* |
152 |
> |
* Resume execution of emulator thread, events just arrived |
153 |
> |
*/ |
154 |
> |
|
155 |
> |
void idle_resume(void) |
156 |
> |
{ |
157 |
|
} |