Develop and Download Open Source Software

Browse CVS Repository

Contents of /mame32jp/mame32jp/src/timer.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Wed Apr 24 03:53:21 2002 UTC (21 years, 11 months ago) by zero
Branch: MAIN
CVS Tags: ver_0_60_1, ver0_59_13, ver0_59_14, ver0_60_2, ver0_60_3, ver0_60_4, ver0_60_5, HEAD
Changes since 1.4: +0 -0 lines
File MIME type: text/x-chdr
*** empty log message ***

1 /***************************************************************************
2
3 timer.c
4
5 Functions needed to generate timing and synchronization between several
6 CPUs.
7
8 ***************************************************************************/
9
10 #ifndef __TIMER_H__
11 #define __TIMER_H__
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 extern double cycles_to_sec[];
18 extern double sec_to_cycles[];
19
20 #define TIME_IN_HZ(hz) (1.0 / (double)(hz))
21 #define TIME_IN_CYCLES(c,cpu) ((double)(c) * cycles_to_sec[cpu])
22 #define TIME_IN_SEC(s) ((double)(s))
23 #define TIME_IN_MSEC(ms) ((double)(ms) * (1.0 / 1000.0))
24 #define TIME_IN_USEC(us) ((double)(us) * (1.0 / 1000000.0))
25 #define TIME_IN_NSEC(us) ((double)(us) * (1.0 / 1000000000.0))
26
27 #define TIME_NOW (0.0)
28 #define TIME_NEVER (1.0e30)
29
30 #define TIME_TO_CYCLES(cpu,t) ((int)((t) * sec_to_cycles[cpu]))
31
32
33 #define SUSPEND_REASON_HALT 0x0001
34 #define SUSPEND_REASON_RESET 0x0002
35 #define SUSPEND_REASON_SPIN 0x0004
36 #define SUSPEND_REASON_TRIGGER 0x0008
37 #define SUSPEND_REASON_DISABLE 0x0010
38 #define SUSPEND_ANY_REASON ((UINT32)-1)
39
40
41 void timer_init(void);
42 void timer_free(void);
43 void *timer_alloc(void (*callback)(int));
44 void timer_adjust(void *which, double duration, int param, double period);
45 void timer_pulse(double period, int param, void (*callback)(int));
46 void timer_set(double duration, int param, void (*callback)(int));
47 void timer_reset(void *which, double duration);
48 void timer_remove(void *which);
49 int timer_enable(void *which, int enable);
50 double timer_timeelapsed(void *which);
51 double timer_timeleft(void *which);
52 double timer_get_time(void);
53 double timer_starttime(void *which);
54 double timer_firetime(void *which);
55 int timer_schedule_cpu(int *cpu, int *cycles);
56 void timer_update_cpu(int cpu, int ran);
57 void timer_suspendcpu(int cpu, int suspend, int reason);
58 void timer_holdcpu(int cpu, int hold, int reason);
59 int timer_iscpususpended(int cpu, int reason);
60 int timer_iscpuheld(int cpunum, int reason);
61 void timer_suspendcpu_trigger(int cpu, int trigger);
62 void timer_holdcpu_trigger(int cpu, int trigger);
63 void timer_trigger(int trigger);
64 double timer_get_overclock(int cpunum);
65 void timer_set_overclock(int cpunum, double overclock);
66
67 #ifdef __cplusplus
68 }
69 #endif
70
71 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26