summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio/x5/adc-x5.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-03-05 00:04:00 +0000
committerJens Arnold <amiconn@rockbox.org>2007-03-05 00:04:00 +0000
commit8876018d25c6a56cce118482c1372bbff344cb23 (patch)
treea66dca10bf92674c655b9862fd366ecc77bba76a /firmware/target/coldfire/iaudio/x5/adc-x5.c
parentee07215d506def8d3483f4adf6e1d4ae51c10c52 (diff)
downloadrockbox-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/x5/adc-x5.c')
-rw-r--r--firmware/target/coldfire/iaudio/x5/adc-x5.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/adc-x5.c b/firmware/target/coldfire/iaudio/x5/adc-x5.c
deleted file mode 100644
index 1895cacfe9..0000000000
--- a/firmware/target/coldfire/iaudio/x5/adc-x5.c
+++ /dev/null
@@ -1,58 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
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 "config.h"
20#include "cpu.h"
21#include "system.h"
22#include "kernel.h"
23#include "thread.h"
24#include "adc.h"
25#include "pcf50606.h"
26
27/* get remaining 2 bits and return 10 bit value */
28static int get_10bit_voltage(int msbdata)
29{
30 int data = msbdata << 2;
31 data |= pcf50606_read(0x31) & 0x3;
32 return data;
33}
34
35unsigned short adc_scan(int channel)
36{
37 static const int adcc2_parms[] =
38 {
39 [ADC_BUTTONS] = 0x81 | (5 << 1), /* 8b - ADCIN2 */
40 [ADC_REMOTE] = 0x81 | (6 << 1), /* 8b - ADCIN3 */
41 [ADC_BATTERY] = 0x01 | (0 << 1), /* 10b - BATVOLT, resistive divider */
42 };
43
44 int level;
45 int data;
46
47 level = set_irq_level(HIGHEST_IRQ_LEVEL);
48
49 pcf50606_write(0x2f, adcc2_parms[channel]);
50 data = pcf50606_read(0x30);
51
52 if (channel == ADC_BATTERY)
53 data = get_10bit_voltage(data);
54
55 set_irq_level(level);
56
57 return (unsigned short)data;
58}