OSDN Git Service

[INITIAL] Import 20141226 version of http://homepage3.nifty.com/takeda-toshiya/common...
[csp-qt/common_source_project-fm7.git] / source / src / vm / fmgen / fmtimer.h
1 // ---------------------------------------------------------------------------\r
2 //      FM sound generator common timer module\r
3 //      Copyright (C) cisc 1998, 2000.\r
4 // ---------------------------------------------------------------------------\r
5 //      $Id: fmtimer.h,v 1.2 2003/04/22 13:12:53 cisc Exp $\r
6 \r
7 #ifndef FM_TIMER_H\r
8 #define FM_TIMER_H\r
9 \r
10 #include "types.h"\r
11 \r
12 // ---------------------------------------------------------------------------\r
13 \r
14 namespace FM\r
15 {\r
16         class Timer\r
17         {\r
18         public:\r
19                 void    Reset();\r
20                 bool    Count(int32 clock);\r
21                 int32   GetNextEvent();\r
22         \r
23         protected:\r
24                 virtual void SetStatus(uint bit) = 0;\r
25                 virtual void ResetStatus(uint bit) = 0;\r
26 \r
27                 void    SetTimerPrescaler(int32 p);\r
28                 void    SetTimerA(uint addr, uint data);\r
29                 void    SetTimerB(uint data);\r
30                 void    SetTimerControl(uint data);\r
31                 \r
32                 void SaveState(void *f);\r
33                 bool LoadState(void *f);\r
34                 \r
35                 uint8   status;\r
36                 uint8   regtc;\r
37         \r
38         private:\r
39                 virtual void TimerA() {}\r
40                 uint8   regta[2];\r
41                 \r
42                 int32   timera, timera_count;\r
43                 int32   timerb, timerb_count;\r
44                 int32   prescaler;\r
45         };\r
46 \r
47 // ---------------------------------------------------------------------------\r
48 //      \8f\89\8aú\89»\r
49 //\r
50 inline void Timer::Reset()\r
51 {\r
52         timera_count = 0;\r
53         timerb_count = 0;\r
54 }\r
55 \r
56 } // namespace FM\r
57 \r
58 #endif // FM_TIMER_H\r