OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [libc/] [src/] [sys-userspace/] [arch-arm/] [sys_stdio.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#include <stdio.h>
2
#include <stdint.h>
3
 
4
extern int __fputc(int c, FILE *stream);
5
 
6
static int ser_out(int c)
7
{
8
        __fputc(c, 0);
9
        if (c == '\n')
10
                ser_out('\r');
11
        return 0;
12
}
13
 
14
static size_t
15
l4kdb_write(void *data, long int position, size_t count, void *handle /*unused*/)
16
{
17
        size_t i;
18
        char *real_data = data;
19
        for (i = 0; i < count; i++)
20
                ser_out(real_data[i]);
21
        return count;
22
}
23
 
24
struct __file __stdin = {
25
        .handle     = NULL,
26
        .read_fn    = NULL,
27
        .write_fn   = NULL,
28
        .close_fn   = NULL,
29
        .eof_fn     = NULL,
30
        .buffering_mode = _IONBF,
31
        .buffer     = NULL,
32
        .unget_pos  = 0,
33
        .current_pos = 0,
34
        .eof        = 0
35
};
36
 
37
 
38
struct __file __stdout = {
39
        .handle     = NULL,
40
        .read_fn    = NULL,
41
        .write_fn   = l4kdb_write,
42
        .close_fn   = NULL,
43
        .eof_fn     = NULL,
44
        .buffering_mode = _IONBF,
45
        .buffer     = NULL,
46
        .unget_pos  = 0,
47
        .current_pos = 0,
48
        .eof        = 0
49
};
50
 
51
 
52
struct __file __stderr = {
53
        .handle     = NULL,
54
        .read_fn    = NULL,
55
        .write_fn   = l4kdb_write,
56
        .close_fn   = NULL,
57
        .eof_fn     = NULL,
58
        .buffering_mode = _IONBF,
59
        .buffer     = NULL,
60
        .unget_pos  = 0,
61
        .current_pos = 0,
62
        .eof        = 0
63
};
64
 
65
FILE *stdin = &__stdin;
66
FILE *stdout = &__stdout;
67
FILE *stderr = &__stderr;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.