summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-16 04:16:55 -0600
committerMartin Roth <martinroth@chromium.org>2018-10-23 22:34:59 +0000
commit4a71d293dbf200396b90e502825165b5c7bd494c (patch)
treedc019def1f7bacf79bd564318bcc34697afcf919
parent4ffc10efe7eab8b2fbd5ba8e442a49a8b802ad6b (diff)
downloadvboot-4a71d293dbf200396b90e502825165b5c7bd494c.tar.gz
Export vb2_error_beep()
This code is used in both the keyboard and detachable UIs. Make it into a common function and export it. BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: I1e2cf67ec3fce9bc78ad412ddcc34e0eaecab5eb Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1286220 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1297022 Reviewed-by: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org>
-rw-r--r--firmware/lib/include/vboot_kernel.h5
-rw-r--r--firmware/lib/vboot_ui.c16
-rw-r--r--firmware/lib/vboot_ui_menu.c8
3 files changed, 15 insertions, 14 deletions
diff --git a/firmware/lib/include/vboot_kernel.h b/firmware/lib/include/vboot_kernel.h
index 15c27101..37243865 100644
--- a/firmware/lib/include/vboot_kernel.h
+++ b/firmware/lib/include/vboot_kernel.h
@@ -122,4 +122,9 @@ void vb2_exit_altfw(void);
*/
void vb2_try_alt_fw(int allowed, int altfw_num);
+/**
+ * Emit two short beeps to indicate an error
+ */
+void vb2_error_beep(void);
+
#endif /* VBOOT_REFERENCE_VBOOT_KERNEL_H_ */
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index 0c4c03dc..0f1f7cc8 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -72,6 +72,14 @@ static int VbWantShutdown(struct vb2_context *ctx, uint32_t key)
return !!shutdown_request;
}
+/* Two short beeps to notify the user that attempted action was disallowed. */
+void vb2_error_beep(void)
+{
+ VbExBeep(120, 400);
+ VbExSleepMs(120);
+ VbExBeep(120, 400);
+}
+
int vb2_prepare_alt_fw(int allowed)
{
if (!allowed) {
@@ -90,9 +98,7 @@ int vb2_prepare_alt_fw(int allowed)
void vb2_exit_altfw(void)
{
- VbExBeep(120, 400);
- VbExSleepMs(120);
- VbExBeep(120, 400);
+ vb2_error_beep();
}
void vb2_try_alt_fw(int allowed, int altfw_num)
@@ -375,9 +381,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx)
"(USB/SD) has not been enabled. Refer "
"to the developer-mode documentation "
"for details.\n");
- VbExBeep(120, 400);
- VbExSleepMs(120);
- VbExBeep(120, 400);
+ vb2_error_beep();
} else {
/*
* Clear the screen to show we get the Ctrl+U
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 1ed01da9..8f610ab9 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -74,14 +74,6 @@ static void vb2_flash_screen(struct vb2_context *ctx)
vb2_draw_current_screen(ctx);
}
-/* Two short beeps to notify the user that attempted action was disallowed. */
-static void vb2_error_beep(void)
-{
- VbExBeep(120, 400);
- VbExSleepMs(120);
- VbExBeep(120, 400);
-}
-
/**
* Switch to a new menu (but don't draw it yet).
*