summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2022-10-12 15:54:54 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-17 22:00:00 +0000
commit793486898dd29e1ec01340654d8b0cfa1fec43cf (patch)
tree7160fd010e61b8eb6846cd3f7cf275380df9e396
parentc95e0eaef93d9a3c640cdfddb3fe11b08be6ca15 (diff)
downloadchrome-ec-793486898dd29e1ec01340654d8b0cfa1fec43cf.tar.gz
Zephyr test: Add EC features helper
Add a helper to query the EC features, which can be used to validate that the AP will see a new feature present. BRANCH=None BUG=b:208884535 TEST=./twister -T ./zephyr/test/drivers Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I27e149a9f4ca3735fdec32a1c996c878bd0d027e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3953480 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Aaron Massey <aaronmassey@google.com>
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/utils.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/zephyr/test/drivers/common/include/test/drivers/utils.h b/zephyr/test/drivers/common/include/test/drivers/utils.h
index 0acefdbccf..8a703108c3 100644
--- a/zephyr/test/drivers/common/include/test/drivers/utils.h
+++ b/zephyr/test/drivers/common/include/test/drivers/utils.h
@@ -104,6 +104,24 @@ uint8_t acpi_read(uint8_t acpi_addr);
void acpi_write(uint8_t acpi_addr, uint8_t write_byte);
/**
+ * Run the host command to gather our EC feature flags.
+ *
+ * This function assumes a successful host command processing and will make a
+ * call to the zassume_* API. A failure here will abort the calling test.
+ *
+ * @return The result of the host command
+ */
+static inline struct ec_response_get_features host_cmd_get_features(void)
+{
+ struct ec_response_get_features response;
+ struct host_cmd_handler_args args =
+ BUILD_HOST_COMMAND_RESPONSE(EC_CMD_GET_FEATURES, 0, response);
+
+ zassume_ok(host_command_process(&args), "Failed to get features");
+ return response;
+}
+
+/**
* Run the host command to get the charge state for a given charger number.
*
* This function assumes a successful host command processing and will make a