OSDN Git Service

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