Rev 3941 | Rev 3958 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3941 | Rev 3947 | ||
---|---|---|---|
Line 92... | Line 92... | ||
92 | 92 | ||
93 | /** Structure for i8042's IRQ. */ |
93 | /** Structure for i8042's IRQ. */ |
94 | static irq_t i8042_kbd_irq; |
94 | static irq_t i8042_kbd_irq; |
95 | static irq_t i8042_mouse_irq; |
95 | static irq_t i8042_mouse_irq; |
96 | 96 | ||
97 | void i8042_grab(void) |
- | |
98 | { |
- | |
99 | ipl_t ipl = interrupts_disable(); |
- | |
100 | - | ||
101 | spinlock_lock(&i8042_kbd_irq.lock); |
- | |
102 | i8042_kbd_irq.notif_cfg.notify = false; |
- | |
103 | spinlock_unlock(&i8042_kbd_irq.lock); |
- | |
104 | - | ||
105 | spinlock_lock(&i8042_mouse_irq.lock); |
- | |
106 | i8042_mouse_irq.notif_cfg.notify = false; |
- | |
107 | spinlock_unlock(&i8042_mouse_irq.lock); |
- | |
108 | - | ||
109 | interrupts_restore(ipl); |
- | |
110 | } |
- | |
111 | - | ||
112 | void i8042_release(void) |
- | |
113 | { |
- | |
114 | ipl_t ipl = interrupts_disable(); |
- | |
115 | - | ||
116 | spinlock_lock(&i8042_kbd_irq.lock); |
- | |
117 | if (i8042_kbd_irq.notif_cfg.answerbox) |
- | |
118 | i8042_kbd_irq.notif_cfg.notify = true; |
- | |
119 | spinlock_unlock(&i8042_kbd_irq.lock); |
- | |
120 | - | ||
121 | spinlock_lock(&i8042_mouse_irq.lock); |
- | |
122 | if (i8042_mouse_irq.notif_cfg.answerbox) |
- | |
123 | i8042_mouse_irq.notif_cfg.notify = true; |
- | |
124 | spinlock_unlock(&i8042_mouse_irq.lock); |
- | |
125 | - | ||
126 | interrupts_restore(ipl); |
- | |
127 | } |
- | |
128 | - | ||
129 | static irq_ownership_t i8042_claim(irq_t *irq) |
97 | static irq_ownership_t i8042_claim(irq_t *irq) |
130 | { |
98 | { |
131 | i8042_instance_t *i8042_instance = irq->instance; |
99 | i8042_instance_t *i8042_instance = irq->instance; |
132 | i8042_t *dev = i8042_instance->i8042; |
100 | i8042_t *dev = i8042_instance->i8042; |
133 | if (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK) |
101 | if (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK) |
Line 136... | Line 104... | ||
136 | return IRQ_DECLINE; |
104 | return IRQ_DECLINE; |
137 | } |
105 | } |
138 | 106 | ||
139 | static void i8042_irq_handler(irq_t *irq) |
107 | static void i8042_irq_handler(irq_t *irq) |
140 | { |
108 | { |
141 | if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) { |
- | |
142 | /* |
- | |
143 | * This will hopefully go to the IRQ dispatcher code soon. |
- | |
144 | */ |
- | |
145 | ipc_irq_send_notif(irq); |
- | |
146 | return; |
- | |
147 | } |
- | |
148 | - | ||
149 | i8042_instance_t *instance = irq->instance; |
109 | i8042_instance_t *instance = irq->instance; |
150 | i8042_t *dev = instance->i8042; |
110 | i8042_t *dev = instance->i8042; |
151 | 111 | ||
152 | uint8_t data; |
112 | uint8_t data; |
153 | uint8_t status; |
113 | uint8_t status; |
Line 211... | Line 171... | ||
211 | sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); |
171 | sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); |
212 | #endif |
172 | #endif |
213 | sysinfo_set_item_val("mouse", NULL, true); |
173 | sysinfo_set_item_val("mouse", NULL, true); |
214 | sysinfo_set_item_val("mouse.devno", NULL, mouse_devno); |
174 | sysinfo_set_item_val("mouse.devno", NULL, mouse_devno); |
215 | sysinfo_set_item_val("mouse.inr", NULL, mouse_inr); |
175 | sysinfo_set_item_val("mouse.inr", NULL, mouse_inr); |
216 | - | ||
217 | i8042_grab(); |
- | |
218 | } |
176 | } |
219 | 177 | ||
220 | /* Called from getc(). */ |
178 | /* Called from getc(). */ |
221 | void i8042_resume(chardev_t *d) |
179 | void i8042_resume(chardev_t *d) |
222 | { |
180 | { |