1 /***************************************************************************
2 * Copyright (C) 2007 Ryan Schultz, PCSX-df Team, PCSX team *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
18 ***************************************************************************/
27 #include "psxcommon.h"
28 #include "decode_xa.h"
34 #define btoi(b) ((b) / 16 * 10 + (b) % 16) /* BCD to u_char */
35 #define itob(i) ((i) / 10 * 16 + (i) % 10) /* u_char to BCD */
37 #define MSF2SECT(m, s, f) (((m) * 60 + (s) - 2) * 75 + (f))
39 #define CD_FRAMESIZE_RAW 2352
40 #define DATA_SIZE (CD_FRAMESIZE_RAW - 12)
42 #define SUB_FRAMESIZE 96
44 #define MIN_VALUE(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
45 #define MAX_VALUE(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
49 unsigned char Reg1Mode;
51 unsigned char CmdProcess;
57 unsigned char Transfer[DATA_SIZE];
61 unsigned char Relative[3];
62 unsigned char Absolute[3];
64 unsigned char TrackChanged;
65 boolean m_locationChanged;
66 unsigned char pad1[2];
67 unsigned int freeze_ver;
69 unsigned char Prev[4];
70 unsigned char Param[8];
71 unsigned char Result[16];
75 unsigned char ResultC;
76 unsigned char ResultP;
77 unsigned char ResultReady;
80 unsigned char SetlocPending;
83 unsigned char ResultTN[6];
84 unsigned char ResultTD[4];
85 unsigned char SetSectorPlay[4];
86 unsigned char SetSectorEnd[4];
87 unsigned char SetSector[4];
91 int Mode, File, Channel;
111 u8 AttenuatorLeftToLeft, AttenuatorLeftToRight;
112 u8 AttenuatorRightToRight, AttenuatorRightToLeft;
113 u8 AttenuatorLeftToLeftT, AttenuatorLeftToRightT;
114 u8 AttenuatorRightToRightT, AttenuatorRightToLeftT;
117 extern cdrStruct cdr;
120 void cdrAttenuate(s16 *buf, int samples, int stereo);
123 void cdrReadInterrupt();
124 void cdrRepplayInterrupt();
125 void cdrLidSeekInterrupt();
126 void cdrPlayInterrupt();
127 void cdrDmaInterrupt();
129 unsigned char cdrRead0(void);
130 unsigned char cdrRead1(void);
131 unsigned char cdrRead2(void);
132 unsigned char cdrRead3(void);
133 void cdrWrite0(unsigned char rt);
134 void cdrWrite1(unsigned char rt);
135 void cdrWrite2(unsigned char rt);
136 void cdrWrite3(unsigned char rt);
137 int cdrFreeze(void *f, int Mode);