Rev 4114 | Rev 4223 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4114 | Rev 4220 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | #include <arch/types.h> |
39 | #include <arch/types.h> |
40 | #include <proc/thread.h> |
40 | #include <proc/thread.h> |
41 | #include <synch/spinlock.h> |
41 | #include <synch/spinlock.h> |
42 | #include <arch/asm.h> |
42 | #include <arch/asm.h> |
43 | #include <arch/drivers/kbd.h> |
43 | #include <arch/drivers/kbd.h> |
- | 44 | #include <string.h> |
|
44 | #include <arch.h> |
45 | #include <arch.h> |
45 | 46 | ||
46 | static indev_t skiin; /**< Ski input device. */ |
47 | static indev_t skiin; /**< Ski input device. */ |
47 | static outdev_t skiout; /**< Ski output device. */ |
48 | static outdev_t skiout; /**< Ski output device. */ |
48 | 49 | ||
49 | static bool kbd_disabled; |
50 | static bool kbd_disabled; |
50 | 51 | ||
- | 52 | static void ski_do_putchar(const wchar_t ch) |
|
- | 53 | { |
|
- | 54 | asm volatile ( |
|
- | 55 | "mov r15 = %[cmd]\n" |
|
- | 56 | "mov r32 = %[ch]\n" /* r32 is in0 */ |
|
- | 57 | "break 0x80000\n" /* modifies r8 */ |
|
- | 58 | : |
|
- | 59 | : [cmd] "i" (SKI_PUTCHAR), [ch] "r" (ch) |
|
- | 60 | : "r15", "in0", "r8" |
|
- | 61 | ); |
|
- | 62 | } |
|
- | 63 | ||
51 | /** Display character on debug console |
64 | /** Display character on debug console |
52 | * |
65 | * |
53 | * Use SSC (Simulator System Call) to |
66 | * Use SSC (Simulator System Call) to |
54 | * display character on debug console. |
67 | * display character on debug console. |
55 | * |
68 | * |
56 | * @param d Character device. |
69 | * @param d Character device. |
57 | * @param ch Character to be printed. |
70 | * @param ch Character to be printed. |
58 | */ |
71 | */ |
59 | static void ski_putchar(outdev_t *d, const char ch, bool silent) |
72 | static void ski_putchar(outdev_t *d, const wchar_t ch, bool silent) |
60 | { |
73 | { |
61 | if (!silent) { |
74 | if (!silent) { |
62 | asm volatile ( |
75 | if (ascii_check(ch)) { |
63 | "mov r15 = %0\n" |
76 | if (ch == '\n') |
64 | "mov r32 = %1\n" /* r32 is in0 */ |
- | |
65 | "break 0x80000\n" /* modifies r8 */ |
77 | ski_do_putchar('\r'); |
66 | : |
78 | |
67 | : "i" (SKI_PUTCHAR), "r" (ch) |
79 | ski_do_putchar(ch); |
68 | : "r15", "in0", "r8" |
- | |
69 | ); |
80 | } else |
70 | - | ||
71 | if (ch == '\n') |
- | |
72 | ski_putchar(d, '\r', false); |
81 | ski_do_putchar(invalch); |
73 | } |
82 | } |
74 | } |
83 | } |
75 | 84 | ||
76 | static indev_operations_t skiin_ops = { |
85 | static indev_operations_t skiin_ops = { |
77 | .poll = NULL |
86 | .poll = NULL |