blob: 3cf392d6fcae22c4db317f9ec5f049966946171c [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
2 * (C) Copyright 2001
3 * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 *
23 * The original I2C interface was
24 * (C) 2000 by Paolo Scaffardi (arsenio@tin.it)
25 * AIRVENT SAM s.p.a - RIMINI(ITALY)
26 * but has been changed substantially.
27 */
28
29#ifndef _I2C_H_
30#define _I2C_H_
31
32#define DRV_I2C_ERROR_DEVICE -101
33#define DRV_I2C_ERROR_DATA -102
34#define DRV_I2C_ERROR_TIMEOUT -103
35#define DRV_I2C_ERROR_TIMEOUTSELF -104
36#define DRV_I2C_BUS_PERSIST_WAIT -105
37#define DRV_I2C_SEND_NOT_COMPLETE -106
38#define DRV_I2C_RECV_NOT_COMPLETE -107
39
40int i2c_init(void);
41
42int i2c_read(uint i2c_bus, ushort slave_addr, ushort reg_addr, uint reg_len,
43 uchar *read_buf, uint read_len);
44
45int i2c_write(uint i2c_bus, ushort slave_addr, ushort reg_addr, uint reg_len,
46 uchar *write_buf, uint write_len);
47#endif /* _I2C_H_ */