-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
bus-common.h
67 lines (55 loc) · 1.84 KB
/
bus-common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef BUS_COMMON
#define BUS_COMMON
#include "clowncommon/clowncommon.h"
#include "clownmdemu.h"
#include "io-port.h"
typedef struct SyncState
{
cc_u32f current_cycle;
} SyncState;
typedef struct SyncCPUState
{
cc_u32f current_cycle;
cc_u32l *cycle_countdown;
} SyncCPUState;
typedef struct CPUCallbackUserData
{
const ClownMDEmu *clownmdemu;
struct
{
SyncCPUState m68k;
SyncCPUState z80;
SyncCPUState mcd_m68k;
SyncCPUState mcd_m68k_irq3;
SyncState fm;
SyncState psg;
SyncState pcm;
SyncState io_ports[3];
} sync;
} CPUCallbackUserData;
typedef struct CycleMegaDrive
{
cc_u32f cycle;
} CycleMegaDrive;
typedef struct CycleMegaCD
{
cc_u32f cycle;
} CycleMegaCD;
/* TODO: Move this to somewhere more specific. */
typedef struct IOPortToController_Parameters
{
Controller *controller;
const ClownMDEmu_Callbacks *frontend_callbacks;
} IOPortToController_Parameters;
typedef cc_u16f (*SyncCPUCommonCallback)(const ClownMDEmu *clownmdemu, void *user_data);
CycleMegaDrive MakeCycleMegaDrive(cc_u32f cycle);
CycleMegaCD MakeCycleMegaCD(cc_u32f cycle);
CycleMegaCD CycleMegaDriveToMegaCD(const ClownMDEmu *clownmdemu, CycleMegaDrive cycle);
CycleMegaDrive CycleMegaCDToMegaDrive(const ClownMDEmu *clownmdemu, CycleMegaCD cycle);
cc_u32f SyncCommon(SyncState *sync, cc_u32f target_cycle, cc_u32f clock_divisor);
void SyncCPUCommon(const ClownMDEmu *clownmdemu, SyncCPUState *sync, cc_u32f target_cycle, SyncCPUCommonCallback callback, const void *user_data);
cc_u8f SyncFM(CPUCallbackUserData *other_state, CycleMegaDrive target_cycle);
void SyncPSG(CPUCallbackUserData *other_state, CycleMegaDrive target_cycle);
void SyncPCM(CPUCallbackUserData *other_state, CycleMegaCD target_cycle);
void SyncCDDA(CPUCallbackUserData *other_state, cc_u32f total_frames);
#endif /* BUS_COMMON */