summaryrefslogtreecommitdiff
path: root/test/usb_tcpmv2_td_pd_src3_e32.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/usb_tcpmv2_td_pd_src3_e32.c')
-rw-r--r--test/usb_tcpmv2_td_pd_src3_e32.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/test/usb_tcpmv2_td_pd_src3_e32.c b/test/usb_tcpmv2_td_pd_src3_e32.c
index 9ade7b83c8..395a251b22 100644
--- a/test/usb_tcpmv2_td_pd_src3_e32.c
+++ b/test/usb_tcpmv2_td_pd_src3_e32.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,18 +10,17 @@
#include "timer.h"
#include "usb_tcpmv2_compliance.h"
-#define PD_T_CHUNK_RECEIVER_REQUEST_MAX (15 * MSEC)
-#define PD_T_CHUNK_SENDER_RSP_MAX (30 * MSEC)
-#define PD_T_CHUNKING_NOT_SUPPORTED_MIN (40 * MSEC)
-#define PD_T_CHUNKING_NOT_SUPPORTED_MAX (50 * MSEC)
+#define PD_T_CHUNK_RECEIVER_REQUEST_MAX (15 * MSEC)
+#define PD_T_CHUNK_SENDER_RSP_MAX (30 * MSEC)
+#define PD_T_CHUNKING_NOT_SUPPORTED_MIN (40 * MSEC)
+#define PD_T_CHUNKING_NOT_SUPPORTED_MAX (50 * MSEC)
static void setup_chunk_msg(int chunk, char *data)
{
int i;
int base_msg_byte = chunk * PD_MAX_EXTENDED_MSG_CHUNK_LEN;
- *(uint16_t *)data = PD_EXT_HEADER(chunk, 0,
- PD_MAX_EXTENDED_MSG_LEN);
+ *(uint16_t *)data = PD_EXT_HEADER(chunk, 0, PD_MAX_EXTENDED_MSG_LEN);
for (i = 0; i < PD_MAX_EXTENDED_MSG_CHUNK_LEN; ++i) {
int val = (i + base_msg_byte) % 256;
@@ -85,12 +84,8 @@ int test_td_pd_src3_e32(void)
possible[1].ctrl_msg = 0;
possible[1].data_msg = 0x1F;
- TEST_EQ(verify_tcpci_possible_tx(possible,
- 2,
- &found_index,
- data,
- sizeof(data),
- &msg_len,
+ TEST_EQ(verify_tcpci_possible_tx(possible, 2, &found_index, data,
+ sizeof(data), &msg_len,
PD_T_CHUNKING_NOT_SUPPORTED_MAX),
EC_SUCCESS, "%d");
mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS);
@@ -112,7 +107,7 @@ int test_td_pd_src3_e32(void)
* tChunkReceiverRequest max (15ms), the test fails.
*/
TEST_ASSERT((get_time().val - start_time) <=
- PD_T_CHUNK_RECEIVER_REQUEST_MAX);
+ PD_T_CHUNK_RECEIVER_REQUEST_MAX);
while (chunk < 4) {
int next_chunk;
@@ -130,12 +125,9 @@ int test_td_pd_src3_e32(void)
setup_chunk_msg(chunk, data);
partner_send_msg(TCPCI_MSG_SOP, 0x1F, 7, 1, (uint32_t *)data);
- TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP,
- 0x1F,
- data,
- sizeof(data),
- &msg_len,
- PD_T_CHUNK_RECEIVER_REQUEST_MAX),
+ TEST_EQ(verify_tcpci_tx_with_data(
+ TCPCI_MSG_SOP, 0x1F, data, sizeof(data),
+ &msg_len, PD_T_CHUNK_RECEIVER_REQUEST_MAX),
EC_SUCCESS, "%d");
mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS);
@@ -159,12 +151,9 @@ int test_td_pd_src3_e32(void)
* i) If a message is not received within tChunkReceiverRequest max,
* the test fails.
*/
- TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP,
- 0x1F,
- data,
- sizeof(data),
- &msg_len,
- PD_T_CHUNK_RECEIVER_REQUEST_MAX),
+ TEST_EQ(verify_tcpci_tx_with_data(TCPCI_MSG_SOP, 0x1F, data,
+ sizeof(data), &msg_len,
+ PD_T_CHUNK_RECEIVER_REQUEST_MAX),
EC_SUCCESS, "%d");
mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS);
@@ -207,9 +196,7 @@ int test_td_pd_src3_e32(void)
* Number of Data Objects field
*/
header = *(uint32_t *)&data[1];
- TEST_EQ(msg_len - 3,
- PD_HEADER_CNT(header) * 4,
- "%d");
+ TEST_EQ(msg_len - 3, PD_HEADER_CNT(header) * 4, "%d");
/*
* 4. The last 2 bytes of the Data Object are 0