2008-08-06 03:09:59 +02:00
|
|
|
/****************************************************************************
|
2008-09-12 07:28:40 +02:00
|
|
|
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
2008-08-06 03:09:59 +02:00
|
|
|
*
|
|
|
|
* softdev July 2006
|
2008-09-12 07:28:40 +02:00
|
|
|
*
|
|
|
|
* aram.cpp
|
|
|
|
*
|
|
|
|
* Gamecube Audio RAM storage
|
|
|
|
***************************************************************************/
|
|
|
|
|
2008-12-30 01:08:17 +01:00
|
|
|
#ifdef HW_DOL
|
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
#include <gccore.h>
|
|
|
|
#include <string.h>
|
2008-09-12 07:28:40 +02:00
|
|
|
|
2008-08-06 03:09:59 +02:00
|
|
|
#include "aram.h"
|
|
|
|
|
|
|
|
#define ARAM_READ 1
|
|
|
|
#define ARAM_WRITE 0
|
|
|
|
|
|
|
|
#define TEMPSIZE 32768
|
|
|
|
static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32);
|
|
|
|
|
2008-09-12 07:28:40 +02:00
|
|
|
/****************************************************************************
|
2008-08-06 03:09:59 +02:00
|
|
|
* ARAMPut
|
|
|
|
*
|
|
|
|
* Move data from MAIN memory to ARAM
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-08-06 03:09:59 +02:00
|
|
|
void
|
|
|
|
ARAMPut (char *src, char *dst, int len)
|
|
|
|
{
|
2008-12-30 01:08:17 +01:00
|
|
|
DCFlushRange (src, len);
|
|
|
|
AR_StartDMA (ARAM_WRITE, (u32) src, (u32) dst, len);
|
|
|
|
while (AR_GetDMAStatus());
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
|
|
|
|
2008-09-12 07:28:40 +02:00
|
|
|
/****************************************************************************
|
2008-08-06 03:09:59 +02:00
|
|
|
* ARAMFetch
|
|
|
|
*
|
|
|
|
* This function will move data from ARAM to MAIN memory
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-08-06 03:09:59 +02:00
|
|
|
void
|
|
|
|
ARAMFetch (char *dst, char *src, int len)
|
|
|
|
{
|
2008-12-30 01:08:17 +01:00
|
|
|
DCInvalidateRange (dst, len);
|
|
|
|
AR_StartDMA (ARAM_READ, (u32) dst, (u32) src, len);
|
|
|
|
while (AR_GetDMAStatus ());
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
|
|
|
|
2008-09-12 07:28:40 +02:00
|
|
|
/****************************************************************************
|
2008-08-06 03:09:59 +02:00
|
|
|
* ARAMFetchSlow
|
|
|
|
*
|
|
|
|
* Required as SNES memory may NOT be 32-byte aligned
|
2008-09-12 07:28:40 +02:00
|
|
|
***************************************************************************/
|
2008-12-30 01:08:17 +01:00
|
|
|
void ARAMFetchSlow(char *dst, char *src, int len)
|
2008-08-06 03:09:59 +02:00
|
|
|
{
|
2008-12-30 01:08:17 +01:00
|
|
|
int t;
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-12-30 01:08:17 +01:00
|
|
|
if (len > TEMPSIZE)
|
2008-08-06 03:09:59 +02:00
|
|
|
{
|
2008-12-30 01:08:17 +01:00
|
|
|
t = 0;
|
|
|
|
while (t < len)
|
|
|
|
{
|
|
|
|
ARAMFetch(tempbuffer, src + t, TEMPSIZE);
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-12-30 01:08:17 +01:00
|
|
|
if (t + TEMPSIZE > len)
|
|
|
|
{
|
|
|
|
memcpy(dst + t, tempbuffer, len - t);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
memcpy(dst + t, tempbuffer, TEMPSIZE);
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-12-30 01:08:17 +01:00
|
|
|
t += TEMPSIZE;
|
|
|
|
}
|
2008-08-06 03:09:59 +02:00
|
|
|
|
2008-12-30 01:08:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ARAMFetch(tempbuffer, src, len);
|
|
|
|
memcpy(dst, tempbuffer, len);
|
|
|
|
}
|
2008-08-06 03:09:59 +02:00
|
|
|
}
|
2008-12-30 01:08:17 +01:00
|
|
|
#endif
|