dsp: Improve DMA debug message

This commit is contained in:
Jannik Vogel 2018-12-28 23:50:59 +01:00 committed by espes
parent 4513ab50da
commit 01be8ef6b8
1 changed files with 77 additions and 4 deletions

View File

@ -54,6 +54,38 @@
# define DPRINTF(s, ...) do { } while (0)
#endif
#ifdef DEBUG
const char *buffer_names[] = {
"fifo0", /* 0x0 */
"fifo1", /* 0x1 */
"fifo2", /* 0x2 */
"fifo3", /* 0x3 */
"<unknown-0x4>", /* 0x4 */
"<unknown-0x5>", /* 0x5 */
"<unknown-0x6>", /* 0x6 */
"<unknown-0x7>", /* 0x7 */
"<unknown-0x8>", /* 0x8 */
"<unknown-0x9>", /* 0x9 */
"<unknown-0xa>", /* 0xA */
"<unknown-0xb>", /* 0xB */
"<unknown-0xc>", /* 0xC */
"<unknown-0xd>", /* 0xD */
"scratch-circular", /* 0xE */
"scratch" /* 0xF */
};
const char *format_names[] = {
"8 bit", /* 0x0 */
"16 bit", /* 0x1 */
"24 bit msb", /* 0x2 */
"32 bit", /* 0x3 */
"<invalid-0x4>", /* 0x4 */
"<invalid-0x5>", /* 0x5 */
"24 bit lsb", /* 0x6 */
"<invalid-0x7>" /* 0x7 */
};
#endif
static void dsp_dma_run(DSPDMAState *s)
{
if (!(s->control & DMA_CONTROL_RUNNING)
@ -92,10 +124,9 @@ static void dsp_dma_run(DSPDMAState *s)
assert(unk2 == 0x0);
assert(unk13 == false);
DPRINTF("\n\n\nDMA addr %x, control %x, count %x, "
"dsp_offset %x, scratch_offset %x, base %x, size %x\n\n\n",
addr, control, count, dsp_offset,
scratch_offset, scratch_base, scratch_size);
/* Decode count for interleaved mode */
uint32_t channel_count = (count & 0xF) + 1;
uint32_t block_count = count >> 4;
unsigned int item_size;
uint32_t item_mask = 0xffffffff;
@ -148,6 +179,48 @@ static void dsp_dma_run(DSPDMAState *s)
assert(false);
}
#ifdef DEBUG
char dsp_space_name = '?';
if (mem_space == DSP_SPACE_X) {
dsp_space_name = 'x';
} else if (mem_space == DSP_SPACE_Y) {
dsp_space_name = 'y';
} else if (mem_space == DSP_SPACE_P) {
dsp_space_name = 'p';
}
#endif
DPRINTF("dsp dma block x:$%x (%s)\n"
" next-block x:$%x%s\n"
" control 0x%06x:\n"
" dsp-interleave %d\n"
" buffer-offset-writeback %d\n"
" buffer 0x%x (%s)\n"
" unk9 %d\n"
" sample-format 0x%x (%s)\n"
" dsp-step 0x%x\n"
" sample-count 0x%x\n"
" block-count 0x%x channel-count %d\n"
" dsp-address 0x%x (%c:$%x)\n"
" buffer-offset 0x%x (+ buffer-base 0x%x = 0x%zx)\n"
" buffer-size 0x%x\n",
addr, direction ? "dsp -> buffer" : "buffer -> dsp",
next_block & NODE_POINTER_VAL, s->eol ? " (eol)" : "",
control,
dsp_interleave,
buffer_offset_writeback,
buf_id, buffer_names[buf_id],
unk9,
format, format_names[format],
dsp_step,
count,
block_count,
channel_count,
dsp_offset, dsp_space_name, mem_address,
scratch_offset, scratch_base, scratch_addr,
scratch_size);
uint8_t* scratch_buf = calloc(count, item_size);
if (direction) {