OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [mips64/] [lib/] [kbd-std.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * This file is subject to the terms and conditions of the GNU General Public
3
 * License.  See the file "COPYING" in the main directory of this archive
4
 * for more details.
5
 *
6
 * Routines for standard PC style keyboards accessible via I/O ports.
7
 *
8
 * Copyright (C) 1998, 1999 by Ralf Baechle
9
 */
10
#include <linux/ioport.h>
11
#include <linux/sched.h>
12
#include <linux/pc_keyb.h>
13
#include <asm/keyboard.h>
14
#include <asm/io.h>
15
 
16
#define KEYBOARD_IRQ 1
17
#define AUX_IRQ 12
18
 
19
static void std_kbd_request_region(void)
20
{
21
        request_region(0x60, 16, "keyboard");
22
}
23
 
24
static int std_kbd_request_irq(void (*handler)(int, void *, struct pt_regs *))
25
{
26
        return request_irq(KEYBOARD_IRQ, handler, 0, "keyboard", NULL);
27
}
28
 
29
static int std_aux_request_irq(void (*handler)(int, void *, struct pt_regs *))
30
{
31
        return request_irq(AUX_IRQ, handler, 0, "PS/2 Mouse", NULL);
32
}
33
 
34
static void std_aux_free_irq(void)
35
{
36
        free_irq(AUX_IRQ, NULL);
37
}
38
 
39
static unsigned char std_kbd_read_input(void)
40
{
41
        return inb(KBD_DATA_REG);
42
}
43
 
44
static void std_kbd_write_output(unsigned char val)
45
{
46
        int status;
47
 
48
        do {
49
                status = inb(KBD_CNTL_REG);
50
        } while (status & KBD_STAT_IBF);
51
        outb(val, KBD_DATA_REG);
52
}
53
 
54
static void std_kbd_write_command(unsigned char val)
55
{
56
        int status;
57
 
58
        do {
59
                status = inb(KBD_CNTL_REG);
60
        } while (status & KBD_STAT_IBF);
61
        outb(val, KBD_CNTL_REG);
62
}
63
 
64
static unsigned char std_kbd_read_status(void)
65
{
66
        return inb(KBD_STATUS_REG);
67
}
68
 
69
struct kbd_ops std_kbd_ops = {
70
        std_kbd_request_region,
71
        std_kbd_request_irq,
72
 
73
        std_aux_request_irq,
74
        std_aux_free_irq,
75
 
76
        std_kbd_read_input,
77
        std_kbd_write_output,
78
        std_kbd_write_command,
79
        std_kbd_read_status
80
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.