summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/tms320dm320/dsp/arm.c3
-rw-r--r--firmware/target/arm/tms320dm320/dsp/dma.c26
-rw-r--r--firmware/target/arm/tms320dm320/dsp/dsp-image.h184
-rw-r--r--firmware/target/arm/tms320dm320/dsp/ipc.h10
-rw-r--r--firmware/target/arm/tms320dm320/dsp/linker.cmd12
-rw-r--r--firmware/target/arm/tms320dm320/dsp/vectors.asm3
-rw-r--r--firmware/target/arm/tms320dm320/dsp/xml2h.py28
7 files changed, 193 insertions, 73 deletions
diff --git a/firmware/target/arm/tms320dm320/dsp/arm.c b/firmware/target/arm/tms320dm320/dsp/arm.c
index 9d886ffede..08fbaa9c12 100644
--- a/firmware/target/arm/tms320dm320/dsp/arm.c
+++ b/firmware/target/arm/tms320dm320/dsp/arm.c
@@ -20,13 +20,13 @@
20 * 20 *
21 ****************************************************************************/ 21 ****************************************************************************/
22 22
23#include <stdio.h>
24#include "arm.h" 23#include "arm.h"
25#include "registers.h" 24#include "registers.h"
26#include "ipc.h" 25#include "ipc.h"
27#include "dma.h" 26#include "dma.h"
28 27
29volatile struct ipc_message status; 28volatile struct ipc_message status;
29volatile short int0_count;
30 30
31#if defined(HAVE_DEBUG) 31#if defined(HAVE_DEBUG)
32static int acked; 32static int acked;
@@ -34,6 +34,7 @@ static int acked;
34 34
35interrupt void handle_int0(void) { 35interrupt void handle_int0(void) {
36 IFR = 1; 36 IFR = 1;
37 int0_count++;
37 38
38#if defined(HAVE_DEBUG) 39#if defined(HAVE_DEBUG)
39 acked = 1; 40 acked = 1;
diff --git a/firmware/target/arm/tms320dm320/dsp/dma.c b/firmware/target/arm/tms320dm320/dsp/dma.c
index 6e5cb71c2b..9ca67df2a0 100644
--- a/firmware/target/arm/tms320dm320/dsp/dma.c
+++ b/firmware/target/arm/tms320dm320/dsp/dma.c
@@ -46,22 +46,21 @@ volatile unsigned short sdem_dsp_size;
46 * (SARAM to McBSP) and the level on the ARM buffer (sdem_level). 46 * (SARAM to McBSP) and the level on the ARM buffer (sdem_level).
47 * sdem_level is used in the main firmware to keep track of the current 47 * sdem_level is used in the main firmware to keep track of the current
48 * playback status. dsp_level is only used in this function. */ 48 * playback status. dsp_level is only used in this function. */
49static unsigned short dsp_level; 49volatile unsigned short dsp_level;
50volatile unsigned short sdem_level; 50volatile unsigned short sdem_level;
51 51
52/* This is used to keep track of the last SDRAM to SARAM transfer */ 52/* This is used to keep track of the last SDRAM to SARAM transfer */
53static unsigned short last_size; 53volatile unsigned short last_size;
54 54
55/* This tells us which half of the DSP buffer (data) is free */ 55/* This tells us which half of the DSP buffer (data) is free */
56static unsigned short dma0_unlocked; 56volatile unsigned short dma0_unlocked;
57 57
58/* This is used by the ARM to flag playback status and start/stop the DMA 58/* This is used by the ARM to flag playback status and start/stop the DMA
59 * transfers. */ 59 * transfers. */
60volatile unsigned short dma0_stopped; 60volatile unsigned short dma0_stopped;
61 61
62/* This is used to effectively flag whether the ARM has new data ready or not */ 62/* This is used to effectively flag whether the ARM has new data ready or not */
63short waiting; 63volatile short waiting;
64
65 64
66/* rebuffer sets up the next SDRAM to SARAM transfer and tells the ARM when DMA 65/* rebuffer sets up the next SDRAM to SARAM transfer and tells the ARM when DMA
67 * needs a new buffer. 66 * needs a new buffer.
@@ -196,16 +195,8 @@ interrupt void handle_dmac(void) {
196} 195}
197 196
198void dma_init(void) { 197void dma_init(void) {
199 /* Initialize some of the global variables to known values avoiding the 198 /* Make sure that DMPREC is clear */
200 * .cinit section. */ 199 DMPREC = 0;
201 dsp_level = 0;
202 sdem_level = 0;
203
204 last_size = 0;
205 dma0_unlocked = 0;
206 dma0_stopped = 1;
207
208 waiting = 0;
209 200
210 /* Configure SARAM to McBSP DMA */ 201 /* Configure SARAM to McBSP DMA */
211 202
@@ -216,8 +207,7 @@ void dma_init(void) {
216 * ABU mode, From data space with postincrement, to data space with no 207 * ABU mode, From data space with postincrement, to data space with no
217 * change 208 * change
218 */ 209 */
219 DMMCR0 = 1 << 14 | 1 << 13 | 210 DMMCR0 = 1 << 14 | 1 << 13 | 1 << 12 | 1 << 8 | 1 << 6 | 1;
220 1 << 12 | 1 << 8 | 1 << 6 | 1;
221 211
222 /* Set the source (incrementing) location */ 212 /* Set the source (incrementing) location */
223 DMSRC0 = (unsigned short)&data; 213 DMSRC0 = (unsigned short)&data;
@@ -228,6 +218,6 @@ void dma_init(void) {
228 /* Set the size of the buffer */ 218 /* Set the size of the buffer */
229 DMCTR0 = sizeof(data); 219 DMCTR0 = sizeof(data);
230 220
231 /* Setup DMA0 interrupts and start the transfer */ 221 /* Set the interrupt mux */
232 DMPREC = 2 << 6; 222 DMPREC = 2 << 6;
233} 223}
diff --git a/firmware/target/arm/tms320dm320/dsp/dsp-image.h b/firmware/target/arm/tms320dm320/dsp/dsp-image.h
index 9f7ff65828..3d72e73858 100644
--- a/firmware/target/arm/tms320dm320/dsp/dsp-image.h
+++ b/firmware/target/arm/tms320dm320/dsp/dsp-image.h
@@ -20,46 +20,178 @@
20 * 20 *
21 */ 21 */
22static const unsigned short _section_text[] = { 22static const unsigned short _section_text[] = {
23 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0001, 0x10f8, 0x031d, 0x76f8, 0x031e, 0x0000, 0xfa44, 0x00c2, 0xf495, 0xeeff, 0x7712, 0x0054, 0x960f, 0xf830, 0x00c2, 0xf074, 0x00fc, 0x7711, 0x0054, 0x6981, 0x0001, 0xf074, 0x02af, 0xf073, 0x00c4, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0x4a11, 0x7711, 0x0026, 0x7712, 0x0001, 0x7713, 0x0001, 0x7681, 0x0010, 0x7711, 0x0000, 0x7681, 0xffff, 0xe501, 0xf495, 0xf6bb, 0xf074, 0x0284, 0xf074, 0x0243, 0xf4e1, 0xf495, 0xf073, 0x00f3, 0xe808, 0x75f8, 0x0008, 0x0280, 0xfc00, 0x4a11, 0x60f8, 0x031d, 0x0001, 0xfa30, 0x0109, 0xf495, 0xeefe, 0x60f8, 0x031d, 0x0002, 0xf820, 0x011e, 0x7711, 0x0054, 0x6881, 0xfffe, 0xf074, 0x02ba, 0xe800, 0x75f8, 0x0008, 0x8006, 0x76f8, 0x031b, 0x0000, 0x76f8, 0x0319, 0x0000, 0x76f8, 0x031a, 0x0000, 0xf073, 0x018b, 0x10f8, 0x031a, 0x08f8, 0x0318, 0xf844, 0x012f, 0x76f8, 0x031a, 0x0000, 0x76f8, 0x031e, 0x0001, 0x76f8, 0x02c5, 0x0003, 0xf074, 0x00f7, 0x10f8, 0x031e, 0xf844, 0x018b, 0x10f8, 0x0318, 0x00f8, 0x0319, 0x08f8, 0x031a, 0x8811, 0xf495, 0x7710, 0x1000, 0xf6a9, 0xf820, 0x0146, 0xf020, 0x1000, 0xf273, 0x014a, 0x08f8, 0x0319, 0x10f8, 0x0318, 0x08f8, 0x031a, 0x80f8, 0x031b, 0x10f8, 0x031c, 0xf6b8, 0xf000, 0x8000, 0x6ff8, 0x0319, 0x0c1f, 0x75f8, 0x0008, 0x8002, 0xe800, 0x75f8, 0x0008, 0x8003, 0x10f8, 0x0316, 0xf1ef, 0xf3e1, 0x10f8, 0x0317, 0xf2a0, 0x00f8, 0x031a, 0x4e00, 0xf020, 0xffff, 0x5700, 0xf280, 0x75f8, 0x0008, 0x8000, 0x5600, 0xf0f0, 0x75f8, 0x0008, 0x8001, 0xe800, 0x75f8, 0x031b, 0x8004, 0x75f8, 0x0008, 0x8005, 0x74f8, 0x02c7, 0x8006, 0x74f8, 0x02c8, 0x8001, 0x74f8, 0x02c9, 0x8000, 0x74f8, 0x02ca, 0x8003, 0xe801, 0x74f8, 0x02cb, 0x8002, 0x75f8, 0x0008, 0x8006, 0xee02, 0x8a11, 0xfc00, 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0040, 0x7711, 0x0055, 0x7681, 0x0000, 0xf020, 0x0800, 0x7711, 0x0057, 0xeeff, 0x1881, 0x8000, 0xf020, 0x0800, 0x1c00, 0x76f8, 0x0319, 0x0000, 0x80f8, 0x031c, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0800, 0x10f8, 0x031b, 0x00f8, 0x0319, 0x80f8, 0x0319, 0x7710, 0x1000, 0x7211, 0x0319, 0x10f8, 0x031b, 0xf5a9, 0xeeff, 0x00f8, 0x031a, 0xfa20, 0x0228, 0x80f8, 0x031a, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0x4a11, 0x7711, 0x0055, 0x76f8, 0x031a, 0x0000, 0x76f8, 0x0319, 0x0000, 0x76f8, 0x031b, 0x0000, 0x76f8, 0x031c, 0x0000, 0x76f8, 0x031e, 0x0000, 0x76f8, 0x031d, 0x0001, 0x7681, 0x0003, 0x7711, 0x0057, 0x7681, 0x2800, 0x7711, 0x0055, 0x7681, 0x0004, 0x7711, 0x0057, 0x7681, 0x7141, 0x7711, 0x0055, 0x7681, 0x0000, 0x7711, 0x0057, 0x7681, 0x8000, 0x7711, 0x0055, 0x7681, 0x0001, 0x7711, 0x0057, 0x7681, 0x0022, 0x7711, 0x0055, 0x7681, 0x0002, 0x7711, 0x0057, 0x7681, 0x1000, 0x7711, 0x0054, 0x7681, 0x0080, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0000, 0x7711, 0x0039, 0x7681, 0x0000, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x7681, 0x0030, 0x7711, 0x0038, 0x7681, 0x000e, 0x7711, 0x0039, 0x7681, 0x0002, 0x7711, 0x0038, 0x7681, 0x0004, 0x7711, 0x0039, 0x7681, 0x00a0, 0x7711, 0x0038, 0x7681, 0x0005, 0x7711, 0x0039, 0x7681, 0x0000, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x6981, 0x0001, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x6881, 0xfffe, 0x8a11, 0xfc00, 23 0xe808, 0x75f8, 0x0008, 0x0280, 0xfc00, 0x4a11, 0x60f8, 0x05a4,
24 0x0001, 0xfa30, 0x0092, 0xf495, 0xeefe, 0x60f8, 0x05a4, 0x0002,
25 0xf820, 0x00a7, 0x7711, 0x0054, 0x6881, 0xfffe, 0xf074, 0x02e2,
26 0xe800, 0x75f8, 0x0008, 0x8006, 0x76f8, 0x05a1, 0x0000, 0x76f8,
27 0x05a0, 0x0000, 0x76f8, 0x05a2, 0x0000, 0xf073, 0x0114, 0x10f8,
28 0x05a1, 0x08f8, 0x059f, 0xf844, 0x00b8, 0x76f8, 0x05a1, 0x0000,
29 0x76f8, 0x054b, 0x0002, 0x76f8, 0x05a5, 0x0001, 0xf074, 0x0080,
30 0x10f8, 0x05a5, 0xf844, 0x0114, 0x10f8, 0x059f, 0x00f8, 0x05a0,
31 0x08f8, 0x05a1, 0x8811, 0xf495, 0x7710, 0x1000, 0xf6a9, 0xf820,
32 0x00cf, 0xf020, 0x1000, 0xf273, 0x00d3, 0x08f8, 0x05a0, 0x10f8,
33 0x059f, 0x08f8, 0x05a1, 0x80f8, 0x05a2, 0xf6b8, 0x10f8, 0x05a3,
34 0xf000, 0x8000, 0x6ff8, 0x05a0, 0x0c1f, 0x75f8, 0x0008, 0x8002,
35 0xe800, 0x75f8, 0x0008, 0x8003, 0x10f8, 0x059d, 0xf1ef, 0xf3e1,
36 0x10f8, 0x059e, 0xf2a0, 0x00f8, 0x05a1, 0x4e00, 0xf020, 0xffff,
37 0x5700, 0xf280, 0x75f8, 0x0008, 0x8000, 0x5600, 0xf0f0, 0x75f8,
38 0x0008, 0x8001, 0xe800, 0x75f8, 0x05a2, 0x8004, 0x75f8, 0x0008,
39 0x8005, 0xe801, 0x74f8, 0x054d, 0x8006, 0x74f8, 0x054e, 0x8001,
40 0x74f8, 0x054f, 0x8000, 0x74f8, 0x0550, 0x8003, 0x74f8, 0x0551,
41 0x8002, 0x75f8, 0x0008, 0x8006, 0xee02, 0x8a11, 0xfc00, 0xf495,
42 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11,
43 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19,
44 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8,
45 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc,
46 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0xeeff,
47 0xf020, 0x0800, 0x7681, 0x0040, 0x7711, 0x0055, 0x7681, 0x0000,
48 0x7711, 0x0057, 0x1881, 0x8000, 0xf020, 0x0800, 0x1c00, 0x80f8,
49 0x05a3, 0x76f8, 0x05a0, 0x0000, 0xf074, 0x0085, 0xee01, 0x8a18,
50 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e,
51 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12,
52 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08,
53 0xf4eb, 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d,
54 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17,
55 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b,
56 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8,
57 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001,
58 0x4a08, 0x7681, 0x0800, 0x10f8, 0x05a2, 0x00f8, 0x05a0, 0x80f8,
59 0x05a0, 0x10f8, 0x05a2, 0x00f8, 0x05a1, 0x80f8, 0x05a1, 0x7211,
60 0x05a0, 0x7710, 0x1000, 0xf5a9, 0xfa20, 0x01b2, 0xf495, 0xeeff,
61 0xf074, 0x0085, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d,
62 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16,
63 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c,
64 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0x4a11, 0x7711, 0x0054,
65 0x7681, 0x0000, 0x7711, 0x0055, 0x7681, 0x0003, 0x7711, 0x0057,
66 0x7681, 0x2800, 0x7711, 0x0055, 0x7681, 0x0004, 0x7711, 0x0057,
67 0x7681, 0x7141, 0x7711, 0x0055, 0x7681, 0x0000, 0x7711, 0x0057,
68 0x7681, 0x8000, 0x7711, 0x0055, 0x7681, 0x0001, 0x7711, 0x0057,
69 0x7681, 0x0022, 0x7711, 0x0055, 0x7681, 0x0002, 0x7711, 0x0057,
70 0x7681, 0x1000, 0x7711, 0x0054, 0x7681, 0x0080, 0x8a11, 0xfc00,
71 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10,
72 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17,
73 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c,
74 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d,
75 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08,
76 0x7681, 0x0001, 0x6bf8, 0x059c, 0x0001, 0x76f8, 0x05a5, 0x0000,
77 0x10f8, 0x05a4, 0xfa44, 0x0245, 0xf495, 0xeeff, 0x7712, 0x0054,
78 0x960f, 0xf830, 0x0245, 0xf074, 0x0085, 0x7711, 0x0054, 0x6981,
79 0x0001, 0xf074, 0x02d7, 0xf073, 0x0247, 0xf074, 0x0085, 0xee01,
80 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06,
81 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13,
82 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09,
83 0x8a08, 0xf4eb, 0xf7be, 0xf6b9, 0xf4a0, 0xf6b7, 0xf6b5, 0xf6b6,
84 0xf7b8, 0x7718, 0x034b, 0x6bf8, 0x0018, 0x01ff, 0x68f8, 0x0018,
85 0xfffe, 0xf020, 0x05aa, 0xf100, 0x0001, 0xf84d, 0x028e, 0xf6b8,
86 0xf495, 0xf020, 0x05aa, 0xf073, 0x0288, 0x7ef8, 0x0012, 0xf000,
87 0x0001, 0x47f8, 0x0011, 0x7e92, 0x00f8, 0x0011, 0xf000, 0x0001,
88 0x7ef8, 0x0011, 0xf000, 0x0001, 0x6c89, 0x027d, 0xf7b8, 0xeefc,
89 0xf020, 0xffff, 0xf100, 0x0001, 0xf84d, 0x02a6, 0xf6b8, 0xf495,
90 0xf020, 0xffff, 0xf273, 0x02a0, 0x4e02, 0xf495, 0xf5e3, 0x5602,
91 0x7e00, 0x1100, 0xfa4c, 0x029e, 0x6b03, 0x0001, 0xf6b8, 0xee04,
92 0xf074, 0x02ed, 0xf074, 0x0310, 0x4a11, 0x7711, 0x0038, 0x7681,
93 0x0000, 0x7711, 0x0039, 0x7681, 0x0000, 0x7711, 0x0038, 0x7681,
94 0x0001, 0x7711, 0x0039, 0x7681, 0x0030, 0x7711, 0x0038, 0x7681,
95 0x000e, 0x7711, 0x0039, 0x7681, 0x0002, 0x7711, 0x0038, 0x7681,
96 0x0004, 0x7711, 0x0039, 0x7681, 0x00a0, 0x7711, 0x0038, 0x7681,
97 0x0005, 0x7711, 0x0039, 0x7681, 0x0000, 0x8a11, 0xfc00, 0x4a11,
98 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x6981, 0x0001,
99 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711,
100 0x0039, 0x6881, 0xfffe, 0x8a11, 0xfc00, 0xf6b8, 0xf495, 0xf162,
101 0xffff, 0xf340, 0xffff, 0xf640, 0xf0e0, 0xf010, 0xffff, 0xf061,
102 0xffff, 0xfa44, 0x0301, 0x4a11, 0xeefe, 0xf273, 0x0307, 0xe800,
103 0xe900, 0x8911, 0xf495, 0x4911, 0x1081, 0xf300, 0x0001, 0x8100,
104 0xf074, 0x032c, 0xee02, 0x8a11, 0xfc00, 0xf495, 0xf073, 0x030e,
105 0x4a11, 0x8811, 0x10f8, 0x05a6, 0xf4e3, 0x10f8, 0x05a9, 0xf845,
106 0x031e, 0x11f8, 0x05a9, 0xf7e3, 0xf495, 0x4811, 0x10f8, 0x05a8,
107 0xf845, 0x0325, 0x10f8, 0x05a8, 0xf4e3, 0x10f8, 0x05a7, 0xf4e3,
108 0xf074, 0x030d, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0026, 0x7712,
109 0x0001, 0x7713, 0x0001, 0x7681, 0x0010, 0x7711, 0x0000, 0x7681,
110 0xffff, 0xe501, 0xf495, 0xf6bb, 0xf074, 0x02ac, 0xf074, 0x01cd,
111 0xf4e1, 0xf495, 0xf073, 0x0340, 0x80f8, 0x05a7, 0xfc00, 0x80f8,
112 0x05a6, 0xfc00, 0xfc00,
24}; 113};
25static const unsigned short _section_vectors[] = { 114
26 0xf273, 0x00df, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xf273, 0x0080, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf273, 0x018e, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf273, 0x01e8, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 115static const unsigned short _section_cinit[] = {
116 0x0001, 0x05a6, 0x034a, 0x0001, 0x05a7, 0x034a, 0x0001, 0x05a8,
117 0x0000, 0x0001, 0x05a9, 0x0000, 0x0000,
27}; 118};
28 119
120static const unsigned short _section_vectors[] = {
121 0xf273, 0x0262, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
122 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
123 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
124 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
125 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
126 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
127 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
128 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
129 0xf273, 0x0200, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
130 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
131 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
132 0xf273, 0x0117, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
133 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
134 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
135 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
136 0xf273, 0x0171, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
137
138};
29 139
140/* Program Mapping */
30static const struct dsp_section dsp_image[] = { 141static const struct dsp_section dsp_image[] = {
31 {_section_text, 0x0080, 0x0245}, 142
32 {NULL /* .bss */, 0x02c5, 0x005a}, 143 {_section_text, 0x0080, 0x02cb},
144 {_section_cinit, 0x05aa, 0x000d},
145 {NULL /* .bss */, 0x054b, 0x005f},
146 {NULL /* .stack */, 0x034b, 0x0200},
33 {_section_vectors, 0x7f80, 0x0080}, 147 {_section_vectors, 0x7f80, 0x0080},
34 {NULL /* .dma */, 0x8000, 0x1000}, 148 {NULL /* .dma */, 0x8000, 0x1000},
35 {NULL, 0, 0} 149 {NULL, 0, 0}
36}; 150};
37 151
38/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */ 152/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */
39#define _handle_int0 0x0080 153#define cinit 0x05aa
40#define _status 0x02c5 154#define ___cinit__ 0x05aa
41#define _audiohw_start 0x02af
42#define _dma0_stopped 0x031d
43#define _waiting 0x031e
44#define _rebuffer 0x00fc
45#define _main 0x00df
46#define _dma_init 0x0243
47#define _audiohw_init 0x0284
48#define _handle_dma0 0x018e
49#define _handle_dmac 0x01e8
50#define _sdem_addrh 0x0316
51#define _sdem_addrl 0x0317
52#define _sdem_level 0x031a
53#define _sdem_dsp_size 0x0318
54#define _audiohw_stop 0x02ba
55#define ___text__ 0x0080 155#define ___text__ 0x0080
56#define etext 0x02c5 156#define etext 0x034b
57#define ___etext__ 0x02c5 157#define ___etext__ 0x034b
58#define ___data__ 0x0080 158#define ___data__ 0x0080
59#define edata 0x0080 159#define edata 0x0080
60#define ___edata__ 0x0080 160#define ___edata__ 0x0080
61#define ___bss__ 0x02c5 161#define ___bss__ 0x054b
62#define end 0x031f 162#define end 0x05aa
63#define ___end__ 0x031f 163#define ___end__ 0x05aa
164#define _int0_count 0x059c
165#define _status 0x054b
166#define _handle_int0 0x0200
167#define _main 0x032c
168#define _handle_dmac 0x0171
169#define _waiting 0x05a5
170#define _sdem_addrh 0x059d
171#define _sdem_addrl 0x059e
172#define _dma0_stopped 0x05a4
173#define _dma0_unlocked 0x05a3
174#define _sdem_dsp_size 0x059f
175#define _handle_dma0 0x0117
176#define _dsp_level 0x05a0
177#define _dma_init 0x01cd
178#define _sdem_level 0x05a1
179#define _rebuffer 0x0085
180#define _last_size 0x05a2
181#define _audiohw_start 0x02d7
182#define _audiohw_init 0x02ac
183#define _audiohw_stop 0x02e2
184#define _c_int00 0x0262
185#define __dtors_ptr 0x05a9
186#define _abort 0x030d
187#define _exit 0x0310
188#define __cleanup_ptr 0x05a8
189#define __lock 0x05a6
190#define __register_unlock 0x0344
191#define __nop 0x034a
192#define __register_lock 0x0347
193#define __unlock 0x05a7
194#define __args_main 0x02ed
64 195
65#endif 196#endif
197
diff --git a/firmware/target/arm/tms320dm320/dsp/ipc.h b/firmware/target/arm/tms320dm320/dsp/ipc.h
index 030febd021..eb886d8638 100644
--- a/firmware/target/arm/tms320dm320/dsp/ipc.h
+++ b/firmware/target/arm/tms320dm320/dsp/ipc.h
@@ -51,11 +51,7 @@ struct ipc_message {
51 unsigned short sdem_addrl; 51 unsigned short sdem_addrl;
52 unsigned short sdem_addrh; 52 unsigned short sdem_addrh;
53 } init PACKED; 53 } init PACKED;
54#define MSG_DEBUGF 2 54#define MSG_REFILL 2
55 struct {
56 short buffer[80];
57 } debugf PACKED;
58#define MSG_REFILL 3
59 struct { 55 struct {
60 unsigned short topbottom; /* byte offset to unlocked half-buffer */ 56 unsigned short topbottom; /* byte offset to unlocked half-buffer */
61 57
@@ -66,6 +62,10 @@ struct ipc_message {
66 unsigned short _DSP_ADDRL; 62 unsigned short _DSP_ADDRL;
67 unsigned short _DMA_SIZE; 63 unsigned short _DMA_SIZE;
68 } refill PACKED; 64 } refill PACKED;
65#define MSG_DEBUGF 3
66 struct {
67 short buffer[80];
68 } debugf PACKED;
69 } payload PACKED; 69 } payload PACKED;
70} PACKED; 70} PACKED;
71#endif 71#endif
diff --git a/firmware/target/arm/tms320dm320/dsp/linker.cmd b/firmware/target/arm/tms320dm320/dsp/linker.cmd
index c2ae5f0c6b..1b53010d41 100644
--- a/firmware/target/arm/tms320dm320/dsp/linker.cmd
+++ b/firmware/target/arm/tms320dm320/dsp/linker.cmd
@@ -1,13 +1,8 @@
1-c 1-c
2-x 2-x
3-stack 0x1000 3-stack 0x200
4-heap 0x100 4-heap 0x200
5 5-l rts500.lib
6/* The rtx500.lib should be included if you want proper initialization,
7 * currently the program is setup so that it is not necessary to save space.
8 * reset vector should jump to _c_int00 if initialization is needed.
9 *
10 * -l rts500.lib*/
11 6
12MEMORY 7MEMORY
13{ 8{
@@ -37,3 +32,4 @@ SECTIONS
37 /* DMA buffers for ABU mode must start on a 2*size boundary. */ 32 /* DMA buffers for ABU mode must start on a 2*size boundary. */
38 .dma > SARAM PAGE 0 33 .dma > SARAM PAGE 0
39} 34}
35
diff --git a/firmware/target/arm/tms320dm320/dsp/vectors.asm b/firmware/target/arm/tms320dm320/dsp/vectors.asm
index 98d1409cb3..adba477d3f 100644
--- a/firmware/target/arm/tms320dm320/dsp/vectors.asm
+++ b/firmware/target/arm/tms320dm320/dsp/vectors.asm
@@ -30,6 +30,7 @@
30 .global _main 30 .global _main
31 .global _handle_dma0 31 .global _handle_dma0
32 .global _handle_dmac 32 .global _handle_dmac
33 .global _c_int00
33 34
34 .sect ".vectors" 35 .sect ".vectors"
35; Reset Interrupt 36; Reset Interrupt
@@ -37,7 +38,7 @@
37; currently the program is setup so that it is not necessary to save space. 38; currently the program is setup so that it is not necessary to save space.
38; reset vector should jump to _c_int00 instead of main if initialization is 39; reset vector should jump to _c_int00 instead of main if initialization is
39; needed. 40; needed.
40RS_V: BD _main 41RS_V: BD _c_int00
41 NOP 42 NOP
42 NOP 43 NOP
43 44
diff --git a/firmware/target/arm/tms320dm320/dsp/xml2h.py b/firmware/target/arm/tms320dm320/dsp/xml2h.py
index 2d25c9028e..166048be26 100644
--- a/firmware/target/arm/tms320dm320/dsp/xml2h.py
+++ b/firmware/target/arm/tms320dm320/dsp/xml2h.py
@@ -87,8 +87,7 @@ def main():
87""" % out_filepath) 87""" % out_filepath)
88 88
89 # Section data and directory. 89 # Section data and directory.
90 h_directory = [""" 90 h_directory = ["static const struct dsp_section dsp_image[] = {\n"]
91static const struct dsp_section dsp_image[] = {"""]
92 91
93 ti_coff = descend(object_file, "ti_coff") 92 ti_coff = descend(object_file, "ti_coff")
94 for section in descendAll(ti_coff, "section"): 93 for section in descendAll(ti_coff, "section"):
@@ -122,6 +121,7 @@ static const struct dsp_section dsp_image[] = {"""]
122 break 121 break
123 122
124 if data or regular or text: 123 if data or regular or text:
124 out_count = 0
125 sys.stderr.write("%s: placing 0x%04x words at 0x%04x from offset " 125 sys.stderr.write("%s: placing 0x%04x words at 0x%04x from offset "
126 "0x%08x\n" % ( 126 "0x%08x\n" % (
127 name, raw_data_size >> 1, physical_addr, raw_data_ptr)) 127 name, raw_data_size >> 1, physical_addr, raw_data_ptr))
@@ -133,14 +133,16 @@ static const struct dsp_section dsp_image[] = {"""]
133 out_file.seek(raw_data_ptr) 133 out_file.seek(raw_data_ptr)
134 data = array.array('H') 134 data = array.array('H')
135 data.fromfile(out_file, raw_data_size >> 1) 135 data.fromfile(out_file, raw_data_size >> 1)
136 h_file.write("\t") 136 h_file.write(" ")
137 for word in data: 137 for word in data:
138 out_count = out_count+1
138 h_file.write("0x%04x, " % word) 139 h_file.write("0x%04x, " % word)
139 h_file.write(""" 140 if out_count % 8 == 0:
140}; 141 h_file.write("\n ")
141""") 142 out_count=0
143 h_file.write("\n};\n\n")
142 144
143 h_directory.append("\t{_section%s, 0x%04x, 0x%04x}," % ( 145 h_directory.append(" {_section%s, 0x%04x, 0x%04x}," % (
144 sanitized_name, physical_addr, raw_data_size >> 1)) 146 sanitized_name, physical_addr, raw_data_size >> 1))
145 147
146 continue 148 continue
@@ -149,15 +151,15 @@ static const struct dsp_section dsp_image[] = {"""]
149 sys.stderr.write("%s: bss section, 0x%04x words at 0x%04x\n" % ( 151 sys.stderr.write("%s: bss section, 0x%04x words at 0x%04x\n" % (
150 name, raw_data_size >> 1, physical_addr)) 152 name, raw_data_size >> 1, physical_addr))
151 153
152 h_directory.append("\t{NULL /* %s */, 0x%04x, 0x%04x}," % ( 154 h_directory.append(" {NULL /* %s */, 0x%04x, 0x%04x}," % (
153 name, physical_addr, raw_data_size >> 1)) 155 name, physical_addr, raw_data_size >> 1))
154 continue 156 continue
155 157
156 sys.stderr.write("%s: error, unprocessed section\n" % name) 158 sys.stderr.write("%s: error, unprocessed section\n" % name)
157 159
158 h_file.write("\n") 160 h_file.write("/* Program Mapping */\n")
159 161
160 h_directory.append("\t{NULL, 0, 0}") 162 h_directory.append(" {NULL, 0, 0}")
161 h_directory.append("};") 163 h_directory.append("};")
162 164
163 h_file.write("\n".join(h_directory)) 165 h_file.write("\n".join(h_directory))
@@ -165,9 +167,7 @@ static const struct dsp_section dsp_image[] = {"""]
165 167
166 # Symbols. 168 # Symbols.
167 symbol_table = descend(ti_coff, "symbol_table") 169 symbol_table = descend(ti_coff, "symbol_table")
168 h_file.write(""" 170 h_file.write("\n/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */\n")
169/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */
170""")
171 for symbol in descendAll(symbol_table, "symbol"): 171 for symbol in descendAll(symbol_table, "symbol"):
172 name = getTagText(symbol, "name") 172 name = getTagText(symbol, "name")
173 kind = getTagText(symbol, "kind") 173 kind = getTagText(symbol, "kind")
@@ -181,7 +181,7 @@ static const struct dsp_section dsp_image[] = {"""]
181 181
182 h_file.write("#define %s 0x%04x\n" % (name, value)) 182 h_file.write("#define %s 0x%04x\n" % (name, value))
183 183
184 h_file.write("\n#endif\n") 184 h_file.write("\n#endif\n\n")
185 h_file.close() 185 h_file.close()
186 out_file.close() 186 out_file.close()
187 187