summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k/dev/adbsys.c
diff options
context:
space:
mode:
authorbriggs <briggs@cvs.openbsd.org>1997-01-24 01:35:55 +0000
committerbriggs <briggs@cvs.openbsd.org>1997-01-24 01:35:55 +0000
commit2cf4fbaafa89ff9455907432816daebe394b533b (patch)
tree14fe32451db6302b379b04d7ca3df0c07d26dce7 /sys/arch/mac68k/dev/adbsys.c
parent2ebc04f559b55bc6705d62e51a00406bee8ef115 (diff)
Sync w/ NETBSD_CURRENT_971122.
Diffstat (limited to 'sys/arch/mac68k/dev/adbsys.c')
-rw-r--r--sys/arch/mac68k/dev/adbsys.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/sys/arch/mac68k/dev/adbsys.c b/sys/arch/mac68k/dev/adbsys.c
index 6b0dbb26d5a..c4e3fe5a664 100644
--- a/sys/arch/mac68k/dev/adbsys.c
+++ b/sys/arch/mac68k/dev/adbsys.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: adbsys.c,v 1.5 1996/10/28 14:46:24 briggs Exp $ */
-/* $NetBSD: adbsys.c,v 1.21 1996/06/21 06:10:56 scottr Exp $ */
+/* $OpenBSD: adbsys.c,v 1.6 1997/01/24 01:35:28 briggs Exp $ */
+/* $NetBSD: adbsys.c,v 1.24 1997/01/13 07:01:23 scottr Exp $ */
/*-
* Copyright (C) 1994 Bradley A. Grantham
@@ -45,9 +45,9 @@
extern struct mac68k_machine_S mac68k_machine;
/* from adb.c */
-void adb_processevent(adb_event_t * event);
+void adb_processevent __P((adb_event_t * event));
-extern void adb_jadbproc(void);
+extern void adb_jadbproc __P((void));
void
adb_complete(buffer, data_area, adb_command)
@@ -55,27 +55,29 @@ adb_complete(buffer, data_area, adb_command)
caddr_t data_area;
int adb_command;
{
- register int i;
- register char *sbuf, *dbuf;
adb_event_t event;
ADBDataBlock adbdata;
int adbaddr;
int error;
+#ifdef MRG_DEBUG
+ register int i;
-#if defined(MRG_DEBUG)
printf("adb: transaction completion\n");
#endif
adbaddr = (adb_command & 0xf0) >> 4;
error = GetADBInfo(&adbdata, adbaddr);
-#if defined(MRG_DEBUG)
+#ifdef MRG_DEBUG
printf("adb: GetADBInfo returned %d\n", error);
#endif
event.addr = adbaddr;
event.hand_id = adbdata.devType;
event.def_addr = adbdata.origADBAddr;
-#if defined(MRG_DEBUG)
+ event.byte_count = buffer[0];
+ memcpy(event.bytes, buffer + 1, event.byte_count);
+
+#ifdef MRG_DEBUG
printf("adb: from %d at %d (org %d) %d:", event.addr,
event.hand_id, event.def_addr, buffer[0]);
for (i = 1; i <= buffer[0]; i++)
@@ -83,33 +85,26 @@ adb_complete(buffer, data_area, adb_command)
printf("\n");
#endif
- i = event.byte_count = buffer[0];
- sbuf = &buffer[1];
- dbuf = &event.bytes[0];
- while (i--)
- *dbuf++ = *sbuf++;
-
microtime(&event.timestamp);
adb_processevent(&event);
}
-static int extdms_done;
+static volatile int extdms_done;
/*
* initialize extended mouse - probes devices as
* described in _Inside Macintosh, Devices_.
*/
void
-extdms_init()
+extdms_init(totaladbs)
+ int totaladbs;
{
ADBDataBlock adbdata;
- int totaladbs;
int adbindex, adbaddr;
short cmd;
char buffer[9];
- totaladbs = CountADBs();
for (adbindex = 1; adbindex <= totaladbs; adbindex++) {
/* Get the ADB information */
adbaddr = GetIndADB(&adbdata, adbindex);
@@ -192,12 +187,12 @@ adb_init()
return;
}
printf("adb: bus subsystem\n");
-#if defined(MRG_DEBUG)
+#ifdef MRG_DEBUG
printf("adb: call mrg_initadbintr\n");
#endif
mrg_initadbintr(); /* Mac ROM Glue okay to do ROM intr */
-#if defined(MRG_DEBUG)
+#ifdef MRG_DEBUG
printf("adb: returned from mrg_initadbintr\n");
#endif
@@ -205,19 +200,18 @@ adb_init()
JADBProc = adb_jadbproc;
/* Initialize ADB */
-#if defined(MRG_DEBUG)
+#ifdef MRG_DEBUG
printf("adb: calling ADBAlternateInit.\n");
#endif
ADBAlternateInit();
-#if defined(MRG_DEBUG)
+#ifdef MRG_DEBUG
printf("adb: done with ADBReInit\n");
#endif
- extdms_init();
-
totaladbs = CountADBs();
+ extdms_init(totaladbs);
/* for each ADB device */
for (adbindex = 1; adbindex <= totaladbs; adbindex++) {
@@ -301,7 +295,7 @@ adb_init()
adbinfo.siServiceRtPtr = (Ptr) adb_asmcomplete;
adbinfo.siDataAreaAddr = NULL;
error = SetADBInfo(&adbinfo, adbaddr);
-#if defined(MRG_DEBUG)
+#ifdef MRG_DEBUG
printf("returned %d from SetADBInfo\n", error);
#endif
}