Changeset 607c5f9 in mainline for arch/mips32/src/drivers/keyboard.c


Ignore:
Timestamp:
2005-11-23T00:16:03Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a83a802
Parents:
2677758
Message:

Enable dummy kconsole for ia32 and amd64 (UP mode works).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/mips32/src/drivers/keyboard.c

    r2677758 r607c5f9  
    3737#include <typedefs.h>
    3838
     39static void keyboard_enable(void);
     40static void keyboard_disable(void);
     41
    3942static chardev_t kbrd;
    40 
    41 static void keyboard_enable(void);
     43static chardev_operations_t ops = {
     44        .resume = keyboard_enable,
     45        .suspend = keyboard_disable
     46};
    4247
    4348/** Initialize keyboard subsystem. */
     
    4550{
    4651        cp0_unmask_int(KEYBOARD_IRQ);
    47         chardev_initialize(&kbrd, keyboard_enable);
     52        chardev_initialize(&kbrd, &ops);
    4853        stdin = &kbrd;
    4954}
    5055
    51 /** Process keyboard interrupt.
    52  *
    53  * This function is called directly from the interrupt handler.
    54  * It feeds the keyboard buffer with characters read. When the buffer
    55  * is full, it simply masks the keyboard interrupt signal.
    56  */
     56/** Process keyboard interrupt. */
    5757void keyboard(void)
    5858{
    5959        char ch;
    6060
    61         spinlock_lock(&kbrd.lock);
    62         kbrd.counter++;
    63         if (kbrd.counter == CHARDEV_BUFLEN - 1) {
    64                 /* buffer full => disable keyboard interrupt */
    65                 cp0_mask_int(KEYBOARD_IRQ);
    66         }
    67 
    6861        ch = *((char *) KEYBOARD_ADDRESS);
    69         putchar(ch);
    70         kbrd.buffer[kbrd.index++] = ch;
    71         kbrd.index = kbrd.index % CHARDEV_BUFLEN; /* index modulo size of buffer */
    72         waitq_wakeup(&kbrd.wq, WAKEUP_FIRST);
    73         spinlock_unlock(&kbrd.lock);
     62        chardev_push_character(&kbrd, ch);
    7463}
    7564
     
    7968        cp0_unmask_int(KEYBOARD_IRQ);
    8069}
     70
     71/* Called from getc(). */
     72void keyboard_disable(void)
     73{
     74        cp0_mask_int(KEYBOARD_IRQ);
     75}
Note: See TracChangeset for help on using the changeset viewer.