Merge tag 'u-boot-imx-20200121' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[oweals/u-boot.git] / examples / api / libgenwrap.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2007 Semihalf
4  *
5  * Written by: Rafal Jaworowski <raj@semihalf.com>
6  *
7  * This is is a set of wrappers/stubs that allow to use certain routines from
8  * U-Boot's lib in the standalone app. This way way we can re-use
9  * existing code e.g. operations on strings and similar.
10  */
11
12 #include <common.h>
13 #include <hang.h>
14 #include <linux/types.h>
15 #include <api_public.h>
16
17 #include "glue.h"
18
19 void putc(const char c)
20 {
21         ub_putc(c);
22 }
23
24 void puts(const char *s)
25 {
26         ub_puts(s);
27 }
28
29 void __udelay(unsigned long usec)
30 {
31         ub_udelay(usec);
32 }
33
34 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
35 {
36         ub_reset();
37         return 0;
38 }
39
40 void *malloc (size_t len)
41 {
42         return NULL;
43 }
44
45 void hang(void)
46 {
47         while (1) ;
48 }