Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/psx/mednadisc/cdrom/scsicd.h
2 views
1
#ifndef __PCFX_SCSICD_H
2
#define __PCFX_SCSICD_H
3
4
typedef int32 scsicd_timestamp_t;
5
6
typedef struct
7
{
8
// Data bus(FIXME: we should have a variable for the target and the initiator, and OR them together to be truly accurate).
9
uint8 DB;
10
11
uint32 signals;
12
13
// Signals under our(the "target") control.
14
//bool BSY, MSG, CD, REQ, IO;
15
16
// Signals under the control of the initiator(not us!)
17
//bool kingACK, kingRST, kingSEL, kingATN;
18
} scsicd_bus_t;
19
20
extern scsicd_bus_t cd_bus; // Don't access this structure directly by name outside of scsicd.c, but use the macros below.
21
22
// Signals under our(the "target") control.
23
#define SCSICD_IO_mask 0x001
24
#define SCSICD_CD_mask 0x002
25
#define SCSICD_MSG_mask 0x004
26
#define SCSICD_REQ_mask 0x008
27
#define SCSICD_BSY_mask 0x010
28
29
// Signals under the control of the initiator(not us!)
30
#define SCSICD_kingRST_mask 0x020
31
#define SCSICD_kingACK_mask 0x040
32
#define SCSICD_kingATN_mask 0x080
33
#define SCSICD_kingSEL_mask 0x100
34
35
#define BSY_signal ((const bool)(cd_bus.signals & SCSICD_BSY_mask))
36
#define ACK_signal ((const bool)(cd_bus.signals & SCSICD_kingACK_mask))
37
#define RST_signal ((const bool)(cd_bus.signals & SCSICD_kingRST_mask))
38
#define MSG_signal ((const bool)(cd_bus.signals & SCSICD_MSG_mask))
39
#define SEL_signal ((const bool)(cd_bus.signals & SCSICD_kingSEL_mask))
40
#define REQ_signal ((const bool)(cd_bus.signals & SCSICD_REQ_mask))
41
#define IO_signal ((const bool)(cd_bus.signals & SCSICD_IO_mask))
42
#define CD_signal ((const bool)(cd_bus.signals & SCSICD_CD_mask))
43
#define ATN_signal ((const bool)(cd_bus.signals & SCSICD_kingATN_mask))
44
45
#define DB_signal ((const uint8)cd_bus.DB)
46
47
#define SCSICD_GetDB() DB_signal
48
#define SCSICD_GetBSY() BSY_signal
49
#define SCSICD_GetIO() IO_signal
50
#define SCSICD_GetCD() CD_signal
51
#define SCSICD_GetMSG() MSG_signal
52
#define SCSICD_GetREQ() REQ_signal
53
54
// Should we phase out getting these initiator-driven signals like this(the initiator really should keep track of them itself)?
55
#define SCSICD_GetACK() ACK_signal
56
#define SCSICD_GetRST() RST_signal
57
#define SCSICD_GetSEL() SEL_signal
58
#define SCSICD_GetATN() ATN_signal
59
60
void SCSICD_Power(scsicd_timestamp_t system_timestamp);
61
void SCSICD_SetDB(uint8 data);
62
63
// These SCSICD_Set* functions are kind of misnomers, at least in comparison to the SCSICD_Get* functions...
64
// They will set/clear the bits corresponding to the KING's side of the bus.
65
void SCSICD_SetACK(bool set);
66
void SCSICD_SetSEL(bool set);
67
void SCSICD_SetRST(bool set);
68
void SCSICD_SetATN(bool set);
69
70
uint32 SCSICD_Run(scsicd_timestamp_t);
71
void SCSICD_ResetTS(uint32 ts_base);
72
73
enum
74
{
75
SCSICD_PCE = 1,
76
SCSICD_PCFX
77
};
78
79
enum
80
{
81
SCSICD_IRQ_DATA_TRANSFER_DONE = 1,
82
SCSICD_IRQ_DATA_TRANSFER_READY,
83
SCSICD_IRQ_MAGICAL_REQ,
84
};
85
86
void SCSICD_GetCDDAValues(int16 &left, int16 &right);
87
88
void SCSICD_SetLog(void (*logfunc)(const char *, const char *, ...));
89
90
void SCSICD_Init(int type, int CDDATimeDiv, int32* left_hrbuf, int32* right_hrbuf, uint32 TransferRate, uint32 SystemClock, void (*IRQFunc)(int), void (*SSCFunc)(uint8, int));
91
void SCSICD_Close(void);
92
93
void SCSICD_SetTransferRate(uint32 TransferRate);
94
void SCSICD_SetCDDAVolume(double left, double right);
95
void SCSICD_StateAction(StateMem *sm, const unsigned load, const bool data_only, const char *sname);
96
97
void SCSICD_SetDisc(bool tray_open, CDIF *cdif, bool no_emu_side_effects = false);
98
99
#endif
100
101