From 7126d6482024249bb556c41aa67894e155b33d68 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Tue, 27 Nov 2007 00:35:41 +0000 Subject: 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 --- firmware/target/arm/ipod/adc-ipod-pcf.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 @@ #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 { -- cgit v1.2.3