#define MIN_VALUE(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
#define MAX_VALUE(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
-#define MSF2SECT(m, s, f) (((m) * 60 + (s) - 2) * 75 + (f))
-
#define CD_FRAMESIZE_RAW 2352
#define DATA_SIZE (CD_FRAMESIZE_RAW - 12)
+/* CD_FRAMESIZE_RAW aligned to a cache line for DMA buffers
+ * (assuming a cache line of max. 64 bytes) */
+#define CD_FRAMESIZE_RAW_ALIGNED 2368
+
#define SUB_FRAMESIZE 96
+#define MSF2SECT(m, s, f) (((m) * 60 + (s) - 2) * 75 + (f))
+
+static inline void lba2msf(unsigned int lba, u8 *m, u8 *s, u8 *f) {
+ *m = lba / 75 / 60;
+ lba = lba - *m * 75 * 60;
+ *s = lba / 75;
+ lba = lba - *s * 75;
+ *f = lba;
+}
+
void cdrReset();
-void cdrAttenuate(s16 *buf, int samples, int stereo);
void cdrInterrupt(void);
-void cdrPlaySeekReadInterrupt(void);
+void cdrPlayReadInterrupt(void);
void cdrLidSeekInterrupt(void);
void cdrDmaInterrupt(void);
void LidInterrupt(void);