[Armadeus-commitlog] armadeus branch, master, updated. release-3.3-375-g8f6c257
Brought to you by:
sszy
|
From: Fabien M <fa...@us...> - 2011-02-25 09:05:50
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 8f6c257fea269709754f83936afa75974df8fe65 (commit)
via d6223d207dbbc791ff81bebaa96ea52b257476ce (commit)
from e623794318b6d2b08bbc79cfc137444e7fdc9f15 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8f6c257fea269709754f83936afa75974df8fe65
Merge: d6223d207dbbc791ff81bebaa96ea52b257476ce e623794318b6d2b08bbc79cfc137444e7fdc9f15
Author: Fabien Marteau <fab...@ar...>
Date: Fri Feb 25 10:05:13 2011 +0100
Merge branch 'master' of ssh://armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit d6223d207dbbc791ff81bebaa96ea52b257476ce
Author: Fabien Marteau <fab...@ar...>
Date: Fri Feb 25 10:04:46 2011 +0100
[as_devices] Fix a bug in i2c_read_msg
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/as_i2c.c | 67 +++++++++++++++++----------------
1 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/target/packages/as_devices/c/as_i2c.c b/target/packages/as_devices/c/as_i2c.c
index 698c249..d899c82 100644
--- a/target/packages/as_devices/c/as_i2c.c
+++ b/target/packages/as_devices/c/as_i2c.c
@@ -3,19 +3,19 @@
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Copyright (C) 2009 Benoît Ryder <be...@ry...>
- * Copyright (C) 2010, 2011 Fabien Marteau <fab...@ar...>
+ * Copyright (C) 2010, 2011 Fabien Marteau <fab...@ar...>
*
*/
@@ -171,36 +171,6 @@ int32_t as_i2c_write_reg(struct as_i2c_device *aDev,
return as_i2c_write(aDev, buf, sizeof(buf));
}
-int32_t as_i2c_read_msg(struct as_i2c_device *aDev,
- uint8_t *aWData, uint8_t aWriteSize,
- uint8_t *aRData, size_t aReadSize)
-{
- /* write reg */
- struct i2c_msg msg = { aDev->slave_addr, 0, aWriteSize, &aReadSize };
- struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
-
- if (aDev->slave_addr == 0) {
- ERROR("Slave address must be set before\n");
- return -1;
- }
-
- if (ioctl(aDev->fi2c, I2C_RDWR, &rdwr) < 0) {
- ERROR("Can't write on i2c\n");
- return -1;
- }
- /* read data */
- msg.flags = I2C_M_RD;
- msg.len = aReadSize;
- msg.buf = aRData;
-
- if (ioctl(aDev->fi2c, I2C_RDWR, &rdwr) < 0) {
- ERROR("Can't read on i2c\n");
- return -2;
- }
-
- return 0;
-}
-
int32_t as_i2c_read_reg_byte(struct as_i2c_device *aDev, uint8_t aReg)
{
uint8_t val;
@@ -230,3 +200,34 @@ int32_t as_i2c_write_reg_byte(struct as_i2c_device *aDev,
return as_i2c_write(aDev, buf, 2);
}
+int32_t as_i2c_read_msg(struct as_i2c_device *aDev,
+ uint8_t *aWData, uint8_t aWriteSize,
+ uint8_t *aRData, size_t aReadSize)
+{
+ int i;
+ /* write reg */
+ struct i2c_msg msg = { aDev->slave_addr, 0, aWriteSize, aWData };
+ struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+
+ if (aDev->slave_addr == 0) {
+ ERROR("Slave address must be set before\n");
+ return -1;
+ }
+ if (ioctl(aDev->fi2c, I2C_RDWR, &rdwr) < 0) {
+ ERROR("Can't write on i2c\n");
+ return -1;
+ }
+ /* read data */
+ msg.flags = I2C_M_RD;
+ msg.len = aReadSize;
+ msg.buf = aRData;
+
+ if (ioctl(aDev->fi2c, I2C_RDWR, &rdwr) < 0) {
+ ERROR("Can't read on i2c\n");
+ return -2;
+ }
+
+ return 0;
+}
+
+
hooks/post-receive
--
armadeus
|