diff options
Diffstat (limited to 'common/mock/usb_tc_sm_mock.c')
-rw-r--r-- | common/mock/usb_tc_sm_mock.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/common/mock/usb_tc_sm_mock.c b/common/mock/usb_tc_sm_mock.c new file mode 100644 index 0000000000..88326cebe1 --- /dev/null +++ b/common/mock/usb_tc_sm_mock.c @@ -0,0 +1,38 @@ +/* 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. + */ + +/* Mock USB TC state machine */ + +#include "common.h" +#include "console.h" +#include "usb_tc_sm.h" +#include "mock/usb_tc_sm_mock.h" +#include "memory.h" + +#ifndef CONFIG_COMMON_RUNTIME +#define cprints(format, args...) +#endif + +struct mock_tc_port_t mock_tc_port[CONFIG_USB_PD_PORT_MAX_COUNT]; + +enum pd_cable_plug tc_get_cable_plug(int port) +{ + return PD_PLUG_FROM_DFP_UFP; +} + +uint8_t tc_get_pd_enabled(int port) +{ + return mock_tc_port[port].pd_enable; +} + +void typec_select_src_collision_rp(int port, enum tcpc_rp_value rp) +{ + mock_tc_port[port].lcl_rp = rp; +} + +int typec_update_cc(int port) +{ + return EC_SUCCESS; +} |