FILE
cros_ec_proto_test_util.h
File preview with syntax highlighting.
linux-6.19.14/drivers/platform/chrome/cros_ec_proto_test_util.h
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * CrOS Kunit tests utilities. 4 */ 5 6#ifndef _CROS_KUNIT_UTIL_H_ 7#define _CROS_KUNIT_UTIL_H_ 8 9#include <linux/platform_data/cros_ec_proto.h> 10 11struct ec_xfer_mock { 12 struct list_head list; 13 struct kunit *test; 14 15 /* input */ 16 void *i_data; 17 18 /* output */ 19 int ret; 20 int result; 21 void *o_data; 22 u32 o_data_len; 23 24 /* input */ 25 /* Must be last -ends in a flexible-array member. */ 26 struct cros_ec_command msg; 27}; 28 29extern int cros_kunit_ec_xfer_mock_default_result; 30extern int cros_kunit_ec_xfer_mock_default_ret; 31extern int cros_kunit_ec_cmd_xfer_mock_called; 32extern int cros_kunit_ec_pkt_xfer_mock_called; 33 34int cros_kunit_ec_xfer_mock(struct cros_ec_device *ec_dev, struct cros_ec_command *msg); 35int cros_kunit_ec_cmd_xfer_mock(struct cros_ec_device *ec_dev, struct cros_ec_command *msg); 36int cros_kunit_ec_pkt_xfer_mock(struct cros_ec_device *ec_dev, struct cros_ec_command *msg); 37struct ec_xfer_mock *cros_kunit_ec_xfer_mock_add(struct kunit *test, size_t size); 38struct ec_xfer_mock *cros_kunit_ec_xfer_mock_addx(struct kunit *test, 39 int ret, int result, size_t size); 40struct ec_xfer_mock *cros_kunit_ec_xfer_mock_next(void); 41 42extern int cros_kunit_readmem_mock_offset; 43extern u8 *cros_kunit_readmem_mock_data; 44extern int cros_kunit_readmem_mock_ret; 45 46int cros_kunit_readmem_mock(struct cros_ec_device *ec_dev, unsigned int offset, 47 unsigned int bytes, void *dest); 48 49void cros_kunit_mock_reset(void); 50 51#endif
~/
Read-only file preview.