Create a new file for common vboot UI functions
Rather than having vboot_ui be the common file between that and
vboot_ui_menu, create a new file.
For now just move over vb2_error_beep(). The other common functions are
being removed in future CLs.
BUG=chromium:837018
BRANCH=none
TEST=FEATURES=test emerge-grunt --nodeps vboot_reference
Change-Id: Iff6917642ff79ea0b5cce60b383876b6f7174d20
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1310794
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/Makefile b/Makefile
index a372013..20f2db9 100644
--- a/Makefile
+++ b/Makefile
@@ -346,6 +346,7 @@
firmware/lib/vboot_display.c \
firmware/lib/vboot_kernel.c \
firmware/lib/vboot_ui.c \
+ firmware/lib/vboot_ui_common.c \
firmware/lib/vboot_ui_menu.c
# Code common to both vboot 2.0 (old structs) and 2.1 (new structs)
diff --git a/firmware/lib/include/vboot_kernel.h b/firmware/lib/include/vboot_kernel.h
index eaddcea..15c2710 100644
--- a/firmware/lib/include/vboot_kernel.h
+++ b/firmware/lib/include/vboot_kernel.h
@@ -122,14 +122,4 @@
*/
void vb2_try_alt_fw(int allowed, int altfw_num);
-enum vb2_beep_type {
- VB_BEEP_FAILED, /* Permitted but the operation failed */
- VB_BEEP_NOT_ALLOWED, /* Operation disabled by user setting */
-};
-
-/**
- * Emit beeps to indicate an error
- */
-void vb2_error_beep(enum vb2_beep_type beep);
-
#endif /* VBOOT_REFERENCE_VBOOT_KERNEL_H_ */
diff --git a/firmware/lib/include/vboot_ui_common.h b/firmware/lib/include/vboot_ui_common.h
new file mode 100644
index 0000000..aa6a67e
--- /dev/null
+++ b/firmware/lib/include/vboot_ui_common.h
@@ -0,0 +1,21 @@
+/* Copyright 2018 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.
+ *
+ * Common code used by both vboot_ui and vboot_ui_menu.
+ */
+
+#ifndef VBOOT_REFERENCE_VBOOT_UI_COMMON_H_
+#define VBOOT_REFERENCE_VBOOT_UI_COMMON_H_
+
+enum vb2_beep_type {
+ VB_BEEP_FAILED, /* Permitted but the operation failed */
+ VB_BEEP_NOT_ALLOWED, /* Operation disabled by user setting */
+};
+
+/**
+ * Emit beeps to indicate an error
+ */
+void vb2_error_beep(enum vb2_beep_type beep);
+
+#endif /* VBOOT_REFERENCE_VBOOT_UI_COMMON_H_ */
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index 9d2c4fd..b512af2 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -24,6 +24,7 @@
#include "vboot_common.h"
#include "vboot_display.h"
#include "vboot_kernel.h"
+#include "vboot_ui_common.h"
/* Global variables */
static int power_button_released;
@@ -72,22 +73,6 @@
return !!shutdown_request;
}
-/* Two short beeps to notify the user that attempted action was disallowed. */
-void vb2_error_beep(enum vb2_beep_type beep)
-{
- switch (beep) {
- case VB_BEEP_FAILED:
- VbExBeep(250, 200);
- break;
- default:
- case VB_BEEP_NOT_ALLOWED:
- VbExBeep(120, 400);
- VbExSleepMs(120);
- VbExBeep(120, 400);
- break;
- }
-}
-
int vb2_prepare_alt_fw(int allowed)
{
if (!allowed) {
diff --git a/firmware/lib/vboot_ui_common.c b/firmware/lib/vboot_ui_common.c
new file mode 100644
index 0000000..6948664
--- /dev/null
+++ b/firmware/lib/vboot_ui_common.c
@@ -0,0 +1,27 @@
+/* Copyright 2018 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.
+ *
+ * High-level firmware wrapper API - user interface for RW firmware
+ */
+
+#include "sysincludes.h"
+
+#include "vboot_api.h"
+#include "vboot_ui_common.h"
+
+/* Two short beeps to notify the user that attempted action was disallowed. */
+void vb2_error_beep(enum vb2_beep_type beep)
+{
+ switch (beep) {
+ case VB_BEEP_FAILED:
+ VbExBeep(250, 200);
+ break;
+ default:
+ case VB_BEEP_NOT_ALLOWED:
+ VbExBeep(120, 400);
+ VbExSleepMs(120);
+ VbExBeep(120, 400);
+ break;
+ }
+}
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 84bb8e6..1de1d30 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -22,6 +22,7 @@
#include "vboot_common.h"
#include "vboot_display.h"
#include "vboot_kernel.h"
+#include "vboot_ui_common.h"
#include "vboot_ui_menu_private.h"
static const char dev_disable_msg[] =