blob: 23fe642426cef160f4136a45469bb357b3e4ba22 [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 Kerr8682ef22019-05-30 17:46:44 +080010#include <libmctp.h>
Jeremy Kerr672c8852019-03-01 12:18:07 +080011
12struct mctp_binding_astlpc;
13
Jeremy Kerrbc53d352019-08-28 14:26:14 +053014enum mctp_binding_astlpc_kcs_reg {
15 MCTP_ASTLPC_KCS_REG_DATA = 0,
16 MCTP_ASTLPC_KCS_REG_STATUS = 1,
17};
18
19struct mctp_binding_astlpc_ops {
20 int (*kcs_read)(void *data, enum mctp_binding_astlpc_kcs_reg reg,
21 uint8_t *val);
22 int (*kcs_write)(void *data, enum mctp_binding_astlpc_kcs_reg reg,
23 uint8_t val);
Andrew Jeffery06b2cd82020-03-17 23:12:27 +103024 int (*lpc_read)(void *data, void *buf, long offset, size_t len);
25 int (*lpc_write)(void *data, void *buf, long offset, size_t len);
Jeremy Kerrbc53d352019-08-28 14:26:14 +053026};
27
28struct mctp_binding_astlpc *mctp_astlpc_init_ops(
Andrew Jefferya0452492020-02-06 11:47:39 +103029 const struct mctp_binding_astlpc_ops *ops,
Jeremy Kerrbc53d352019-08-28 14:26:14 +053030 void *ops_data, void *lpc_map);
Andrew Jeffery4663f672020-03-10 23:36:24 +103031void mctp_astlpc_destroy(struct mctp_binding_astlpc *astlpc);
Jeremy Kerr3b36d172019-09-04 11:56:09 +080032
33struct mctp_binding *mctp_binding_astlpc_core(struct mctp_binding_astlpc *b);
34
Jeremy Kerr672c8852019-03-01 12:18:07 +080035int mctp_astlpc_poll(struct mctp_binding_astlpc *astlpc);
36
Jeremy Kerrbc53d352019-08-28 14:26:14 +053037/* fileio-based interface */
38struct mctp_binding_astlpc *mctp_astlpc_init_fileio(void);
39int mctp_astlpc_get_fd(struct mctp_binding_astlpc *astlpc);
40
Jeremy Kerr672c8852019-03-01 12:18:07 +080041#ifdef __cplusplus
42}
43#endif
44
Andrew Jeffery0ddd07e2020-05-25 19:53:34 +093045#endif /* _LIBMCTP_ASTLPC_H */