FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
i2c.h
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 #ifndef included_vlib_i2c_h
17 #define included_vlib_i2c_h
18 
19 #include <vppinfra/types.h>
20 
21 
22 #define I2C_MSG_FLAG_WRITE 0
23 #define I2C_MSG_FLAG_READ 1
24 
25 typedef struct
26 {
31 } i2c_msg_t;
32 
33 typedef struct i2c_bus_t
34 {
35  void (*put_bits) (struct i2c_bus_t * b, int scl, int sda);
36  void (*get_bits) (struct i2c_bus_t * b, int *scl, int *sda);
37 
38  int timeout;
42 
43  /* Private data */
45 
46 } i2c_bus_t;
47 
48 void vlib_i2c_init (i2c_bus_t * bus);
51  u16 length, u8 * data);
52 
53 static inline int
55 {
56  return bus->timeout;
57 }
58 
59 #endif /* included_vlib_i2c_h */
60 
61 /*
62  * fd.io coding-style-patch-verification: ON
63  *
64  * Local Variables:
65  * eval: (c-set-style "gnu")
66  * End:
67  */
i2c_bus_t
Definition: i2c.h:33
i2c_bus_t::timeout
int timeout
Definition: i2c.h:38
types.h
vlib_i2c_bus_timed_out
static int vlib_i2c_bus_timed_out(i2c_bus_t *bus)
Definition: i2c.h:54
i2c_msg_t::flags
u8 flags
Definition: i2c.h:28
u16
unsigned short u16
Definition: types.h:57
start_addr
vl_api_address_t start_addr
Definition: ikev2_types.api:37
i2c_bus_t::get_bits
void(* get_bits)(struct i2c_bus_t *b, int *scl, int *sda)
Definition: i2c.h:36
i2c_msg_t::addr
u8 addr
Definition: i2c.h:27
i2c_msg_t::buffer
u8 * buffer
Definition: i2c.h:30
uword
u64 uword
Definition: types.h:112
f64
double f64
Definition: types.h:142
i2c_bus_t::private_data
uword private_data
Definition: i2c.h:44
i2c_bus_t::hold_time
f64 hold_time
Definition: i2c.h:40
data
u8 data[128]
Definition: ipsec_types.api:92
u32
unsigned int u32
Definition: types.h:88
vlib_i2c_xfer
void vlib_i2c_xfer(i2c_bus_t *bus, i2c_msg_t *msgs)
Definition: i2c.c:168
i2c_bus_t
struct i2c_bus_t i2c_bus_t
msgs
vapi_message_desc_t ** msgs
Definition: vapi.c:48
length
char const int length
Definition: cJSON.h:163
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
u8
unsigned char u8
Definition: types.h:56
vlib_i2c_read_eeprom
void vlib_i2c_read_eeprom(i2c_bus_t *bus, u8 i2c_addr, u16 start_addr, u16 length, u8 *data)
Definition: i2c.c:201
i2c_bus_t::put_bits
void(* put_bits)(struct i2c_bus_t *b, int scl, int sda)
Definition: i2c.h:35
i2c_msg_t::len
u16 len
Definition: i2c.h:29
vlib_i2c_init
void vlib_i2c_init(i2c_bus_t *bus)
Definition: i2c.c:150
i2c_bus_t::clock
u32 clock
Definition: i2c.h:39
bus
u8 bus
Definition: pci_types.api:21
i2c_msg_t
Definition: i2c.h:25
i2c_bus_t::rise_fall_time
f64 rise_fall_time
Definition: i2c.h:41