Rev 631 | Rev 1104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 631 | Rev 1050 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | #include <arch.h> |
36 | #include <arch.h> |
37 | #include <func.h> |
37 | #include <func.h> |
38 | #include <print.h> |
38 | #include <print.h> |
39 | #include <arch/atomic.h> |
39 | #include <arch/atomic.h> |
40 | 40 | ||
- | 41 | #define BUFLEN 2048 |
|
- | 42 | static char debug_buffer[BUFLEN]; |
|
- | 43 | static size_t offset = 0; |
|
- | 44 | /** Initialize stdout to something that does not print, but does not fail |
|
- | 45 | * |
|
- | 46 | * Save data in some buffer so that it could be retrieved in the debugger |
|
- | 47 | */ |
|
- | 48 | static void null_putchar(chardev_t *d, const char ch) |
|
- | 49 | { |
|
- | 50 | if (offset >= BUFLEN) |
|
- | 51 | offset = 0; |
|
- | 52 | debug_buffer[offset++] = ch; |
|
- | 53 | } |
|
- | 54 | ||
- | 55 | static chardev_operations_t null_stdout_ops = { |
|
- | 56 | .write = null_putchar |
|
- | 57 | }; |
|
- | 58 | chardev_t null_stdout = { |
|
- | 59 | .name = "null", |
|
- | 60 | .op = &null_stdout_ops |
|
- | 61 | }; |
|
- | 62 | ||
41 | /** Standard input character device. */ |
63 | /** Standard input character device. */ |
42 | chardev_t *stdin = NULL; |
64 | chardev_t *stdin = NULL; |
43 | chardev_t *stdout = NULL; |
65 | chardev_t *stdout = &null_stdout; |
44 | 66 | ||
45 | /** Get character from character device. Do not echo character. |
67 | /** Get character from character device. Do not echo character. |
46 | * |
68 | * |
47 | * @param chardev Character device. |
69 | * @param chardev Character device. |
48 | * |
70 | * |