summaryrefslogtreecommitdiff
path: root/test/usb_tcpmv2_compliance.h
blob: 1426b9f825675632b3d614ae973d25e517e7cc34 (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
/* Copyright 2020 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 USB_TCPMV2_COMPLIANCE_H
#define USB_TCPMV2_COMPLIANCE_H

#define PORT0 0

enum mock_cc_state {
	MOCK_CC_SRC_OPEN = 0,
	MOCK_CC_SNK_OPEN = 0,
	MOCK_CC_SRC_RA = 1,
	MOCK_CC_SNK_RP_DEF = 1,
	MOCK_CC_SRC_RD = 2,
	MOCK_CC_SNK_RP_1_5 = 2,
	MOCK_CC_SNK_RP_3_0 = 3,
};
enum mock_connect_result {
	MOCK_CC_DUT_IS_SRC = 0,
	MOCK_CC_DUT_IS_SNK = 1,
};


extern int partner_tx_id;

extern uint32_t rdo;
extern uint32_t pdo;

extern const struct tcpc_config_t tcpc_config[];
extern const struct usb_mux usb_muxes[];


void mock_set_cc(enum mock_connect_result cr,
	enum mock_cc_state cc1, enum mock_cc_state cc2);
void mock_set_role(int drp, enum tcpc_rp_value rp,
	enum tcpc_cc_pull cc1, enum tcpc_cc_pull cc2);
void mock_set_alert(int alert);
uint16_t tcpc_get_alert_status(void);
bool vboot_allow_usb_pd(void);
int pd_check_vconn_swap(int port);
void board_reset_pd_mcu(void);


int tcpci_startup(void);

void partner_set_data_role(enum pd_data_role data_role);
enum pd_data_role partner_get_data_role(void);

void partner_set_power_role(enum pd_power_role power_role);
enum pd_power_role partner_get_power_role(void);

void partner_set_pd_rev(enum pd_rev_type pd_rev);
enum pd_rev_type partner_get_pd_rev(void);

void partner_send_msg(enum pd_msg_type sop,
		      uint16_t type,
		      uint16_t cnt,
		      uint16_t ext,
		      uint32_t *payload);

int proc_pd_e1(enum pd_data_role data_role);
int proc_pd_e3(void);

int test_td_pd_ll_e3_dfp(void);
int test_td_pd_ll_e3_ufp(void);
int test_td_pd_ll_e4_dfp(void);
int test_td_pd_ll_e4_ufp(void);
int test_td_pd_src3_e26(void);
int test_td_pd_snk3_e12(void);

int test_connect_as_nonpd_sink(void);
int test_retry_count_sop(void);
int test_retry_count_hard_reset(void);

#endif /* USB_TCPMV2_COMPLIANCE_H */