1 /*
2   Hatari - clocks_timings.h
3 
4   This file is distributed under the GNU General Public License, version 2
5   or at your option any later version. Read the file gpl.txt for details.
6 */
7 
8 #ifndef HATARI_CLOCKS_TIMINGS_H
9 #define HATARI_CLOCKS_TIMINGS_H
10 
11 
12 
13 
14 /* All the possible clock frequencies in Hz used in the supported machines. */
15 /* When a value is 0, the corresponding part is not available in this model */
16 
17 typedef struct
18 {
19   /* Common to all machines */
20   Uint32        MCLK_Freq;
21   Uint32        BUS_Freq;
22 
23   Uint32        CPU_Freq;			/* 'normal' CPU Freq (eg 8 MHz for ST or 16 MHz for Falcon) */
24   Uint32        FPU_Freq;
25   Uint32        DMA_Freq;
26   Uint32        MFP_Freq;
27   Uint32        MFP_Timer_Freq;
28   Uint32        FDC_Freq;
29   Uint32        BLITTER_Freq;
30   Uint32        YM_Freq;
31   Uint32        ACIA_Freq;
32   Uint32        IKBD_Freq;
33 
34   /* STF specific */
35   Uint32        MMU_Freq;			/* STF only */
36   Uint32        GLUE_Freq;			/* STF only */
37   Uint32        SHIFTER_Freq;			/* STF/STE */
38 
39   /* STE specific */
40   Uint32        MCU_Freq;			/* replaces MMU+GLUE in STF */
41   Uint32	DMA_Audio_Freq;			/* also used for SND SHIFTER in TT */
42 
43   /* TT specific */
44   Uint32        TTVIDEO_Freq;
45 
46   /* Falcon specific */
47   Uint32	COMBEL_Freq;			/* includes the BLITTER */
48   Uint32        VIDEL_Freq;
49   Uint32        CODEC_Freq;
50   Uint32        DSP_Freq;
51 
52   /* Common to all machines, runtime variables */
53   Uint32        CPU_Freq_Emul;			/* Freq in Hz at which the CPU is emulated (taking nCpuFreqShift and CPU_Freq into account) */
54 
55 } CLOCKS_STRUCT;
56 
57 
58 
59 extern CLOCKS_STRUCT	MachineClocks;
60 
61 extern bool	RoundVBLPerSec;
62 
63 
64 #define	CLOCKS_TIMINGS_SHIFT_VBL	24		/* The value returned by ClocksTimings_GetVBLPerSec is << 24 to increase precision */
65 
66 /* Functions' prototypes */
67 
68 void	ClocksTimings_InitMachine ( MACHINETYPE MachineType );
69 void	ClocksTimings_UpdateCpuFreqEmul ( MACHINETYPE MachineType , int nCpuFreqShift );
70 Uint32	ClocksTimings_GetCyclesPerVBL ( MACHINETYPE MachineType , int ScreenRefreshRate );
71 Uint32	ClocksTimings_GetVBLPerSec ( MACHINETYPE MachineType , int ScreenRefreshRate );
72 Uint32	ClocksTimings_GetVBLDuration_micro ( MACHINETYPE MachineType , int ScreenRefreshRate );
73 Sint64	ClocksTimings_GetSamplesPerVBL ( MACHINETYPE MachineType , int ScreenRefreshRate , int AudioFreq );
74 
75 
76 
77 
78 
79 #endif
80 
81