From owner-FreeBSD-tech-jp@jp.freebsd.org  Wed Oct 15 10:51:05 1997
Received: by jaz.jp.freebsd.org (8.8.7+2.7Wbeta7/8.7.3) id KAA28045
	Wed, 15 Oct 1997 10:51:05 +0900 (JST)
Received: by jaz.jp.freebsd.org (8.8.7+2.7Wbeta7/8.7.3) with ESMTP id KAA27799
	Wed, 15 Oct 1997 10:50:27 +0900 (JST)
Received: from mailsv.nec.co.jp ([133.200.254.203])
	by TYO9.gate.nec.co.jp (8.8.7+2.7Wbeta6/3.6Wbeta697082713) with ESMTP id KAA24025;
	Wed, 15 Oct 1997 10:50:24 +0900 (JST)
Received: from gw.ccs.mt.nec.co.jp (gw.ccs.mt.nec.co.jp [133.201.2.2]) by mailsv.nec.co.jp (8.8.7+2.7Wbeta6/3.6Wbeta6-97092610) with ESMTP
	id KAA28888; Wed, 15 Oct 1997 10:50:04 +0900 (JST)
Received: from mail.ccs.mt.nec.co.jp (mail.ccs.mt.nec.co.jp [133.201.3.22]) by gw.ccs.mt.nec.co.jp (8.8.5+2.7Wbeta4/3.3W9-GW_CCS) with ESMTP id KAA07316; Wed, 15 Oct 1997 10:50:03 +0900 (JST)
Received: from spls63.ccs.mt.nec.co.jp by mail.ccs.mt.nec.co.jp (8.8.5+2.7Wbeta4/6.4J.6-ccs_mx)
	id KAA05892; Wed, 15 Oct 1997 10:50:03 +0900 (JST)
Received: from localhost by spls63.ccs.mt.nec.co.jp (8.6.12+2.4W/6.4J.6-slave-1.0)
	id KAA24228; Wed, 15 Oct 1997 10:50:28 +0900
Message-Id: <199710150150.KAA24228@spls63.ccs.mt.nec.co.jp>
To: FreeBSD-tech-jp@jp.freebsd.org
cc: FreeBSD-users-jp@jp.freebsd.org
In-reply-to: Your message of "Wed, 15 Oct 1997 10:34:43 JST"
References: <199710150111.KAA24025@spls63.ccs.mt.nec.co.jp> 
 <199710150130.BAA13019@festdssv.tokyo.se.fujitsu.co.jp> 
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-2022-JP
Date: Wed, 15 Oct 1997 10:50:26 +0900
From: Nakagawa Yoshihisa <y-nakaga@ccs.mt.nec.co.jp>
Reply-To: FreeBSD-tech-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=20]
X-Sequence: FreeBSD-tech-jp 721
Subject: [FreeBSD-tech-jp 721] Re: [FreeBSD-users-jp 19305] Re: AHA-1510B 
Errors-To: owner-FreeBSD-tech-jp@jp.freebsd.org
Sender: owner-FreeBSD-tech-jp@jp.freebsd.org

$B!t(Btech $B$K?6$j$^$9!#(Busers-jp $B$K$b(B cc: $B$7$F$^$9$N$G!"$=$N$&$A:o$C$F(B
$B!t$/$@$5$$!#(B

| $B$($C$H!"$3$l$KBP1~$9$k$?$a$K$O%I%i%$%P$K<j$rF~$l$kI,MW$,$"$k$N(B
| $B$G$9$+!)(B

PnP driver $BMQ$N(B probe/attach $BItJ,$@$1=q$1$P!"$[$H$s$I=*$j$@$H;W$$(B
$B$^$9!#<j85$K%+!<%I$,$"$l$P!"$d$C$A$c$C$F$b$$$$$s$G$9$,!D!#(B

http://www.iet.unipi.it/~luigi/pnp970924.tgz $B$K(B 2.2.x $B8~$1$N%Q%C%A(B
$B0l<0$,$"$j$^$9!#$3$NCf$K%I%-%e%a%s%H$b4^$^$l$F$$$^$9$N$G!"$=$l$rFI(B
$B$a$P$@$$$?$$J,$+$k$+$H!#(B

Luigi's new audio driver $B$N:G?7HG$O(B 
http://www.iet.unipi.it/~luigi/snd971007.tgz $B$G$9!#EvA3!"(BPnP $BBP1~(B
$B$K$J$C$F$^$9!#(B

$B%5%s%W%k$H$7$F<B83E*$K(B joy.c $B$r(B PnP $BBP1~$K$7$?:9J,$r$D$1$^$9!#(B
$B!J(BLuigi $B$K$O4{$KAw$C$F$^$9!#!K(B

-- 
	$BF|K\EE5$3t<02q<R(B $B%M%C%H%o!<%-%s%05;=Q8&5f=j(B $B%$%s%?%M%C%H5;=QIt(B
		$BCf@n(B $B9%5W(B	y-nakaga@ccs.mt.nec.co.jp
				jj3mxl@eatell.msr.prug.or.jp

*** joy.c.org	Tue Sep 10 17:21:59 1996
--- joy.c	Sun Oct 12 22:47:38 1997
***************
*** 46,51 ****
--- 46,56 ----
  #include <i386/isa/isa_device.h>
  #include <i386/isa/timerreg.h>
  
+ #include "pnp.h"
+ #if NPNP > 0
+ #include <i386/isa/pnp.h>	/* XXX pnp support */
+ #endif
+ 
  /* The game port can manage 4 buttons and 4 variable resistors (usually 2
   * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
   * Getting the state of the buttons is done by reading the game port:
***************
*** 78,83 ****
--- 83,89 ----
  #endif
  } joy[NJOY];
  
+ u_long njoy = 0;	/* total number of joystick devices */
  
  static int joyprobe (struct isa_device *);
  static int joyattach (struct isa_device *);
***************
*** 106,111 ****
--- 112,124 ----
      DELAY (10000); /*  10 ms delay */
      return (inb (dev->id_iobase) & 0x0f) != 0x0f;
  #else
+     if (njoy >= NJOY) {
+       printf("joy: unit number (%d) too high\n", njoy);
+       return 0;
+     }
+     njoy++;
+     dev->id_unit = njoy;
+ 
      return 1;
  #endif
  }
***************
*** 293,297 ****
--- 306,375 ----
  
  #endif /* JOY_MODULE */
  
+ #if NPNP > 0
+ /*
+  * here we have support for PnP cards
+  *
+  */
+ 
+ static char * joy_pnp_probe(u_long csn, u_long vend_id);
+ static void joy_pnp_attach(u_long csn, u_long vend_id, char *name,
+ 	struct isa_device *dev);
+ 
+ static struct pnp_device joy_pnp = {
+ 	"joystick",
+ 	joy_pnp_probe,
+ 	joy_pnp_attach,
+ 	&njoy,	/* use this for all joystick cards */
+ 	NULL	/* imask */
+ };
+ DATA_SET (pnpdevice_set, joy_pnp);
+ 
+ static char *
+ joy_pnp_probe(u_long csn, u_long vend_id)
+ {
+     char *s = NULL ;
+     u_long id = vend_id & 0xff00ffff;
+     if ( id == 0x3700630e )
+ 	s = "CS4237" ;
+     else if ( id == 0x3600630e )
+ 	s = "CS4236" ;
+     else if ( id == 0x3200630e)
+ 	s = "CS4232" ;
+     if (s) {
+ 	struct pnp_cinfo d;
+ 	read_pnp_parms(&d, 1);
+ 	if (d.enable == 0) {
+ 	    printf("This is a %s, but LDN 0 is disabled\n", s);
+ 	    return NULL ;
+ 	}
+ 	return s;
+     }
+ 
+     return NULL ;
+ }
+ 
+ static void
+ joy_pnp_attach(u_long csn, u_long vend_id, char *name,
+ 	struct isa_device *dev)
+ {
+     struct pnp_cinfo d ;
+     int ldn = 1 ;
+ 
+     if (read_pnp_parms ( &d , ldn ) == 0 ) {
+ 	printf("failed to read pnp parms\n");
+ 	return ;
+     }
+ 
+     dev->id_driver = &joydriver ;
+     dev->id_alive = 8 ; /* number of io ports ? */
+     dev->id_iobase = d.port[0] ;
+ 
+     write_pnp_parms( &d, ldn );
+     enable_pnp_card();
+ 
+     joyattach(dev);
+ }
  
+ #endif /* NPNP */
  #endif /* NJOY > 0 */
