view target-utils/dspdump/dspops.c @ 1014:961efadd530a default tip

fc-shell TCH DL handler: add support for CSD modes TCH DL capture mechanism in FC Tourmaline firmware has been extended to support CSD modes in addition to speech - add the necessary support on the host tools side. It needs to be noted that this mechanism in its present state does NOT provide the debug utility value that was sought: as we learned only after the code was implemented, TI's DSP has a misfeature in that the buffer we are reading (a_dd_0[]) is zeroed out when the IDS block is enabled, i.e., we are reading all zeros and not the real DL bits we were after. But since the code has already been written, we are keeping it - perhaps we can do some tests with IDS disabled.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Nov 2024 06:27:43 +0000
parents 27b5526ba1a8
children
line wrap: on
line source

#include "types.h"
#include "leadapi.h"
#include "dumpagent.h"

wait_for_dsp_ready()
{
	unsigned cnt;

	for (cnt = 0; cnt < 10000; cnt++)
		if (DOWNLOAD_STATUS == LEAD_READY)
			return(0);
	return(-1);
}

boot_dsp_dump_agent()
{
	const u16 *src;
	volatile u16 *api;
	unsigned n;

	/* put it into reset first */
	CLKM_CNTL_RST |= CLKM_LEAD_RST;
	/* generous 1 ms for the reset pulse */
	wait_ARM_cycles(13000);
	/* lift it out of reset */
	CLKM_CNTL_RST &= ~CLKM_LEAD_RST;
	/* another generous 1 ms */
	wait_ARM_cycles(13000);
	/* bootloader should be ready for us now */
	if (wait_for_dsp_ready() < 0) {
		printf("ERROR: DSP bootloader not ready out of reset\n");
		return(-1);
	}
	/* upload the agent code */
	src = dsp_agent_code;
	api = (volatile u16 *) APIF_ADDR;
	for (n = 0; n < DSP_DUMPCODE_LEN; n++)
		*api++ = *src++;
	DOWNLOAD_EXT_PAGE = 0;
	DOWNLOAD_SIZE = DSP_DUMPCODE_LEN;
	DOWNLOAD_ADDR = DSP_DUMPCODE_START;
	DOWNLOAD_STATUS = BLOCK_READY;
	if (wait_for_dsp_ready() < 0) {
		printf("ERROR: DSP bl not ready after block write\n");
		return(-1);
	}
	/* start it! */
	DOWNLOAD_EXT_PAGE = 0;
	DOWNLOAD_SIZE = 0;
	DOWNLOAD_ADDR = DSP_DUMPCODE_START;
	DOWNLOAD_STATUS = BLOCK_READY;
	if (wait_for_dsp_ready() < 0) {
		printf("ERROR: DSP not ready after commanded jump to agent\n");
		return(-1);
	}
}

dsp_read_op(mode, addr, blklen)
	u16 mode, blklen;
	u32 addr;
{
	int rc;

	APIRAM_FIRST_WORD = mode;
	DOWNLOAD_STATUS = PAGE_SELECTION;
	rc = wait_for_dsp_ready();
	if (rc < 0)
		return(rc);
	DOWNLOAD_EXT_PAGE = addr >> 16;
	DOWNLOAD_SIZE = blklen;
	DOWNLOAD_ADDR = addr;
	DOWNLOAD_STATUS = BLOCK_READY;
	rc = wait_for_dsp_ready();
	return(rc);
}