diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-09-21 14:08:36 -0700 |
---|---|---|
committer | Tom Hughes <tomhughes@chromium.org> | 2022-09-22 12:59:38 -0700 |
commit | c453fd704268ef72de871b0c5ac7a989de662334 (patch) | |
tree | fcf6ce5810f9ff9e3c8cce434812dd75492269ed /util/uut/opr.c | |
parent | 6c1587ca70f558b4f96b3f0b18ad8b027d3ba99d (diff) | |
parent | 28712dae9d7ed1e694f7622cc083afa71090d4d5 (diff) | |
download | chrome-ec-firmware-fpmcu-dartmonkey-release.tar.gz |
Merge remote-tracking branch cros/main into firmware-fpmcu-dartmonkey-releasefirmware-fpmcu-dartmonkey-release
Generated by: ./util/update_release_branch.py --board dartmonkey --relevant_paths_file
./util/fingerprint-relevant-paths.txt firmware-fpmcu-dartmonkey-release
Relevant changes:
git log --oneline 6c1587ca70..28712dae9d -- board/nocturne_fp
board/dartmonkey common/fpsensor docs/fingerprint driver/fingerprint
util/getversion.sh
ded9307b79 util/getversion.sh: Fix version when not in a git repo
956055e692 board: change Google USB vendor info
71b2ef709d Update license boilerplate text in source code files
33e11afda0 Revert "fpsensor: Build fpsensor source file with C++"
c8d0360723 fpsensor: Build fpsensor source file with C++
bc113abd53 fpsensor: Fix g++ compiler error
150a58a0dc fpsensor: Fix fp_set_sensor_mode return type
b33b5ce85b fpsensor: Remove nested designators for C++ compatibility
2e864b2539 tree-wide: const-ify argv for console commands
56d8b360f9 test: Add test for get ikm failure when seed not set
3a3d6c3690 test: Add test for fpsensor trivial key failure
233e6bbd08 fpsensor_crypto: Abstract calls to hmac_SHA256
0a041b285b docs/fingerprint: Typo correction
c03fab67e2 docs/fingerprint: Fix the path of fputils.py
0b5d4baf5a util/getversion.sh: Fix empty file list handling
6e128fe760 FPMCU dev board environment with Satlab
3eb29b6aa5 builtin: Move ssize_t to sys/types.h
345d62ebd1 docs/fingerprint: Update power numbers for latest dartmonkey release
c25ffdb316 common: Conditionally support printf %l and %i modifiers
9a3c514b45 test: Add a test to check if the debugger is connected
54e603413f Move standard library tests to their own file
43fa6b4bf8 docs/fingerprint: Update power numbers for latest bloonchipper release
25536f9a84 driver/fingerprint/fpc/bep/fpc_sensor_spi.c: Format with clang-format
4face99efd driver/fingerprint/fpc/libfp/fpc_sensor_pal.h: Format with clang-format
738de2b575 trng: Rename rand to trng_rand
14b8270edd docs/fingerprint: Update dragonclaw power numbers
0b268f93d1 driver/fingerprint/fpc/libfp/fpc_private.c: Format with clang-format
f80da163f2 driver/fingerprint/fpc/libfp/fpc_private.h: Format with clang-format
a0751778f4 board/nocturne_fp/ro_workarounds.c: Format with clang-format
5e9c85c9b1 driver/fingerprint/fpc/libfp/fpc_sensor_pal.c: Format with clang-format
c1f9dd3cf8 driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h: Format with clang-format
eb1e1bed8d driver/fingerprint/fpc/libfp/fpc1145_private.h: Format with clang-format
6e7b611821 driver/fingerprint/fpc/bep/fpc_bio_algorithm.h: Format with clang-format
e0589cd5e2 driver/fingerprint/fpc/bep/fpc1035_private.h: Format with clang-format
58f0246dbe board/nocturne_fp/board_ro.c: Format with clang-format
7905e556a0 common/fpsensor/fpsensor_crypto.c: Format with clang-format
21289d170c driver/fingerprint/fpc/bep/fpc1025_private.h: Format with clang-format
98a20f937e common/fpsensor/fpsensor_state.c: Format with clang-format
a2d255d8af common/fpsensor/fpsensor.c: Format with clang-format
84e53a65da board/nocturne_fp/board.h: Format with clang-format
73055eeb3f driver/fingerprint/fpc/bep/fpc_private.c: Format with clang-format
0f7b5cb509 common/fpsensor/fpsensor_private.h: Format with clang-format
1ceade6e65 driver/fingerprint/fpc/bep/fpc_private.h: Format with clang-format
dca9d74321 Revert "trng: Rename rand to trng_rand"
a6b0b3554f trng: Rename rand to trng_rand
28d0b75b70 third_party/boringssl: Remove unused header
BRANCH=None
BUG=b:244387210 b:242720240 b:215613183 b:242720910 b:236386294
BUG=b:234181908 b:244781166 b:234781655 b:234143158 b:234181908
BUG=b:237344361 b:236025198 b:234181908 b:180945056 chromium:1098010
BUG=b:246424843 b:234181908 b:131913998
TEST=`make -j buildall`
TEST=./util/run_device_tests.py --board dartmonkey
Test "aes": PASSED
Test "cec": PASSED
Test "cortexm_fpu": PASSED
Test "crc": PASSED
Test "flash_physical": PASSED
Test "flash_write_protect": PASSED
Test "fpsensor_hw": PASSED
Test "fpsensor_spi_ro": PASSED
Test "fpsensor_spi_rw": PASSED
Test "fpsensor_uart_ro": PASSED
Test "fpsensor_uart_rw": PASSED
Test "mpu_ro": PASSED
Test "mpu_rw": PASSED
Test "mutex": PASSED
Test "pingpong": PASSED
Test "printf": PASSED
Test "queue": PASSED
Test "rollback_region0": PASSED
Test "rollback_region1": PASSED
Test "rollback_entropy": PASSED
Test "rtc": PASSED
Test "sha256": PASSED
Test "sha256_unrolled": PASSED
Test "static_if": PASSED
Test "stdlib": PASSED
Test "system_is_locked_wp_on": PASSED
Test "system_is_locked_wp_off": PASSED
Test "timer_dos": PASSED
Test "utils": PASSED
Test "utils_str": PASSED
Test "panic_data_dartmonkey_v2.0.2887": PASSED
Test "panic_data_nocturne_fp_v2.2.64": PASSED
Test "panic_data_nami_fp_v2.2.144": PASSED
Force-Relevant-Builds: all
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I2c312583a709fedae8fe11d92c22328c3b634bc7
Diffstat (limited to 'util/uut/opr.c')
-rw-r--r-- | util/uut/opr.c | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/util/uut/opr.c b/util/uut/opr.c index 5c979afb16..8ad60bd3d4 100644 --- a/util/uut/opr.c +++ b/util/uut/opr.c @@ -1,5 +1,5 @@ /* - * Copyright 2018 The Chromium OS Authors. All rights reserved. + * Copyright 2018 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -34,7 +34,7 @@ int port_handle = INVALID_HANDLE_VALUE; *--------------------------------------------------------------------------- */ #define MAX_PORT_NAME_SIZE 32 -#define OPR_TIMEOUT 10L /* 10 seconds */ +#define OPR_TIMEOUT 10L /* 10 seconds */ #define FLASH_ERASE_TIMEOUT 120L /* 120 seconds */ #define STS_MSG_MIN_SIZE 8 @@ -119,9 +119,8 @@ bool opr_open_port(const char *port_name, struct comport_fields port_cfg) if (port_handle <= 0) { display_color_msg(FAIL, "\nERROR: COM Port failed to open.\n"); - DISPLAY_MSG( - ("Please select the right serial port or check if " - "other serial\n")); + DISPLAY_MSG(("Please select the right serial port or check if " + "other serial\n")); DISPLAY_MSG(("communication applications are opened.\n")); return false; } @@ -150,13 +149,13 @@ bool opr_write_chunk(uint8_t *buffer, uint32_t addr, uint32_t size) struct command_node wr_cmd_buf; if (size > MAX_RW_DATA_SIZE) { - display_color_msg(FAIL, - "ERROR: Block cannot exceed %d\n", MAX_RW_DATA_SIZE); + display_color_msg(FAIL, "ERROR: Block cannot exceed %d\n", + MAX_RW_DATA_SIZE); } /* Initialize response size */ wr_cmd_buf.resp_size = 1; - cmd_create_write(addr, size, buffer, - wr_cmd_buf.cmd, &wr_cmd_buf.cmd_size); + cmd_create_write(addr, size, buffer, wr_cmd_buf.cmd, + &wr_cmd_buf.cmd_size); return opr_send_cmds(&wr_cmd_buf, 1); } @@ -179,13 +178,13 @@ bool opr_read_chunk(uint8_t *buffer, uint32_t addr, uint32_t size) struct command_node rd_cmd_buf; if (size > MAX_RW_DATA_SIZE) { - display_color_msg(FAIL, - "ERROR: Block cannot exceed %d\n", MAX_RW_DATA_SIZE); + display_color_msg(FAIL, "ERROR: Block cannot exceed %d\n", + MAX_RW_DATA_SIZE); return false; } - cmd_create_read(addr, ((uint8_t)size - 1), - rd_cmd_buf.cmd, &rd_cmd_buf.cmd_size); + cmd_create_read(addr, ((uint8_t)size - 1), rd_cmd_buf.cmd, + &rd_cmd_buf.cmd_size); rd_cmd_buf.resp_size = size + 3; if (opr_send_cmds(&rd_cmd_buf, 1)) { if (resp_buf[0] == (uint8_t)(UFPP_READ_CMD)) { @@ -228,7 +227,7 @@ void opr_write_mem(uint8_t *buffer, uint32_t addr, uint32_t size) wr_cmd_buf.resp_size = 1; DISPLAY_MSG(("Writing [%d] bytes in [%d] packets\n", size, - ((size + (block_size - 1)) / block_size))); + ((size + (block_size - 1)) / block_size))); /* Read first token from string */ if (console) @@ -248,21 +247,21 @@ void opr_write_mem(uint8_t *buffer, uint32_t addr, uint32_t size) /* Prepare the next iteration */ token = strtok(NULL, seps); } - write_size = (size_remain > block_size) ? - block_size : size_remain; + write_size = (size_remain > block_size) ? block_size : + size_remain; if (console) { cmd_create_write(cur_addr, write_size, data_buf, - wr_cmd_buf.cmd, &wr_cmd_buf.cmd_size); + wr_cmd_buf.cmd, &wr_cmd_buf.cmd_size); } else { cmd_create_write(cur_addr, write_size, buffer, - wr_cmd_buf.cmd, &wr_cmd_buf.cmd_size); + wr_cmd_buf.cmd, &wr_cmd_buf.cmd_size); buffer += write_size; } if (opr_send_cmds(&wr_cmd_buf, 1) != true) break; cmd_disp_write(resp_buf, write_size, cmd_idx, - ((size + (block_size - 1)) / block_size)); + ((size + (block_size - 1)) / block_size)); cur_addr += write_size; size_remain -= write_size; cmd_idx++; @@ -302,7 +301,8 @@ void opr_read_mem(char *output, uint32_t addr, uint32_t size) output_file_id = fopen(output, "w+b"); if (output_file_id == NULL) { - display_color_msg(FAIL, + display_color_msg( + FAIL, "ERROR: could not open output file [%s]\n", output); return; @@ -310,21 +310,22 @@ void opr_read_mem(char *output, uint32_t addr, uint32_t size) } DISPLAY_MSG(("Reading [%d] bytes in [%d] packets\n", size, - ((size + (MAX_RW_DATA_SIZE - 1)) / MAX_RW_DATA_SIZE))); + ((size + (MAX_RW_DATA_SIZE - 1)) / MAX_RW_DATA_SIZE))); for (cur_addr = addr; cur_addr < (addr + size); - cur_addr += MAX_RW_DATA_SIZE) { + cur_addr += MAX_RW_DATA_SIZE) { bytes_left = (uint32_t)(addr + size - cur_addr); read_size = MIN(bytes_left, MAX_RW_DATA_SIZE); cmd_create_read(cur_addr, ((uint8_t)read_size - 1), - rd_cmd_buf.cmd, &rd_cmd_buf.cmd_size); + rd_cmd_buf.cmd, &rd_cmd_buf.cmd_size); rd_cmd_buf.resp_size = read_size + 3; if (opr_send_cmds(&rd_cmd_buf, 1) != true) break; - cmd_disp_read(resp_buf, read_size, cmd_idx, + cmd_disp_read( + resp_buf, read_size, cmd_idx, ((size + (MAX_RW_DATA_SIZE - 1)) / MAX_RW_DATA_SIZE)); if (console) @@ -386,8 +387,8 @@ bool opr_execute_return(uint32_t addr) * Check the response command code is UFPP_FCALL_RSLT_CMD and * the return value from monitor is 0x03. (program finish and verify ok) */ - if (resp_buf[1] != (uint8_t)(UFPP_FCALL_RSLT_CMD) - || resp_buf[2] != 0x03) + if (resp_buf[1] != (uint8_t)(UFPP_FCALL_RSLT_CMD) || + resp_buf[2] != 0x03) return false; return true; } @@ -473,29 +474,31 @@ bool opr_scan_baudrate(void) sr = opr_check_sync(baud); step = (baud * BR_BIG_STEP) / 100; if (sr == SR_OK) { - printf("SR_OK: Baud rate - %d, resp_buf - 0x%x\n", - baud, resp_buf[0]); + printf("SR_OK: Baud rate - %d, resp_buf - 0x%x\n", baud, + resp_buf[0]); synched = true; step = (baud * BR_SMALL_STEP) / 100; } else if (sr == SR_WRONG_DATA) { printf("SR_WRONG_DATA: Baud rate - %d, resp_buf - " - "0x%x\n", baud, resp_buf[0]); + "0x%x\n", + baud, resp_buf[0]); data_received = true; step = (baud * BR_MEDIUM_STEP) / 100; } else if (sr == SR_TIMEOUT) { printf("SR_TIMEOUT: Baud rate - %d, resp_buf - 0x%x\n", - baud, resp_buf[0]); + baud, resp_buf[0]); if (synched || data_received) break; } else if (sr == SR_ERROR) { printf("SR_ERROR: Baud rate - %d, resp_buf - 0x%x\n", - baud, resp_buf[0]); + baud, resp_buf[0]); if (synched || data_received) break; } else printf("Unknown error code: Baud rate - %d, resp_buf - " - "0x%x\n", baud, resp_buf[0]); + "0x%x\n", + baud, resp_buf[0]); } return true; @@ -524,7 +527,7 @@ static bool opr_send_cmds(struct command_node *cmd_buf, uint32_t cmd_num) for (cmd = 0; cmd < cmd_num; cmd++, cur_cmd++) { if (com_port_write_bin(port_handle, cur_cmd->cmd, - cur_cmd->cmd_size) == true) { + cur_cmd->cmd_size) == true) { time(&start); do { @@ -533,15 +536,17 @@ static bool opr_send_cmds(struct command_node *cmd_buf, uint32_t cmd_num) } while ((read < cur_cmd->resp_size) && (elapsed_time <= OPR_TIMEOUT)); com_port_read_bin(port_handle, resp_buf, - cur_cmd->resp_size); + cur_cmd->resp_size); if (elapsed_time > OPR_TIMEOUT) - display_color_msg(FAIL, + display_color_msg( + FAIL, "ERROR: [%d] bytes received for read, " "[%d] bytes are expected\n", read, cur_cmd->resp_size); } else { - display_color_msg(FAIL, + display_color_msg( + FAIL, "ERROR: Failed to send Command number %d\n", cmd); return false; |