2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef included_vlib_i2c_h
17 #define included_vlib_i2c_h
19 #include <vppinfra/types.h>
22 #define I2C_MSG_FLAG_WRITE 0
23 #define I2C_MSG_FLAG_READ 1
32 typedef struct i2c_bus_t {
33 void (* put_bits) (struct i2c_bus_t * b, int scl, int sda);
34 void (* get_bits) (struct i2c_bus_t * b, int *scl, int *sda);
46 void vlib_i2c_init (i2c_bus_t * bus);
47 void vlib_i2c_xfer (i2c_bus_t * bus, i2c_msg_t * msgs);
48 void vlib_i2c_read_eeprom (i2c_bus_t * bus, u8 i2c_addr, u16 start_addr, u16 length, u8 * data);
51 vlib_i2c_bus_timed_out(i2c_bus_t * bus)
56 #endif /* included_vlib_i2c_h */