forked from len0rd/rockbox
Failed attempt to use DMA
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@453 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c62a0852c3
commit
55fec178bc
3 changed files with 51 additions and 19 deletions
|
|
@ -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 $<
|
||||
|
|
|
|||
|
|
@ -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 = .;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) */
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue