Subversion Repositories HelenOS-historic

Rev

Rev 1702 | Rev 1753 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 jermar 1
/*
2
 * Copyright (C) 2001-2004 Jakub Jermar
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
 
1702 cejka 29
 /** @addtogroup genarch   
30
 * @{
31
 */
32
/** @file
33
 */
34
 
894 jermar 35
#include <genarch/i8042/i8042.h>
36
#include <arch/drivers/i8042.h>
1 jermar 37
#include <arch/interrupt.h>
38
#include <cpu.h>
39
#include <arch/asm.h>
40
#include <arch.h>
508 jermar 41
#include <synch/spinlock.h>
42
#include <typedefs.h>
511 jermar 43
#include <console/chardev.h>
44
#include <console/console.h>
517 jermar 45
#include <macros.h>
576 palkovsky 46
#include <interrupt.h>
1 jermar 47
 
508 jermar 48
/**
1 jermar 49
 * i8042 processor driver.
508 jermar 50
 * It takes care of low-level keyboard functions.
1 jermar 51
 */
52
 
512 jermar 53
/** Keyboard commands. */
54
#define KBD_ENABLE  0xf4
55
#define KBD_DISABLE 0xf5
56
#define KBD_ACK     0xfa
57
 
670 vana 58
/*
893 jermar 59
 * 60  Write 8042 Command Byte: next data byte written to port 60h is
895 jermar 60
 *     placed in 8042 command register. Format:
893 jermar 61
 *
62
 *    |7|6|5|4|3|2|1|0|8042 Command Byte
63
 *     | | | | | | | `---- 1=enable output register full interrupt
64
 *     | | | | | | `----- should be 0
65
 *     | | | | | `------ 1=set status register system, 0=clear
66
 *     | | | | `------- 1=override keyboard inhibit, 0=allow inhibit
67
 *     | | | `-------- disable keyboard I/O by driving clock line low
68
 *     | | `--------- disable auxiliary device, drives clock line low
69
 *     | `---------- IBM scancode translation 0=AT, 1=PC/XT
70
 *     `----------- reserved, should be 0
71
 */
670 vana 72
 
893 jermar 73
#define i8042_SET_COMMAND   0x60
74
#define i8042_COMMAND       0x49
894 jermar 75
 
76
#define i8042_BUFFER_FULL_MASK  0x01
893 jermar 77
#define i8042_WAIT_MASK     0x02
670 vana 78
 
508 jermar 79
#define SPECIAL     '?'
80
#define KEY_RELEASE 0x80
81
 
895 jermar 82
/**
83
 * These codes read from i8042 data register are silently ignored.
84
 */
85
#define IGNORE_CODE 0x7f
86
 
508 jermar 87
static void key_released(__u8 sc);
88
static void key_pressed(__u8 sc);
878 vana 89
static char key_read(chardev_t *d);
508 jermar 90
 
91
#define PRESSED_SHIFT       (1<<0)
92
#define PRESSED_CAPSLOCK    (1<<1)
93
#define LOCKED_CAPSLOCK     (1<<0)
94
 
894 jermar 95
#define ACTIVE_READ_BUFF_SIZE 16    /* Must be power of 2 */
878 vana 96
 
894 jermar 97
static __u8 active_read_buff[ACTIVE_READ_BUFF_SIZE];
878 vana 98
 
623 jermar 99
SPINLOCK_INITIALIZE(keylock);       /**< keylock protects keyflags and lockflags. */
508 jermar 100
static volatile int keyflags;       /**< Tracking of multiple keypresses. */
509 jermar 101
static volatile int lockflags;      /**< Tracking of multiple keys lockings. */
508 jermar 102
 
575 palkovsky 103
static void i8042_suspend(chardev_t *);
104
static void i8042_resume(chardev_t *);
511 jermar 105
 
106
static chardev_t kbrd;
107
static chardev_operations_t ops = {
108
    .suspend = i8042_suspend,
878 vana 109
    .resume = i8042_resume,
110
    .read = key_read
511 jermar 111
};
112
 
508 jermar 113
/** Primary meaning of scancodes. */
114
static char sc_primary_map[] = {
115
    SPECIAL, /* 0x00 */
116
    SPECIAL, /* 0x01 - Esc */
117
    '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
588 palkovsky 118
    '\b', /* 0x0e - Backspace */
508 jermar 119
    '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',
120
    SPECIAL, /* 0x1d - LCtrl */
121
    'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'',
122
    '`',
123
    SPECIAL, /* 0x2a - LShift */
124
    '\\',
125
    'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
126
    SPECIAL, /* 0x36 - RShift */
127
    '*',
128
    SPECIAL, /* 0x38 - LAlt */
129
    ' ',
130
    SPECIAL, /* 0x3a - CapsLock */
131
    SPECIAL, /* 0x3b - F1 */
132
    SPECIAL, /* 0x3c - F2 */
133
    SPECIAL, /* 0x3d - F3 */
134
    SPECIAL, /* 0x3e - F4 */
135
    SPECIAL, /* 0x3f - F5 */
136
    SPECIAL, /* 0x40 - F6 */
137
    SPECIAL, /* 0x41 - F7 */
138
    SPECIAL, /* 0x42 - F8 */
139
    SPECIAL, /* 0x43 - F9 */
140
    SPECIAL, /* 0x44 - F10 */
141
    SPECIAL, /* 0x45 - NumLock */
142
    SPECIAL, /* 0x46 - ScrollLock */
143
    '7', '8', '9', '-',
144
    '4', '5', '6', '+',
145
    '1', '2', '3',
146
    '0', '.',
147
    SPECIAL, /* 0x54 - Alt-SysRq */
148
    SPECIAL, /* 0x55 - F11/F12/PF1/FN */
149
    SPECIAL, /* 0x56 - unlabelled key next to LAlt */
150
    SPECIAL, /* 0x57 - F11 */
151
    SPECIAL, /* 0x58 - F12 */
152
    SPECIAL, /* 0x59 */
153
    SPECIAL, /* 0x5a */
154
    SPECIAL, /* 0x5b */
155
    SPECIAL, /* 0x5c */
156
    SPECIAL, /* 0x5d */
157
    SPECIAL, /* 0x5e */
158
    SPECIAL, /* 0x5f */
159
    SPECIAL, /* 0x60 */
160
    SPECIAL, /* 0x61 */
161
    SPECIAL, /* 0x62 */
162
    SPECIAL, /* 0x63 */
163
    SPECIAL, /* 0x64 */
164
    SPECIAL, /* 0x65 */
165
    SPECIAL, /* 0x66 */
166
    SPECIAL, /* 0x67 */
167
    SPECIAL, /* 0x68 */
168
    SPECIAL, /* 0x69 */
169
    SPECIAL, /* 0x6a */
170
    SPECIAL, /* 0x6b */
171
    SPECIAL, /* 0x6c */
172
    SPECIAL, /* 0x6d */
173
    SPECIAL, /* 0x6e */
174
    SPECIAL, /* 0x6f */
175
    SPECIAL, /* 0x70 */
176
    SPECIAL, /* 0x71 */
177
    SPECIAL, /* 0x72 */
178
    SPECIAL, /* 0x73 */
179
    SPECIAL, /* 0x74 */
180
    SPECIAL, /* 0x75 */
181
    SPECIAL, /* 0x76 */
182
    SPECIAL, /* 0x77 */
183
    SPECIAL, /* 0x78 */
184
    SPECIAL, /* 0x79 */
185
    SPECIAL, /* 0x7a */
186
    SPECIAL, /* 0x7b */
187
    SPECIAL, /* 0x7c */
188
    SPECIAL, /* 0x7d */
189
    SPECIAL, /* 0x7e */
190
    SPECIAL, /* 0x7f */
191
};
192
 
193
/** Secondary meaning of scancodes. */
194
static char sc_secondary_map[] = {
195
    SPECIAL, /* 0x00 */
196
    SPECIAL, /* 0x01 - Esc */
197
    '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',
198
    SPECIAL, /* 0x0e - Backspace */
199
    '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n',
200
    SPECIAL, /* 0x1d - LCtrl */
201
    'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"',
202
    '~',
203
    SPECIAL, /* 0x2a - LShift */
204
    '|',
205
    'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
206
    SPECIAL, /* 0x36 - RShift */
207
    '*',
208
    SPECIAL, /* 0x38 - LAlt */
209
    ' ',
210
    SPECIAL, /* 0x3a - CapsLock */
211
    SPECIAL, /* 0x3b - F1 */
212
    SPECIAL, /* 0x3c - F2 */
213
    SPECIAL, /* 0x3d - F3 */
214
    SPECIAL, /* 0x3e - F4 */
215
    SPECIAL, /* 0x3f - F5 */
216
    SPECIAL, /* 0x40 - F6 */
217
    SPECIAL, /* 0x41 - F7 */
218
    SPECIAL, /* 0x42 - F8 */
219
    SPECIAL, /* 0x43 - F9 */
220
    SPECIAL, /* 0x44 - F10 */
221
    SPECIAL, /* 0x45 - NumLock */
222
    SPECIAL, /* 0x46 - ScrollLock */
223
    '7', '8', '9', '-',
224
    '4', '5', '6', '+',
225
    '1', '2', '3',
226
    '0', '.',
227
    SPECIAL, /* 0x54 - Alt-SysRq */
228
    SPECIAL, /* 0x55 - F11/F12/PF1/FN */
229
    SPECIAL, /* 0x56 - unlabelled key next to LAlt */
230
    SPECIAL, /* 0x57 - F11 */
231
    SPECIAL, /* 0x58 - F12 */
232
    SPECIAL, /* 0x59 */
233
    SPECIAL, /* 0x5a */
234
    SPECIAL, /* 0x5b */
235
    SPECIAL, /* 0x5c */
236
    SPECIAL, /* 0x5d */
237
    SPECIAL, /* 0x5e */
238
    SPECIAL, /* 0x5f */
239
    SPECIAL, /* 0x60 */
240
    SPECIAL, /* 0x61 */
241
    SPECIAL, /* 0x62 */
242
    SPECIAL, /* 0x63 */
243
    SPECIAL, /* 0x64 */
244
    SPECIAL, /* 0x65 */
245
    SPECIAL, /* 0x66 */
246
    SPECIAL, /* 0x67 */
247
    SPECIAL, /* 0x68 */
248
    SPECIAL, /* 0x69 */
249
    SPECIAL, /* 0x6a */
250
    SPECIAL, /* 0x6b */
251
    SPECIAL, /* 0x6c */
252
    SPECIAL, /* 0x6d */
253
    SPECIAL, /* 0x6e */
254
    SPECIAL, /* 0x6f */
255
    SPECIAL, /* 0x70 */
256
    SPECIAL, /* 0x71 */
257
    SPECIAL, /* 0x72 */
258
    SPECIAL, /* 0x73 */
259
    SPECIAL, /* 0x74 */
260
    SPECIAL, /* 0x75 */
261
    SPECIAL, /* 0x76 */
262
    SPECIAL, /* 0x77 */
263
    SPECIAL, /* 0x78 */
264
    SPECIAL, /* 0x79 */
265
    SPECIAL, /* 0x7a */
266
    SPECIAL, /* 0x7b */
267
    SPECIAL, /* 0x7c */
268
    SPECIAL, /* 0x7d */
269
    SPECIAL, /* 0x7e */
270
    SPECIAL, /* 0x7f */
271
};
272
 
958 jermar 273
static void i8042_interrupt(int n, istate_t *istate);
895 jermar 274
static void i8042_wait(void);
576 palkovsky 275
 
1474 palkovsky 276
static iroutine oldvector;
277
/** Initialize keyboard and service interrupts using kernel routine */
278
void i8042_grab(void)
1 jermar 279
{
1474 palkovsky 280
    oldvector = exc_register(VECTOR_KBD, "i8042_interrupt", (iroutine) i8042_interrupt);
895 jermar 281
    i8042_wait();
894 jermar 282
    i8042_command_write(i8042_SET_COMMAND);
895 jermar 283
    i8042_wait();
894 jermar 284
    i8042_data_write(i8042_COMMAND);
895 jermar 285
    i8042_wait();
1474 palkovsky 286
}
287
/** Resume the former interrupt vector */
288
void i8042_release(void)
289
{
290
    if (oldvector)
291
        exc_register(VECTOR_KBD, "user_interrupt", oldvector);
292
}
670 vana 293
 
1474 palkovsky 294
/** Initialize i8042. */
295
void i8042_init(void)
296
{
297
    int i;
298
 
299
    i8042_grab();
300
        /* Prevent user from accidentaly releasing calling i8042_resume
301
     * and disabling keyboard
302
     */
303
    oldvector = NULL;
304
 
512 jermar 305
    trap_virtual_enable_irqs(1<<IRQ_KBD);
575 palkovsky 306
    chardev_initialize("i8042_kbd", &kbrd, &ops);
511 jermar 307
    stdin = &kbrd;
1195 jermar 308
 
1194 vana 309
    /*
1195 jermar 310
     * Clear input buffer.
311
     * Number of iterations is limited to prevent infinite looping.
312
     */
313
    for (i = 0; (i8042_status_read() & i8042_BUFFER_FULL_MASK) && i < 100; i++) {
1194 vana 314
        i8042_data_read();
1195 jermar 315
    }  
1 jermar 316
}
317
 
508 jermar 318
/** Process i8042 interrupt.
319
 *
320
 * @param n Interrupt vector.
1708 jermar 321
 * @param istate Interrupted state.
508 jermar 322
 */
958 jermar 323
void i8042_interrupt(int n, istate_t *istate)
1 jermar 324
{
325
    __u8 x;
326
 
327
    trap_virtual_eoi();
894 jermar 328
    x = i8042_data_read();
508 jermar 329
    if (x & KEY_RELEASE)
330
        key_released(x ^ KEY_RELEASE);
331
    else
332
        key_pressed(x);
1 jermar 333
}
508 jermar 334
 
895 jermar 335
/** Wait until the controller reads its data. */
336
void i8042_wait(void) {
337
    while (i8042_status_read() & i8042_WAIT_MASK) {
338
        /* wait */
339
    }
340
}
341
 
508 jermar 342
/** Process release of key.
343
 *
344
 * @param sc Scancode of the key being released.
345
 */
346
void key_released(__u8 sc)
347
{
348
    spinlock_lock(&keylock);
349
    switch (sc) {
350
        case SC_LSHIFT:
351
        case SC_RSHIFT:
352
        keyflags &= ~PRESSED_SHIFT;
353
        break;
354
        case SC_CAPSLOCK:
355
        keyflags &= ~PRESSED_CAPSLOCK;
356
        if (lockflags & LOCKED_CAPSLOCK)
357
            lockflags &= ~LOCKED_CAPSLOCK;
358
        else
359
            lockflags |= LOCKED_CAPSLOCK;
360
        break;
361
        default:
362
        break;
363
    }
364
    spinlock_unlock(&keylock);
365
}
366
 
367
/** Process keypress.
368
 *
369
 * @param sc Scancode of the key being pressed.
370
 */
371
void key_pressed(__u8 sc)
372
{
373
    char *map = sc_primary_map;
374
    char ascii = sc_primary_map[sc];
375
    bool shift, capslock;
376
    bool letter = false;
377
 
378
    spinlock_lock(&keylock);
379
    switch (sc) {
601 palkovsky 380
    case SC_LSHIFT:
381
    case SC_RSHIFT:
508 jermar 382
            keyflags |= PRESSED_SHIFT;
383
        break;
601 palkovsky 384
    case SC_CAPSLOCK:
508 jermar 385
        keyflags |= PRESSED_CAPSLOCK;
386
        break;
601 palkovsky 387
    case SC_SPEC_ESCAPE:
388
        break;
389
    case SC_LEFTARR:
390
        chardev_push_character(&kbrd, 0x1b);
391
        chardev_push_character(&kbrd, 0x5b);
392
        chardev_push_character(&kbrd, 0x44);
393
        break;
394
    case SC_RIGHTARR:
395
        chardev_push_character(&kbrd, 0x1b);
396
        chardev_push_character(&kbrd, 0x5b);
397
        chardev_push_character(&kbrd, 0x43);
398
        break;
399
    case SC_UPARR:
400
        chardev_push_character(&kbrd, 0x1b);
401
        chardev_push_character(&kbrd, 0x5b);
402
        chardev_push_character(&kbrd, 0x41);
403
        break;
404
    case SC_DOWNARR:
405
        chardev_push_character(&kbrd, 0x1b);
406
        chardev_push_character(&kbrd, 0x5b);
407
        chardev_push_character(&kbrd, 0x42);
408
        break;
606 palkovsky 409
    case SC_HOME:
410
        chardev_push_character(&kbrd, 0x1b);
411
        chardev_push_character(&kbrd, 0x4f);
412
        chardev_push_character(&kbrd, 0x48);
413
        break;
414
    case SC_END:
415
        chardev_push_character(&kbrd, 0x1b);
416
        chardev_push_character(&kbrd, 0x4f);
417
        chardev_push_character(&kbrd, 0x46);
418
        break;
419
    case SC_DELETE:
420
        chardev_push_character(&kbrd, 0x1b);
421
        chardev_push_character(&kbrd, 0x5b);
422
        chardev_push_character(&kbrd, 0x33);
423
        chardev_push_character(&kbrd, 0x7e);
424
        break;
601 palkovsky 425
    default:
517 jermar 426
            letter = is_lower(ascii);
508 jermar 427
        capslock = (keyflags & PRESSED_CAPSLOCK) || (lockflags & LOCKED_CAPSLOCK);
428
        shift = keyflags & PRESSED_SHIFT;
429
        if (letter && capslock)
430
            shift = !shift;
431
        if (shift)
432
            map = sc_secondary_map;
511 jermar 433
        chardev_push_character(&kbrd, map[sc]);
508 jermar 434
        break;
435
    }
436
    spinlock_unlock(&keylock);
437
}
511 jermar 438
 
439
/* Called from getc(). */
575 palkovsky 440
void i8042_resume(chardev_t *d)
511 jermar 441
{
442
}
443
 
444
/* Called from getc(). */
575 palkovsky 445
void i8042_suspend(chardev_t *d)
511 jermar 446
{
447
}
878 vana 448
 
449
static __u8 active_read_buff_read(void)
450
{
451
    static int i=0;
894 jermar 452
    i &= (ACTIVE_READ_BUFF_SIZE-1);
453
    if(!active_read_buff[i]) {
878 vana 454
        return 0;
455
    }
456
    return active_read_buff[i++];
457
}
458
 
459
static void active_read_buff_write(__u8 ch)
460
{
461
    static int i=0;
894 jermar 462
    active_read_buff[i] = ch;
878 vana 463
    i++;
894 jermar 464
    i &= (ACTIVE_READ_BUFF_SIZE-1);
878 vana 465
    active_read_buff[i]=0;
466
}
467
 
468
 
893 jermar 469
static void active_read_key_pressed(__u8 sc)
878 vana 470
{
471
    char *map = sc_primary_map;
472
    char ascii = sc_primary_map[sc];
473
    bool shift, capslock;
474
    bool letter = false;
475
 
476
    /*spinlock_lock(&keylock);*/
477
    switch (sc) {
478
    case SC_LSHIFT:
479
    case SC_RSHIFT:
480
            keyflags |= PRESSED_SHIFT;
481
        break;
482
    case SC_CAPSLOCK:
483
        keyflags |= PRESSED_CAPSLOCK;
484
        break;
485
    case SC_SPEC_ESCAPE:
486
        break;
487
    case SC_LEFTARR:
488
        active_read_buff_write(0x1b);
489
        active_read_buff_write(0x5b);
490
        active_read_buff_write(0x44);
491
        break;
492
    case SC_RIGHTARR:
493
        active_read_buff_write(0x1b);
494
        active_read_buff_write(0x5b);
495
        active_read_buff_write(0x43);
496
        break;
497
    case SC_UPARR:
498
        active_read_buff_write(0x1b);
499
        active_read_buff_write(0x5b);
500
        active_read_buff_write(0x41);
501
        break;
502
    case SC_DOWNARR:
503
        active_read_buff_write(0x1b);
504
        active_read_buff_write(0x5b);
505
        active_read_buff_write(0x42);
506
        break;
507
    case SC_HOME:
508
        active_read_buff_write(0x1b);
509
        active_read_buff_write(0x4f);
510
        active_read_buff_write(0x48);
511
        break;
512
    case SC_END:
513
        active_read_buff_write(0x1b);
514
        active_read_buff_write(0x4f);
515
        active_read_buff_write(0x46);
516
        break;
517
    case SC_DELETE:
518
        active_read_buff_write(0x1b);
519
        active_read_buff_write(0x5b);
520
        active_read_buff_write(0x33);
521
        active_read_buff_write(0x7e);
522
        break;
523
    default:
524
            letter = is_lower(ascii);
525
        capslock = (keyflags & PRESSED_CAPSLOCK) || (lockflags & LOCKED_CAPSLOCK);
526
        shift = keyflags & PRESSED_SHIFT;
527
        if (letter && capslock)
528
            shift = !shift;
529
        if (shift)
530
            map = sc_secondary_map;
531
        active_read_buff_write(map[sc]);
532
        break;
533
    }
534
    /*spinlock_unlock(&keylock);*/
535
 
536
}
537
 
538
static char key_read(chardev_t *d)
539
{
540
    char ch;   
541
 
894 jermar 542
    while(!(ch = active_read_buff_read())) {
878 vana 543
        __u8 x;
894 jermar 544
        while (!((x=i8042_status_read() & i8042_BUFFER_FULL_MASK)))
545
            ;
546
        x = i8042_data_read();
895 jermar 547
        if (x != IGNORE_CODE) {
548
            if (x & KEY_RELEASE)
549
                key_released(x ^ KEY_RELEASE);
550
            else
551
                active_read_key_pressed(x);
552
        }
878 vana 553
    }
554
    return ch;
555
}
895 jermar 556
 
557
/** Poll for key press and release events.
558
 *
559
 * This function can be used to implement keyboard polling.
560
 */
561
void i8042_poll(void)
562
{
563
    __u8 x;
564
 
565
    while (((x = i8042_status_read() & i8042_BUFFER_FULL_MASK))) {
566
        x = i8042_data_read();
567
        if (x != IGNORE_CODE) {
568
            if (x & KEY_RELEASE)
569
                key_released(x ^ KEY_RELEASE);
570
            else
571
                key_pressed(x);
572
        }
573
    }
574
}
1702 cejka 575
 
576
 /** @}
577
 */
578