xref: /illumos-gate/usr/src/test/i2c-tests/tests/ioctl/i2c_ioctl_util.h (revision 0cbe48189888d02563dba9c90132ac391ba233b6)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2025 Oxide Computer Company
14  */
15 
16 #ifndef _I2C_IOCTL_UTIL_H
17 #define	_I2C_IOCTL_UTIL_H
18 
19 /*
20  * Misc. utility functions to aid our ioctl tests
21  */
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef struct {
28 	uint16_t ba_type;
29 	uint16_t ba_addr;
30 	i2c_errno_t ba_error;
31 } bad_addr_t;
32 
33 extern const bad_addr_t bad_addrs[];
34 extern const size_t nbad_addrs;
35 
36 typedef enum {
37 	I2C_D_CTRL,
38 	I2C_D_PORT,
39 	I2C_D_MUX,
40 	I2C_D_DEVICE,
41 	/*
42 	 * This is meant just for internal uses in the enumeration. Don't use it
43 	 * explicitly.
44 	 */
45 	I2C_D_OTHER
46 } i2c_dev_t;
47 
48 extern int i2c_ioctl_test_get_fd(i2c_dev_t, const char *, int);
49 
50 /*
51  * Path for di_init() to the i2csim driver.
52  */
53 extern const char *i2c_sim_dipath;
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif /* _I2C_IOCTL_UTIL_H */
60