Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hthh
Last active July 4, 2020 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hthh/ad17a78d95abd5cdac21954b3b4486f4 to your computer and use it in GitHub Desktop.
Save hthh/ad17a78d95abd5cdac21954b3b4486f4 to your computer and use it in GitHub Desktop.
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <malloc.h>
#include <ogc/gx.h>
#include <ogc/audio.h>
#include <ogc/system.h>
#include <ogc/machine/processor.h>
#include <stdlib.h>
#include <string.h>
#include <wiiuse/wpad.h>
#include <math.h>
#include "common/hwtests.h"
char buffer[2*1024*1024];
char audio_buffer[1024*1024];
char * volatile bufp;
volatile int done = 0;
volatile int cycles = 0;
static void audio_dma_callback(void)
{
cycles = mfpmc3();
done = 1;
}
volatile int spin;
int main() {
SYS_StartPMC(0, (1 << 27));
network_init();
WPAD_Init();
bufp = buffer;
{
u32 i, level;
DSP_Init();
AUDIO_Init(NULL);
AUDIO_StopDMA();
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
done = 0;
AUDIO_RegisterDMACallback(audio_dma_callback);
}
bufp += sprintf(bufp, "start\n");
int dma_size = 12 * 0x20;
{
for (int j = 0; j < 30; j++)
{
u32 level = IRQ_Disable();
done = 0;
AUDIO_InitDMA((u32)audio_buffer,SND_BUFFERSIZE);
SYS_ResetPMC();
AUDIO_StartDMA();
IRQ_Restore(level);
int i = 0;
while (!done) {
i++;
}
bufp += sprintf(bufp, "size %x: cycles = %d, i = %d\n", dma_size, cycles, i);
AUDIO_StopDMA();
for (spin = 0; spin < 356258 * 2; spin++) {
}
}
}
bufp += sprintf(bufp, "end\n");
network_printf("%s\n", buffer);
network_printf("Shutting down...\n");
network_shutdown();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment