Jeremy Kerr | 3d36ee2 | 2019-05-30 11:15:37 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ |
Jeremy Kerr | 672c885 | 2019-03-01 12:18:07 +0800 | [diff] [blame] | 2 | |
| 3 | #ifndef _LIBMCTP_ASTLPCL_H |
| 4 | #define _LIBMCTP_ASTLPCL_H |
| 5 | |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
Jeremy Kerr | 8682ef2 | 2019-05-30 17:46:44 +0800 | [diff] [blame] | 10 | #include <libmctp.h> |
Jeremy Kerr | 672c885 | 2019-03-01 12:18:07 +0800 | [diff] [blame] | 11 | |
| 12 | struct mctp_binding_astlpc; |
| 13 | |
Jeremy Kerr | bc53d35 | 2019-08-28 14:26:14 +0530 | [diff] [blame] | 14 | enum mctp_binding_astlpc_kcs_reg { |
| 15 | MCTP_ASTLPC_KCS_REG_DATA = 0, |
| 16 | MCTP_ASTLPC_KCS_REG_STATUS = 1, |
| 17 | }; |
| 18 | |
| 19 | struct 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 Jeffery | 06b2cd8 | 2020-03-17 23:12:27 +1030 | [diff] [blame] | 24 | 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 Kerr | bc53d35 | 2019-08-28 14:26:14 +0530 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | struct mctp_binding_astlpc *mctp_astlpc_init_ops( |
Andrew Jeffery | a045249 | 2020-02-06 11:47:39 +1030 | [diff] [blame] | 29 | const struct mctp_binding_astlpc_ops *ops, |
Jeremy Kerr | bc53d35 | 2019-08-28 14:26:14 +0530 | [diff] [blame] | 30 | void *ops_data, void *lpc_map); |
Andrew Jeffery | 4663f67 | 2020-03-10 23:36:24 +1030 | [diff] [blame] | 31 | void mctp_astlpc_destroy(struct mctp_binding_astlpc *astlpc); |
Jeremy Kerr | 3b36d17 | 2019-09-04 11:56:09 +0800 | [diff] [blame] | 32 | |
| 33 | struct mctp_binding *mctp_binding_astlpc_core(struct mctp_binding_astlpc *b); |
| 34 | |
Jeremy Kerr | 672c885 | 2019-03-01 12:18:07 +0800 | [diff] [blame] | 35 | int mctp_astlpc_poll(struct mctp_binding_astlpc *astlpc); |
| 36 | |
Jeremy Kerr | bc53d35 | 2019-08-28 14:26:14 +0530 | [diff] [blame] | 37 | /* fileio-based interface */ |
| 38 | struct mctp_binding_astlpc *mctp_astlpc_init_fileio(void); |
| 39 | int mctp_astlpc_get_fd(struct mctp_binding_astlpc *astlpc); |
| 40 | |
Jeremy Kerr | 672c885 | 2019-03-01 12:18:07 +0800 | [diff] [blame] | 41 | #ifdef __cplusplus |
| 42 | } |
| 43 | #endif |
| 44 | |
Andrew Jeffery | 0ddd07e | 2020-05-25 19:53:34 +0930 | [diff] [blame] | 45 | #endif /* _LIBMCTP_ASTLPC_H */ |