annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
540
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include "types.h"
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include "leadapi.h"
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include "dumpagent.h"
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 wait_for_dsp_ready()
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 {
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 unsigned cnt;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 for (cnt = 0; cnt < 10000; cnt++)
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 if (DOWNLOAD_STATUS == LEAD_READY)
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 return(0);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 return(-1);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 }
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 boot_dsp_dump_agent()
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 const u16 *src;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 volatile u16 *api;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 unsigned n;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 /* put it into reset first */
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 CLKM_CNTL_RST |= CLKM_LEAD_RST;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 /* generous 1 ms for the reset pulse */
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 wait_ARM_cycles(13000);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 /* lift it out of reset */
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 CLKM_CNTL_RST &= ~CLKM_LEAD_RST;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /* another generous 1 ms */
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 wait_ARM_cycles(13000);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 /* bootloader should be ready for us now */
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 if (wait_for_dsp_ready() < 0) {
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 printf("ERROR: DSP bootloader not ready out of reset\n");
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 return(-1);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 }
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /* upload the agent code */
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 src = dsp_agent_code;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 api = (volatile u16 *) APIF_ADDR;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 for (n = 0; n < DSP_DUMPCODE_LEN; n++)
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 *api++ = *src++;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 DOWNLOAD_EXT_PAGE = 0;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 DOWNLOAD_SIZE = DSP_DUMPCODE_LEN;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 DOWNLOAD_ADDR = DSP_DUMPCODE_START;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 DOWNLOAD_STATUS = BLOCK_READY;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 if (wait_for_dsp_ready() < 0) {
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 printf("ERROR: DSP bl not ready after block write\n");
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 return(-1);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 /* start it! */
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 DOWNLOAD_EXT_PAGE = 0;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 DOWNLOAD_SIZE = 0;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 DOWNLOAD_ADDR = DSP_DUMPCODE_START;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 DOWNLOAD_STATUS = BLOCK_READY;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 if (wait_for_dsp_ready() < 0) {
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 printf("ERROR: DSP not ready after commanded jump to agent\n");
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 return(-1);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 }
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 }
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 dsp_read_op(mode, addr, blklen)
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 u16 mode, blklen;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 u32 addr;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 {
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 int rc;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 APIRAM_FIRST_WORD = mode;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 DOWNLOAD_STATUS = PAGE_SELECTION;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 rc = wait_for_dsp_ready();
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 if (rc < 0)
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 return(rc);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 DOWNLOAD_EXT_PAGE = addr >> 16;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 DOWNLOAD_SIZE = blklen;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 DOWNLOAD_ADDR = addr;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 DOWNLOAD_STATUS = BLOCK_READY;
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 rc = wait_for_dsp_ready();
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 return(rc);
27b5526ba1a8 dspdump target program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 }