|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
31 while (t < b->hold_time)
35 b->get_bits (
b, &scl, &sda);
40 t +=
b->rise_fall_time;
50 b->put_bits (
b, 1, 1);
56 b->put_bits (
b, 1, 0);
58 b->put_bits (
b, 0, 0);
65 b->put_bits (
b, 0, 0);
68 b->put_bits (
b, 1, 0);
71 b->put_bits (
b, 1, 1);
78 b->put_bits (
b, 0, sda);
81 b->put_bits (
b, 1, sda);
85 b->put_bits (
b, 0, sda);
94 b->put_bits (
b, 1, 1);
98 b->get_bits (
b, &scl, sda);
100 b->put_bits (
b, 0, 1);
109 for (
i = 7;
i >= 0;
i--)
116 b->put_bits (
b, 0, 1);
133 b->put_bits (
b, 0, 1);
136 for (
i = 7;
i >= 0;
i--)
142 *
data |= (sda != 0) <<
i;
156 tick = 1.0 /
b->clock;
160 b->hold_time = 0.4 * tick;
163 if (!
b->rise_fall_time)
164 b->rise_fall_time = 0.1 * tick;
180 for (
i = 0;
i < msg->
len;
i++)
188 for (
i = 0;
i < msg->
len;
i++)
210 msg[0].
addr = i2c_addr;
212 msg[0].
buffer = (
u8 *) & start_address;
215 msg[1].
addr = i2c_addr;
static void i2c_read_byte(i2c_bus_t *b, u8 *data, int ack)
static void i2c_write_bit(i2c_bus_t *b, int sda)
static int vlib_i2c_bus_timed_out(i2c_bus_t *bus)
static void vlib_time_wait(vlib_main_t *vm, f64 wait)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vl_api_address_t start_addr
void vlib_i2c_xfer(i2c_bus_t *bus, i2c_msg_t *msgs)
#define I2C_MSG_FLAG_WRITE
static void i2c_stop(i2c_bus_t *b)
void vlib_i2c_read_eeprom(i2c_bus_t *bus, u8 i2c_addr, u16 start_addr, u16 length, u8 *data)
static void i2c_write_byte(i2c_bus_t *b, u8 data)
#define I2C_MSG_FLAG_READ
static void i2c_delay(i2c_bus_t *b, f64 timeout)
sll srl srl sll sra u16x4 i
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
void vlib_i2c_init(i2c_bus_t *b)
static void i2c_read_bit(i2c_bus_t *b, int *sda)
#define vec_free(V)
Free vector's memory (no header).
#define vec_foreach(var, vec)
Vector iterator.
vapi_message_desc_t ** msgs
static void i2c_start(i2c_bus_t *b)
static vlib_main_t * vlib_get_main(void)
static void i2c_wait_for_scl(i2c_bus_t *b)