summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/include/test/drivers/tcpci_test_common.h
blob: e39738a9d52f7f2f83e3151af97e818f558134e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __TCPCI_TEST_COMMON_H
#define __TCPCI_TEST_COMMON_H

#include "stubs.h"

/**
 * @brief Check TCPC register value using zassert API
 *
 * @param emul Pointer to TCPCI emulator
 * @param reg TCPC register address to check
 * @param exp_val Expected value of register
 * @param line Line number to print in case of failure
 */
void check_tcpci_reg_f(const struct emul *emul, int reg, uint16_t exp_val,
		       int line);
#define check_tcpci_reg(emul, reg, exp_val)			\
	check_tcpci_reg_f((emul), (reg), (exp_val), __LINE__)

/**
 * @brief Check TCPC register value with mask using zassert API
 *
 * @param emul Pointer to TCPCI emulator
 * @param reg TCPC register address to check
 * @param exp_val Expected value of register
 * @param mask Bits that are checked
 * @param line Line number to print in case of failure
 */
void check_tcpci_reg_with_mask_f(const struct emul *emul, int reg,
				 uint16_t exp_val, uint16_t mask, int line);
#define check_tcpci_reg_with_mask(emul, reg, exp_val, mask)		\
	check_tcpci_reg_with_mask_f((emul), (reg), (exp_val), (mask), __LINE__)

/**
 * @brief Test TCPCI init and vbus level callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_init(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI release callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_release(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI get cc callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_get_cc(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI set cc callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_set_cc(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI set polarity callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_set_polarity(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI set vconn callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_set_vconn(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI set msg header callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_set_msg_header(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI rx and sop prime enable callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_set_rx_detect(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI get raw message from TCPC callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_get_rx_message_raw(const struct emul *emul,
				   enum usbc_port port);

/**
 * @brief Test TCPCI transmitting message from TCPC callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_transmit(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI alert callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_alert(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI alert RX message callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_alert_rx_message(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI auto discharge on disconnect callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_auto_discharge(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI drp toggle callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_drp_toggle(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI get chip info callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_get_chip_info(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI enter low power mode callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_low_power_mode(const struct emul *emul, enum usbc_port port);

/**
 * @brief Test TCPCI set bist test mode callback
 *
 * @param emul Pointer to TCPCI emulator
 * @param port Select USBC port that will be used to obtain tcpm_drv from
 *             tcpc_config
 */
void test_tcpci_set_bist_mode(const struct emul *emul, enum usbc_port port);

#endif /* __TCPCI_TEST_COMMON_H */