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


Ignore:
Timestamp:
2005-12-08T00:29:53Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
944b15c
Parents:
9d5e23c
Message:

Added simple support for arc keyboards on mips.

File:
1 edited

Legend:

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

    r9d5e23c rac0cb2a  
    3636#include <synch/waitq.h>
    3737#include <typedefs.h>
     38#include <arch/drivers/arc.h>
    3839
    3940static void keyboard_enable(void);
    4041static void keyboard_disable(void);
     42static void arc_kb_disable(void);
     43static void arc_kb_enable(void);
    4144
    4245static chardev_t kbrd;
    43 static chardev_operations_t ops = {
     46
     47static chardev_operations_t arc_ops = {
     48        .resume = arc_kb_enable,
     49        .suspend = arc_kb_disable
     50};
     51
     52static chardev_operations_t msim_ops = {
    4453        .resume = keyboard_enable,
    4554        .suspend = keyboard_disable
    4655};
    4756
     57static int arc_kb_enabled;
     58
    4859/** Initialize keyboard subsystem. */
    4960void keyboard_init(void)
    5061{
    51         cp0_unmask_int(KEYBOARD_IRQ);
    52         chardev_initialize(&kbrd, &ops);
     62        if (arc_enabled()) {
     63                chardev_initialize(&kbrd, &arc_ops);
     64                arc_kb_enabled = 1;
     65        } else {
     66                cp0_unmask_int(KEYBOARD_IRQ);
     67                chardev_initialize(&kbrd, &msim_ops);
     68        }
    5369        stdin = &kbrd;
    5470}
     
    7490        cp0_mask_int(KEYBOARD_IRQ);
    7591}
     92
     93/*****************************/
     94/* Arc keyboard */
     95
     96void keyboard_poll(void)
     97{
     98        int ch;
     99
     100        if (!arc_enabled() || !arc_kb_enabled)
     101                return;
     102        while ((ch = arc_getchar()) != -1)
     103                chardev_push_character(&kbrd, ch);             
     104}
     105
     106static void arc_kb_enable(void)
     107{
     108        arc_kb_enabled = 1;
     109}
     110
     111/* Called from getc(). */
     112static void arc_kb_disable(void)
     113{
     114        arc_kb_enabled = 0;
     115}
Note: See TracChangeset for help on using the changeset viewer.