summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2011-09-23 14:42:26 -0700
committerBill Richardson <wfrichar@chromium.org>2011-09-23 16:04:15 -0700
commit4313fba2fb928f662a63b7566f235291dc1455f7 (patch)
tree593510a01782588a495e8cc954aef23f8f9efd3b
parent132e6e0c8cfa49a470199374e2331e3bb2ea21d6 (diff)
downloadvboot-4313fba2fb928f662a63b7566f235291dc1455f7.tar.gz
VbExBeep() now returns VbError_t instead of void
This enables us to support playing sounds in the background if the BIOS allows it, so we don't have to block while beeping is happening. The new declaration is: VbError_t VbExBeep(uint32_t msec, uint32_t frequency); If the audio codec can run in the background, then: zero frequency means OFF, non-zero frequency means ON zero msec means return immediately, non-zero msec means delay (and then OFF if needed) else: non-zero msec and non-zero frequency means ON, delay, OFF, return zero msec or zero frequency means do nothing and return immediately The return value is used by the caller to determine the capabilities. The implementation should always do the best it can if it cannot fully support all features - for example, beeping at a fixed frequency if frequency support is not available. At a minimum, it must delay for the specified non-zero duration. Currently, VbExBeep() is called only when displaying the dev-mode screen. BUG=none TEST=manual I've tested on x86 and ARM, all timeouts and noises work as before. Note that ARM and coreboot will require a corresponding change to their VbExBeep() implementations, which will have to be handled with separate, simultaneous CLs. Change-Id: I3417ae4b99d9d0aee63f2ccaeed39b61d4333e5d Reviewed-on: http://gerrit.chromium.org/gerrit/8234 Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
-rw-r--r--firmware/include/vboot_api.h26
-rw-r--r--firmware/lib/vboot_display.c2
-rw-r--r--firmware/stub/vboot_api_stub.c3
3 files changed, 23 insertions, 8 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index c468868f..2703e05b 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -94,7 +94,11 @@ enum VbErrorPredefined_t {
/* Simulated (test) error */
VBERROR_SIMULATED = 0x10016,
/* Invalid parameter */
- VBERROR_INVALID_PARAMETER = 0x10017
+ VBERROR_INVALID_PARAMETER = 0x10017,
+ /* VbExBeep() can't make sounds at all */
+ VBERROR_NO_SOUND = 0x10018,
+ /* VbExBeep() can't make sound in the background */
+ VBERROR_NO_BACKGROUND_SOUND = 0x10019
};
@@ -329,11 +333,21 @@ void VbExSleepMs(uint32_t msec);
/* Play a beep tone of the specified frequency in Hz and duration in msec.
* This is effectively a VbSleep() variant that makes noise.
*
- * The implementation should do the best it can if it cannot fully
- * support this interface - for example, beeping at a fixed frequency
- * if frequency support is not available. At a minimum, it must delay for
- * the specified duration. */
-void VbExBeep(uint32_t msec, uint32_t frequency);
+ * If the audio codec can run in the background, then:
+ * zero frequency means OFF, non-zero frequency means ON
+ * zero msec means return immediately, non-zero msec means delay (and
+ * then OFF if needed)
+ * else:
+ * non-zero msec and non-zero frequency means ON, delay, OFF, return
+ * zero msec or zero frequency means do nothing and return immediately
+ *
+ * The return value is used by the caller to determine the capabilities. The
+ * implementation should always do the best it can if it cannot fully support
+ * all features - for example, beeping at a fixed frequency if frequency
+ * support is not available. At a minimum, it must delay for the specified
+ * non-zero duration.
+ */
+VbError_t VbExBeep(uint32_t msec, uint32_t frequency);
/*****************************************************************************/
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index bd2a93c8..b0166e81 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -315,7 +315,7 @@ VbError_t VbDisplayScreenFromGBB(VbCommonParams* cparams, uint32_t screen,
*/
if (gbb->major_version == GBB_MAJOR_VER && gbb->minor_version >= 1 &&
(gbb->flags != 0)) {
- (void)VbExDisplayDebugInfo("GBB.flags is nonzero");
+ (void)VbExDisplayDebugInfo("gbb.flags is nonzero");
}
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index 80368300..732facb9 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -64,7 +64,8 @@ void VbExSleepMs(uint32_t msec) {
}
-void VbExBeep(uint32_t msec, uint32_t frequency) {
+VbError_t VbExBeep(uint32_t msec, uint32_t frequency) {
+ return VBERROR_SUCCESS;
}