Rev 4632 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4632 | Rev 4634 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | #include <genarch/fb/visuals.h> |
51 | #include <genarch/fb/visuals.h> |
52 | #include <print.h> |
52 | #include <print.h> |
53 | 53 | ||
54 | #define PL050_KEY_RELEASE 0xF0 |
54 | #define PL050_KEY_RELEASE 0xF0 |
55 | #define PL050_ESC_KEY 0xE0 |
55 | #define PL050_ESC_KEY 0xE0 |
- | 56 | #define PL050_CAPS_SCAN_CODE 0x58 |
|
56 | 57 | ||
57 | static void pl050_suspend(chardev_t *); |
58 | static void pl050_suspend(chardev_t *); |
58 | static void pl050_resume(chardev_t *); |
59 | static void pl050_resume(chardev_t *); |
59 | 60 | ||
60 | static chardev_operations_t ops = { |
61 | static chardev_operations_t ops = { |
Line 114... | Line 115... | ||
114 | } |
115 | } |
115 | 116 | ||
116 | static void pl050_irq_handler(irq_t *irq, void *arg, ...) |
117 | static void pl050_irq_handler(irq_t *irq, void *arg, ...) |
117 | { |
118 | { |
118 | static int key_released_flag = 0; |
119 | static int key_released_flag = 0; |
119 | static int caps_count = 0; |
120 | static int caps_locked = 0; |
120 | 121 | ||
121 | if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) |
122 | if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) |
122 | ipc_irq_send_notif(irq); |
123 | ipc_irq_send_notif(irq); |
123 | else { |
124 | else { |
124 | uint8_t data; |
125 | uint8_t data; |
125 | uint8_t status; |
126 | uint8_t status; |
126 | 127 | ||
127 | if (((status = pl050_statusread()) & PL050_STAT_RXFULL)) { |
128 | while (((status = pl050_statusread()) & PL050_STAT_RXFULL)) { |
128 | data = pl050_dataread(); |
129 | data = pl050_dataread(); |
129 | 130 | ||
130 | if (data == PL050_ESC_KEY) |
- | |
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 | } |
- | |
143 | - | ||
144 | if (data == PL050_KEY_RELEASE) { |
131 | if (data == PL050_KEY_RELEASE) { |
145 | key_released_flag = 1; |
132 | key_released_flag = 1; |
146 | } else { |
133 | } else { |
147 | if (key_released_flag) { |
134 | if (key_released_flag) { |
- | 135 | key_released_flag = 0; |
|
- | 136 | if (data == PL050_CAPS_SCAN_CODE) { |
|
- | 137 | if (!caps_locked) { |
|
- | 138 | caps_locked = 1; |
|
- | 139 | } else { |
|
- | 140 | caps_locked = 0; |
|
- | 141 | return; |
|
- | 142 | } |
|
- | 143 | } |
|
148 | key_released(data); |
144 | key_released(data); |
- | 145 | ||
149 | } else { |
146 | } else { |
- | 147 | if (data == PL050_CAPS_SCAN_CODE && caps_locked) |
|
- | 148 | return; |
|
150 | key_pressed(data); |
149 | key_pressed(data); |
151 | } |
150 | } |
152 | key_released_flag = 0; |
- | |
153 | } |
151 | } |
154 | } |
152 | } |
155 | } |
153 | } |
156 | } |
154 | } |
157 | 155 |