mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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>
This commit is contained in:
committed by
chrome-bot
parent
ea1515ae13
commit
0201aa1620
@@ -78,6 +78,7 @@ ifneq ($(CONFIG_CUSTOMIZED_RO),)
|
||||
custom-ro_objs-y = chip/g/clock.o
|
||||
custom-ro_objs-y += chip/g/dcrypto/sha256.o
|
||||
custom-ro_objs-y += chip/g/loader/key_ladder.o
|
||||
custom-ro_objs-y += chip/g/loader/debug_printf.o
|
||||
custom-ro_objs-y += chip/g/loader/launch.o
|
||||
custom-ro_objs-y += chip/g/loader/main.o
|
||||
custom-ro_objs-y += chip/g/loader/rom_flash.o
|
||||
|
||||
28
chip/g/loader/debug_printf.c
Normal file
28
chip/g/loader/debug_printf.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -131,21 +131,3 @@ void interrupt_disable(void)
|
||||
{
|
||||
asm("cpsid i");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user