2 * Copyright (C) 2004,2008 Kustaa Nyholm
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * with this program; If not, see <http://www.gnu.org/licenses/>.
21 #ifdef CONFIG_CARL9170FW_PRINTF
24 static unsigned int num;
28 static void out(const char c)
33 static void outDgt(const char dgt)
35 out(dgt + (dgt < 10 ? '0' : (uc ? 'A' : 'a') - 10));
39 static void divOut(const unsigned int d)
41 unsigned char dgt = 0;
52 void tfp_printf(const char *fmt, ...)
61 while ((ch = *(fmt++))) {
74 if (ch >= '0' && ch <= '9') {
76 while (ch >= '0' && ch <= '9') {
77 w = (((w << 2) + w) << 1) + ch - '0';
92 num = va_arg(va, unsigned int);
93 if (ch == 'd' && (int) num < 0) {
98 for (i = 100000000; i != 1; i /= 10)
108 num = va_arg(va, unsigned int);
109 for (i = 0x10000000; i != 0x1; i >>= 4)
116 out((char)(va_arg(va, int)));
120 p = va_arg(va, char*);
132 while (*bf++ && w > 0)
136 putcharacter(lz ? '0' : ' ');
150 void min_printf(const char *fmt, ...)
160 #endif /* CONFIG_CARL9170FW_PRINTF */