1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
26 void (*scl_hi
)(void); /* Drive SCL high, might sleep on clk stretch */
27 void (*scl_lo
)(void); /* Drive SCL low */
28 void (*sda_hi
)(void); /* Drive SDA high */
29 void (*sda_lo
)(void); /* Drive SDA low */
30 void (*sda_input
)(void); /* Set SDA as input */
31 void (*sda_output
)(void); /* Set SDA as output */
32 void (*scl_input
)(void); /* Set SCL as input */
33 void (*scl_output
)(void); /* Set SCL as output */
34 int (*scl
)(void); /* Read SCL, returns 0 or non-zero */
35 int (*sda
)(void); /* Read SDA, returns 0 or non-zero */
37 /* These are the delays specified in the I2C specification, the
38 time pairs to the right are the minimum 100kHz and 400kHz specs */
39 void (*delay_hd_sta
)(void); /* START SDA hold (tHD:SDA) 4.0us/0.6us */
40 void (*delay_hd_dat
)(void); /* SDA hold (tHD:DAT) 5.0us/0us */
41 void (*delay_su_dat
)(void); /* SDA setup (tSU:DAT) 250ns/100ns */
42 void (*delay_su_sto
)(void); /* STOP setup (tSU:STO) 4.0us/0.6us */
43 void (*delay_su_sta
)(void); /* Rep. START setup (tSU:STA) 4.7us/0.6us */
44 void (*delay_thigh
)(void); /* SCL high period (tHIGH) 4.0us/0.6us */
47 int i2c_add_node(const struct i2c_interface
*iface
);
48 int i2c_write_data(int bus_index
, int bus_address
, int address
,
49 const unsigned char* buf
, int count
);
50 int i2c_read_data(int bus_index
, int bus_address
, int address
,
51 unsigned char* buf
, int count
);
53 #endif /* _GEN_I2C_ */