2 * Boot Prep common file
4 * Copyright 2008-2009 Freescale Semiconductor
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 void printhex(int data)
31 for (i = sizeof(int) * 2 - 1; i >= 0; i--) {
35 serial_putc(c - 10 + 'A');
41 void printdec(int data)
44 char str[10] = { 0, };
50 } else if (data < 0) {
55 for (i = 0; m > 0; i++) {
56 str[i] = m % 10 + '0';
59 for (i--; i >= 0; i--) {
64 void dprintf(const char *fmt, ...)
78 serial_putc(va_arg(args, int));
82 serial_puts(va_arg(args, const char *));
88 printdec(va_arg(args, int));
95 printhex(va_arg(args, int));
103 dprintf("\nUnsupported format string token '%c'(%x) in '%s'\n",