Rev 329 | Rev 341 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 329 | Rev 332 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | #include <putchar.h> |
29 | #include <putchar.h> |
30 | #include <arch/types.h> |
30 | #include <arch/types.h> |
31 | #include <arch/cp0.h> |
31 | #include <arch/cp0.h> |
32 | #include <arch/console.h> |
32 | #include <arch/console.h> |
33 | #include <arch.h> |
33 | #include <arch.h> |
- | 34 | #include <arch/drivers/arc.h> |
|
- | 35 | #include <arch/arch.h> |
|
34 | 36 | ||
35 | static void arc_putchar(const char ch) |
- | |
36 | { |
- | |
37 | int cnt; |
- | |
38 | pri_t pri; |
- | |
39 | - | ||
40 | /* TODO: Should be spinlock? */ |
37 | /** Putchar that works with MSIM & gxemul */ |
41 | pri = cpu_priority_high(); |
- | |
42 | bios_write(1, &ch, 1, &cnt); |
- | |
43 | cpu_priority_restore(pri); |
- | |
44 | - | ||
45 | } |
- | |
46 | - | ||
47 | static void cons_putchar(const char ch) |
38 | static void cons_putchar(const char ch) |
48 | { |
39 | { |
49 | *((char *) VIDEORAM) = ch; |
40 | *((char *) VIDEORAM) = ch; |
50 | } |
41 | } |
51 | 42 | ||
52 | - | ||
- | 43 | /** Putchar that works with simics */ |
|
53 | static void serial_putchar(const char ch) |
44 | static void serial_putchar(const char ch) |
54 | { |
45 | { |
55 | int i; |
46 | int i; |
56 | 47 | ||
57 | if (ch=='\n') |
48 | if (ch=='\n') |
Line 65... | Line 56... | ||
65 | 56 | ||
66 | static void (*putchar_func)(const char ch) = cons_putchar; |
57 | static void (*putchar_func)(const char ch) = cons_putchar; |
67 | 58 | ||
68 | void console_init(void) |
59 | void console_init(void) |
69 | { |
60 | { |
- | 61 | if (arc_enabled()) |
|
- | 62 | putchar_func = arc_putchar; |
|
70 | /* The LSR on the start usually contains this value */ |
63 | /* The LSR on the start usually contains this value */ |
71 | if (*SERIAL_LSR == 0x60) |
64 | else if (*SERIAL_LSR == 0x60) |
72 | putchar_func = serial_putchar; |
65 | putchar_func = serial_putchar; |
73 | else |
66 | else |
74 | putchar_func = cons_putchar; |
67 | putchar_func = cons_putchar; |
75 | } |
68 | } |
76 | 69 |