diff options
author | Sam Hurst <shurst@google.com> | 2020-02-24 08:51:03 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-25 03:34:36 +0000 |
commit | f6ee241a55abb590917cb8ffbf13c22f2f52bc57 (patch) | |
tree | 499adaabe0364fb5386587b29a0a98826b0429f2 /include/usb_common.h | |
parent | a51fa30d71c486bd256a4922a1feb6f9f36b7a7d (diff) | |
download | chrome-ec-f6ee241a55abb590917cb8ffbf13c22f2f52bc57.tar.gz |
TCPMv1/v2: Move hex8tou32 and remote_flashing to common file
BUG=chromium:1021235
BRANCH=none
TEST=make buildall -j
Signed-off-by: Sam Hurst <shurst@google.com>
Change-Id: Ia243d5062c77d8f6b8299fbd131cabfdbcffb01e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2070452
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Sam Hurst <shurst@google.com>
Diffstat (limited to 'include/usb_common.h')
-rw-r--r-- | include/usb_common.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/usb_common.h b/include/usb_common.h index c70826a158..5078ff071e 100644 --- a/include/usb_common.h +++ b/include/usb_common.h @@ -50,6 +50,31 @@ struct pd_pref_config_t { enum pd_pref_type type; }; +/* + * This function converts an 8 character ascii string with hex digits, without + * the 0x prefix, into a signed 32-bit number. + * + * @param str pointer to hex string to convert + * @param val pointer to where the integer version is stored + * @return EC_SUCCSSS on success else EC_ERROR_INVAL on failure + */ +int hex8tou32(char *str, uint32_t *val); + +/* + * Flash a USB PD device using the ChromeOS Vendor Defined Command. + * + * @param argc number arguments in argv. Must be greater than 3. + * @param argv [1] is the usb port + * [2] unused + * [3] is the command {"erase", "rebooot", "signature", + * "info", "version", "write"} + * [4] if command was "write", then this will be the + * start of the data that will be written. + * @return EC_SUCCESS on success, else EC_ERROR_PARAM_COUNT or EC_ERROR_PARAM2 + * on failure. + */ +int remote_flashing(int argc, char **argv); + /* Returns the battery percentage [0-100] of the system. */ int usb_get_battery_soc(void); |