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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [char/] [atarimouse.c] - Blame information for rev 1275

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Atari Mouse Driver for Linux
3
 * by Robert de Vries (robert@and.nl) 19Jul93
4
 *
5
 * 16 Nov 1994 Andreas Schwab
6
 * Compatibility with busmouse
7
 * Support for three button mouse (shamelessly stolen from MiNT)
8
 * third button wired to one of the joystick directions on joystick 1
9
 *
10
 * 1996/02/11 Andreas Schwab
11
 * Module support
12
 * Allow multiple open's
13
 *
14
 * Converted to use new generic busmouse code.  5 Apr 1998
15
 *   Russell King <rmk@arm.uk.linux.org>
16
 */
17
 
18
#include <linux/module.h>
19
 
20
#include <linux/sched.h>
21
#include <linux/errno.h>
22
#include <linux/miscdevice.h>
23
#include <linux/mm.h>
24
#include <linux/random.h>
25
#include <linux/poll.h>
26
#include <linux/init.h>
27
#include <linux/logibusmouse.h>
28
 
29
#include <asm/setup.h>
30
#include <asm/atarikb.h>
31
#include <asm/uaccess.h>
32
 
33
#include "busmouse.h"
34
 
35
static int msedev;
36
static int mouse_threshold[2] = {2,2};
37
MODULE_PARM(mouse_threshold, "2i");
38
extern int atari_mouse_buttons;
39
 
40
static void atari_mouse_interrupt(char *buf)
41
{
42
        int buttons;
43
 
44
/*      ikbd_mouse_disable(); */
45
 
46
        buttons = ((buf[0] & 1)
47
               | ((buf[0] & 2) << 1)
48
               | (atari_mouse_buttons & 2));
49
        atari_mouse_buttons = buttons;
50
 
51
        busmouse_add_movementbuttons(msedev, buf[1], -buf[2], buttons ^ 7);
52
/*      ikbd_mouse_rel_pos(); */
53
}
54
 
55
static int release_mouse(struct inode *inode, struct file *file)
56
{
57
        ikbd_mouse_disable();
58
        atari_mouse_interrupt_hook = NULL;
59
        return 0;
60
}
61
 
62
static int open_mouse(struct inode *inode, struct file *file)
63
{
64
        atari_mouse_buttons = 0;
65
        ikbd_mouse_y0_top ();
66
        ikbd_mouse_thresh (mouse_threshold[0], mouse_threshold[1]);
67
        ikbd_mouse_rel_pos();
68
        atari_mouse_interrupt_hook = atari_mouse_interrupt;
69
        return 0;
70
}
71
 
72
static struct busmouse atarimouse = {
73
        ATARIMOUSE_MINOR, "atarimouse", THIS_MODULE, open_mouse, release_mouse, 0
74
};
75
 
76
static int __init atari_mouse_init(void)
77
{
78
        if (!MACH_IS_ATARI)
79
                return -ENODEV;
80
        msedev = register_busmouse(&atarimouse);
81
        if (msedev < 0)
82
                printk(KERN_WARNING "Unable to register Atari mouse driver.\n");
83
        else
84
                printk(KERN_INFO "Atari mouse installed.\n");
85
        return msedev < 0 ? msedev : 0;
86
}
87
 
88
 
89
#ifndef MODULE
90
 
91
#define MIN_THRESHOLD 1
92
#define MAX_THRESHOLD 20        /* more seems not reasonable... */
93
 
94
static int __init atari_mouse_setup( char *str )
95
{
96
    int ints[8];
97
 
98
    str = get_options(str, ARRAY_SIZE(ints), ints);
99
 
100
    if (ints[0] < 1) {
101
        printk(KERN_ERR "atari_mouse_setup: no arguments!\n" );
102
        return 0;
103
    }
104
    else if (ints[0] > 2) {
105
        printk(KERN_WARNING "atari_mouse_setup: too many arguments\n" );
106
    }
107
 
108
    if (ints[1] < MIN_THRESHOLD || ints[1] > MAX_THRESHOLD)
109
        printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" );
110
    else {
111
        mouse_threshold[0] = ints[1];
112
        mouse_threshold[1] = ints[1];
113
        if (ints[0] > 1) {
114
            if (ints[2] < MIN_THRESHOLD || ints[2] > MAX_THRESHOLD)
115
                printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" );
116
            else
117
                mouse_threshold[1] = ints[2];
118
        }
119
    }
120
 
121
    return 1;
122
}
123
 
124
__setup("atarimouse=",atari_mouse_setup);
125
 
126
#endif /* !MODULE */
127
 
128
static void __exit atari_mouse_cleanup (void)
129
{
130
        unregister_busmouse(msedev);
131
}
132
 
133
module_init(atari_mouse_init);
134
module_exit(atari_mouse_cleanup);
135
 
136
MODULE_LICENSE("GPL");

powered by: WebSVN 2.1.0

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