summaryrefslogtreecommitdiff
path: root/firmware/test
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/test')
-rw-r--r--firmware/test/i2c/Makefile5
-rw-r--r--firmware/test/i2c/app.lds20
-rw-r--r--firmware/test/i2c/main.c45
3 files changed, 51 insertions, 19 deletions
diff --git a/firmware/test/i2c/Makefile b/firmware/test/i2c/Makefile
index dcc0d2be7a..63f0eb6a10 100644
--- a/firmware/test/i2c/Makefile
+++ b/firmware/test/i2c/Makefile
@@ -9,8 +9,9 @@ INCLUDES=-I../.. -I../../drivers
CFLAGS = -g -Wall -m1 -nostdlib -Wstrict-prototypes -fschedule-insns -fno-builtin $(INCLUDES) -DDEBUG
AFLAGS += -small -relax
-OBJS= crt0.o main.o ../../drivers/i2c.o ../../drivers/mas.o ../../debug.o \
- ../../common/sprintf.o mp3data.o
+OBJS= ../../crt0.o main.o ../../drivers/i2c.o ../../drivers/mas.o \
+ ../../debug.o ../../kernel.o ../../thread.o ../../common/sprintf.o \
+ ../../panic.o mp3data.o
%.o: %.S
$(CC) -o $@ $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
diff --git a/firmware/test/i2c/app.lds b/firmware/test/i2c/app.lds
index 4b7e5f4c6f..2aa374f8c1 100644
--- a/firmware/test/i2c/app.lds
+++ b/firmware/test/i2c/app.lds
@@ -2,22 +2,34 @@ ENTRY(start)
OUTPUT_FORMAT(elf32-sh)
SECTIONS
{
- .text 0x09018000 :
+ .text 0x09010000 :
+ {
+ *(.vectors)
+ . = ALIGN(0x200);
+ *(.init.text)
+ }
+
+ .text :
{
- *(.rodata)
*(.text)
}
.data :
{
+ *(.rodata)
*(.data)
}
+ .rodata :
+ {
+ *(.rodata)
+ }
+
.bss :
{
*(.bss)
- _end = . + 0x8000;
- _stack = . + 0x9000;
+ _end = .;
+ _stack = . + 0x1000;
_edata = .;
}
}
diff --git a/firmware/test/i2c/main.c b/firmware/test/i2c/main.c
index 746f1c7355..b5aecec733 100644
--- a/firmware/test/i2c/main.c
+++ b/firmware/test/i2c/main.c
@@ -82,8 +82,8 @@ void setup_sci0(void)
/* Clear FER and PER */
SSR0 &= 0xe7;
- /* Set interrupt D priority to 0 */
-// IPRD &= 0x0ff0;
+ /* Set interrupt ITU2 and SCI0 priority to 0 */
+ IPRD &= 0x0ff0;
/* set IRQ6 and IRQ7 to edge detect */
// ICR |= 0x03;
@@ -98,7 +98,7 @@ void setup_sci0(void)
IPRB = 0;
/* Enable Tx (only!) */
- SCR0 |= 0x20;
+ SCR0 |= 0xa0;
}
int mas_tx_ready(void)
@@ -106,12 +106,32 @@ int mas_tx_ready(void)
return (SSR0 & SCI_TDRE);
}
+void init_dma(void)
+{
+ SAR3 = (unsigned int) mp3data;
+ DAR3 = 0xFFFFEC3;
+ CHCR3 = 0x1500; /* Single address destination, TXI0 */
+ DTCR3 = 64000;
+ DMAOR = 0x0001; /* Enable DMA */
+}
+
+void start_dma(void)
+{
+ CHCR3 |= 1;
+}
+
+void stop_dma(void)
+{
+ CHCR3 &= ~1;
+}
+
int main(void)
{
char buf[40];
char str[32];
int i=0;
+ int dma_on = 0;
/* Clear it all! */
SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);
@@ -217,11 +237,15 @@ int main(void)
i = 0;
+ init_dma();
+
while(1)
{
/* Demand pin high? */
if(PBDR & 0x4000)
{
+ start_dma();
+#if 0
/* More data to write? */
if(i < mp3datalen)
{
@@ -232,18 +256,13 @@ int main(void)
TDR0 = fliptable[mp3data[i++]];
SSR0 &= ~SCI_TDRE;
}
+#endif
+ }
+ else
+ {
+ stop_dma();
}
}
while(1);
}
-
-extern const void stack(void);
-
-const void* vectors[] __attribute__ ((section (".vectors"))) =
-{
- main, /* Power-on reset */
- stack, /* Power-on reset (stack pointer) */
- main, /* Manual reset */
- stack /* Manual reset (stack pointer) */
-};