1 #include <stdint.h> 2 3 #include "libmctp.h" 4 5 struct mctp_binding_i2c; 6 7 typedef int (*mctp_i2c_tx_fn)(const void *buf, size_t len, void *ctx); 8 9 /* Configures the i2c binding. */ 10 int mctp_i2c_setup(struct mctp_binding_i2c *i2c, uint8_t own_addr, 11 mctp_i2c_tx_fn tx_fn, void *tx_ctx); 12 void mctp_i2c_cleanup(struct mctp_binding_i2c *i2c); 13 14 int mctp_i2c_set_address(struct mctp_binding_i2c *i2c, uint8_t own_addr); 15 16 struct mctp_binding *mctp_binding_i2c_core(struct mctp_binding_i2c *i2c); 17 18 int mctp_i2c_set_neighbour(struct mctp_binding_i2c *i2c, uint8_t eid, 19 uint8_t addr); 20 21 void mctp_i2c_rx(struct mctp_binding_i2c *i2c, const void *data, size_t len); 22 int mctp_i2c_parse_hdr(const void *data, size_t len, uint8_t *src_addr, 23 uint8_t *dest_addr, uint8_t *bytecount); 24 void 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) 32