summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2011-02-06 19:28:46 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2011-02-06 19:28:46 +0000
commitfafd50938c94a317fe85138e7173a68e8cd4bac7 (patch)
tree4167226eb7972902d37a29cf9de054b1f4a2dd98 /firmware/target
parent52b0605fb41ae72b95246a92431221637e1e377a (diff)
DM320 DSP PCM handler: Use initialization library to make sure that code starts up reliably. Also make some variables volatile so code can be easier debugged.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29219 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-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 @@
*
****************************************************************************/
-#include <stdio.h>
#include "arm.h"
#include "registers.h"
#include "ipc.h"
#include "dma.h"
volatile struct ipc_message status;
+volatile short int0_count;
#if defined(HAVE_DEBUG)
static int acked;
@@ -34,6 +34,7 @@ static int acked;
interrupt void handle_int0(void) {
IFR = 1;
+ int0_count++;
#if defined(HAVE_DEBUG)
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;
* (SARAM to McBSP) and the level on the ARM buffer (sdem_level).
* sdem_level is used in the main firmware to keep track of the current
* playback status. dsp_level is only used in this function. */
-static unsigned short dsp_level;
+volatile unsigned short dsp_level;
volatile unsigned short sdem_level;
/* This is used to keep track of the last SDRAM to SARAM transfer */
-static unsigned short last_size;
+volatile unsigned short last_size;
/* This tells us which half of the DSP buffer (data) is free */
-static unsigned short dma0_unlocked;
+volatile unsigned short dma0_unlocked;
/* This is used by the ARM to flag playback status and start/stop the DMA
* transfers. */
volatile unsigned short dma0_stopped;
/* This is used to effectively flag whether the ARM has new data ready or not */
-short waiting;
-
+volatile short waiting;
/* rebuffer sets up the next SDRAM to SARAM transfer and tells the ARM when DMA
* needs a new buffer.
@@ -196,16 +195,8 @@ interrupt void handle_dmac(void) {
}
void dma_init(void) {
- /* Initialize some of the global variables to known values avoiding the
- * .cinit section. */
- dsp_level = 0;
- sdem_level = 0;
-
- last_size = 0;
- dma0_unlocked = 0;
- dma0_stopped = 1;
-
- waiting = 0;
+ /* Make sure that DMPREC is clear */
+ DMPREC = 0;
/* Configure SARAM to McBSP DMA */
@@ -216,8 +207,7 @@ void dma_init(void) {
* ABU mode, From data space with postincrement, to data space with no
* change
*/
- DMMCR0 = 1 << 14 | 1 << 13 |
- 1 << 12 | 1 << 8 | 1 << 6 | 1;
+ DMMCR0 = 1 << 14 | 1 << 13 | 1 << 12 | 1 << 8 | 1 << 6 | 1;
/* Set the source (incrementing) location */
DMSRC0 = (unsigned short)&data;
@@ -228,6 +218,6 @@ void dma_init(void) {
/* Set the size of the buffer */
DMCTR0 = sizeof(data);
- /* Setup DMA0 interrupts and start the transfer */
+ /* Set the interrupt mux */
DMPREC = 2 << 6;
}
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 @@
*
*/
static const unsigned short _section_text[] = {
- 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,
+ 0xe808, 0x75f8, 0x0008, 0x0280, 0xfc00, 0x4a11, 0x60f8, 0x05a4,
+ 0x0001, 0xfa30, 0x0092, 0xf495, 0xeefe, 0x60f8, 0x05a4, 0x0002,
+ 0xf820, 0x00a7, 0x7711, 0x0054, 0x6881, 0xfffe, 0xf074, 0x02e2,
+ 0xe800, 0x75f8, 0x0008, 0x8006, 0x76f8, 0x05a1, 0x0000, 0x76f8,
+ 0x05a0, 0x0000, 0x76f8, 0x05a2, 0x0000, 0xf073, 0x0114, 0x10f8,
+ 0x05a1, 0x08f8, 0x059f, 0xf844, 0x00b8, 0x76f8, 0x05a1, 0x0000,
+ 0x76f8, 0x054b, 0x0002, 0x76f8, 0x05a5, 0x0001, 0xf074, 0x0080,
+ 0x10f8, 0x05a5, 0xf844, 0x0114, 0x10f8, 0x059f, 0x00f8, 0x05a0,
+ 0x08f8, 0x05a1, 0x8811, 0xf495, 0x7710, 0x1000, 0xf6a9, 0xf820,
+ 0x00cf, 0xf020, 0x1000, 0xf273, 0x00d3, 0x08f8, 0x05a0, 0x10f8,
+ 0x059f, 0x08f8, 0x05a1, 0x80f8, 0x05a2, 0xf6b8, 0x10f8, 0x05a3,
+ 0xf000, 0x8000, 0x6ff8, 0x05a0, 0x0c1f, 0x75f8, 0x0008, 0x8002,
+ 0xe800, 0x75f8, 0x0008, 0x8003, 0x10f8, 0x059d, 0xf1ef, 0xf3e1,
+ 0x10f8, 0x059e, 0xf2a0, 0x00f8, 0x05a1, 0x4e00, 0xf020, 0xffff,
+ 0x5700, 0xf280, 0x75f8, 0x0008, 0x8000, 0x5600, 0xf0f0, 0x75f8,
+ 0x0008, 0x8001, 0xe800, 0x75f8, 0x05a2, 0x8004, 0x75f8, 0x0008,
+ 0x8005, 0xe801, 0x74f8, 0x054d, 0x8006, 0x74f8, 0x054e, 0x8001,
+ 0x74f8, 0x054f, 0x8000, 0x74f8, 0x0550, 0x8003, 0x74f8, 0x0551,
+ 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, 0xeeff,
+ 0xf020, 0x0800, 0x7681, 0x0040, 0x7711, 0x0055, 0x7681, 0x0000,
+ 0x7711, 0x0057, 0x1881, 0x8000, 0xf020, 0x0800, 0x1c00, 0x80f8,
+ 0x05a3, 0x76f8, 0x05a0, 0x0000, 0xf074, 0x0085, 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, 0x05a2, 0x00f8, 0x05a0, 0x80f8,
+ 0x05a0, 0x10f8, 0x05a2, 0x00f8, 0x05a1, 0x80f8, 0x05a1, 0x7211,
+ 0x05a0, 0x7710, 0x1000, 0xf5a9, 0xfa20, 0x01b2, 0xf495, 0xeeff,
+ 0xf074, 0x0085, 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, 0x0054,
+ 0x7681, 0x0000, 0x7711, 0x0055, 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,
+ 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, 0x6bf8, 0x059c, 0x0001, 0x76f8, 0x05a5, 0x0000,
+ 0x10f8, 0x05a4, 0xfa44, 0x0245, 0xf495, 0xeeff, 0x7712, 0x0054,
+ 0x960f, 0xf830, 0x0245, 0xf074, 0x0085, 0x7711, 0x0054, 0x6981,
+ 0x0001, 0xf074, 0x02d7, 0xf073, 0x0247, 0xf074, 0x0085, 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, 0xf7be, 0xf6b9, 0xf4a0, 0xf6b7, 0xf6b5, 0xf6b6,
+ 0xf7b8, 0x7718, 0x034b, 0x6bf8, 0x0018, 0x01ff, 0x68f8, 0x0018,
+ 0xfffe, 0xf020, 0x05aa, 0xf100, 0x0001, 0xf84d, 0x028e, 0xf6b8,
+ 0xf495, 0xf020, 0x05aa, 0xf073, 0x0288, 0x7ef8, 0x0012, 0xf000,
+ 0x0001, 0x47f8, 0x0011, 0x7e92, 0x00f8, 0x0011, 0xf000, 0x0001,
+ 0x7ef8, 0x0011, 0xf000, 0x0001, 0x6c89, 0x027d, 0xf7b8, 0xeefc,
+ 0xf020, 0xffff, 0xf100, 0x0001, 0xf84d, 0x02a6, 0xf6b8, 0xf495,
+ 0xf020, 0xffff, 0xf273, 0x02a0, 0x4e02, 0xf495, 0xf5e3, 0x5602,
+ 0x7e00, 0x1100, 0xfa4c, 0x029e, 0x6b03, 0x0001, 0xf6b8, 0xee04,
+ 0xf074, 0x02ed, 0xf074, 0x0310, 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, 0xf6b8, 0xf495, 0xf162,
+ 0xffff, 0xf340, 0xffff, 0xf640, 0xf0e0, 0xf010, 0xffff, 0xf061,
+ 0xffff, 0xfa44, 0x0301, 0x4a11, 0xeefe, 0xf273, 0x0307, 0xe800,
+ 0xe900, 0x8911, 0xf495, 0x4911, 0x1081, 0xf300, 0x0001, 0x8100,
+ 0xf074, 0x032c, 0xee02, 0x8a11, 0xfc00, 0xf495, 0xf073, 0x030e,
+ 0x4a11, 0x8811, 0x10f8, 0x05a6, 0xf4e3, 0x10f8, 0x05a9, 0xf845,
+ 0x031e, 0x11f8, 0x05a9, 0xf7e3, 0xf495, 0x4811, 0x10f8, 0x05a8,
+ 0xf845, 0x0325, 0x10f8, 0x05a8, 0xf4e3, 0x10f8, 0x05a7, 0xf4e3,
+ 0xf074, 0x030d, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0026, 0x7712,
+ 0x0001, 0x7713, 0x0001, 0x7681, 0x0010, 0x7711, 0x0000, 0x7681,
+ 0xffff, 0xe501, 0xf495, 0xf6bb, 0xf074, 0x02ac, 0xf074, 0x01cd,
+ 0xf4e1, 0xf495, 0xf073, 0x0340, 0x80f8, 0x05a7, 0xfc00, 0x80f8,
+ 0x05a6, 0xfc00, 0xfc00,
};
-static const unsigned short _section_vectors[] = {
- 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,
+
+static const unsigned short _section_cinit[] = {
+ 0x0001, 0x05a6, 0x034a, 0x0001, 0x05a7, 0x034a, 0x0001, 0x05a8,
+ 0x0000, 0x0001, 0x05a9, 0x0000, 0x0000,
};
+static const unsigned short _section_vectors[] = {
+ 0xf273, 0x0262, 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, 0x0200, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
+ 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
+ 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
+ 0xf273, 0x0117, 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, 0x0171, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
+
+};
+/* Program Mapping */
static const struct dsp_section dsp_image[] = {
- {_section_text, 0x0080, 0x0245},
- {NULL /* .bss */, 0x02c5, 0x005a},
+
+ {_section_text, 0x0080, 0x02cb},
+ {_section_cinit, 0x05aa, 0x000d},
+ {NULL /* .bss */, 0x054b, 0x005f},
+ {NULL /* .stack */, 0x034b, 0x0200},
{_section_vectors, 0x7f80, 0x0080},
{NULL /* .dma */, 0x8000, 0x1000},
{NULL, 0, 0}
};
/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */
-#define _handle_int0 0x0080
-#define _status 0x02c5
-#define _audiohw_start 0x02af
-#define _dma0_stopped 0x031d
-#define _waiting 0x031e
-#define _rebuffer 0x00fc
-#define _main 0x00df
-#define _dma_init 0x0243
-#define _audiohw_init 0x0284
-#define _handle_dma0 0x018e
-#define _handle_dmac 0x01e8
-#define _sdem_addrh 0x0316
-#define _sdem_addrl 0x0317
-#define _sdem_level 0x031a
-#define _sdem_dsp_size 0x0318
-#define _audiohw_stop 0x02ba
+#define cinit 0x05aa
+#define ___cinit__ 0x05aa
#define ___text__ 0x0080
-#define etext 0x02c5
-#define ___etext__ 0x02c5
+#define etext 0x034b
+#define ___etext__ 0x034b
#define ___data__ 0x0080
#define edata 0x0080
#define ___edata__ 0x0080
-#define ___bss__ 0x02c5
-#define end 0x031f
-#define ___end__ 0x031f
+#define ___bss__ 0x054b
+#define end 0x05aa
+#define ___end__ 0x05aa
+#define _int0_count 0x059c
+#define _status 0x054b
+#define _handle_int0 0x0200
+#define _main 0x032c
+#define _handle_dmac 0x0171
+#define _waiting 0x05a5
+#define _sdem_addrh 0x059d
+#define _sdem_addrl 0x059e
+#define _dma0_stopped 0x05a4
+#define _dma0_unlocked 0x05a3
+#define _sdem_dsp_size 0x059f
+#define _handle_dma0 0x0117
+#define _dsp_level 0x05a0
+#define _dma_init 0x01cd
+#define _sdem_level 0x05a1
+#define _rebuffer 0x0085
+#define _last_size 0x05a2
+#define _audiohw_start 0x02d7
+#define _audiohw_init 0x02ac
+#define _audiohw_stop 0x02e2
+#define _c_int00 0x0262
+#define __dtors_ptr 0x05a9
+#define _abort 0x030d
+#define _exit 0x0310
+#define __cleanup_ptr 0x05a8
+#define __lock 0x05a6
+#define __register_unlock 0x0344
+#define __nop 0x034a
+#define __register_lock 0x0347
+#define __unlock 0x05a7
+#define __args_main 0x02ed
#endif
+
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 {
unsigned short sdem_addrl;
unsigned short sdem_addrh;
} init PACKED;
-#define MSG_DEBUGF 2
- struct {
- short buffer[80];
- } debugf PACKED;
-#define MSG_REFILL 3
+#define MSG_REFILL 2
struct {
unsigned short topbottom; /* byte offset to unlocked half-buffer */
@@ -66,6 +62,10 @@ struct ipc_message {
unsigned short _DSP_ADDRL;
unsigned short _DMA_SIZE;
} refill PACKED;
+#define MSG_DEBUGF 3
+ struct {
+ short buffer[80];
+ } debugf PACKED;
} payload PACKED;
} PACKED;
#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 @@
-c
-x
--stack 0x1000
--heap 0x100
-
-/* The rtx500.lib should be included if you want proper initialization,
- * currently the program is setup so that it is not necessary to save space.
- * reset vector should jump to _c_int00 if initialization is needed.
- *
- * -l rts500.lib*/
+-stack 0x200
+-heap 0x200
+-l rts500.lib
MEMORY
{
@@ -37,3 +32,4 @@ SECTIONS
/* DMA buffers for ABU mode must start on a 2*size boundary. */
.dma > SARAM PAGE 0
}
+
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 @@
.global _main
.global _handle_dma0
.global _handle_dmac
+ .global _c_int00
.sect ".vectors"
; Reset Interrupt
@@ -37,7 +38,7 @@
; currently the program is setup so that it is not necessary to save space.
; reset vector should jump to _c_int00 instead of main if initialization is
; needed.
-RS_V: BD _main
+RS_V: BD _c_int00
NOP
NOP
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():
""" % out_filepath)
# Section data and directory.
- h_directory = ["""
-static const struct dsp_section dsp_image[] = {"""]
+ h_directory = ["static const struct dsp_section dsp_image[] = {\n"]
ti_coff = descend(object_file, "ti_coff")
for section in descendAll(ti_coff, "section"):
@@ -122,6 +121,7 @@ static const struct dsp_section dsp_image[] = {"""]
break
if data or regular or text:
+ out_count = 0
sys.stderr.write("%s: placing 0x%04x words at 0x%04x from offset "
"0x%08x\n" % (
name, raw_data_size >> 1, physical_addr, raw_data_ptr))
@@ -133,14 +133,16 @@ static const struct dsp_section dsp_image[] = {"""]
out_file.seek(raw_data_ptr)
data = array.array('H')
data.fromfile(out_file, raw_data_size >> 1)
- h_file.write("\t")
+ h_file.write(" ")
for word in data:
+ out_count = out_count+1
h_file.write("0x%04x, " % word)
- h_file.write("""
-};
-""")
+ if out_count % 8 == 0:
+ h_file.write("\n ")
+ out_count=0
+ h_file.write("\n};\n\n")
- h_directory.append("\t{_section%s, 0x%04x, 0x%04x}," % (
+ h_directory.append(" {_section%s, 0x%04x, 0x%04x}," % (
sanitized_name, physical_addr, raw_data_size >> 1))
continue
@@ -149,15 +151,15 @@ static const struct dsp_section dsp_image[] = {"""]
sys.stderr.write("%s: bss section, 0x%04x words at 0x%04x\n" % (
name, raw_data_size >> 1, physical_addr))
- h_directory.append("\t{NULL /* %s */, 0x%04x, 0x%04x}," % (
+ h_directory.append(" {NULL /* %s */, 0x%04x, 0x%04x}," % (
name, physical_addr, raw_data_size >> 1))
continue
sys.stderr.write("%s: error, unprocessed section\n" % name)
- h_file.write("\n")
+ h_file.write("/* Program Mapping */\n")
- h_directory.append("\t{NULL, 0, 0}")
+ h_directory.append(" {NULL, 0, 0}")
h_directory.append("};")
h_file.write("\n".join(h_directory))
@@ -165,9 +167,7 @@ static const struct dsp_section dsp_image[] = {"""]
# Symbols.
symbol_table = descend(ti_coff, "symbol_table")
- h_file.write("""
-/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */
-""")
+ h_file.write("\n/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */\n")
for symbol in descendAll(symbol_table, "symbol"):
name = getTagText(symbol, "name")
kind = getTagText(symbol, "kind")
@@ -181,7 +181,7 @@ static const struct dsp_section dsp_image[] = {"""]
h_file.write("#define %s 0x%04x\n" % (name, value))
- h_file.write("\n#endif\n")
+ h_file.write("\n#endif\n\n")
h_file.close()
out_file.close()