Use wrappers around all romvec functions on SPARC32 to flush register window and...
[openbios.git] / drivers / adb_mouse.c
blobb94a34420a704eb1760fbfc144bd693a7adb77ec
1 /*
3 * Open Hack'Ware BIOS ADB mouse support, ported to OpenBIOS
5 * Copyright (c) 2005 Jocelyn Mayer
6 * Copyright (c) 2005 Stefan Reinauer
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License V2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
22 #include "config.h"
23 #include "libopenbios/bindings.h"
24 #include "libc/byteorder.h"
25 #include "libc/vsprintf.h"
27 #include "adb_bus.h"
28 #include "adb_mouse.h"
30 DECLARE_UNNAMED_NODE( mouse, INSTALL_OPEN, sizeof(int));
32 static void
33 mouse_open(int *idx)
35 RET(-1);
38 static void
39 mouse_close(int *idx)
43 NODE_METHODS( mouse ) = {
44 { "open", mouse_open },
45 { "close", mouse_close },
48 void adb_mouse_new (char *path, void *private)
50 char buf[64];
51 int props[1];
52 phandle_t ph, aliases;
53 adb_dev_t *dev = private;
55 snprintf(buf, sizeof(buf), "%s/mouse", path);
56 REGISTER_NAMED_NODE( mouse, buf);
58 ph = find_dev(buf);
60 set_property(ph, "device_type", "mouse", 6);
61 props[0] = __cpu_to_be32(dev->addr);
62 set_property(ph, "reg", (char *)&props, sizeof(props));
63 set_int_property(ph, "#buttons", 3);
65 aliases = find_dev("/aliases");
66 set_property(aliases, "adb-mouse", buf, strlen(buf) + 1);