diff options
Diffstat (limited to 'firmware/target/hosted/ypr0/ascodec-ypr0.c')
-rw-r--r-- | firmware/target/hosted/ypr0/ascodec-ypr0.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/firmware/target/hosted/ypr0/ascodec-ypr0.c b/firmware/target/hosted/ypr0/ascodec-ypr0.c index ec5568554b..954b4d95ef 100644 --- a/firmware/target/hosted/ypr0/ascodec-ypr0.c +++ b/firmware/target/hosted/ypr0/ascodec-ypr0.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: ascodec-target.h 26116 2010-05-17 20:53:25Z funman $ | ||
9 | * | 8 | * |
10 | * Module wrapper for AS3543 audio codec, using /dev/afe (afe.ko) of Samsung YP-R0 | 9 | * Module wrapper for AS3543 audio codec, using /dev/afe (afe.ko) of Samsung YP-R0 |
11 | * | 10 | * |
@@ -28,7 +27,7 @@ | |||
28 | #include "sys/ioctl.h" | 27 | #include "sys/ioctl.h" |
29 | #include "stdlib.h" | 28 | #include "stdlib.h" |
30 | 29 | ||
31 | #include "ascodec-target.h" | 30 | #include "ascodec.h" |
32 | 31 | ||
33 | int afe_dev = -1; | 32 | int afe_dev = -1; |
34 | 33 | ||
@@ -134,24 +133,32 @@ void ascodec_unlock(void) | |||
134 | { | 133 | { |
135 | } | 134 | } |
136 | 135 | ||
137 | /* Read 10-bit channel data */ | 136 | bool ascodec_chg_status(void) |
138 | unsigned short adc_read(int channel) | ||
139 | { | 137 | { |
140 | if ((unsigned)channel >= NUM_ADC_CHANNELS) | 138 | return ascodec_read(AS3514_IRQ_ENRD0) & CHG_STATUS; |
141 | return 0; | 139 | } |
142 | 140 | ||
143 | /* Select channel */ | 141 | bool ascodec_endofch(void) |
144 | ascodec_write(AS3514_ADC_0, (channel << 4)); | 142 | { |
145 | unsigned char buf[2]; | 143 | return ascodec_read(AS3514_IRQ_ENRD0) & CHG_ENDOFCH; |
144 | } | ||
145 | |||
146 | void ascodec_monitor_endofch(void) | ||
147 | { | ||
148 | ascodec_write(AS3514_IRQ_ENRD0, IRQ_ENDOFCH); | ||
149 | } | ||
146 | 150 | ||
147 | /* Read data */ | ||
148 | if (ascodec_readbytes(AS3514_ADC_0, 2, buf) < 0) | ||
149 | return 0; | ||
150 | 151 | ||
151 | /* decode to 10-bit and return */ | 152 | void ascodec_write_charger(int value) |
152 | return (((buf[0] & 0x3) << 8) | buf[1]); | 153 | { |
154 | ascodec_write_pmu(AS3543_CHARGER, 1, value); | ||
155 | } | ||
156 | |||
157 | int ascodec_read_charger(void) | ||
158 | { | ||
159 | return ascodec_read_pmu(AS3543_CHARGER, 1); | ||
153 | } | 160 | } |
154 | 161 | ||
155 | void adc_init(void) | 162 | void ascodec_wait_adc_finished(void) |
156 | { | 163 | { |
157 | } | 164 | } |