summaryrefslogtreecommitdiff
path: root/firmware/2lib/include/2api.h
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2020-04-21 12:50:03 +0800
committerCommit Bot <commit-bot@chromium.org>2020-05-28 07:11:17 +0000
commit72d4c9dae9c910e2bb5d0fcb8b34771fd4ce16f0 (patch)
tree4cdc51b85e5fa77b58d434bb1a0d04b000775239 /firmware/2lib/include/2api.h
parent0bbd72df633a90258d8f5203614ef16258c25a00 (diff)
downloadvboot-72d4c9dae9c910e2bb5d0fcb8b34771fd4ce16f0.tar.gz
vboot: move timer and beep functions to vboot2 namespace
Move these functions from vboot_api.h into 2api.h: VbExGetTimer --> vb2ex_mtime (usec -> msec) VbExSleepMs --> vb2ex_msleep VbExBeep --> vb2ex_beep Rename the constants: VB_USEC_PER_MSEC --> VB2_USEC_PER_MSEC VB_MSEC_PER_SEC --> VB2_MSEC_PER_SEC Remove the constant VB_USEC_PER_SEC. The error code VBERROR_NO_BACKGROUND_SOUND is dropped since it is not currently used. Update a few printf lines to use VB2_DEBUG instead. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I887112ffd5f68fb6a9c4d9ad624aa420cbd55b4b Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:2158665 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2158666 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'firmware/2lib/include/2api.h')
-rw-r--r--firmware/2lib/include/2api.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index f8a1b4e0..4a6fe0d4 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -1220,4 +1220,37 @@ int vb2ex_physical_presence_pressed(void);
*/
uint32_t vb2ex_get_locale_count(void);
+/**
+ * Delay for at least the specified number of milliseconds.
+ *
+ * @param msec Duration in milliseconds.
+ */
+void vb2ex_msleep(uint32_t msec);
+
+/**
+ * Play a beep tone of the specified frequency in Hz for the duration msec.
+ *
+ * This is effectively a sleep call that makes noise. The implementation may
+ * beep at a fixed frequency if frequency support is not available. Regardless
+ * of whether any errors occur, the callback is expected to delay for the
+ * specified duration before returning.
+ *
+ * @param msec Duration of beep in milliseconds.
+ * @param frequency Sound frequency in Hz.
+ */
+void vb2ex_beep(uint32_t msec, uint32_t frequency);
+
+/*****************************************************************************/
+/* Timer. */
+
+/**
+ * Read a millisecond timer.
+ *
+ * This should have a sufficient number of bits to avoid wraparound for at
+ * least 10 minutes.
+ *
+ * @return Current timer value in milliseconds.
+ */
+uint32_t vb2ex_mtime(void);
+
#endif /* VBOOT_REFERENCE_2API_H_ */