~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 3241e2d493fa2aec9d5ef14facdbc8dae3bfc545 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef __STDIO_H
#define __STDIO_H

#include <stdarg.h>
#include <linux/compiler.h>

/* stdin */
int getchar(void);
int tstc(void);

/* stdout */
#if !defined(CONFIG_SPL_BUILD) || \
	(defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL)) || \
	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \
		defined(CONFIG_SPL_SERIAL))
void putc(const char c);
void puts(const char *s);
#ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
void flush(void);
#else
static inline void flush(void) {}
#endif
int __printf(1, 2) printf(const char *fmt, ...);
int vprintf(const char *fmt, va_list args);
#else
static inline void putc(const char c)
{
}

static inline void puts(const char *s)
{
}

static inline void flush(void)
{
}

static inline int __printf(1, 2) printf(const char *fmt, ...)
{
	return 0;
}

static inline int vprintf(const char *fmt, va_list args)
{
	return 0;
}
#endif

/*
 * FILE based functions (can only be used AFTER relocation!)
 */
#define stdin		0
#define stdout		1
#define stderr		2
#define MAX_FILES	3

/* stderr */
#define eputc(c)		fputc(stderr, c)
#define eputs(s)		fputs(stderr, s)
#define eflush()		fflush(stderr)
#define eprintf(fmt, args...)	fprintf(stderr, fmt, ##args)

int __printf(2, 3) fprintf(int file, const char *fmt, ...);
void fputs(int file, const char *s);
void fputc(int file, const char c);
#ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
void fflush(int file);
#else
static inline void fflush(int file) {}
#endif
int ftstc(int file);
int fgetc(int file);

#endif /* __STDIO_H */