Rev 1849 | Rev 1896 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1849 | Rev 1875 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | #include <genarch/kbd/scanc.h> |
39 | #include <genarch/kbd/scanc.h> |
40 | #include <genarch/kbd/scanc_sun.h> |
40 | #include <genarch/kbd/scanc_sun.h> |
41 | #include <arch/drivers/fhc.h> |
41 | #include <arch/drivers/fhc.h> |
42 | #include <arch/drivers/z8530.h> |
42 | #include <arch/drivers/z8530.h> |
43 | #include <arch/interrupt.h> |
43 | #include <arch/interrupt.h> |
- | 44 | #include <arch/drivers/kbd.h> |
|
44 | #include <cpu.h> |
45 | #include <cpu.h> |
45 | #include <arch/asm.h> |
46 | #include <arch/asm.h> |
46 | #include <arch.h> |
47 | #include <arch.h> |
47 | #include <typedefs.h> |
48 | #include <typedefs.h> |
48 | #include <console/chardev.h> |
49 | #include <console/chardev.h> |
49 | #include <console/console.h> |
50 | #include <console/console.h> |
50 | #include <interrupt.h> |
51 | #include <interrupt.h> |
- | 52 | #include <sysinfo/sysinfo.h> |
|
- | 53 | #include <print.h> |
|
51 | 54 | ||
52 | /* |
55 | /* |
53 | * These codes read from z8530 data register are silently ignored. |
56 | * These codes read from z8530 data register are silently ignored. |
54 | */ |
57 | */ |
55 | #define IGNORE_CODE 0x7f /* all keys up */ |
58 | #define IGNORE_CODE 0x7f /* all keys up */ |
56 | 59 | ||
- | 60 | bool z8530_belongs_to_kernel = true; |
|
- | 61 | ||
57 | static void z8530_suspend(chardev_t *); |
62 | static void z8530_suspend(chardev_t *); |
58 | static void z8530_resume(chardev_t *); |
63 | static void z8530_resume(chardev_t *); |
59 | 64 | ||
60 | chardev_t kbrd; |
65 | chardev_t kbrd; |
61 | static chardev_operations_t ops = { |
66 | static chardev_operations_t ops = { |
Line 67... | Line 72... | ||
67 | void z8530_wait(void); |
72 | void z8530_wait(void); |
68 | 73 | ||
69 | /** Initialize keyboard and service interrupts using kernel routine */ |
74 | /** Initialize keyboard and service interrupts using kernel routine */ |
70 | void z8530_grab(void) |
75 | void z8530_grab(void) |
71 | { |
76 | { |
- | 77 | z8530_belongs_to_kernel = true; |
|
72 | } |
78 | } |
73 | 79 | ||
74 | /** Resume the former interrupt vector */ |
80 | /** Resume the former interrupt vector */ |
75 | void z8530_release(void) |
81 | void z8530_release(void) |
76 | { |
82 | { |
- | 83 | z8530_belongs_to_kernel = false; |
|
77 | } |
84 | } |
78 | 85 | ||
79 | /** Initialize z8530. */ |
86 | /** Initialize z8530. */ |
80 | void z8530_init(void) |
87 | void z8530_init(void) |
81 | { |
88 | { |
82 | chardev_initialize("z8530_kbd", &kbrd, &ops); |
89 | chardev_initialize("z8530_kbd", &kbrd, &ops); |
83 | stdin = &kbrd; |
90 | stdin = &kbrd; |
84 | 91 | ||
- | 92 | sysinfo_set_item_val("kbd", NULL, true); |
|
- | 93 | sysinfo_set_item_val("kbd.irq", NULL, 0); |
|
- | 94 | sysinfo_set_item_val("kbd.address.virtual", NULL, (uintptr_t) kbd_virt_address); |
|
- | 95 | ||
85 | (void) z8530_read_a(RR8); |
96 | (void) z8530_read_a(RR8); |
86 | 97 | ||
- | 98 | /* |
|
- | 99 | * Clear any pending TX interrupts or we never manage |
|
- | 100 | * to set FHC UART interrupt state to idle. |
|
- | 101 | */ |
|
- | 102 | z8530_write_a(WR0, WR0_TX_IP_RST); |
|
- | 103 | ||
87 | z8530_write_a(WR1, WR1_IARCSC); /* interrupt on all characters */ |
104 | z8530_write_a(WR1, WR1_IARCSC); /* interrupt on all characters */ |
88 | 105 | ||
89 | /* 8 bits per character and enable receiver */ |
106 | /* 8 bits per character and enable receiver */ |
90 | z8530_write_a(WR3, WR3_RX8BITSCH | WR3_RX_ENABLE); |
107 | z8530_write_a(WR3, WR3_RX8BITSCH | WR3_RX_ENABLE); |
91 | 108 | ||
92 | z8530_write_a(WR9, WR9_MIE); /* Master Interrupt Enable. */ |
109 | z8530_write_a(WR9, WR9_MIE); /* Master Interrupt Enable. */ |
93 | 110 | ||
94 | /* |
111 | /* |
95 | * We need to initialize the FireHose Controller, |
112 | * We need to initialize the FireHose Controller, |
96 | * to which is this z8530 attached. Otherwise |
113 | * to which is this z8530 attached. Otherwise |
97 | * interrupts generated by the z8530 would not |
114 | * interrupts generated by the z8530 would not |