summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio
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 /firmware/target/coldfire/iaudio
parent422454c87dda5d2766788d3a5a9c1a0544da9e84 (diff)
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
Diffstat (limited to 'firmware/target/coldfire/iaudio')
-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
7 files changed, 223 insertions, 7 deletions
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)
#define DRAMORIG 0x31000000 + STUBOFFSET
#define IRAMORIG 0x10000000
+#ifdef IAUDIO_M3
+#define IRAMSIZE 0xc000
+#else
#define IRAMSIZE 0x10000
+#endif
/* End of the audio buffer, where the codec buffer starts */
#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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2008 by Jens Arnold
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "cpu.h"
+#include "system.h"
+#include "kernel.h"
+#include "thread.h"
+#include "adc.h"
+
+unsigned short adc_scan(int channel)
+{
+ /* TODO */
+ (void)channel;
+ return 0xff;
+}
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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2006 by Michael Sevakis
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "system.h"
+#include "cpu.h"
+#include "audio.h"
+#include "sound.h"
+
+void audio_set_output_source(int source)
+{
+ int level = set_irq_level(DMA_IRQ_LEVEL);
+ unsigned long txsrc;
+
+ if ((unsigned)source >= AUDIO_NUM_SOURCES)
+ txsrc = (3 << 8); /* playback, PDOR3 */
+ else
+ txsrc = (4 << 8); /* recording, iis1RcvData */
+
+ IIS1CONFIG = (IIS1CONFIG & ~(7 << 8)) | txsrc;
+ set_irq_level(level);
+} /* audio_set_output_source */
+
+void audio_input_mux(int source, unsigned flags)
+{
+ /* Prevent pops from unneeded switching */
+ static int last_source = AUDIO_SRC_PLAYBACK;
+ static bool last_recording = false;
+
+ bool recording = flags & SRCF_RECORDING;
+
+ switch (source)
+ {
+ default: /* playback - no recording */
+ source = AUDIO_SRC_PLAYBACK;
+ case AUDIO_SRC_PLAYBACK:
+ if (source != last_source)
+ {
+ audiohw_disable_recording();
+ audiohw_set_monitor(false);
+ coldfire_set_dataincontrol(0);
+ }
+ break;
+
+ case AUDIO_SRC_MIC: /* recording only */
+ if (source != last_source)
+ {
+ audiohw_enable_recording(true); /* source mic */
+ /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
+ coldfire_set_dataincontrol((3 << 14) | (4 << 3));
+ }
+ break;
+
+ case AUDIO_SRC_LINEIN: /* recording only */
+ if (source != last_source)
+ {
+ audiohw_enable_recording(false); /* source line */
+ /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
+ coldfire_set_dataincontrol((3 << 14) | (4 << 3));
+ }
+ break;
+
+ case AUDIO_SRC_FMRADIO: /* recording and playback */
+ if (!recording)
+ audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN);
+
+ /* I2S recording and analog playback */
+ if (source == last_source && recording == last_recording)
+ break;
+
+ last_recording = recording;
+
+ if (recording)
+ {
+ /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
+ coldfire_set_dataincontrol((3 << 14) | (4 << 3));
+ audiohw_enable_recording(false); /* source line */
+ }
+ else
+ {
+ audiohw_disable_recording();
+ audiohw_set_monitor(true); /* analog bypass */
+ coldfire_set_dataincontrol(0);
+ }
+ break;
+ } /* end switch */
+
+ /* set line multiplexer */
+ if (source == AUDIO_SRC_FMRADIO)
+ and_l(~(1 << 25), &GPIO1_OUT); /* FM radio */
+ else
+ or_l((1 << 25), &GPIO1_OUT); /* Line In */
+
+ or_l((1 << 25), &GPIO1_ENABLE);
+ or_l((1 << 25), &GPIO1_FUNCTION);
+
+ last_source = source;
+} /* audio_input_mux */
+
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)
hold_button_old = hold_button;
hold_button = button_hold();
-#ifndef BOOTLOADER
- /* give BL notice if HB state chaged */
- if (hold_button != hold_button_old)
- backlight_hold_changed(hold_button);
-#endif
-
if (!hold_button)
{
#if 0 /* TODO: implement ADC */
@@ -83,7 +77,7 @@ int button_read_device(void)
#ifndef BOOTLOADER
if (remote_hold_button != remote_hold_button_old)
- remote_backlight_hold_changed(remote_hold_button);
+ backlight_hold_changed(remote_hold_button);
#endif
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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ * Physical interface of the Philips TEA5767 in iAudio M3
+ *
+ * Copyright (C) 2002 by Linus Nielsen Feltzing
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "config.h"
+
+#if (CONFIG_TUNER & TEA5767)
+
+#include "i2c-coldfire.h"
+
+int fmradio_i2c_write(unsigned char address, const unsigned char* buf,
+ int count)
+{
+ return i2c_write(I2C_IFACE_0, address, buf, count);
+}
+
+int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
+{
+ return i2c_read(I2C_IFACE_0, address, buf, count);
+}
+
+#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)
#endif
}
+/* TODO: implement blit functions */
+
+/* Performance function that works with an external buffer
+ note that by and bheight are in 8-pixel units! */
+void lcd_blit(const fb_data *data, int x, int by, int width,
+ int bheight, int stride)
+{
+ (void)data;
+ (void)x;
+ (void)by;
+ (void)width;
+ (void)bheight;
+ (void)stride;
+}
+
+/* Performance function that works with an external buffer
+ note that by and bheight are in 8-pixel units! */
+void lcd_grey_phase_blit(unsigned char *values, unsigned char *phases,
+ int x, int by, int width, int bheight, int stride)
+{
+ (void)values;
+ (void)phases;
+ (void)x;
+ (void)by;
+ (void)width;
+ (void)bheight;
+ (void)stride;
+}
+
/* Update the display.
This must be called after all other LCD functions that change the display. */
void 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)
}
#endif /* SIMULATOR */
+
+bool tuner_power(bool status)
+{
+ (void)status;
+ return true;
+}