summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_ui.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2017-12-12 14:05:19 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-05 21:14:11 -0800
commitde818cc08fab92ad389dc92f31687f3314a1a03a (patch)
tree88ac00585794cf8be66601ea9cd5f38e34d88d13 /firmware/lib/vboot_ui.c
parent5142132f44bbee683c830fdb837bbedb00bad8ba (diff)
downloadvboot-de818cc08fab92ad389dc92f31687f3314a1a03a.tar.gz
firmware: simplify audio
Vboot firmware previously supported a rather complex audio looping library. Our original intent was to allow developers to flash a custom beep sequence / tune as an easter egg. We never fully supported that, but the code to allow it lived on. Get rid of that. Vboot also previously made no assumptions about the frequency of VbExGetTimer(), which was only used by the vboot_audio library. So it spent 10ms every boot measuring the frequency. Which is silly now, because depthcharge implements that as a microsecond timer. Get rid of that measurement and define the timer as a microsecond timer. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I350246874fb36b00149423696285cfcaca0fc526 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847311 Reviewed-by: Shelley Chen <shchen@chromium.org>
Diffstat (limited to 'firmware/lib/vboot_ui.c')
-rw-r--r--firmware/lib/vboot_ui.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index 50c27e76..4057ed18 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -171,8 +171,6 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
uint32_t use_legacy = 0;
uint32_t ctrl_d_pressed = 0;
- VbAudioContext *audio = 0;
-
VB2_DEBUG("Entering\n");
/* Check if USB booting is allowed */
@@ -240,15 +238,14 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
/* Show the dev mode warning screen */
VbDisplayScreen(ctx, cparams, VB_SCREEN_DEVELOPER_WARNING, 0);
- /* Get audio/delay context */
- audio = VbAudioOpen(cparams);
+ /* Initialize audio/delay context */
+ vb2_audio_start(ctx);
/* We'll loop until we finish the delay or are interrupted */
do {
uint32_t key = VbExKeyboardRead();
if (VbWantShutdown(ctx, key)) {
VB2_DEBUG("VbBootDeveloper() - shutdown requested!\n");
- VbAudioClose(audio);
return VBERROR_SHUTDOWN_REQUESTED;
}
@@ -267,7 +264,6 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
if (shared->flags & VBSD_HONOR_VIRT_DEV_SWITCH &&
shared->flags & VBSD_BOOT_DEV_SWITCH_ON) {
/* Stop the countdown while we go ask... */
- VbAudioClose(audio);
if (sd->gbb_flags &
GBB_FLAG_FORCE_DEV_SWITCH_ON) {
/*
@@ -308,7 +304,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
VB_SCREEN_DEVELOPER_WARNING,
0);
/* Start new countdown */
- audio = VbAudioOpen(cparams);
+ vb2_audio_start(ctx);
}
} else {
/*
@@ -318,7 +314,6 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
VB2_DEBUG("going to recovery\n");
vb2_nv_set(ctx, VB2_NV_RECOVERY_REQUEST,
VB2_RECOVERY_RW_DEV_SCREEN);
- VbAudioClose(audio);
return VBERROR_LOAD_KERNEL_RECOVERY;
}
break;
@@ -364,7 +359,6 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
0);
if (VBERROR_SUCCESS ==
VbTryUsb(ctx, cparams)) {
- VbAudioClose(audio);
return VBERROR_SUCCESS;
} else {
/* Show dev mode warning screen again */
@@ -380,7 +374,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
VbCheckDisplayKey(ctx, cparams, key);
break;
}
- } while(VbAudioLooping(audio));
+ } while(vb2_audio_looping());
fallout:
@@ -392,14 +386,12 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
if ((use_usb && !ctrl_d_pressed) && allow_usb) {
if (VBERROR_SUCCESS == VbTryUsb(ctx, cparams)) {
- VbAudioClose(audio);
return VBERROR_SUCCESS;
}
}
/* Timeout or Ctrl+D; attempt loading from fixed disk */
VB2_DEBUG("VbBootDeveloper() - trying fixed disk\n");
- VbAudioClose(audio);
return VbTryLoadKernel(ctx, cparams, VB_DISK_FLAG_FIXED);
}