summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-16 04:16:55 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-10-19 08:58:00 -0700
commit25e898ff2f7e52e81d07f6849ff9a9227d81066a (patch)
tree4102ffa4a4fc3075931f6a024bcad9a69653b46f
parent7fb621f3f8432dd3f171c9477f8940574142c76b (diff)
downloadvboot-25e898ff2f7e52e81d07f6849ff9a9227d81066a.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>
-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).
*