FD.io VPP  v20.09-64-g4f7b92f0a
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  */
u32 clock
Definition: i2c.h:39
f64 hold_time
Definition: i2c.h:40
vl_api_address_t start_addr
Definition: ikev2_types.api:37
unsigned char u8
Definition: types.h:56
u8 data[128]
Definition: ipsec_types.api:89
double f64
Definition: types.h:142
u8 flags
Definition: i2c.h:28
f64 rise_fall_time
Definition: i2c.h:41
Definition: i2c.h:25
vapi_message_desc_t ** msgs
Definition: vapi.c:48
unsigned int u32
Definition: types.h:88
uword private_data
Definition: i2c.h:44
unsigned short u16
Definition: types.h:57
u8 * buffer
Definition: i2c.h:30
void vlib_i2c_init(i2c_bus_t *bus)
Definition: i2c.c:150
int timeout
Definition: i2c.h:38
Definition: i2c.h:33
struct i2c_bus_t i2c_bus_t
void(* get_bits)(struct i2c_bus_t *b, int *scl, int *sda)
Definition: i2c.h:36
u8 addr
Definition: i2c.h:27
void(* put_bits)(struct i2c_bus_t *b, int scl, int sda)
Definition: i2c.h:35
void vlib_i2c_xfer(i2c_bus_t *bus, i2c_msg_t *msgs)
Definition: i2c.c:168
u16 len
Definition: i2c.h:29
u64 uword
Definition: types.h:112
static int vlib_i2c_bus_timed_out(i2c_bus_t *bus)
Definition: i2c.h:54
u8 bus
Definition: pci_types.api:21
void vlib_i2c_read_eeprom(i2c_bus_t *bus, u8 i2c_addr, u16 start_addr, u16 length, u8 *data)
Definition: i2c.c:201