diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-03-05 00:04:00 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-03-05 00:04:00 +0000 |
commit | 8876018d25c6a56cce118482c1372bbff344cb23 (patch) | |
tree | a66dca10bf92674c655b9862fd366ecc77bba76a /firmware/target/coldfire/iaudio/m5/audio-m5.c | |
parent | ee07215d506def8d3483f4adf6e1d4ae51c10c52 (diff) | |
download | rockbox-8876018d25c6a56cce118482c1372bbff344cb23.tar.gz rockbox-8876018d25c6a56cce118482c1372bbff344cb23.zip |
Bring up the M5 port to a working stage: Extended numerous explicit checks for IAUDIO_X5 to also check for IAUDIO_M5, moved code around the target tree, added preliminary background for the sim.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12610 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iaudio/m5/audio-m5.c')
-rw-r--r-- | firmware/target/coldfire/iaudio/m5/audio-m5.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iaudio/m5/audio-m5.c b/firmware/target/coldfire/iaudio/m5/audio-m5.c new file mode 100644 index 0000000000..fcedbcad78 --- /dev/null +++ b/firmware/target/coldfire/iaudio/m5/audio-m5.c | |||
@@ -0,0 +1,82 @@ | |||
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 | #include "system.h" | ||
20 | #include "cpu.h" | ||
21 | #include "audio.h" | ||
22 | #include "sound.h" | ||
23 | |||
24 | void audio_set_output_source(int source) | ||
25 | { | ||
26 | unsigned long txsrc; | ||
27 | |||
28 | if ((unsigned)source >= AUDIO_NUM_SOURCES) | ||
29 | txsrc = (3 << 8); /* playback, PDOR3 */ | ||
30 | else | ||
31 | txsrc = (4 << 8); /* recording, iis1RcvData */ | ||
32 | |||
33 | IIS1CONFIG = (IIS1CONFIG & ~(7 << 8)) | txsrc; | ||
34 | } /* audio_set_output_source */ | ||
35 | |||
36 | void audio_set_source(int source, unsigned flags) | ||
37 | { | ||
38 | /* Prevent pops from unneeded switching */ | ||
39 | static int last_source = AUDIO_SRC_PLAYBACK; | ||
40 | |||
41 | (void)flags; | ||
42 | |||
43 | switch (source) | ||
44 | { | ||
45 | default: /* playback - no recording */ | ||
46 | source = AUDIO_SRC_PLAYBACK; | ||
47 | case AUDIO_SRC_PLAYBACK: | ||
48 | if (source != last_source) | ||
49 | { | ||
50 | audiohw_disable_recording(); | ||
51 | audiohw_set_monitor(false); | ||
52 | /* Reset PDIR2 data flow */ | ||
53 | DATAINCONTROL = (1 << 9); | ||
54 | } | ||
55 | break; | ||
56 | |||
57 | case AUDIO_SRC_MIC: /* recording only */ | ||
58 | if (source != last_source) | ||
59 | { | ||
60 | audiohw_enable_recording(true); /* source mic */ | ||
61 | /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ | ||
62 | DATAINCONTROL = (3 << 14) | (4 << 3); | ||
63 | } | ||
64 | break; | ||
65 | |||
66 | case AUDIO_SRC_LINEIN: /* recording only */ | ||
67 | if (source != last_source) | ||
68 | { | ||
69 | audiohw_enable_recording(false); /* source line */ | ||
70 | /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ | ||
71 | DATAINCONTROL = (3 << 14) | (4 << 3); | ||
72 | } | ||
73 | break; | ||
74 | } /* end switch */ | ||
75 | |||
76 | or_l((1 << 29), &GPIO_OUT); /* Line In */ | ||
77 | or_l((1 << 29), &GPIO_ENABLE); | ||
78 | or_l((1 << 29), &GPIO_FUNCTION); | ||
79 | |||
80 | last_source = source; | ||
81 | } /* audio_set_source */ | ||
82 | |||