summaryrefslogtreecommitdiff
path: root/include/mock/tcpm_mock.h
blob: 7fd89919f5954aae9adce4fb78fa6f711546d0c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* 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 for the TCPM interface */

#include "common.h"
#include "tcpm/tcpm.h"

/* Copied from usb_prl_sm.c, line 99. */
#define MOCK_CHK_BUF_SIZE 7

/* Define a struct to hold the data we need to control the mocks. */
struct mock_tcpm_t {
	uint32_t mock_rx_chk_buf[MOCK_CHK_BUF_SIZE];
	uint32_t mock_header;
	int mock_has_pending_message;
};

extern struct mock_tcpm_t mock_tcpm[CONFIG_USB_PD_PORT_MAX_COUNT];

void mock_tcpm_reset(void);
void mock_tcpm_rx_msg(int port, uint16_t header, int cnt, const uint32_t *data);