summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-03-14 08:54:54 +0000
committerJens Arnold <amiconn@rockbox.org>2008-03-14 08:54:54 +0000
commit8a6291dd63063bea12805a41fd43f13c17aa2be5 (patch)
treeda36f06943a24c9eb02e533fac3a825bd0f8e7d1
parent422454c87dda5d2766788d3a5a9c1a0544da9e84 (diff)
downloadrockbox-8a6291dd63063bea12805a41fd43f13c17aa2be5.tar.gz
rockbox-8a6291dd63063bea12805a41fd43f13c17aa2be5.zip
More iAudio M3 work. Target build compiles, but same problem regarding plugins as the simulator. Boots to the menu, but it can't be used yet because only main & remote Play button work. USB works.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16660 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c5
-rw-r--r--apps/plugins/plugin.lds2
-rw-r--r--firmware/SOURCES6
-rw-r--r--firmware/export/config-iaudiom3.h9
-rw-r--r--firmware/target/coldfire/iaudio/app.lds4
-rw-r--r--firmware/target/coldfire/iaudio/m3/adc-m3.c32
-rw-r--r--firmware/target/coldfire/iaudio/m3/audio-m3.c114
-rw-r--r--firmware/target/coldfire/iaudio/m3/button-m3.c8
-rw-r--r--firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c37
-rw-r--r--firmware/target/coldfire/iaudio/m3/lcd-m3.c29
-rw-r--r--firmware/target/coldfire/iaudio/m3/power-m3.c6
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c2
12 files changed, 243 insertions, 11 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index b77a09a18c..cf1e8dceb6 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1002,6 +1002,9 @@ static bool dbg_spdif(void)
1002#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD 1002#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
1003# define DEBUG_CANCEL BUTTON_REC 1003# define DEBUG_CANCEL BUTTON_REC
1004 1004
1005#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
1006# define DEBUG_CANCEL BUTTON_RC_REC
1007
1005#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) 1008#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
1006# define DEBUG_CANCEL BUTTON_REW 1009# define DEBUG_CANCEL BUTTON_REW
1007 1010
@@ -2050,7 +2053,7 @@ static bool dbg_save_roms(void)
2050 fd = creat("/internal_rom_000000-1FFFFF.bin"); 2053 fd = creat("/internal_rom_000000-1FFFFF.bin");
2051#elif defined(IRIVER_H300_SERIES) 2054#elif defined(IRIVER_H300_SERIES)
2052 fd = creat("/internal_rom_000000-3FFFFF.bin"); 2055 fd = creat("/internal_rom_000000-3FFFFF.bin");
2053#elif defined(IAUDIO_X5) || defined(IAUDIO_M5) 2056#elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
2054 fd = creat("/internal_rom_000000-3FFFFF.bin"); 2057 fd = creat("/internal_rom_000000-3FFFFF.bin");
2055#endif 2058#endif
2056 if(fd >= 0) 2059 if(fd >= 0)
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index 47969e0537..9659412730 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -34,7 +34,7 @@ OUTPUT_FORMAT(elf32-sh)
34#define ARCH_IRIVER 34#define ARCH_IRIVER
35#endif 35#endif
36 36
37#ifdef ARCH_IRIVER 37#if defined(ARCH_IRIVER) || defined(IAUDIO_M3)
38#define DRAMORIG 0x31000000 38#define DRAMORIG 0x31000000
39#define IRAMORIG 0x1000c000 39#define IRAMORIG 0x1000c000
40#define IRAMSIZE 0xc000 40#define IRAMSIZE 0xc000
diff --git a/firmware/SOURCES b/firmware/SOURCES
index f4fc252193..b5906d4648 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -496,13 +496,19 @@ target/coldfire/iaudio/m5/audio-m5.c
496#ifdef IAUDIO_M3 496#ifdef IAUDIO_M3
497#ifndef SIMULATOR 497#ifndef SIMULATOR
498target/coldfire/ata-as-coldfire.S 498target/coldfire/ata-as-coldfire.S
499target/coldfire/iaudio/m3/adc-m3.c
499target/coldfire/iaudio/m3/ata-m3.c 500target/coldfire/iaudio/m3/ata-m3.c
500target/coldfire/iaudio/m3/backlight-m3.c 501target/coldfire/iaudio/m3/backlight-m3.c
501target/coldfire/iaudio/m3/button-m3.c 502target/coldfire/iaudio/m3/button-m3.c
503target/coldfire/iaudio/m3/fmradio_i2c-m3.c
502target/coldfire/iaudio/m3/lcd-m3.c 504target/coldfire/iaudio/m3/lcd-m3.c
503target/coldfire/iaudio/m3/power-m3.c 505target/coldfire/iaudio/m3/power-m3.c
504target/coldfire/iaudio/m3/system-m3.c 506target/coldfire/iaudio/m3/system-m3.c
507target/coldfire/iaudio/m3/usb-m3.c
505target/coldfire/iaudio/powermgmt-iaudio.c 508target/coldfire/iaudio/powermgmt-iaudio.c
509#ifndef BOOTLOADER
510target/coldfire/iaudio/m3/audio-m3.c
511#endif
506#endif /* SIMULATOR */ 512#endif /* SIMULATOR */
507#endif /* IAUDIO_M3 */ 513#endif /* IAUDIO_M3 */
508 514
diff --git a/firmware/export/config-iaudiom3.h b/firmware/export/config-iaudiom3.h
index efac5bb893..8e4b4976f9 100644
--- a/firmware/export/config-iaudiom3.h
+++ b/firmware/export/config-iaudiom3.h
@@ -11,7 +11,7 @@
11 11
12/* Define bitmask of input sources - recordable bitmask can be defined 12/* Define bitmask of input sources - recordable bitmask can be defined
13 explicitly if different */ 13 explicitly if different */
14#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) 14#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
15 15
16/* define the bitmask of hardware sample rates */ 16/* define the bitmask of hardware sample rates */
17#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) 17#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11)
@@ -72,6 +72,10 @@
72/* The number of bytes reserved for loadable plugins */ 72/* The number of bytes reserved for loadable plugins */
73#define PLUGIN_BUFFER_SIZE 0x80000 73#define PLUGIN_BUFFER_SIZE 0x80000
74 74
75/* FM Tuner */
76#define CONFIG_TUNER TEA5767
77#define CONFIG_TUNER_XTAL 32768
78
75#define HAVE_TLV320 79#define HAVE_TLV320
76 80
77/* TLV320 has no tone controls, so we use the software ones */ 81/* TLV320 has no tone controls, so we use the software ones */
@@ -131,6 +135,9 @@
131 135
132#endif /* SIMULATOR */ 136#endif /* SIMULATOR */
133 137
138/* Define this for FM radio input available */
139#define HAVE_FMRADIO_IN
140
134/** Port-specific settings **/ 141/** Port-specific settings **/
135 142
136/* Main LCD contrast range and defaults */ 143/* Main LCD contrast range and defaults */
diff --git a/firmware/target/coldfire/iaudio/app.lds b/firmware/target/coldfire/iaudio/app.lds
index f7d8e975da..63c462cf4a 100644
--- a/firmware/target/coldfire/iaudio/app.lds
+++ b/firmware/target/coldfire/iaudio/app.lds
@@ -18,7 +18,11 @@ INPUT(target/coldfire/crt0.o)
18 18
19#define DRAMORIG 0x31000000 + STUBOFFSET 19#define DRAMORIG 0x31000000 + STUBOFFSET
20#define IRAMORIG 0x10000000 20#define IRAMORIG 0x10000000
21#ifdef IAUDIO_M3
22#define IRAMSIZE 0xc000
23#else
21#define IRAMSIZE 0x10000 24#define IRAMSIZE 0x10000
25#endif
22 26
23/* End of the audio buffer, where the codec buffer starts */ 27/* End of the audio buffer, where the codec buffer starts */
24#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) 28#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
diff --git a/firmware/target/coldfire/iaudio/m3/adc-m3.c b/firmware/target/coldfire/iaudio/m3/adc-m3.c
new file mode 100644
index 0000000000..c4f8d92ae1
--- /dev/null
+++ b/firmware/target/coldfire/iaudio/m3/adc-m3.c
@@ -0,0 +1,32 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Jens Arnold
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "cpu.h"
22#include "system.h"
23#include "kernel.h"
24#include "thread.h"
25#include "adc.h"
26
27unsigned short adc_scan(int channel)
28{
29 /* TODO */
30 (void)channel;
31 return 0xff;
32}
diff --git a/firmware/target/coldfire/iaudio/m3/audio-m3.c b/firmware/target/coldfire/iaudio/m3/audio-m3.c
new file mode 100644
index 0000000000..4edae48744
--- /dev/null
+++ b/firmware/target/coldfire/iaudio/m3/audio-m3.c
@@ -0,0 +1,114 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Michael Sevakis
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "system.h"
21#include "cpu.h"
22#include "audio.h"
23#include "sound.h"
24
25void audio_set_output_source(int source)
26{
27 int level = set_irq_level(DMA_IRQ_LEVEL);
28 unsigned long txsrc;
29
30 if ((unsigned)source >= AUDIO_NUM_SOURCES)
31 txsrc = (3 << 8); /* playback, PDOR3 */
32 else
33 txsrc = (4 << 8); /* recording, iis1RcvData */
34
35 IIS1CONFIG = (IIS1CONFIG & ~(7 << 8)) | txsrc;
36 set_irq_level(level);
37} /* audio_set_output_source */
38
39void audio_input_mux(int source, unsigned flags)
40{
41 /* Prevent pops from unneeded switching */
42 static int last_source = AUDIO_SRC_PLAYBACK;
43 static bool last_recording = false;
44
45 bool recording = flags & SRCF_RECORDING;
46
47 switch (source)
48 {
49 default: /* playback - no recording */
50 source = AUDIO_SRC_PLAYBACK;
51 case AUDIO_SRC_PLAYBACK:
52 if (source != last_source)
53 {
54 audiohw_disable_recording();
55 audiohw_set_monitor(false);
56 coldfire_set_dataincontrol(0);
57 }
58 break;
59
60 case AUDIO_SRC_MIC: /* recording only */
61 if (source != last_source)
62 {
63 audiohw_enable_recording(true); /* source mic */
64 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
65 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
66 }
67 break;
68
69 case AUDIO_SRC_LINEIN: /* recording only */
70 if (source != last_source)
71 {
72 audiohw_enable_recording(false); /* source line */
73 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
74 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
75 }
76 break;
77
78 case AUDIO_SRC_FMRADIO: /* recording and playback */
79 if (!recording)
80 audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN);
81
82 /* I2S recording and analog playback */
83 if (source == last_source && recording == last_recording)
84 break;
85
86 last_recording = recording;
87
88 if (recording)
89 {
90 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
91 coldfire_set_dataincontrol((3 << 14) | (4 << 3));
92 audiohw_enable_recording(false); /* source line */
93 }
94 else
95 {
96 audiohw_disable_recording();
97 audiohw_set_monitor(true); /* analog bypass */
98 coldfire_set_dataincontrol(0);
99 }
100 break;
101 } /* end switch */
102
103 /* set line multiplexer */
104 if (source == AUDIO_SRC_FMRADIO)
105 and_l(~(1 << 25), &GPIO1_OUT); /* FM radio */
106 else
107 or_l((1 << 25), &GPIO1_OUT); /* Line In */
108
109 or_l((1 << 25), &GPIO1_ENABLE);
110 or_l((1 << 25), &GPIO1_FUNCTION);
111
112 last_source = source;
113} /* audio_input_mux */
114
diff --git a/firmware/target/coldfire/iaudio/m3/button-m3.c b/firmware/target/coldfire/iaudio/m3/button-m3.c
index 1a27af93f5..b5b09807c0 100644
--- a/firmware/target/coldfire/iaudio/m3/button-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/button-m3.c
@@ -54,12 +54,6 @@ int button_read_device(void)
54 hold_button_old = hold_button; 54 hold_button_old = hold_button;
55 hold_button = button_hold(); 55 hold_button = button_hold();
56 56
57#ifndef BOOTLOADER
58 /* give BL notice if HB state chaged */
59 if (hold_button != hold_button_old)
60 backlight_hold_changed(hold_button);
61#endif
62
63 if (!hold_button) 57 if (!hold_button)
64 { 58 {
65#if 0 /* TODO: implement ADC */ 59#if 0 /* TODO: implement ADC */
@@ -83,7 +77,7 @@ int button_read_device(void)
83 77
84#ifndef BOOTLOADER 78#ifndef BOOTLOADER
85 if (remote_hold_button != remote_hold_button_old) 79 if (remote_hold_button != remote_hold_button_old)
86 remote_backlight_hold_changed(remote_hold_button); 80 backlight_hold_changed(remote_hold_button);
87#endif 81#endif
88 82
89 if (!remote_hold_button) 83 if (!remote_hold_button)
diff --git a/firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c b/firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c
new file mode 100644
index 0000000000..dcd945d813
--- /dev/null
+++ b/firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c
@@ -0,0 +1,37 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 * Physical interface of the Philips TEA5767 in iAudio M3
10 *
11 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include "config.h"
21
22#if (CONFIG_TUNER & TEA5767)
23
24#include "i2c-coldfire.h"
25
26int fmradio_i2c_write(unsigned char address, const unsigned char* buf,
27 int count)
28{
29 return i2c_write(I2C_IFACE_0, address, buf, count);
30}
31
32int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
33{
34 return i2c_read(I2C_IFACE_0, address, buf, count);
35}
36
37#endif
diff --git a/firmware/target/coldfire/iaudio/m3/lcd-m3.c b/firmware/target/coldfire/iaudio/m3/lcd-m3.c
index b8c410b321..b1e81f91ba 100644
--- a/firmware/target/coldfire/iaudio/m3/lcd-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/lcd-m3.c
@@ -428,6 +428,35 @@ void lcd_init_device(void)
428#endif 428#endif
429} 429}
430 430
431/* TODO: implement blit functions */
432
433/* Performance function that works with an external buffer
434 note that by and bheight are in 8-pixel units! */
435void lcd_blit(const fb_data *data, int x, int by, int width,
436 int bheight, int stride)
437{
438 (void)data;
439 (void)x;
440 (void)by;
441 (void)width;
442 (void)bheight;
443 (void)stride;
444}
445
446/* Performance function that works with an external buffer
447 note that by and bheight are in 8-pixel units! */
448void lcd_grey_phase_blit(unsigned char *values, unsigned char *phases,
449 int x, int by, int width, int bheight, int stride)
450{
451 (void)values;
452 (void)phases;
453 (void)x;
454 (void)by;
455 (void)width;
456 (void)bheight;
457 (void)stride;
458}
459
431/* Update the display. 460/* Update the display.
432 This must be called after all other LCD functions that change the display. */ 461 This must be called after all other LCD functions that change the display. */
433void lcd_update(void) ICODE_ATTR; 462void lcd_update(void) ICODE_ATTR;
diff --git a/firmware/target/coldfire/iaudio/m3/power-m3.c b/firmware/target/coldfire/iaudio/m3/power-m3.c
index 624e3b44a5..7b5af43026 100644
--- a/firmware/target/coldfire/iaudio/m3/power-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/power-m3.c
@@ -69,3 +69,9 @@ void power_off(void)
69} 69}
70 70
71#endif /* SIMULATOR */ 71#endif /* SIMULATOR */
72
73bool tuner_power(bool status)
74{
75 (void)status;
76 return true;
77}
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c
index 6d79ed08f1..d30ef87c61 100644
--- a/firmware/target/coldfire/pcm-coldfire.c
+++ b/firmware/target/coldfire/pcm-coldfire.c
@@ -78,7 +78,7 @@ static const unsigned char pcm_freq_parms[HW_NUM_FREQ][3] =
78}; 78};
79#endif 79#endif
80 80
81#if CONFIG_CPU == MCF5250 && defined(HAVE_TLV320) 81#if (CONFIG_CPU == MCF5250 || CONFIG_CPU == MCF5249) && defined(HAVE_TLV320)
82static const unsigned char pcm_freq_parms[HW_NUM_FREQ][3] = 82static const unsigned char pcm_freq_parms[HW_NUM_FREQ][3] =
83{ 83{
84 [HW_FREQ_88] = { 0x0c, 0x01, 0x02 }, 84 [HW_FREQ_88] = { 0x0c, 0x01, 0x02 },