summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-11-27 00:35:41 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-11-27 00:35:41 +0000
commit7126d6482024249bb556c41aa67894e155b33d68 (patch)
treeec83a5bc982629d590de7130f36a2b3ebe169552
parentb9b736fa392a08355da912de10f1d4b80073497f (diff)
downloadrockbox-7126d6482024249bb556c41aa67894e155b33d68.tar.gz
rockbox-7126d6482024249bb556c41aa67894e155b33d68.zip
Further lockdown of multipart i2c operations that must be done without intrusion.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15823 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/ipod/adc-ipod-pcf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/target/arm/ipod/adc-ipod-pcf.c b/firmware/target/arm/ipod/adc-ipod-pcf.c
index bc2524de5d..c0936251ad 100644
--- a/firmware/target/arm/ipod/adc-ipod-pcf.c
+++ b/firmware/target/arm/ipod/adc-ipod-pcf.c
@@ -24,6 +24,7 @@
24#include "string.h" 24#include "string.h"
25#include "adc.h" 25#include "adc.h"
26#include "pcf50605.h" 26#include "pcf50605.h"
27#include "i2c-pp.h"
27 28
28struct adc_struct { 29struct adc_struct {
29 long timeout; 30 long timeout;
@@ -39,6 +40,9 @@ static unsigned short _adc_read(struct adc_struct *adc)
39 if (adc->timeout < current_tick) { 40 if (adc->timeout < current_tick) {
40 unsigned char data[2]; 41 unsigned char data[2];
41 unsigned short value; 42 unsigned short value;
43
44 i2c_lock();
45
42 /* 5x per 2 seconds */ 46 /* 5x per 2 seconds */
43 adc->timeout = current_tick + (HZ * 2 / 5); 47 adc->timeout = current_tick + (HZ * 2 / 5);
44 48
@@ -53,6 +57,8 @@ static unsigned short _adc_read(struct adc_struct *adc)
53 adc->conversion(&value); 57 adc->conversion(&value);
54 } 58 }
55 adc->data = value; 59 adc->data = value;
60
61 i2c_unlock();
56 return value; 62 return value;
57 } else 63 } else
58 { 64 {