blob: d8f23ca8e00cbdc5a2465ccd8ddd941cb797c8c8 [file] [log] [blame]
Matt Johnstone5b941d2024-09-17 16:44:38 +08001#include <stdint.h>
2
3#include "libmctp.h"
4
5struct mctp_binding_i2c;
6
7typedef int (*mctp_i2c_tx_fn)(const void *buf, size_t len, void *ctx);
8
9/* Configures the i2c binding. */
10int mctp_i2c_setup(struct mctp_binding_i2c *i2c, uint8_t own_addr,
11 mctp_i2c_tx_fn tx_fn, void *tx_ctx);
12void mctp_i2c_cleanup(struct mctp_binding_i2c *i2c);
13
14int mctp_i2c_set_address(struct mctp_binding_i2c *i2c, uint8_t own_addr);
15
16struct mctp_binding *mctp_binding_i2c_core(struct mctp_binding_i2c *i2c);
17
18int mctp_i2c_set_neighbour(struct mctp_binding_i2c *i2c, uint8_t eid,
19 uint8_t addr);
20
21void mctp_i2c_rx(struct mctp_binding_i2c *i2c, const void *data, size_t len);
22int mctp_i2c_parse_hdr(const void *data, size_t len, uint8_t *src_addr,
23 uint8_t *dest_addr, uint8_t *bytecount);
24void mctp_i2c_tx_poll(struct mctp_binding_i2c *i2c);
25
26/* Can be customised if needed */
27#ifndef I2C_BTU
28#define I2C_BTU MCTP_BTU
29#endif
30
31#define MCTP_I2C_PACKET_SIZE (MCTP_PACKET_SIZE(I2C_BTU) + 4)