diff options
author | Randall Spangler <rspangler@chromium.org> | 2011-12-07 18:51:09 +0000 |
---|---|---|
committer | Vincent Palatin <vpalatin@chromium.org> | 2011-12-07 19:10:02 +0000 |
commit | bdf7da5b082f6d18dd27f1e5d8cca0b12154a28c (patch) | |
tree | 6f14312a6cc70d056efc2bede8728c0868266719 /include/i2c.h | |
parent | abe5786058f4b60dc6d30e7d7c964aae850caa1f (diff) | |
download | chrome-ec-bdf7da5b082f6d18dd27f1e5d8cca0b12154a28c.tar.gz |
Initial sources import 1/3
source files mainly done by Randall.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: Iaff83a842b17f3350fb6f2a3f1597ad4c29bd12a
Diffstat (limited to 'include/i2c.h')
-rw-r--r-- | include/i2c.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h new file mode 100644 index 0000000000..34076b1f34 --- /dev/null +++ b/include/i2c.h @@ -0,0 +1,29 @@ +/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* I2C interface for Chrome EC */ + +#ifndef __CROS_EC_I2C_H +#define __CROS_EC_I2C_H + +#include "common.h" + +/* Flags for slave address field, in addition to the 8-bit address */ +#define I2C_FLAG_BIG_ENDIAN 0x100 /* 16 byte values are MSB-first */ + +/* Initializes the module. */ +int i2c_init(void); + +/* Reads a 16-bit register from the slave at 8-bit slave address + * <slaveaddr>, at the specified 8-bit <offset> in the slave's address + * space. */ +int i2c_read16(int port, int slave_addr, int offset, int* data); + +/* Writes a 16-bit register to the slave at 8-bit slave address + * <slaveaddr>, at the specified 8-bit <offset> in the slave's address + * space. */ +int i2c_write16(int port, int slave_addr, int offset, int data); + +#endif /* __CROS_EC_I2C_H */ |