summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k/dev/adbsys.c
diff options
context:
space:
mode:
authorbriggs <briggs@cvs.openbsd.org>1996-05-26 18:14:44 +0000
committerbriggs <briggs@cvs.openbsd.org>1996-05-26 18:14:44 +0000
commitb6700f4a6dad1f781af611627f1b245f0bfcb1f2 (patch)
treeeafc30749b1b1fd3d326929c6c45a42e7c0c5050 /sys/arch/mac68k/dev/adbsys.c
parent7aade6e6e58d423c865758a97a7ba25c54343b63 (diff)
Sync with NetBSD-current.
Diffstat (limited to 'sys/arch/mac68k/dev/adbsys.c')
-rw-r--r--sys/arch/mac68k/dev/adbsys.c69
1 files changed, 53 insertions, 16 deletions
diff --git a/sys/arch/mac68k/dev/adbsys.c b/sys/arch/mac68k/dev/adbsys.c
index e34a969f9a6..539b32c5483 100644
--- a/sys/arch/mac68k/dev/adbsys.c
+++ b/sys/arch/mac68k/dev/adbsys.c
@@ -1,4 +1,4 @@
-/* $NetBSD: adbsys.c,v 1.15 1995/09/04 02:50:57 briggs Exp $ */
+/* $NetBSD: adbsys.c,v 1.20 1996/05/08 13:36:41 briggs Exp $ */
/*-
* Copyright (C) 1994 Bradley A. Grantham
@@ -31,10 +31,11 @@
*/
#include <sys/param.h>
+#include <sys/systm.h>
#include <machine/adbsys.h>
+#include <machine/viareg.h>
#include "adbvar.h"
-#include "../mac68k/via.h"
#include "../mac68k/macrom.h"
/* from adb.c */
@@ -101,14 +102,49 @@ extdms_init()
int adbindex, adbaddr;
short cmd;
char buffer[9];
- void extdms_complete();
totaladbs = CountADBs();
for (adbindex = 1; adbindex <= totaladbs; adbindex++) {
/* Get the ADB information */
adbaddr = GetIndADB(&adbdata, adbindex);
if (adbdata.origADBAddr == ADBADDR_MS &&
- (adbdata.devType == 1 || adbdata.devType == 2)) {
+ (adbdata.devType == ADBMS_USPEED)) {
+ /* Found MicroSpeed Mouse Deluxe Mac */
+ cmd = ((adbaddr<<4)&0xF0)|0x9; /* listen 1 */
+
+ /*
+ * To setup the MicroSpeed, it appears that we can
+ * send the following command to the mouse and then
+ * expect data back in the form:
+ * buffer[0] = 4 (bytes)
+ * buffer[1], buffer[2] as std. mouse
+ * buffer[3] = buffer[4] = 0xff when no buttons
+ * are down. When button N down, bit N is clear.
+ * buffer[4]'s locking mask enables a
+ * click to toggle the button down state--sort of
+ * like the "Easy Access" shift/control/etc. keys.
+ * buffer[3]'s alternative speed mask enables using
+ * different speed when the corr. button is down
+ */
+ buffer[0] = 4;
+ buffer[1] = 0x00; /* Alternative speed */
+ buffer[2] = 0x00; /* speed = maximum */
+ buffer[3] = 0x10; /* enable extended protocol,
+ * lower bits = alt. speed mask
+ * = 0000b
+ */
+ buffer[4] = 0x07; /* Locking mask = 0000b,
+ * enable buttons = 0111b
+ */
+ extdms_done = 0;
+ ADBOp((Ptr)buffer, (Ptr)extdms_complete,
+ (Ptr)&extdms_done, cmd);
+ while (!extdms_done)
+ /* busy wait until done */;
+ }
+ if (adbdata.origADBAddr == ADBADDR_MS &&
+ ( adbdata.devType == ADBMS_100DPI
+ || adbdata.devType == ADBMS_200DPI)) {
/* found a mouse */
cmd = ((adbaddr << 4) & 0xf0) | 0x3;
@@ -135,12 +171,10 @@ adb_init()
{
ADBDataBlock adbdata;
ADBSetInfoBlock adbinfo;
- int i, s;
int totaladbs;
int adbindex, adbaddr;
int error;
char buffer[9];
- void extdms_complete();
if (!mrg_romready()) {
printf("adb: no ROM ADB driver in this kernel for this machine\n");
@@ -161,7 +195,7 @@ adb_init()
/* Initialize ADB */
#if defined(MRG_DEBUG)
- printf("adb: calling ADBAlternateInit\n");
+ printf("adb: calling ADBAlternateInit.\n");
#endif
ADBAlternateInit();
@@ -182,15 +216,15 @@ adb_init()
/* Print out the glory */
printf("adb: ");
switch (adbdata.origADBAddr) {
- case 2:
+ case ADBADDR_MAP:
switch (adbdata.devType) {
- case 1:
+ case ADB_STDKBD:
printf("keyboard");
break;
- case 2:
+ case ADB_EXTKBD:
printf("extended keyboard");
break;
- case 12:
+ case ADB_PBKBD:
printf("PowerBook keyboard");
break;
default:
@@ -199,7 +233,7 @@ adb_init()
break;
}
break;
- case 3:
+ case ADBADDR_REL:
extdms_done = 0;
/* talk register 3 */
ADBOp((Ptr)buffer, (Ptr)extdms_complete,
@@ -207,13 +241,16 @@ adb_init()
while (!extdms_done)
/* busy-wait until done */;
switch (buffer[2]) {
- case 1:
+ case ADBMS_100DPI:
printf("100 dpi mouse");
break;
- case 2:
+ case ADBMS_200DPI:
printf("200 dpi mouse");
break;
- case 4:
+ case ADBMS_USPEED:
+ printf("MicroSpeed mouse, default parameters");
+ break;
+ case ADBMS_EXTENDED:
extdms_done = 0;
/* talk register 1 */
ADBOp((Ptr)buffer, (Ptr)extdms_complete,
@@ -239,7 +276,7 @@ adb_init()
break;
}
break;
- case 4:
+ case ADBADDR_ABS:
printf("absolute positioning device (tablet?) (%d)", adbdata.devType);
break;
default: