Subversion Repositories HelenOS-historic

Rev

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

Rev 1196 Rev 1474
Line 265... Line 265...
265
};
265
};
266
 
266
 
267
static void i8042_interrupt(int n, istate_t *istate);
267
static void i8042_interrupt(int n, istate_t *istate);
268
static void i8042_wait(void);
268
static void i8042_wait(void);
269
 
269
 
270
/** Initialize i8042. */
270
static iroutine oldvector;
-
 
271
/** Initialize keyboard and service interrupts using kernel routine */
271
void i8042_init(void)
272
void i8042_grab(void)
272
{
273
{
273
    int i;
-
 
274
 
-
 
275
    exc_register(VECTOR_KBD, "i8042_interrupt", (iroutine) i8042_interrupt);
274
    oldvector = exc_register(VECTOR_KBD, "i8042_interrupt", (iroutine) i8042_interrupt);
276
    i8042_wait();
275
    i8042_wait();
277
    i8042_command_write(i8042_SET_COMMAND);
276
    i8042_command_write(i8042_SET_COMMAND);
278
    i8042_wait();
277
    i8042_wait();
279
    i8042_data_write(i8042_COMMAND);
278
    i8042_data_write(i8042_COMMAND);
280
    i8042_wait();
279
    i8042_wait();
-
 
280
}
-
 
281
/** Resume the former interrupt vector */
-
 
282
void i8042_release(void)
-
 
283
{
-
 
284
    if (oldvector)
-
 
285
        exc_register(VECTOR_KBD, "user_interrupt", oldvector);
-
 
286
}
-
 
287
 
-
 
288
/** Initialize i8042. */
-
 
289
void i8042_init(void)
-
 
290
{
-
 
291
    int i;
-
 
292
 
-
 
293
    i8042_grab();
-
 
294
        /* Prevent user from accidentaly releasing calling i8042_resume
-
 
295
     * and disabling keyboard
-
 
296
     */
-
 
297
    oldvector = NULL;
281
 
298
 
282
    trap_virtual_enable_irqs(1<<IRQ_KBD);
299
    trap_virtual_enable_irqs(1<<IRQ_KBD);
283
    chardev_initialize("i8042_kbd", &kbrd, &ops);
300
    chardev_initialize("i8042_kbd", &kbrd, &ops);
284
    stdin = &kbrd;
301
    stdin = &kbrd;
285
 
302