summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire')
-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
8 files changed, 224 insertions, 8 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)
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 },