blob: 039f7df6892ff93af753275d1593f6c69390c09d [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) || \
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))
16void 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 */