2 * Copyright (c) 2004 M. Warner Losh
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * Copyright 1992 by the University of Guelph
32 * Permission to use, copy and modify this
33 * software and its documentation for any purpose and without
34 * fee is hereby granted, provided that the above copyright
35 * notice appear in all copies and that both that copyright
36 * notice and this permission notice appear in supporting
38 * University of Guelph makes no representations about the suitability of
39 * this software for any purpose. It is provided "as is"
40 * without express or implied warranty.
43 /* driver configuration flags (config) */
44 #define MSE_CONFIG_ACCEL 0x00f0 /* acceleration factor */
45 #define MSE_CONFIG_FLAGS (MSE_CONFIG_ACCEL)
48 * Software control structure for mouse. The sc_enablemouse(),
49 * sc_disablemouse() and sc_getmouse() routines must be called spl'd().
51 typedef struct mse_softc {
54 struct selinfo sc_selp;
55 struct resource *sc_port;
56 struct resource *sc_intr;
57 bus_space_tag_t sc_iot;
58 bus_space_handle_t sc_ioh;
60 void (*sc_enablemouse)(bus_space_tag_t t,
61 bus_space_handle_t h);
62 void (*sc_disablemouse)(bus_space_tag_t t,
63 bus_space_handle_t h);
64 void (*sc_getmouse)(bus_space_tag_t t, bus_space_handle_t h,
65 int *dx, int *dy, int *but);
71 u_char sc_bytes[MOUSE_SYS_PACKETSIZE];
72 struct callout_handle sc_callout;
82 #define MSESC_OPEN 0x1
83 #define MSESC_WANT 0x2
86 #define MSE_NONE 0 /* don't move this! */
88 /* pc98 bus mouse types */
89 #define MSE_98BUSMOUSE 0x1
91 /* isa bus mouse types */
92 #define MSE_LOGITECH 0x1
93 #define MSE_ATIINPORT 0x2
95 #define MSE_LOGI_SIG 0xA5
105 * Table of mouse types.
106 * Keep the Logitech last, since I haven't figured out how to probe it
107 * properly yet. (Someday I'll have the documentation.)
110 int m_type; /* Type of bus mouse */
111 int (*m_probe)(device_t dev, mse_softc_t *sc);
112 /* Probe routine to test for it */
113 void (*m_enable)(bus_space_tag_t t, bus_space_handle_t h);
115 void (*m_disable)(bus_space_tag_t t, bus_space_handle_t h);
116 /* Disable interrupts routine */
117 void (*m_get)(bus_space_tag_t t, bus_space_handle_t h, int *dx,
119 /* and get mouse status */
120 mousehw_t m_hw; /* buttons iftype type model hwid */
121 mousemode_t m_mode; /* proto rate res accel level size mask */
124 extern devclass_t mse_devclass;
125 int mse_common_attach(device_t);