diff options
author | Namyoon Woo <namyoon@google.com> | 2020-03-07 21:08:56 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-10 23:19:07 +0000 |
commit | 72e5fc940ab60c5b3ea659a27033f74786c45323 (patch) | |
tree | 21382849d4983e7fb417d080d7d5ea8bb1337e81 /include/ec_comm.h | |
parent | c2aa02c9118a32d6ff4b0d5d55345bfd667ab6b8 (diff) | |
download | chrome-ec-72e5fc940ab60c5b3ea659a27033f74786c45323.tar.gz |
move ec_comm implementation to common directory
This patch moves ec_comm.c and ec_efs.c from board/cr50 to common/,
so that they can be shared with other board configuration (like host).
This is to build unittest for those files.
BUG=none
BRANCH=cr50
TEST=make buildall -j
Signed-off-by: Namyoon Woo <namyoon@chromium.org>
Change-Id: I67ac313054ebe4604848a176f0a42e3483957e74
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2094076
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'include/ec_comm.h')
-rw-r--r-- | include/ec_comm.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/ec_comm.h b/include/ec_comm.h new file mode 100644 index 0000000000..263d311e63 --- /dev/null +++ b/include/ec_comm.h @@ -0,0 +1,45 @@ +/* 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 __CROS_EC_COMM_H +#define __CROS_EC_COMM_H +#include <stdint.h> +#include "common.h" +/* GPIO Interrupt handler for GPIO_EC_PACKET_MODE_EN rising edge */ +void ec_comm_packet_mode_en(enum gpio_signal unsed); +/* GPIO Interrupt handler for GPIO_EC_PACKET_MODE_DIS falling edge */ +void ec_comm_packet_mode_dis(enum gpio_signal unsed); +/* + * Return True if the given UART is in packet mode, in which EC-CR50 + * communication is on-going. + */ +int ec_comm_is_uart_in_packet_mode(int uart); +/* + * Try to process the given char as a EC-CR50 communication packet. + * If EC-CR50 communication is broken or uninitiated yet, then + * it does not process it. + * + * @return 1 if the given char was detected and processed as a part of packet. + * 0 otherwise. + */ +int ec_comm_process_packet(uint8_t ch); +/* + * Block or unblock EC-CR50 communication. + * @param block non-zero value blocks EC-CR50 communication. + * Zero value unblocks it. + */ +void ec_comm_block(int block); +/* Reset EC EFS context */ +void ec_efs_reset(void); +/* Set EC-EFS boot_mode */ +uint16_t ec_efs_set_boot_mode(const char *data, const uint8_t size); +/* Verify the given hash data against the EC-FW hash from kernel secdata */ +uint16_t ec_efs_verify_hash(const char *hash_data, const uint8_t size); + +/* Re-load EC Hash code from TPM Kernel Secdata */ +void ec_efs_refresh(void); +/* print EC-EFS status */ +void ec_efs_print_status(void); + +#endif /* __CROS_EC_COMM_H */ |