diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-05-02 23:02:36 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-05-02 23:02:36 +0000 |
commit | 46f5461ac742921cff1a17472399e9b6d1b18eeb (patch) | |
tree | e763637688c7212b7fd33533e4875ec43f28ed3f | |
parent | 611a7c55e2eeec09c62a8c211d672c3129163d33 (diff) | |
download | rockbox-46f5461ac742921cff1a17472399e9b6d1b18eeb.tar.gz rockbox-46f5461ac742921cff1a17472399e9b6d1b18eeb.zip |
Early MP3 playing test
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@394 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/test/i2c/Makefile | 2 | ||||
-rw-r--r-- | firmware/test/i2c/main.c | 88 |
2 files changed, 89 insertions, 1 deletions
diff --git a/firmware/test/i2c/Makefile b/firmware/test/i2c/Makefile index 4f004f8333..dcc0d2be7a 100644 --- a/firmware/test/i2c/Makefile +++ b/firmware/test/i2c/Makefile | |||
@@ -10,7 +10,7 @@ CFLAGS = -g -Wall -m1 -nostdlib -Wstrict-prototypes -fschedule-insns -fno-builti | |||
10 | AFLAGS += -small -relax | 10 | AFLAGS += -small -relax |
11 | 11 | ||
12 | OBJS= crt0.o main.o ../../drivers/i2c.o ../../drivers/mas.o ../../debug.o \ | 12 | OBJS= crt0.o main.o ../../drivers/i2c.o ../../drivers/mas.o ../../debug.o \ |
13 | ../../common/sprintf.o | 13 | ../../common/sprintf.o mp3data.o |
14 | 14 | ||
15 | %.o: %.S | 15 | %.o: %.S |
16 | $(CC) -o $@ $(CFLAGS) $(INCLUDES) $(DEFS) -c $< | 16 | $(CC) -o $@ $(CFLAGS) $(INCLUDES) $(DEFS) -c $< |
diff --git a/firmware/test/i2c/main.c b/firmware/test/i2c/main.c index 13eaacef7a..825de73788 100644 --- a/firmware/test/i2c/main.c +++ b/firmware/test/i2c/main.c | |||
@@ -21,6 +21,56 @@ | |||
21 | #include "sh7034.h" | 21 | #include "sh7034.h" |
22 | #include "debug.h" | 22 | #include "debug.h" |
23 | 23 | ||
24 | extern char mp3data[]; | ||
25 | extern int mp3datalen; | ||
26 | |||
27 | unsigned char *mp3dataptr; | ||
28 | |||
29 | void setup_sci0(void) | ||
30 | { | ||
31 | /* set PB12 to output */ | ||
32 | PBIOR |= 0x1000; | ||
33 | |||
34 | /* Disable serial port */ | ||
35 | SCR0 = 0x00; | ||
36 | |||
37 | /* Syncronous, 8N1, no prescale */ | ||
38 | SMR0 = 0x80; | ||
39 | |||
40 | /* Set baudrate 1Mbit/s */ | ||
41 | BRR0 = 0x03; | ||
42 | |||
43 | /* use SCK as serial clock output */ | ||
44 | SCR0 = 0x01; | ||
45 | |||
46 | /* Clear FER and PER */ | ||
47 | SSR0 &= 0xe7; | ||
48 | |||
49 | /* Set interrupt D priority to 0 */ | ||
50 | // IPRD &= 0x0ff0; | ||
51 | |||
52 | /* set IRQ6 and IRQ7 to edge detect */ | ||
53 | // ICR |= 0x03; | ||
54 | |||
55 | /* set PB15 and PB14 to inputs */ | ||
56 | PBIOR &= 0x7fff; | ||
57 | PBIOR &= 0xbfff; | ||
58 | |||
59 | /* set IRQ6 prio 8 and IRQ7 prio 0 */ | ||
60 | // IPRB = ( IPRB & 0xff00 ) | 0x80; | ||
61 | |||
62 | IPRB = 0; | ||
63 | |||
64 | /* Enable Tx (only!) */ | ||
65 | SCR0 = 0x20; | ||
66 | } | ||
67 | |||
68 | int mas_tx_ready(void) | ||
69 | { | ||
70 | return (SSR0 & SCI_TDRE); | ||
71 | } | ||
72 | |||
73 | |||
24 | int main(void) | 74 | int main(void) |
25 | { | 75 | { |
26 | char buf[40]; | 76 | char buf[40]; |
@@ -105,6 +155,44 @@ int main(void) | |||
105 | } | 155 | } |
106 | 156 | ||
107 | debugf("Register 0xaa: %x\n", i); | 157 | debugf("Register 0xaa: %x\n", i); |
158 | |||
159 | i=mas_writereg(0x3b, 0x20); | ||
160 | if (i < 0) { | ||
161 | debugf("Error - mas_writereg() returned %d\n", i); | ||
162 | while(1); | ||
163 | } | ||
164 | |||
165 | i = mas_run(1); | ||
166 | if (i < 0) { | ||
167 | debugf("Error - mas_run() returned %d\n", i); | ||
168 | while(1); | ||
169 | } | ||
170 | |||
171 | |||
172 | setup_sci0(); | ||
173 | |||
174 | mp3dataptr = mp3data; | ||
175 | i = 0; | ||
176 | |||
177 | while(1) | ||
178 | { | ||
179 | if(PBDR & 0x4000) | ||
180 | { | ||
181 | if(i < mp3datalen) | ||
182 | { | ||
183 | while(!mas_tx_ready()){}; | ||
184 | /* | ||
185 | * Write data into TDR and clear TDRE | ||
186 | */ | ||
187 | TDR0 = mp3dataptr[i++]; | ||
188 | SSR0 &= ~SCI_TDRE; | ||
189 | } | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | debugf("MAS not ready\n"); | ||
194 | } | ||
195 | } | ||
108 | 196 | ||
109 | while(1); | 197 | while(1); |
110 | } | 198 | } |