diff options
author | Simon Glass <sjg@chromium.org> | 2018-10-31 09:53:05 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-01 02:17:43 -0700 |
commit | 8ed28879229b62f3860286b2b1985af713d3e05a (patch) | |
tree | 9a8c1c7e6f35c6eefba32214690202181621286c | |
parent | 90407e9bc1f77de570aad2d45beb73db5ee8382b (diff) | |
download | vboot-8ed28879229b62f3860286b2b1985af713d3e05a.tar.gz |
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>
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | firmware/lib/include/vboot_kernel.h | 10 | ||||
-rw-r--r-- | firmware/lib/include/vboot_ui_common.h | 21 | ||||
-rw-r--r-- | firmware/lib/vboot_ui.c | 17 | ||||
-rw-r--r-- | firmware/lib/vboot_ui_common.c | 27 | ||||
-rw-r--r-- | firmware/lib/vboot_ui_menu.c | 1 |
6 files changed, 51 insertions, 26 deletions
@@ -346,6 +346,7 @@ VBSLK_SRCS = \ 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 eaddcea5..15c27101 100644 --- a/firmware/lib/include/vboot_kernel.h +++ b/firmware/lib/include/vboot_kernel.h @@ -122,14 +122,4 @@ void vb2_exit_altfw(void); */ 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 00000000..aa6a67e0 --- /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 9d2c4fd2..b512af2a 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 @@ 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(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 00000000..69486649 --- /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 84bb8e64..1de1d30e 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[] = |