]>
git.ipfire.org Git - people/ms/u-boot.git/blob - examples/api/libgenwrap.c
2 * (C) Copyright 2007 Semihalf
4 * Written by: Rafal Jaworowski <raj@semihalf.com>
6 * SPDX-License-Identifier: GPL-2.0+
8 * This is is a set of wrappers/stubs that allow to use certain routines from
9 * U-Boot's lib in the standalone app. This way way we can re-use
10 * existing code e.g. operations on strings and similar.
14 #include <linux/types.h>
15 #include <api_public.h>
20 * printf() and vprintf() are stolen from u-boot/common/console.c
22 int printf (const char *fmt
, ...)
26 char printbuffer
[256];
30 /* For this to work, printbuffer must be larger than
31 * anything we ever want to print.
33 i
= vsprintf (printbuffer
, fmt
, args
);
36 /* Print the string */
37 ub_puts (printbuffer
);
41 int vprintf (const char *fmt
, va_list args
)
44 char printbuffer
[256];
46 /* For this to work, printbuffer must be larger than
47 * anything we ever want to print.
49 i
= vsprintf (printbuffer
, fmt
, args
);
51 /* Print the string */
52 ub_puts (printbuffer
);
56 void putc (const char c
)
61 void __udelay(unsigned long usec
)
66 int do_reset(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
72 void *malloc (size_t len
)