diff options
-rw-r--r-- | apps/debug_menu.c | 5 | ||||
-rw-r--r-- | apps/plugins/plugin.lds | 2 | ||||
-rw-r--r-- | firmware/SOURCES | 6 | ||||
-rw-r--r-- | firmware/export/config-iaudiom3.h | 9 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/app.lds | 4 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/adc-m3.c | 32 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/audio-m3.c | 114 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/button-m3.c | 8 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/fmradio_i2c-m3.c | 37 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/lcd-m3.c | 29 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/power-m3.c | 6 | ||||
-rw-r--r-- | firmware/target/coldfire/pcm-coldfire.c | 2 |
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) #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD # define DEBUG_CANCEL BUTTON_REC +#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD) +# define DEBUG_CANCEL BUTTON_RC_REC + #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) # define DEBUG_CANCEL BUTTON_REW @@ -2050,7 +2053,7 @@ static bool dbg_save_roms(void) fd = creat("/internal_rom_000000-1FFFFF.bin"); #elif defined(IRIVER_H300_SERIES) fd = creat("/internal_rom_000000-3FFFFF.bin"); -#elif defined(IAUDIO_X5) || defined(IAUDIO_M5) +#elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3) fd = creat("/internal_rom_000000-3FFFFF.bin"); #endif 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) #define ARCH_IRIVER #endif -#ifdef ARCH_IRIVER +#if defined(ARCH_IRIVER) || defined(IAUDIO_M3) #define DRAMORIG 0x31000000 #define IRAMORIG 0x1000c000 #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 #ifdef IAUDIO_M3 #ifndef SIMULATOR target/coldfire/ata-as-coldfire.S +target/coldfire/iaudio/m3/adc-m3.c target/coldfire/iaudio/m3/ata-m3.c target/coldfire/iaudio/m3/backlight-m3.c target/coldfire/iaudio/m3/button-m3.c +target/coldfire/iaudio/m3/fmradio_i2c-m3.c target/coldfire/iaudio/m3/lcd-m3.c target/coldfire/iaudio/m3/power-m3.c target/coldfire/iaudio/m3/system-m3.c +target/coldfire/iaudio/m3/usb-m3.c target/coldfire/iaudio/powermgmt-iaudio.c +#ifndef BOOTLOADER +target/coldfire/iaudio/m3/audio-m3.c +#endif #endif /* SIMULATOR */ #endif /* IAUDIO_M3 */ 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 @@ /* Define bitmask of input sources - recordable bitmask can be defined explicitly if different */ -#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN) +#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO) /* define the bitmask of hardware sample rates */ #define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11) @@ -72,6 +72,10 @@ /* The number of bytes reserved for loadable plugins */ #define PLUGIN_BUFFER_SIZE 0x80000 +/* FM Tuner */ +#define CONFIG_TUNER TEA5767 +#define CONFIG_TUNER_XTAL 32768 + #define HAVE_TLV320 /* TLV320 has no tone controls, so we use the software ones */ @@ -131,6 +135,9 @@ #endif /* SIMULATOR */ +/* Define this for FM radio input available */ +#define HAVE_FMRADIO_IN + /** Port-specific settings **/ /* 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) #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; +} 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] = }; #endif -#if CONFIG_CPU == MCF5250 && defined(HAVE_TLV320) +#if (CONFIG_CPU == MCF5250 || CONFIG_CPU == MCF5249) && defined(HAVE_TLV320) static const unsigned char pcm_freq_parms[HW_NUM_FREQ][3] = { [HW_FREQ_88] = { 0x0c, 0x01, 0x02 }, |