diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2007-11-27 00:35:41 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2007-11-27 00:35:41 +0000 |
| commit | 7126d6482024249bb556c41aa67894e155b33d68 (patch) | |
| tree | ec83a5bc982629d590de7130f36a2b3ebe169552 | |
| parent | b9b736fa392a08355da912de10f1d4b80073497f (diff) | |
| download | rockbox-7126d6482024249bb556c41aa67894e155b33d68.zip rockbox-7126d6482024249bb556c41aa67894e155b33d68.tar.gz rockbox-7126d6482024249bb556c41aa67894e155b33d68.tar.bz2 rockbox-7126d6482024249bb556c41aa67894e155b33d68.tar.xz | |
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.c | 6 |
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 bc2524d..c093625 100644 --- a/firmware/target/arm/ipod/adc-ipod-pcf.c +++ b/firmware/target/arm/ipod/adc-ipod-pcf.c @@ -24,6 +24,7 @@ #include "string.h" #include "adc.h" #include "pcf50605.h" +#include "i2c-pp.h" struct adc_struct { long timeout; @@ -39,6 +40,9 @@ static unsigned short _adc_read(struct adc_struct *adc) if (adc->timeout < current_tick) { unsigned char data[2]; unsigned short value; + + i2c_lock(); + /* 5x per 2 seconds */ adc->timeout = current_tick + (HZ * 2 / 5); @@ -53,6 +57,8 @@ static unsigned short _adc_read(struct adc_struct *adc) adc->conversion(&value); } adc->data = value; + + i2c_unlock(); return value; } else { |