1 /* SPDX-License-Identifier: GPL-2.0 */
3 * CrOS Kunit tests utilities.
6 #ifndef _CROS_KUNIT_UTIL_H_
7 #define _CROS_KUNIT_UTIL_H_
9 #include <linux/platform_data/cros_ec_proto.h>
12 struct list_head list
;
16 struct cros_ec_command msg
;
26 extern int cros_kunit_ec_xfer_mock_default_result
;
27 extern int cros_kunit_ec_xfer_mock_default_ret
;
28 extern int cros_kunit_ec_cmd_xfer_mock_called
;
29 extern int cros_kunit_ec_pkt_xfer_mock_called
;
31 int cros_kunit_ec_xfer_mock(struct cros_ec_device
*ec_dev
, struct cros_ec_command
*msg
);
32 int cros_kunit_ec_cmd_xfer_mock(struct cros_ec_device
*ec_dev
, struct cros_ec_command
*msg
);
33 int cros_kunit_ec_pkt_xfer_mock(struct cros_ec_device
*ec_dev
, struct cros_ec_command
*msg
);
34 struct ec_xfer_mock
*cros_kunit_ec_xfer_mock_add(struct kunit
*test
, size_t size
);
35 struct ec_xfer_mock
*cros_kunit_ec_xfer_mock_addx(struct kunit
*test
,
36 int ret
, int result
, size_t size
);
37 struct ec_xfer_mock
*cros_kunit_ec_xfer_mock_next(void);
39 extern int cros_kunit_readmem_mock_offset
;
40 extern u8
*cros_kunit_readmem_mock_data
;
41 extern int cros_kunit_readmem_mock_ret
;
43 int cros_kunit_readmem_mock(struct cros_ec_device
*ec_dev
, unsigned int offset
,
44 unsigned int bytes
, void *dest
);
46 void cros_kunit_mock_reset(void);