blob: 9759ff1725eda79f9545ccf1917b78664fd4d755 [file] [log] [blame]
Jeremy Kerr3d36ee22019-05-30 11:15:37 +08001/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
Jeremy Kerr672c8852019-03-01 12:18:07 +08002
3#ifndef _LIBMCTP_ASTLPCL_H
4#define _LIBMCTP_ASTLPCL_H
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
Jeremy Kerrbc53d352019-08-28 14:26:14 +053010#include <unistd.h>
Jeremy Kerr8682ef22019-05-30 17:46:44 +080011#include <libmctp.h>
Jeremy Kerr672c8852019-03-01 12:18:07 +080012
13struct mctp_binding_astlpc;
14
Jeremy Kerrbc53d352019-08-28 14:26:14 +053015enum mctp_binding_astlpc_kcs_reg {
16 MCTP_ASTLPC_KCS_REG_DATA = 0,
17 MCTP_ASTLPC_KCS_REG_STATUS = 1,
18};
19
20struct mctp_binding_astlpc_ops {
21 int (*kcs_read)(void *data, enum mctp_binding_astlpc_kcs_reg reg,
22 uint8_t *val);
23 int (*kcs_write)(void *data, enum mctp_binding_astlpc_kcs_reg reg,
24 uint8_t val);
25 int (*lpc_read)(void *data, void *buf, off_t offset, size_t len);
26 int (*lpc_write)(void *data, void *buf, off_t offset, size_t len);
27};
28
29struct mctp_binding_astlpc *mctp_astlpc_init_ops(
Andrew Jefferya0452492020-02-06 11:47:39 +103030 const struct mctp_binding_astlpc_ops *ops,
Jeremy Kerrbc53d352019-08-28 14:26:14 +053031 void *ops_data, void *lpc_map);
Andrew Jeffery4663f672020-03-10 23:36:24 +103032void mctp_astlpc_destroy(struct mctp_binding_astlpc *astlpc);
Jeremy Kerr3b36d172019-09-04 11:56:09 +080033
34struct mctp_binding *mctp_binding_astlpc_core(struct mctp_binding_astlpc *b);
35
Jeremy Kerr672c8852019-03-01 12:18:07 +080036int mctp_astlpc_poll(struct mctp_binding_astlpc *astlpc);
37
Jeremy Kerrbc53d352019-08-28 14:26:14 +053038/* fileio-based interface */
39struct mctp_binding_astlpc *mctp_astlpc_init_fileio(void);
40int mctp_astlpc_get_fd(struct mctp_binding_astlpc *astlpc);
41
Jeremy Kerr672c8852019-03-01 12:18:07 +080042#ifdef __cplusplus
43}
44#endif
45
46#endif /* _LIBMCTP_ASTLPCL_H */