-
Notifications
You must be signed in to change notification settings - Fork 25
/
i2c-internal.h
45 lines (35 loc) · 926 Bytes
/
i2c-internal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
#pragma once
#include <assert.h>
#include "libmctp.h"
#include "libmctp-i2c.h"
/* Limited by bytecount field */
static_assert(I2C_BTU <= 254);
#ifndef MCTP_I2C_NEIGH_COUNT
#define MCTP_I2C_NEIGH_COUNT 4
#endif
struct mctp_i2c_hdr {
uint8_t dest;
uint8_t cmd;
uint8_t bytecount;
uint8_t source;
};
struct mctp_i2c_neigh {
bool used;
/* 7-bit address */
uint8_t addr;
uint8_t eid;
/* from platform_now(), for LRU eviction */
uint64_t last_seen_timestamp;
};
struct mctp_binding_i2c {
struct mctp_binding binding;
struct mctp_i2c_neigh neigh[MCTP_I2C_NEIGH_COUNT];
uint8_t own_addr;
uint8_t tx_storage[sizeof(struct mctp_i2c_hdr) +
MCTP_PKTBUF_SIZE(I2C_BTU)] __attribute((aligned(8)));
uint8_t rx_storage[sizeof(struct mctp_i2c_hdr) +
MCTP_PKTBUF_SIZE(I2C_BTU)] __attribute((aligned(8)));
mctp_i2c_tx_fn tx_fn;
void *tx_ctx;
};