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 void flushc(void);
19 int __printf(1, 2) printf(const char *fmt, ...);
20 int vprintf(const char *fmt, va_list args);
21 #else
putc(const char c)22 static inline void putc(const char c)
23 {
24 }
25
puts(const char * s)26 static inline void puts(const char *s)
27 {
28 }
29
flushc(void)30 static inline void flushc(void)
31 {
32 }
33
printf(const char * fmt,...)34 static inline int __printf(1, 2) printf(const char *fmt, ...)
35 {
36 return 0;
37 }
38
vprintf(const char * fmt,va_list args)39 static inline int vprintf(const char *fmt, va_list args)
40 {
41 return 0;
42 }
43 #endif
44
45 /*
46 * FILE based functions (can only be used AFTER relocation!)
47 */
48 #define stdin 0
49 #define stdout 1
50 #define stderr 2
51 #define MAX_FILES 3
52
53 /* stderr */
54 #define eputc(c) fputc(stderr, c)
55 #define eputs(s) fputs(stderr, s)
56 #define eprintf(fmt, args...) fprintf(stderr, fmt, ##args)
57
58 int __printf(2, 3) fprintf(int file, const char *fmt, ...);
59 void fputs(int file, const char *s);
60 void fputc(int file, const char c);
61 int ftstc(int file);
62 int fgetc(int file);
63
64 #endif /* __STDIO_H */
65