Files
OpenCellular/chip/g/loader/debug_printf.c
nagendra modadugu 0201aa1620 CR50: refactor debug_printf() for use as a library function
loader/key_ladder.c depends on debug_printf().  Refactor
the printf function so that key_ladder.c need not depend
on main.c.

This change being made in preparation for a future
change which introduces a dependency between RW and
key_ladder.o

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=build succeeds

Change-Id: I5c9bf7bd6dd9f76ab6410e6e797973bdb072ec16
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/351760
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-06-15 15:29:14 -07:00

29 lines
527 B
C

/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "debug_printf.h"
#include "printf.h"
#include "uart.h"
#include "stddef.h"
static int printchar(void *context, int c)
{
if (c == '\n')
uart_write_char('\r');
uart_write_char(c);
return 0;
}
void debug_printf(const char *format, ...)
{
va_list args;
va_start(args, format);
vfnprintf(printchar, NULL, format, args);
va_end(args);
}