David Hendricks | f4c3508 | 2012-12-27 14:15:51 -0800 | [diff] [blame] | 1 | /* |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
David Hendricks | f4c3508 | 2012-12-27 14:15:51 -0800 | [diff] [blame] | 3 | * |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 4 | * Copyright (C) 2013 Google, Inc. |
David Hendricks | f4c3508 | 2012-12-27 14:15:51 -0800 | [diff] [blame] | 5 | * |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
David Hendricks | f4c3508 | 2012-12-27 14:15:51 -0800 | [diff] [blame] | 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA |
David Hendricks | f4c3508 | 2012-12-27 14:15:51 -0800 | [diff] [blame] | 18 | */ |
| 19 | |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 20 | #ifndef _DEVICE_I2C_H_ |
| 21 | #define _DEVICE_I2C_H_ |
David Hendricks | f4c3508 | 2012-12-27 14:15:51 -0800 | [diff] [blame] | 22 | |
Gabe Black | a5dc091 | 2013-06-30 03:47:33 -0700 | [diff] [blame^] | 23 | #include <stdint.h> |
| 24 | |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 25 | /* note: chip is the 7-bit I2C address */ |
| 26 | int i2c_read(unsigned bus, unsigned chip, unsigned addr, |
Gabe Black | a5dc091 | 2013-06-30 03:47:33 -0700 | [diff] [blame^] | 27 | unsigned alen, uint8_t *buf, unsigned len); |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 28 | int i2c_write(unsigned bus, unsigned chip, unsigned addr, |
Gabe Black | a5dc091 | 2013-06-30 03:47:33 -0700 | [diff] [blame^] | 29 | unsigned alen, const uint8_t *buf, unsigned len); |
David Hendricks | f4c3508 | 2012-12-27 14:15:51 -0800 | [diff] [blame] | 30 | |
David Hendricks | cfb7360 | 2013-04-05 13:42:39 -0700 | [diff] [blame] | 31 | #endif /* _DEVICE_I2C_H_ */ |