Subversion Repositories HelenOS

Rev

Rev 3932 | Rev 3941 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3932 Rev 3934
Line 50... Line 50...
50
#include <interrupt.h>
50
#include <interrupt.h>
51
#include <sysinfo/sysinfo.h>
51
#include <sysinfo/sysinfo.h>
52
#include <ipc/irq.h>
52
#include <ipc/irq.h>
53
 
53
 
54
i8042_instance_t lgcy_i8042_instance = {
54
i8042_instance_t lgcy_i8042_instance = {
55
    .i8042 = (i8042_t *) i8042_BASE,
55
    .i8042 = (i8042_t *) I8042_BASE,
56
};
56
};
57
 
57
 
58
/* Keyboard commands. */
58
/* Keyboard commands. */
59
#define KBD_ENABLE  0xf4
59
#define KBD_ENABLE  0xf4
60
#define KBD_DISABLE 0xf5
60
#define KBD_DISABLE 0xf5
Line 86... Line 86...
86
static void i8042_resume(chardev_t *);
86
static void i8042_resume(chardev_t *);
87
 
87
 
88
static chardev_operations_t ops = {
88
static chardev_operations_t ops = {
89
    .suspend = i8042_suspend,
89
    .suspend = i8042_suspend,
90
    .resume = i8042_resume,
90
    .resume = i8042_resume,
91
    .read = i8042_key_read
-
 
92
};
91
};
93
 
92
 
94
/** Structure for i8042's IRQ. */
93
/** Structure for i8042's IRQ. */
95
static irq_t i8042_kbd_irq;
94
static irq_t i8042_kbd_irq;
96
static irq_t i8042_mouse_irq;
95
static irq_t i8042_mouse_irq;
Line 226... Line 225...
226
/* Called from getc(). */
225
/* Called from getc(). */
227
void i8042_suspend(chardev_t *d)
226
void i8042_suspend(chardev_t *d)
228
{
227
{
229
}
228
}
230
 
229
 
231
char i8042_key_read(chardev_t *d)
-
 
232
{
-
 
233
    i8042_t *dev = lgcy_i8042_instance.i8042;
-
 
234
    char ch;
-
 
235
   
-
 
236
    while (!(ch = active_read_buff_read())) {
-
 
237
        uint8_t x;
-
 
238
       
-
 
239
        while (!(pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK))
-
 
240
            ;
-
 
241
       
-
 
242
        x = pio_read_8(&dev->data);
-
 
243
        if (x & KEY_RELEASE)
-
 
244
            key_released(x ^ KEY_RELEASE);
-
 
245
        else
-
 
246
            active_read_key_pressed(x);
-
 
247
    }
-
 
248
    return ch;
-
 
249
}
-
 
250
 
-
 
251
/** @}
230
/** @}
252
 */
231
 */