blob: 1939a48f0fb61fc5b86a1c806e6e5b0801b22c95 [file] [log] [blame]
Masahiro Yamada5e882e92017-09-16 14:10:39 +09001#ifndef __STDIO_H
2#define __STDIO_H
3
4#include <stdarg.h>
5#include <linux/compiler.h>
6
7/* stdin */
Heinrich Schuchardtc4954fb2020-10-07 18:11:48 +02008int getchar(void);
Masahiro Yamada5e882e92017-09-16 14:10:39 +09009int tstc(void);
10
11/* stdout */
12#if !defined(CONFIG_SPL_BUILD) || \
Simon Glassf4d60392021-08-08 12:20:12 -060013 (defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL)) || \
Masahiro Yamada5e882e92017-09-16 14:10:39 +090014 (defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \
Simon Glassf4d60392021-08-08 12:20:12 -060015 defined(CONFIG_SPL_SERIAL))
Masahiro Yamada5e882e92017-09-16 14:10:39 +090016void putc(const char c);
17void puts(const char *s);
18int __printf(1, 2) printf(const char *fmt, ...);
19int vprintf(const char *fmt, va_list args);
20#else
21static inline void putc(const char c)
22{
23}
24
25static inline void puts(const char *s)
26{
27}
28
29static inline int __printf(1, 2) printf(const char *fmt, ...)
30{
31 return 0;
32}
33
34static 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
53int __printf(2, 3) fprintf(int file, const char *fmt, ...);
54void fputs(int file, const char *s);
55void fputc(int file, const char c);
56int ftstc(int file);
57int fgetc(int file);
58
59#endif /* __STDIO_H */