Rev 4629 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4629 | Rev 4632 | ||
---|---|---|---|
Line 114... | Line 114... | ||
114 | } |
114 | } |
115 | 115 | ||
116 | static void pl050_irq_handler(irq_t *irq, void *arg, ...) |
116 | static void pl050_irq_handler(irq_t *irq, void *arg, ...) |
117 | { |
117 | { |
118 | static int key_released_flag = 0; |
118 | static int key_released_flag = 0; |
119 | static uint8_t prev_char = 0xFF; |
119 | static int caps_count = 0; |
120 | 120 | ||
121 | if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) |
121 | if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) |
122 | ipc_irq_send_notif(irq); |
122 | ipc_irq_send_notif(irq); |
123 | else { |
123 | else { |
124 | uint8_t data; |
124 | uint8_t data; |
Line 127... | Line 127... | ||
127 | if (((status = pl050_statusread()) & PL050_STAT_RXFULL)) { |
127 | if (((status = pl050_statusread()) & PL050_STAT_RXFULL)) { |
128 | data = pl050_dataread(); |
128 | data = pl050_dataread(); |
129 | 129 | ||
130 | if (data == PL050_ESC_KEY) |
130 | if (data == PL050_ESC_KEY) |
131 | return; |
131 | return; |
- | 132 | ||
- | 133 | if (data == 0x58) { |
|
- | 134 | if (caps_count == 2) { |
|
- | 135 | caps_count = 0; |
|
- | 136 | return; |
|
- | 137 | } else if (key_released_flag && !caps_count) { |
|
- | 138 | key_released_flag = 0; |
|
- | 139 | return; |
|
- | 140 | } |
|
- | 141 | caps_count++; |
|
- | 142 | } |
|
132 | 143 | ||
133 | if (data == PL050_KEY_RELEASE) { |
144 | if (data == PL050_KEY_RELEASE) { |
134 | key_released_flag = 1; |
145 | key_released_flag = 1; |
135 | } else { |
146 | } else { |
136 | if (key_released_flag && prev_char == data) { |
147 | if (key_released_flag) { |
137 | prev_char = 0xFF; |
- | |
138 | key_released(data); |
148 | key_released(data); |
139 | } else { |
149 | } else { |
140 | key_pressed(data); |
150 | key_pressed(data); |
141 | prev_char = data; |
- | |
142 | } |
151 | } |
143 | key_released_flag = 0; |
152 | key_released_flag = 0; |
144 | } |
153 | } |
145 | } |
154 | } |
146 | } |
155 | } |
Line 159... | Line 168... | ||
159 | pl050_kbd_irq.claim = pl050_claim; |
168 | pl050_kbd_irq.claim = pl050_claim; |
160 | pl050_kbd_irq.handler = pl050_irq_handler; |
169 | pl050_kbd_irq.handler = pl050_irq_handler; |
161 | pl050_kbd_pbase = pbase; |
170 | pl050_kbd_pbase = pbase; |
162 | pl050_kbd_vbase = vbase; |
171 | pl050_kbd_vbase = vbase; |
163 | irq_register(&pl050_kbd_irq); |
172 | irq_register(&pl050_kbd_irq); |
164 | val = PL050_CR_RXINTR | PL050_CR_INTR | PL050_CR_FKMIC; |
173 | val = PL050_CR_RXINTR | PL050_CR_INTR; |
165 | 174 | ||
166 | pl050_crwrite(val); |
175 | pl050_crwrite(val); |
167 | 176 | ||
168 | /* reset the data buffer */ |
177 | /* reset the data buffer */ |
169 | pl050_dataread(); |
178 | pl050_dataread(); |
Line 188... | Line 197... | ||
188 | } |
197 | } |
189 | 198 | ||
190 | char pl050_key_read(chardev_t *d) |
199 | char pl050_key_read(chardev_t *d) |
191 | { |
200 | { |
192 | char ch; |
201 | char ch; |
193 | - | ||
- | 202 | printf("entering key_read\n"); |
|
194 | while(!(ch = active_read_buff_read())) { |
203 | while(!(ch = active_read_buff_read())) { |
195 | uint8_t x; |
204 | uint8_t x; |
196 | while (!(pl050_statusread() & PL050_STAT_RXFULL)) |
205 | while (!(pl050_statusread() & PL050_STAT_RXFULL)) |
197 | ; |
206 | ; |
198 | x = pl050_dataread(); |
207 | x = pl050_dataread(); |
Line 210... | Line 219... | ||
210 | */ |
219 | */ |
211 | void pl050_poll(void) |
220 | void pl050_poll(void) |
212 | { |
221 | { |
213 | uint8_t x; |
222 | uint8_t x; |
214 | 223 | ||
- | 224 | printf("entering poll\n"); |
|
215 | while (((x = pl050_statusread() & PL050_STAT_RXFULL))) { |
225 | while (((x = pl050_statusread() & PL050_STAT_RXFULL))) { |
216 | x = pl050_dataread(); |
226 | x = pl050_dataread(); |
217 | if (x & KEY_RELEASE) |
227 | if (x & KEY_RELEASE) |
218 | key_released(x ^ KEY_RELEASE); |
228 | key_released(x ^ KEY_RELEASE); |
219 | else |
229 | else |