summaryrefslogtreecommitdiff
path: root/include/i2c.h
blob: 34076b1f349558988e8b7e24f26c63f97ae261ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 */