1 /*
2  * Copyright 2024 Meta Platforms, Inc. and its affiliates
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_DRIVERS_I3C_ERROR_TYPES_H_
8 #define ZEPHYR_INCLUDE_DRIVERS_I3C_ERROR_TYPES_H_
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * @brief I3C SDR Controller Error Types
16  *
17  * These are error types defined by the I3C specification.
18  *
19  * #I3C_ERROR_CE_UNKNOWN and #I3C_ERROR_CE_NONE are not
20  * official error types according to the specification.
21  * These are there simply to aid in error handling during
22  * interactions with the I3C drivers and subsystem.
23  */
24 enum i3c_sdr_controller_error_types {
25 	/** Transaction after sending CCC */
26 	I3C_ERROR_CE0,
27 
28 	/** Monitoring Error */
29 	I3C_ERROR_CE1,
30 
31 	/** No response to broadcast address (0x7E) */
32 	I3C_ERROR_CE2,
33 
34 	/** Failed Controller Handoff */
35 	I3C_ERROR_CE3,
36 
37 	/** Unknown error (not official error type) */
38 	I3C_ERROR_CE_UNKNOWN,
39 
40 	/** No error (not official error type) */
41 	I3C_ERROR_CE_NONE,
42 
43 	I3C_ERROR_CE_MAX = I3C_ERROR_CE_UNKNOWN,
44 	I3C_ERROR_CE_INVALID,
45 };
46 
47 /**
48  * @brief I3C SDR Target Error Types
49  *
50  * These are error types defined by the I3C specification.
51  *
52  * #I3C_ERROR_TE_UNKNOWN and #I3C_ERROR_TE_NONE are not
53  * official error types according to the specification.
54  * These are there simply to aid in error handling during
55  * interactions with the I3C drivers and subsystem.
56  */
57 enum i3c_sdr_target_error_types {
58 	/**
59 	 * Invalid Broadcast Address or
60 	 * Dynamic Address after DA assignment
61 	 */
62 	I3C_ERROR_TE0,
63 
64 	/** CCC type */
65 	I3C_ERROR_TE1,
66 
67 	/** Write Data */
68 	I3C_ERROR_TE2,
69 
70 	/** Assigned Address during Dynamic Address Arbitration */
71 	I3C_ERROR_TE3,
72 
73 	/** 0x7E/R missing after RESTART during Dynamic Address Arbitration */
74 	I3C_ERROR_TE4,
75 
76 	/** Transaction after detecting CCC */
77 	I3C_ERROR_TE5,
78 
79 	/** Monitoring Error */
80 	I3C_ERROR_TE6,
81 
82 	/** Dead Bus Recovery */
83 	I3C_ERROR_DBR,
84 
85 	/** Unknown error (not official error type) */
86 	I3C_ERROR_TE_UNKNOWN,
87 
88 	/** No error (not official error type) */
89 	I3C_ERROR_TE_NONE,
90 
91 	I3C_ERROR_TE_MAX = I3C_ERROR_TE_UNKNOWN,
92 	I3C_ERROR_TE_INVALID,
93 };
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* ZEPHYR_INCLUDE_DRIVERS_I3C_ERROR_TYPES_H_ */
100