summaryrefslogtreecommitdiff
path: root/include/uart.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-06-06 12:16:11 -0700
committerGerrit <chrome-bot@google.com>2012-06-07 00:54:02 -0700
commitc7f2e0246e8129aa179b09c5042d0265266e3a17 (patch)
tree62a7e81c5119b9a8f09078dc85078a3396a005b8 /include/uart.h
parent3073c600786c6170cb3ff4d05ebc917f154c4ec1 (diff)
downloadchrome-ec-c7f2e0246e8129aa179b09c5042d0265266e3a17.tar.gz
Move printf() formatting to its own file to enable re-use
Also add snprintf(), and %X format code. BUG=chrome-os-partner:10206 TEST=timerinfo; should print correctly. 'ectool battery' on host side should print same serial as 'battery' on EC console. Change-Id: I5c9f69d1a20ee5d0a59440c122655adbf62c9aea Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/24635 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'include/uart.h')
-rw-r--r--include/uart.h35
1 files changed, 12 insertions, 23 deletions
diff --git a/include/uart.h b/include/uart.h
index f71d151c76..27293f7b0c 100644
--- a/include/uart.h
+++ b/include/uart.h
@@ -40,28 +40,12 @@ int uart_puts(const char *outstr);
/* Print formatted output to the UART, like printf().
*
- * Returns error if output was truncated.
- *
- * Supports the following format strings:
- * char (%c)
- * string (%s)
- * native int (signed/unsigned) (%d / %u / %x)
- * int32_t / uint32_t (%d / %x)
- * int64_t / uint64_t (%ld / %lu / %lx)
- * pointer (%p)
- * And the following special format codes:
- * current time in sec (%T) - interpreted as "%.6T" for fixed-point format
- * including padding (%-5s, %8d, %08x, %016lx)
- *
- * Floating point output (%f / %g) is not supported, but there is a fixed-point
- * extension for integers; a padding option of .N (where N is a number) will
- * put a decimal before that many digits. For example, printing 123 with
- * format code %.6d will result in "0.000123". This is most useful for
- * printing times, voltages, and currents. */
+ * See printf.h for valid formatting codes. */
int uart_printf(const char *format, ...);
-/* Print formatted output to the UART, like vprintf(). Supports the same
- * formatting codes as uart_printf(). */
+/* Print formatted output to the UART, like vprintf().
+ *
+ * See printf.h for valid formatting codes. */
int uart_vprintf(const char *format, va_list args);
/* Flushes output. Blocks until UART has transmitted all output. */
@@ -69,11 +53,16 @@ void uart_flush_output(void);
/* Flushes output.
*
- * Blocks until UART has transmitted all output,
- * even if we are in high priority interrupt context
- */
+ * Blocks until UART has transmitted all output, even in a high priority
+ * interrupt context. */
void uart_emergency_flush(void);
+/* Like uart_printf(), but bypasses the transmit buffer.
+ *
+ * Blocks until UART has transmitted the formatted output, even in a high
+ * priority interrupt context. */
+int uart_emergency_printf(const char *format, ...);
+
/*****************************************************************************/
/* Input functions
*