diff options
author | Dave Chapman <dave@dchapman.com> | 2008-09-06 17:50:59 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-09-06 17:50:59 +0000 |
commit | d462a64a918117991e11dade2d7fa3a28196e07a (patch) | |
tree | 0a6f5ed8777b18bb1641fbb3608f10374901706c /firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c | |
parent | b87715f670f04c9adbe358c32a385c6771d99a81 (diff) | |
download | rockbox-d462a64a918117991e11dade2d7fa3a28196e07a.tar.gz rockbox-d462a64a918117991e11dade2d7fa3a28196e07a.zip |
Initial commit of iaudio 7 port by Vitja Makarov (FS#9245). Port is at quite an advanced stage, but is troubled by the lack of a reliable NAND driver (similar to the Cowon D2 port) and is not yet suitable for non-developers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18435 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c')
-rw-r--r-- | firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c new file mode 100644 index 0000000000..4e7f58df47 --- /dev/null +++ b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Michael Sevakis | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "system.h" | ||
22 | #include "cpu.h" | ||
23 | #include "audio.h" | ||
24 | #include "sound.h" | ||
25 | |||
26 | int audio_channels = 2; | ||
27 | int audio_output_source = AUDIO_SRC_PLAYBACK; | ||
28 | |||
29 | void audiohw_enable_output(bool on) | ||
30 | { | ||
31 | (void) on; | ||
32 | } | ||
33 | |||
34 | void audio_set_output_source(int source) | ||
35 | { | ||
36 | int oldmode = set_fiq_status(FIQ_DISABLED); | ||
37 | |||
38 | if ((unsigned)source >= AUDIO_NUM_SOURCES) | ||
39 | source = AUDIO_SRC_PLAYBACK; | ||
40 | |||
41 | audio_output_source = source; | ||
42 | set_fiq_status(oldmode); | ||
43 | } | ||
44 | |||
45 | void audio_input_mux(int source, unsigned flags) | ||
46 | { | ||
47 | static int last_source = AUDIO_SRC_PLAYBACK; | ||
48 | static bool last_recording = false; | ||
49 | bool recording = flags & SRCF_RECORDING; | ||
50 | |||
51 | switch (source) | ||
52 | { | ||
53 | default: /* playback - no recording */ | ||
54 | source = AUDIO_SRC_PLAYBACK; | ||
55 | case AUDIO_SRC_PLAYBACK: | ||
56 | audio_channels = 2; | ||
57 | if (source != last_source) | ||
58 | { | ||
59 | audiohw_set_monitor(false); | ||
60 | /* audiohw_disable_recording();*/ | ||
61 | } | ||
62 | break; | ||
63 | |||
64 | case AUDIO_SRC_MIC: /* recording only */ | ||
65 | GPIOD |= 0x1; | ||
66 | |||
67 | audio_channels = 1; | ||
68 | if (source != last_source) | ||
69 | { | ||
70 | /*audiohw_set_monitor(false); | ||
71 | audiohw_enable_recording(true); /. source mic */ | ||
72 | } | ||
73 | break; | ||
74 | |||
75 | case AUDIO_SRC_FMRADIO: /* recording and playback */ | ||
76 | GPIOD &= ~0x1; | ||
77 | |||
78 | audio_channels = 2; | ||
79 | |||
80 | if (source == last_source && recording == last_recording) | ||
81 | break; | ||
82 | |||
83 | last_recording = recording; | ||
84 | |||
85 | if (recording) | ||
86 | { | ||
87 | /*audiohw_set_monitor(false); | ||
88 | audiohw_enable_recording(false);*/ | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | /*audiohw_disable_recording(); */ | ||
93 | audiohw_set_monitor(true); /* line 1 analog audio path */ | ||
94 | } | ||
95 | break; | ||
96 | } /* end switch */ | ||
97 | |||
98 | last_source = source; | ||
99 | } /* audio_input_mux */ | ||