mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Add %T format code to print current timestamp.
Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8724 TEST=if timestamps show up in the debug output, it works Change-Id: I5264a3a40a07a824cc15b39a7bd81f2db02a3c13
This commit is contained in:
@@ -388,7 +388,7 @@ static void lpc_interrupt(void)
|
||||
|
||||
/* Debugging: print changes to LPC0RESET */
|
||||
if (mis & (1 << 31)) {
|
||||
uart_printf("[LPC PLTRST# %sasserted]\n",
|
||||
uart_printf("[%T LPC PLTRST# %sasserted]\n",
|
||||
(LM4_LPC_LPCSTS & (1<<10)) ? "" : "de");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ static void update_other_switches(void)
|
||||
|
||||
static void set_pwrbtn_to_pch(int high)
|
||||
{
|
||||
uart_printf("[PB PCH pwrbtn=%s]\n", high ? "HIGH" : "LOW");
|
||||
uart_printf("[%T PB PCH pwrbtn=%s]\n", high ? "HIGH" : "LOW");
|
||||
gpio_set_level(GPIO_PCH_PWRBTNn, high);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ static void power_button_changed(uint64_t tnow)
|
||||
static void lid_switch_changed(uint64_t tnow)
|
||||
{
|
||||
int v = gpio_get_level(GPIO_LID_SWITCHn);
|
||||
uart_printf("[PB lid %s]\n", v ? "open" : "closed");
|
||||
uart_printf("[%T PB lid %s]\n", v ? "open" : "closed");
|
||||
|
||||
lpc_set_host_events(EC_LPC_HOST_EVENT_MASK((v ?
|
||||
EC_LPC_HOST_EVENT_LID_OPEN : EC_LPC_HOST_EVENT_LID_CLOSED)));
|
||||
@@ -262,7 +262,7 @@ void power_button_task(void)
|
||||
* that can't happen - and even if it did, we'd just go
|
||||
* back to sleep after deciding that we woke up too
|
||||
* early.) */
|
||||
uart_printf("[PB task wait %d]\n", d);
|
||||
uart_printf("[%T PB task wait %d]\n", d);
|
||||
task_wait_msg(d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ void port_80_write(int data)
|
||||
* itself. Probably not worth the system overhead to buffer the data
|
||||
* and print it from a task, because we're printing a small amount of
|
||||
* data and uart_printf() doesn't block. */
|
||||
uart_printf("%c[Port 80: 0x%02x]", scroll ? '\n' : '\r', data);
|
||||
uart_printf("%c[%T Port 80: 0x%02x]", scroll ? '\n' : '\r', data);
|
||||
|
||||
history[head] = data;
|
||||
head = (head + 1) & (HISTORY_LEN - 1);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
#include "uart.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -458,7 +459,11 @@ int uart_printf(const char *format, ...)
|
||||
/* TODO: (crosbug.com/p/7490) handle "%l" prefix for
|
||||
* uint64_t */
|
||||
|
||||
v = va_arg(args, uint32_t);
|
||||
/* Special-case: %T = current time */
|
||||
if (c == 'T')
|
||||
v = get_time().le.lo;
|
||||
else
|
||||
v = va_arg(args, uint32_t);
|
||||
|
||||
switch (c) {
|
||||
case 'd':
|
||||
@@ -468,6 +473,7 @@ int uart_printf(const char *format, ...)
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
case 'T':
|
||||
break;
|
||||
case 'x':
|
||||
case 'p':
|
||||
|
||||
@@ -307,7 +307,7 @@ void x86_power_task(void)
|
||||
x86_power_init();
|
||||
|
||||
while (1) {
|
||||
uart_printf("[x86 power state %d = %s, in 0x%04x]\n",
|
||||
uart_printf("[%T x86 power state %d = %s, in 0x%04x]\n",
|
||||
state, state_names[state], in_signals);
|
||||
|
||||
switch (state) {
|
||||
|
||||
@@ -41,16 +41,20 @@ int uart_puts(const char *outstr);
|
||||
*
|
||||
* Returns error if output was truncated.
|
||||
*
|
||||
* Must support format strings for:
|
||||
* 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 us (%T)
|
||||
* including padding (%-5s, %8d, %08x)
|
||||
*
|
||||
* Note: Floating point output (%f / %g) is not required.
|
||||
* Support planned for:
|
||||
* int64_t / uint64_t (%ld / %lu / %lx)
|
||||
*
|
||||
* Note: Floating point output (%f / %g) is not supported.
|
||||
*/
|
||||
int uart_printf(const char *format, ...);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user