Rev 584 | Rev 892 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 584 | Rev 586 | ||
|---|---|---|---|
| Line 31... | Line 31... | ||
| 31 | #include <console/chardev.h> |
31 | #include <console/chardev.h> |
| 32 | 32 | ||
| 33 | static chardev_t ski_console; |
33 | static chardev_t ski_console; |
| 34 | static bool kb_disable; |
34 | static bool kb_disable; |
| 35 | 35 | ||
| 36 | static void ski_write(chardev_t *d, const char ch); |
36 | static void ski_putchar(chardev_t *d, const char ch); |
| 37 | static __s32 ski_getchar(void); |
37 | static __s32 ski_getchar(void); |
| 38 | 38 | ||
| 39 | /** Display character on debug console |
39 | /** Display character on debug console |
| 40 | * |
40 | * |
| 41 | * Use SSC (Simulator System Call) to |
41 | * Use SSC (Simulator System Call) to |
| 42 | * display character on debug console. |
42 | * display character on debug console. |
| 43 | * |
43 | * |
| 44 | * @param d Character device. |
44 | * @param d Character device. |
| 45 | * @param ch Character to be printed. |
45 | * @param ch Character to be printed. |
| 46 | */ |
46 | */ |
| 47 | void ski_write(chardev_t *d, const char ch) |
47 | void ski_putchar(chardev_t *d, const char ch) |
| 48 | { |
48 | { |
| 49 | __asm__ ( |
49 | __asm__ ( |
| 50 | "mov r15=%0\n" |
50 | "mov r15=%0\n" |
| 51 | "mov r32=%1\n" /* r32 is in0 */ |
51 | "mov r32=%1\n" /* r32 is in0 */ |
| 52 | "break 0x80000\n" /* modifies r8 */ |
52 | "break 0x80000\n" /* modifies r8 */ |
| Line 54... | Line 54... | ||
| 54 | : "i" (SKI_PUTCHAR), "r" (ch) |
54 | : "i" (SKI_PUTCHAR), "r" (ch) |
| 55 | : "r15", "in0", "r8" |
55 | : "r15", "in0", "r8" |
| 56 | ); |
56 | ); |
| 57 | 57 | ||
| 58 | if (ch == '\n') |
58 | if (ch == '\n') |
| 59 | ski_write(d, '\r'); |
59 | ski_putchar(d, '\r'); |
| 60 | } |
60 | } |
| 61 | 61 | ||
| 62 | /** Ask debug console if a key was pressed. |
62 | /** Ask debug console if a key was pressed. |
| 63 | * |
63 | * |
| 64 | * Use SSC (Simulator System Call) to |
64 | * Use SSC (Simulator System Call) to |
| Line 114... | Line 114... | ||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | static chardev_operations_t ski_ops = { |
116 | static chardev_operations_t ski_ops = { |
| 117 | .resume = ski_kb_enable, |
117 | .resume = ski_kb_enable, |
| 118 | .suspend = ski_kb_disable, |
118 | .suspend = ski_kb_disable, |
| 119 | .write = ski_write |
119 | .write = ski_putchar |
| 120 | }; |
120 | }; |
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | /** Initialize debug console |
123 | /** Initialize debug console |
| 124 | * |
124 | * |