summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-03-13 20:56:57 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-03-13 20:56:57 +0000
commit2a3b7a961006abcdd282b1ad9905c894b46ef80a (patch)
tree696f37ac1fc60b50d1bd51baf809c6549548250a
parent647887e8a26c8ad8d866cd079da8526f70969893 (diff)
Drop the second and third arguments to adb_op_sync, for they are not used;
while there, remove explicit global variable initializations to zero, and appease the gods by removing the most ludicrous spurious casts. No functional change (except for code shrinkage).
-rw-r--r--sys/arch/mac68k/dev/adb.c138
-rw-r--r--sys/arch/macppc/dev/adb.c115
-rw-r--r--sys/dev/adb/adb.h4
-rw-r--r--sys/dev/adb/akbd.c12
-rw-r--r--sys/dev/adb/ams.c34
5 files changed, 131 insertions, 172 deletions
diff --git a/sys/arch/mac68k/dev/adb.c b/sys/arch/mac68k/dev/adb.c
index 815d348190b..0f2dfc9055a 100644
--- a/sys/arch/mac68k/dev/adb.c
+++ b/sys/arch/mac68k/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.24 2007/03/04 15:35:09 miod Exp $ */
+/* $OpenBSD: adb.c,v 1.25 2007/03/13 20:56:54 miod Exp $ */
/* $NetBSD: adb.c,v 1.47 2005/06/16 22:43:36 jmc Exp $ */
/* $NetBSD: adb_direct.c,v 1.51 2005/06/16 22:43:36 jmc Exp $ */
@@ -246,39 +246,39 @@ const char *adbHardwareDescr[] = {
int adbHardware = ADB_HW_UNKNOWN;
int adbActionState = ADB_ACTION_NOTREADY;
int adbBusState = ADB_BUS_UNKNOWN;
-int adbWaiting = 0; /* waiting for return data from the device */
-int adbWriteDelay = 0; /* working on (or waiting to do) a write */
-int adbOutQueueHasData = 0; /* something in the queue waiting to go out */
-int adbSoftPower = 0; /* machine supports soft power */
-
-int adbWaitingCmd = 0; /* ADB command we are waiting for */
-u_char *adbBuffer = (long)0; /* pointer to user data area */
-void *adbCompRout = (long)0; /* pointer to the completion routine */
-void *adbCompData = (long)0; /* pointer to the completion routine data */
+int adbWaiting; /* waiting for return data from the device */
+int adbWriteDelay; /* working on (or waiting to do) a write */
+int adbOutQueueHasData; /* something in the queue waiting to go out */
+int adbSoftPower; /* machine supports soft power */
+
+int adbWaitingCmd; /* ADB command we are waiting for */
+u_char *adbBuffer; /* pointer to user data area */
+void *adbCompRout; /* pointer to the completion routine */
+void *adbCompData; /* pointer to the completion routine data */
int adbStarting = 1; /* doing adb_reinit so do polling differently */
u_char adbInputBuffer[ADB_MAX_MSG_LENGTH]; /* data input buffer */
u_char adbOutputBuffer[ADB_MAX_MSG_LENGTH]; /* data output buffer */
struct adbCmdHoldEntry adbOutQueue; /* our 1 entry output queue */
-int adbSentChars = 0; /* how many characters we have sent */
-int adbLastDevice = 0; /* last ADB dev we heard from (II ONLY) */
+int adbSentChars; /* how many characters we have sent */
+int adbLastDevice; /* last ADB dev we heard from (II ONLY) */
struct ADBDevEntry ADBDevTable[16]; /* our ADB device table */
int ADBNumDevices; /* num. of ADB devices found with adb_reinit */
struct adbCommand adbInbound[ADB_QUEUE]; /* incoming queue */
-volatile int adbInCount = 0; /* how many packets in in queue */
-int adbInHead = 0; /* head of in queue */
-int adbInTail = 0; /* tail of in queue */
+volatile int adbInCount; /* how many packets in in queue */
+int adbInHead; /* head of in queue */
+int adbInTail; /* tail of in queue */
struct adbCommand adbOutbound[ADB_QUEUE]; /* outgoing queue - not used yet */
-int adbOutCount = 0; /* how many packets in out queue */
-int adbOutHead = 0; /* head of out queue */
-int adbOutTail = 0; /* tail of out queue */
+int adbOutCount; /* how many packets in out queue */
+int adbOutHead; /* head of out queue */
+int adbOutTail; /* tail of out queue */
-int tickle_count = 0; /* how many tickles seen for this packet? */
-int tickle_serial = 0; /* the last packet tickled */
-int adb_cuda_serial = 0; /* the current packet */
+int tickle_count; /* how many tickles seen for this packet? */
+int tickle_serial; /* the last packet tickled */
+int adb_cuda_serial; /* the current packet */
struct timeout adb_cuda_timeout;
@@ -310,7 +310,6 @@ void adb_reinit(struct device *);
int count_adbs(void);
int get_ind_adb_info(ADBDataBlock *, int);
int get_adb_info(ADBDataBlock *, int);
-int set_adb_info(ADBSetInfoBlock *, int);
void adb_setup_hw_type(void);
int adb_op(Ptr, Ptr, Ptr, short);
void adb_read_II(u_char *);
@@ -335,11 +334,11 @@ print_single(u_char *str)
{
int x;
- if (str == 0) {
+ if (str == NULL) {
printf_intr("no data - null pointer\n");
return;
}
- if (*str == 0) {
+ if (*str == '\0') {
printf_intr("nothing returned\n");
return;
}
@@ -465,9 +464,9 @@ switch_start:
adbWaitingCmd = 0; /* reset "waiting" vars */
adbWaiting = 0;
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
} else {
packet.unsol = 1;
packet.ack_only = 0;
@@ -565,9 +564,9 @@ switch_start:
/* reset "waiting" vars, just in case */
adbWaitingCmd = 0;
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
}
adbWriteDelay = 0; /* done writing */
@@ -714,7 +713,7 @@ adb_intr_II(void *arg)
unsigned int s;
s = splhigh(); /* can't be too careful - might be called */
- /* from a routine, NOT an interrupt */
+ /* from a routine, NOT an interrupt */
ADB_VIA_CLR_INTR(); /* clear interrupt */
@@ -863,9 +862,9 @@ switch_start:
adbWaiting = 0;
adbInputBuffer[0] = 0;
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
/*
* Since we are done, check whether there is any data
* waiting to do out. If so, start the sending the data.
@@ -983,9 +982,9 @@ switch_start:
adb_pass_up(&packet);
/* reset "waiting" vars, just in case */
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
if (adbOutQueueHasData == 1) {
/* copy over data */
memcpy(adbOutputBuffer, adbOutQueue.outBuf,
@@ -1234,7 +1233,7 @@ adb_intr_IIsi(void *arg)
unsigned int s;
s = splhigh(); /* can't be too careful - might be called */
- /* from a routine, NOT an interrupt */
+ /* from a routine, NOT an interrupt */
ADB_VIA_CLR_INTR(); /* clear interrupt */
@@ -1298,9 +1297,9 @@ switch_start:
adbWaitingCmd = 0; /* reset "waiting" vars */
adbWaiting = 0;
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
} else {
packet.unsol = 1;
packet.ack_only = 0;
@@ -1384,9 +1383,9 @@ switch_start:
/* reset "waiting" vars, just in case */
adbWaitingCmd = 0;
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
}
adbWriteDelay = 0; /* done writing */
@@ -1550,11 +1549,6 @@ adb_pass_up(struct adbCommand *in)
int start = 0, len = 0, cmd = 0;
ADBDataBlock block;
- /* temp for testing */
- /*u_char *buffer = 0;*/
- /*u_char *compdata = 0;*/
- /*u_char *comprout = 0;*/
-
if (adbInCount >= ADB_QUEUE) {
#ifdef ADB_DEBUG
if (adb_debug)
@@ -1660,8 +1654,6 @@ adb_pass_up(struct adbCommand *in)
adb_soft_intr();
else
setsoftadb();
-
- return;
}
@@ -1675,9 +1667,9 @@ adb_soft_intr(void)
{
int s;
int cmd = 0;
- u_char *buffer = 0;
- u_char *comprout = 0;
- u_char *compdata = 0;
+ u_char *buffer;
+ void *comprout;
+ u_char *compdata;
/*delay(2*ADB_DELAY);*/
@@ -2025,7 +2017,7 @@ adb_reinit(struct device *self)
delay(1000);
/* send an ADB reset first */
- (void)adb_op_sync((Ptr)0, (Ptr)0, (Ptr)0, (short)0x00);
+ (void)adb_op_sync((Ptr)0, (short)0x00);
delay(3000);
/*
@@ -2048,8 +2040,7 @@ adb_reinit(struct device *self)
/* initial scan through the devices */
for (i = 1; i < 16; i++) {
command = ADBTALK(i, 3);
- result = adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ result = adb_op_sync((Ptr)send_string, (short)command);
if (result == 0 && send_string[0] != 0) {
/* found a device */
@@ -2059,9 +2050,8 @@ adb_reinit(struct device *self)
(int)(send_string[2]);
ADBDevTable[ADBNumDevices].origAddr = i;
ADBDevTable[ADBNumDevices].currentAddr = i;
- ADBDevTable[ADBNumDevices].DataAreaAddr =
- (long)0;
- ADBDevTable[ADBNumDevices].ServiceRtPtr = (void *)0;
+ ADBDevTable[ADBNumDevices].DataAreaAddr = NULL;
+ ADBDevTable[ADBNumDevices].ServiceRtPtr = NULL;
pm_check_adb_devices(i); /* tell pm driver device
* is here */
}
@@ -2091,23 +2081,20 @@ adb_reinit(struct device *self)
/* send TALK R3 to address */
command = ADBTALK(device, 3);
- (void)adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ (void)adb_op_sync((Ptr)send_string, (short)command);
/* move device to higher address */
command = ADBLISTEN(device, 3);
send_string[0] = 2;
send_string[1] = (u_char)(saveptr | 0x60);
send_string[2] = 0xfe;
- (void)adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ (void)adb_op_sync((Ptr)send_string, (short)command);
delay(1000);
/* send TALK R3 - anthing at new address? */
command = ADBTALK(saveptr, 3);
send_string[0] = 0;
- result = adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ result = adb_op_sync((Ptr)send_string, (short)command);
delay(1000);
if (result != 0 || send_string[0] == 0) {
@@ -2120,8 +2107,8 @@ adb_reinit(struct device *self)
send_string[0] = 2;
send_string[1] = (u_char)(device | 0x60);
send_string[2] = 0x00;
- (void)adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ (void)adb_op_sync((Ptr)send_string,
+ (short)command);
#ifdef ADB_DEBUG
if (adb_debug & 0x80)
printf_intr("failed, continuing\n");
@@ -2133,8 +2120,7 @@ adb_reinit(struct device *self)
/* send TALK R3 - anything at old address? */
command = ADBTALK(device, 3);
send_string[0] = 0;
- result = adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ result = adb_op_sync((Ptr)send_string, (short)command);
if (result == 0 && send_string[0] != 0) {
/* new device found */
/* update data for previously moved device */
@@ -2189,8 +2175,8 @@ adb_reinit(struct device *self)
send_string[0] = 2;
send_string[1] = (u_char)(device | 0x60);
send_string[2] = 0xfe;
- (void)adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ (void)adb_op_sync((Ptr)send_string,
+ (short)command);
delay(1000);
}
}
@@ -2383,13 +2369,9 @@ adb_setup_hw_type(void)
* This routine does exactly what the adb_op routine does, except that after
* the adb_op is called, it waits until the return value is present before
* returning.
- *
- * NOTE: The user specified compRout is ignored, since this routine specifies
- * it's own to adb_op, which is why you really called this in the first place
- * anyway.
*/
int
-adb_op_sync(Ptr buffer, Ptr compRout, Ptr data, short command)
+adb_op_sync(Ptr buffer, short command)
{
int tmout;
int result;
@@ -2435,7 +2417,7 @@ adb_op_sync(Ptr buffer, Ptr compRout, Ptr data, short command)
void
adb_op_comprout(caddr_t buffer, caddr_t data_area, int adb_command)
{
- *(u_short *)data_area = 0x01; /* update flag value */
+ *(int *)data_area = 0x01; /* update flag value */
}
int
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c
index 3ff42930cfc..1c0e690066e 100644
--- a/sys/arch/macppc/dev/adb.c
+++ b/sys/arch/macppc/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.23 2007/03/04 15:33:31 miod Exp $ */
+/* $OpenBSD: adb.c,v 1.24 2007/03/13 20:56:55 miod Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */
@@ -216,40 +216,40 @@ struct adbCommand {
*/
int adbHardware = ADB_HW_UNKNOWN;
int adbActionState = ADB_ACTION_NOTREADY;
-int adbWaiting = 0; /* waiting for return data from the device */
-int adbWriteDelay = 0; /* working on (or waiting to do) a write */
-int adbSoftPower = 0; /* machine supports soft power */
-
-int adbWaitingCmd = 0; /* ADB command we are waiting for */
-u_char *adbBuffer = (long)0; /* pointer to user data area */
-void *adbCompRout = (long)0; /* pointer to the completion routine */
-void *adbCompData = (long)0; /* pointer to the completion routine data */
+int adbWaiting; /* waiting for return data from the device */
+int adbWriteDelay; /* working on (or waiting to do) a write */
+int adbSoftPower; /* machine supports soft power */
+
+int adbWaitingCmd; /* ADB command we are waiting for */
+u_char *adbBuffer; /* pointer to user data area */
+void *adbCompRout; /* pointer to the completion routine */
+void *adbCompData; /* pointer to the completion routine data */
int adbStarting = 1; /* doing adb_reinit so do polling differently */
u_char adbInputBuffer[ADB_MAX_MSG_LENGTH]; /* data input buffer */
u_char adbOutputBuffer[ADB_MAX_MSG_LENGTH]; /* data output buffer */
struct adbCmdHoldEntry adbOutQueue; /* our 1 entry output queue */
-int adbSentChars = 0; /* how many characters we have sent */
+int adbSentChars; /* how many characters we have sent */
struct ADBDevEntry ADBDevTable[16]; /* our ADB device table */
int ADBNumDevices; /* num. of ADB devices found with adb_reinit */
struct adbCommand adbInbound[ADB_QUEUE]; /* incoming queue */
-int adbInCount = 0; /* how many packets in in queue */
-int adbInHead = 0; /* head of in queue */
-int adbInTail = 0; /* tail of in queue */
+int adbInCount; /* how many packets in in queue */
+int adbInHead; /* head of in queue */
+int adbInTail; /* tail of in queue */
struct adbCommand adbOutbound[ADB_QUEUE]; /* outgoing queue - not used yet */
-int adbOutCount = 0; /* how many packets in out queue */
-int adbOutHead = 0; /* head of out queue */
-int adbOutTail = 0; /* tail of out queue */
+int adbOutCount; /* how many packets in out queue */
+int adbOutHead; /* head of out queue */
+int adbOutTail; /* tail of out queue */
-int tickle_count = 0; /* how many tickles seen for this packet? */
-int tickle_serial = 0; /* the last packet tickled */
-int adb_cuda_serial = 0; /* the current packet */
+int tickle_count; /* how many tickles seen for this packet? */
+int tickle_serial; /* the last packet tickled */
+int adb_cuda_serial; /* the current packet */
struct timeout adb_cuda_timeout;
struct timeout adb_softintr_timeout;
-int adbempty = 0; /* nonzero if no adb devices */
+int adbempty; /* nonzero if no adb devices */
volatile u_char *Via1Base;
@@ -269,7 +269,6 @@ void adb_reinit(void);
int count_adbs(void);
int get_ind_adb_info(ADBDataBlock *, int);
int get_adb_info(ADBDataBlock *, int);
-int set_adb_info(ADBSetInfoBlock *, int);
void adb_setup_hw_type(void);
int adb_op(Ptr, Ptr, Ptr, short);
void adb_hw_setup(void);
@@ -293,11 +292,11 @@ print_single(str)
{
int x;
- if (str == 0) {
+ if (str == NULL) {
printf_intr("no data - null pointer\n");
return;
}
- if (*str == 0) {
+ if (*str == '\0') {
printf_intr("nothing returned\n");
return;
}
@@ -353,7 +352,7 @@ adb_intr_cuda(void)
struct adbCommand packet;
s = splhigh(); /* can't be too careful - might be called */
- /* from a routine, NOT an interrupt */
+ /* from a routine, NOT an interrupt */
ADB_VIA_CLR_INTR(); /* clear interrupt */
ADB_VIA_INTR_DISABLE(); /* disable ADB interrupt on IIs. */
@@ -423,9 +422,9 @@ switch_start:
adbWaitingCmd = 0; /* reset "waiting" vars */
adbWaiting = 0;
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
} else {
packet.unsol = 1;
packet.ack_only = 0;
@@ -523,9 +522,9 @@ switch_start:
/* reset "waiting" vars, just in case */
adbWaitingCmd = 0;
- adbBuffer = (long)0;
- adbCompRout = (long)0;
- adbCompData = (long)0;
+ adbBuffer = NULL;
+ adbCompRout = NULL;
+ adbCompData = NULL;
}
adbWriteDelay = 0; /* done writing */
@@ -705,11 +704,6 @@ adb_pass_up(struct adbCommand *in)
int start = 0, len = 0, cmd = 0;
ADBDataBlock block;
- /* temp for testing */
- /*u_char *buffer = 0;*/
- /*u_char *compdata = 0;*/
- /*u_char *comprout = 0;*/
-
if (adbInCount >= ADB_QUEUE) {
#ifdef ADB_DEBUG
if (adb_debug)
@@ -817,9 +811,9 @@ adb_soft_intr(void)
{
int s;
int cmd = 0;
- u_char *buffer = 0;
- u_char *comprout = 0;
- u_char *compdata = 0;
+ u_char *buffer;
+ u_char *comprout;
+ u_char *compdata;
/*delay(2*ADB_DELAY);*/
@@ -1017,7 +1011,7 @@ adb_reinit(void)
delay(1000);
/* send an ADB reset first */
- adb_op_sync((Ptr)0, (Ptr)0, (Ptr)0, (short)0x00);
+ adb_op_sync((Ptr)0, (short)0x00);
delay(200000);
/*
@@ -1041,8 +1035,7 @@ adb_reinit(void)
for (i = 1; i < 16; i++) {
send_string[0] = 0;
command = ADBTALK(i, 3);
- result = adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ result = adb_op_sync((Ptr)send_string, (short)command);
if (send_string[0] != 0) {
/* check for valid device handler */
@@ -1061,9 +1054,8 @@ adb_reinit(void)
(int)send_string[2];
ADBDevTable[ADBNumDevices].origAddr = i;
ADBDevTable[ADBNumDevices].currentAddr = i;
- ADBDevTable[ADBNumDevices].DataAreaAddr =
- (long)0;
- ADBDevTable[ADBNumDevices].ServiceRtPtr = (void *)0;
+ ADBDevTable[ADBNumDevices].DataAreaAddr = NULL;
+ ADBDevTable[ADBNumDevices].ServiceRtPtr = NULL;
}
}
@@ -1091,22 +1083,19 @@ adb_reinit(void)
/* send TALK R3 to address */
command = ADBTALK(device, 3);
- adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ adb_op_sync((Ptr)send_string, (short)command);
/* move device to higher address */
command = ADBLISTEN(device, 3);
send_string[0] = 2;
send_string[1] = (u_char)(saveptr | 0x60);
send_string[2] = 0xfe;
- adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ adb_op_sync((Ptr)send_string, (short)command);
delay(500);
/* send TALK R3 - anything at new address? */
command = ADBTALK(saveptr, 3);
- adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ adb_op_sync((Ptr)send_string, (short)command);
delay(500);
if (send_string[0] == 0) {
@@ -1119,8 +1108,7 @@ adb_reinit(void)
/* send TALK R3 - anything at old address? */
command = ADBTALK(device, 3);
- result = adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ result = adb_op_sync((Ptr)send_string, (short)command);
if (send_string[0] != 0) {
/* check for valid device handler */
switch (send_string[2]) {
@@ -1153,10 +1141,8 @@ adb_reinit(void)
ADBDevTable[ADBNumDevices].currentAddr = device;
/* These will be set correctly in adbsys.c */
/* Until then, unsol. data will be ignored. */
- ADBDevTable[ADBNumDevices].DataAreaAddr =
- (long)0;
- ADBDevTable[ADBNumDevices].ServiceRtPtr =
- (void *)0;
+ ADBDevTable[ADBNumDevices].DataAreaAddr = NULL;
+ ADBDevTable[ADBNumDevices].ServiceRtPtr = NULL;
/* find next unused address */
for (x = saveptr; x > 0; x--) {
if (-1 == get_adb_info(&data, x)) {
@@ -1182,8 +1168,7 @@ adb_reinit(void)
send_string[0] = 2;
send_string[1] = (u_char)(device | 0x60);
send_string[2] = 0xfe;
- adb_op_sync((Ptr)send_string, (Ptr)0,
- (Ptr)0, (short)command);
+ adb_op_sync((Ptr)send_string, (short)command);
delay(1000);
}
}
@@ -1260,13 +1245,9 @@ adb_cmd_result(u_char *in)
* This routine does exactly what the adb_op routine does, except that after
* the adb_op is called, it waits until the return value is present before
* returning.
- *
- * NOTE: The user specified compRout is ignored, since this routine specifies
- * it's own to adb_op, which is why you really called this in the first place
- * anyway.
*/
int
-adb_op_sync(Ptr buffer, Ptr compRout, Ptr data, short command)
+adb_op_sync(Ptr buffer, short command)
{
int tmout;
int result;
@@ -1311,13 +1292,9 @@ adb_op_sync(Ptr buffer, Ptr compRout, Ptr data, short command)
* function is done.
*/
void
-adb_op_comprout(buffer, compdata, cmd)
- caddr_t buffer, compdata;
- int cmd;
+adb_op_comprout(caddr_t buffer, caddr_t compdata, int cmd)
{
- short *p = (short *)compdata;
-
- *p = 1;
+ *(int *)compdata = 0x01; /* update flag value */
}
void
diff --git a/sys/dev/adb/adb.h b/sys/dev/adb/adb.h
index e675281628f..209688337b6 100644
--- a/sys/dev/adb/adb.h
+++ b/sys/dev/adb/adb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.h,v 1.2 2006/02/12 18:06:23 miod Exp $ */
+/* $OpenBSD: adb.h,v 1.3 2007/03/13 20:56:56 miod Exp $ */
/* $NetBSD: adbsys.h,v 1.4 2000/12/19 02:59:24 tsubai Exp $ */
/*-
@@ -139,7 +139,7 @@ typedef struct {
} ADBDataBlock;
int adbprint(void *, const char *);
-int adb_op_sync(Ptr, Ptr, Ptr, short);
+int adb_op_sync(Ptr, short);
int set_adb_info(ADBSetInfoBlock *, int);
#endif /* _KERNEL */
diff --git a/sys/dev/adb/akbd.c b/sys/dev/adb/akbd.c
index a685b775d90..938a9b25a1e 100644
--- a/sys/dev/adb/akbd.c
+++ b/sys/dev/adb/akbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: akbd.c,v 1.5 2006/03/23 21:54:26 miod Exp $ */
+/* $OpenBSD: akbd.c,v 1.6 2007/03/13 20:56:56 miod Exp $ */
/* $NetBSD: akbd.c,v 1.17 2005/01/15 16:00:59 chs Exp $ */
/*
@@ -144,7 +144,7 @@ akbdattach(struct device *parent, struct device *self, void *aux)
case ADB_EXTKBD:
cmd = ADBTALK(sc->adbaddr, 1);
kbd_done =
- (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd) == 0);
+ (adb_op_sync((Ptr)buffer, cmd) == 0);
/* Ignore Logitech MouseMan/Trackman pseudo keyboard */
if (kbd_done && buffer[1] == 0x9a && buffer[2] == 0x20) {
@@ -305,7 +305,7 @@ getleds(int addr)
buffer[0] = 0;
cmd = ADBTALK(addr, 2);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd) == 0 &&
+ if (adb_op_sync((Ptr)buffer, cmd) == 0 &&
buffer[0] > 0)
leds = ~(buffer[2]) & 0x07;
@@ -329,7 +329,7 @@ setleds(struct akbd_softc *sc, u_char leds)
buffer[0] = 0;
cmd = ADBTALK(addr, 2);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd) || buffer[0] == 0)
+ if (adb_op_sync((Ptr)buffer, cmd) || buffer[0] == 0)
return (EIO);
leds = ~leds & 0x07;
@@ -337,11 +337,11 @@ setleds(struct akbd_softc *sc, u_char leds)
buffer[2] |= leds;
cmd = ADBLISTEN(addr, 2);
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd);
+ adb_op_sync((Ptr)buffer, cmd);
/* talk R2 */
cmd = ADBTALK(addr, 2);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd) || buffer[0] == 0)
+ if (adb_op_sync((Ptr)buffer, cmd) || buffer[0] == 0)
return (EIO);
if ((buffer[2] & 0xf8) != leds)
diff --git a/sys/dev/adb/ams.c b/sys/dev/adb/ams.c
index a85db149ac5..d1fd1925aa3 100644
--- a/sys/dev/adb/ams.c
+++ b/sys/dev/adb/ams.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ams.c,v 1.3 2006/02/12 18:06:24 miod Exp $ */
+/* $OpenBSD: ams.c,v 1.4 2007/03/13 20:56:56 miod Exp $ */
/* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */
/*
@@ -235,7 +235,7 @@ ems_init(struct ams_softc *sc)
buffer[4] = 0x07; /* Locking mask = 0000b,
* enable buttons = 0111b
*/
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd);
+ adb_op_sync((Ptr)buffer, cmd);
sc->sc_buttons = 3;
sc->sc_res = 200;
@@ -249,21 +249,21 @@ ems_init(struct ams_softc *sc)
{ 8, 0xa5, 0x14, 0, 0, 0x69, 0xff, 0xff, 0x27 };
buffer[0] = 0;
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, ADBFLUSH(adbaddr));
+ adb_op_sync((Ptr)buffer, ADBFLUSH(adbaddr));
- adb_op_sync((Ptr)data1, (Ptr)0, (Ptr)0, ADBLISTEN(adbaddr, 2));
+ adb_op_sync((Ptr)data1, ADBLISTEN(adbaddr, 2));
buffer[0] = 0;
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, ADBFLUSH(adbaddr));
+ adb_op_sync((Ptr)buffer, ADBFLUSH(adbaddr));
- adb_op_sync((Ptr)data2, (Ptr)0, (Ptr)0, ADBLISTEN(adbaddr, 2));
+ adb_op_sync((Ptr)data2, ADBLISTEN(adbaddr, 2));
return;
}
if ((sc->handler_id == ADBMS_100DPI) ||
(sc->handler_id == ADBMS_200DPI)) {
/* found a mouse */
cmd = ADBTALK(adbaddr, 3);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd)) {
+ if (adb_op_sync((Ptr)buffer, cmd)) {
#ifdef ADB_DEBUG
if (adb_debug)
printf("adb: ems_init timed out\n");
@@ -274,7 +274,7 @@ ems_init(struct ams_softc *sc)
/* Attempt to initialize Extended Mouse Protocol */
buffer[2] = 4; /* make handler ID 4 */
cmd = ADBLISTEN(adbaddr, 3);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd)) {
+ if (adb_op_sync((Ptr)buffer, cmd)) {
#ifdef ADB_DEBUG
if (adb_debug)
printf("adb: ems_init timed out\n");
@@ -287,11 +287,11 @@ ems_init(struct ams_softc *sc)
* try to initialize it as other types
*/
cmd = ADBTALK(adbaddr, 3);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd) == 0 &&
+ if (adb_op_sync((Ptr)buffer, cmd) == 0 &&
buffer[2] == ADBMS_EXTENDED) {
sc->handler_id = ADBMS_EXTENDED;
cmd = ADBTALK(adbaddr, 1);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd)) {
+ if (adb_op_sync((Ptr)buffer, cmd)) {
#ifdef ADB_DEBUG
if (adb_debug)
printf("adb: ems_init timed out\n");
@@ -313,25 +313,25 @@ ems_init(struct ams_softc *sc)
buffer[0]=2;
buffer[1]=0x00;
buffer[2]=0x81;
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd);
+ adb_op_sync((Ptr)buffer, cmd);
cmd = ADBLISTEN(adbaddr, 1);
buffer[0]=2;
buffer[1]=0x01;
buffer[2]=0x81;
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd);
+ adb_op_sync((Ptr)buffer, cmd);
cmd = ADBLISTEN(adbaddr, 1);
buffer[0]=2;
buffer[1]=0x02;
buffer[2]=0x81;
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd);
+ adb_op_sync((Ptr)buffer, cmd);
cmd = ADBLISTEN(adbaddr, 1);
buffer[0]=2;
buffer[1]=0x03;
buffer[2]=0x38;
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd);
+ adb_op_sync((Ptr)buffer, cmd);
sc->sc_buttons = 3;
sc->sc_res = 400;
@@ -345,7 +345,7 @@ ems_init(struct ams_softc *sc)
/* Attempt to initialize as an A3 mouse */
buffer[2] = 0x03; /* make handler ID 3 */
cmd = ADBLISTEN(adbaddr, 3);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd)) {
+ if (adb_op_sync((Ptr)buffer, cmd)) {
#ifdef ADB_DEBUG
if (adb_debug)
printf("adb: ems_init timed out\n");
@@ -358,7 +358,7 @@ ems_init(struct ams_softc *sc)
* try to initialize it as other types
*/
cmd = ADBTALK(adbaddr, 3);
- if (adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd) == 0
+ if (adb_op_sync((Ptr)buffer, cmd) == 0
&& buffer[2] == ADBMS_MSA3) {
sc->handler_id = ADBMS_MSA3;
/* Initialize as above */
@@ -372,7 +372,7 @@ ems_init(struct ams_softc *sc)
* enable 3 button mode = 0111b,
* speed = normal
*/
- adb_op_sync((Ptr)buffer, (Ptr)0, (Ptr)0, cmd);
+ adb_op_sync((Ptr)buffer, cmd);
sc->sc_buttons = 3;
sc->sc_res = 300;
} else {