Merge tag 'efi-2020-01-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / include / stdio.h
1 #ifndef __STDIO_H
2 #define __STDIO_H
3
4 #include <stdarg.h>
5 #include <linux/compiler.h>
6
7 /* stdin */
8 int getc(void);
9 int tstc(void);
10
11 /* stdout */
12 #if !defined(CONFIG_SPL_BUILD) || \
13         (defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \
14         (defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \
15                 defined(CONFIG_SPL_SERIAL_SUPPORT))
16 void putc(const char c);
17 void puts(const char *s);
18 int __printf(1, 2) printf(const char *fmt, ...);
19 int vprintf(const char *fmt, va_list args);
20 #else
21 static inline void putc(const char c)
22 {
23 }
24
25 static inline void puts(const char *s)
26 {
27 }
28
29 static inline int __printf(1, 2) printf(const char *fmt, ...)
30 {
31         return 0;
32 }
33
34 static inline int vprintf(const char *fmt, va_list args)
35 {
36         return 0;
37 }
38 #endif
39
40 /*
41  * FILE based functions (can only be used AFTER relocation!)
42  */
43 #define stdin           0
44 #define stdout          1
45 #define stderr          2
46 #define MAX_FILES       3
47
48 /* stderr */
49 #define eputc(c)                fputc(stderr, c)
50 #define eputs(s)                fputs(stderr, s)
51 #define eprintf(fmt, args...)   fprintf(stderr, fmt, ##args)
52
53 int __printf(2, 3) fprintf(int file, const char *fmt, ...);
54 void fputs(int file, const char *s);
55 void fputc(int file, const char c);
56 int ftstc(int file);
57 int fgetc(int file);
58
59 #endif /* __STDIO_H */