Rev 3766 | Rev 3853 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3766 | Rev 3844 | ||
---|---|---|---|
Line 54... | Line 54... | ||
54 | chardev_t ski_console; |
54 | chardev_t ski_console; |
55 | chardev_t ski_uconsole; |
55 | chardev_t ski_uconsole; |
56 | 56 | ||
57 | static bool kbd_disabled; |
57 | static bool kbd_disabled; |
58 | 58 | ||
59 | static void ski_putchar(chardev_t *d, const char ch); |
- | |
60 | static int32_t ski_getchar(void); |
- | |
61 | - | ||
62 | /** Display character on debug console |
59 | /** Display character on debug console |
63 | * |
60 | * |
64 | * Use SSC (Simulator System Call) to |
61 | * Use SSC (Simulator System Call) to |
65 | * display character on debug console. |
62 | * display character on debug console. |
66 | * |
63 | * |
67 | * @param d Character device. |
64 | * @param d Character device. |
68 | * @param ch Character to be printed. |
65 | * @param ch Character to be printed. |
69 | */ |
66 | */ |
70 | void ski_putchar(chardev_t *d, const char ch) |
67 | static void ski_putchar(chardev_t *d, const char ch, bool silent) |
71 | { |
68 | { |
- | 69 | if (!silent) { |
|
72 | asm volatile ( |
70 | asm volatile ( |
73 | "mov r15 = %0\n" |
71 | "mov r15 = %0\n" |
74 | "mov r32 = %1\n" /* r32 is in0 */ |
72 | "mov r32 = %1\n" /* r32 is in0 */ |
75 | "break 0x80000\n" /* modifies r8 */ |
73 | "break 0x80000\n" /* modifies r8 */ |
76 | : |
74 | : |
77 | : "i" (SKI_PUTCHAR), "r" (ch) |
75 | : "i" (SKI_PUTCHAR), "r" (ch) |
78 | : "r15", "in0", "r8" |
76 | : "r15", "in0", "r8" |
79 | ); |
77 | ); |
80 | 78 | ||
81 | if (ch == '\n') |
79 | if (ch == '\n') |
82 | ski_putchar(d, '\r'); |
80 | ski_putchar(d, '\r'); |
- | 81 | } |
|
83 | } |
82 | } |
84 | 83 | ||
85 | /** Ask debug console if a key was pressed. |
84 | /** Ask debug console if a key was pressed. |
86 | * |
85 | * |
87 | * Use SSC (Simulator System Call) to |
86 | * Use SSC (Simulator System Call) to |
Line 89... | Line 88... | ||
89 | * |
88 | * |
90 | * This call is non-blocking. |
89 | * This call is non-blocking. |
91 | * |
90 | * |
92 | * @return ASCII code of pressed key or 0 if no key pressed. |
91 | * @return ASCII code of pressed key or 0 if no key pressed. |
93 | */ |
92 | */ |
94 | int32_t ski_getchar(void) |
93 | static int32_t ski_getchar(void) |
95 | { |
94 | { |
96 | uint64_t ch; |
95 | uint64_t ch; |
97 | 96 | ||
98 | asm volatile ( |
97 | asm volatile ( |
99 | "mov r15 = %1\n" |
98 | "mov r15 = %1\n" |