* GNU General Public License for more details. *
***************************************************************************/
+#include <stdalign.h>
#include <stdlib.h>
#include <string.h>
#include "system.h"
u32 buf_cnt, thread_exit, do_prefetch, prefetch_failed, have_subchannel;
u32 total_lba, prefetch_lba;
int check_eject_delay;
- u8 buf_local[CD_FRAMESIZE_RAW]; // single sector cache, not touched by the thread
+
+ // single sector cache, not touched by the thread
+ alignas(64) u8 buf_local[CD_FRAMESIZE_RAW_ALIGNED];
} acdrom;
static void lbacache_do(u32 lba)
{
- unsigned char msf[3], buf[CD_FRAMESIZE_RAW], buf_sub[SUB_FRAMESIZE];
+ alignas(64) unsigned char buf[CD_FRAMESIZE_RAW_ALIGNED];
+ unsigned char msf[3], buf_sub[SUB_FRAMESIZE];
u32 i = lba % acdrom.buf_cnt;
int ret;
* Handles all CD-ROM registers and functions.
*/
+#include <stdalign.h>
#include <assert.h>
#include "cdrom.h"
#include "cdrom-async.h"
u8 AttenuatorLeftToLeftT, AttenuatorLeftToRightT;
u8 AttenuatorRightToRightT, AttenuatorRightToLeftT;
} cdr;
-static s16 read_buf[CD_FRAMESIZE_RAW/2];
+alignas(64) static s16 read_buf[CD_FRAMESIZE_RAW_ALIGNED / 2];
struct SubQ {
char res0[12];
#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))