blob: bcdd5c779f6ad0dd4f73e83d0434ed410c914fef (
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
75
76
77
|
#include "project.h"
unsigned block_stdio;
int
_open (const char *name, int flags, int mode)
{
errno = ENOSYS;
return -1; /* Always fails */
} /* _open () */
int
_close (int file)
{
errno = EBADF;
return -1; /* Always fails */
} /* _close () */
int
_write (int file, char *buf, int nbytes)
{
int ret = nbytes;
if (!block_stdio)
ret = usart1_write (buf, nbytes, 1);
if (ret < 0) {
errno = -ret;
return -1;
}
return ret;
} /* _write () */
int
_read (int file, char *buf, int nbytes)
{
errno = -EAGAIN;
return -1; /* EOF */
} /* _read () */
#if 0
int
_fstat (int file, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
} /* _fstat () */
#endif
int
_lseek (int file, int offset, int whence)
{
return 0;
} /* _lseek () */
int
isatty (int file)
{
return 1;
} /* _isatty () */
void
stdio_drain (void)
{
usart1_drain();
}
|