Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Feb 1999 00:35:44 +0900
From:      Jun Kuriyama <kuriyama@sky.rim.or.jp>
To:        FreeBSD-current <FreeBSD-current@FreeBSD.ORG>, nate@FreeBSD.ORG
Subject:   Re: [Call for Review] new ioctl for src/sys/pccard/*
Message-ID:  <36BDB2D0.CA3FE4BB@sky.rim.or.jp>
References:  <36BDAD4E.CC8A2452@sky.rim.or.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------6331448DC47966073EBB6A88
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

Jun Kuriyama wrote:
> I'm planning to commit these changes into src/sys/pccard/.  This adds
> two features.  These features are obtained from PAO.

Sorry, I forgot to add patch. :-)


-- 
Jun Kuriyama // kuriyama@sky.rim.or.jp
            // kuriyama@FreeBSD.ORG
--------------6331448DC47966073EBB6A88
Content-Type: text/plain; charset=iso-2022-jp; name="pccard.diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="pccard.diff.txt"

Index: cardinfo.h
===================================================================
RCS file: /home/ncvs/src/sys/pccard/cardinfo.h,v
retrieving revision 1.10
diff -u -r1.10 cardinfo.h
--- cardinfo.h	1998/04/20 15:20:58	1.10
+++ cardinfo.h	1999/02/07 14:20:48
@@ -45,6 +45,8 @@
 #define PIOCRWFLAG	_IOW('P', 7, int)	/* Set flags for drv use */
 #define PIOCRWMEM	_IOWR('P', 8, unsigned long) /* Set mem for drv use */
 #define PIOCSPOW	_IOW('P', 9, struct power) /* Set power structure */
+#define PIOCSVIR	_IOW('P', 10, int)	/* Virtual insert/remove */
+#define PIOCSBEEP	_IOW('P', 11, int)		/* Select Beep */
 /*
  *	Debug codes.
  */
@@ -54,7 +56,7 @@
 /*
  *	Slot states for PIOCGSTATE
  */
-enum cardstate { noslot, empty, suspend, filled };
+enum cardstate { noslot, empty, suspend, filled, inactive };
 
 /*
  *	Descriptor structure for memory map.
Index: driver.h
===================================================================
RCS file: /home/ncvs/src/sys/pccard/driver.h,v
retrieving revision 1.6
diff -u -r1.6 driver.h
--- driver.h	1999/01/19 00:18:25	1.6
+++ driver.h	1999/02/07 14:20:48
@@ -23,6 +23,6 @@
 void	pccard_remove_beep __P((void));
 void	pccard_success_beep __P((void));
 void	pccard_failure_beep __P((void));
-void	pccard_beep_select __P((enum beepstate));
+int	pccard_beep_select __P((enum beepstate));
 
 #endif /* !_PCCARD_DRIVER_H_ */
Index: pccard.c
===================================================================
RCS file: /home/ncvs/src/sys/pccard/pccard.c,v
retrieving revision 1.70
diff -u -r1.70 pccard.c
--- pccard.c	1999/01/27 23:45:40	1.70
+++ pccard.c	1999/02/07 14:20:48
@@ -897,6 +897,7 @@
 	struct mem_desc *mp;
 	struct io_desc *ip;
 	int s, err;
+	int	pwval;
 
 	/* beep is disabled until the 1st call of crdioctl() */
 	pccard_beep_select(BEEP_ON);
@@ -1026,6 +1027,53 @@
 		else
 			pccard_failure_beep();
 		return err;
+	/*
+	 * Virtual removal/insertion
+	 * 
+	 * State of cards:
+	 *
+	 *         insertion        virtual removal
+ 	 * (empty) --------> (filled) --------> (inactive)
+	 *   ^ ^               |  ^                 | |
+	 *   | |               |  |                 | |
+	 *   | +---------------+  +-----------------+ |
+	 *   |      removal        virtual insertion  |
+	 *   |                                        |
+	 *   +----------------------------------------+
+	 *                    removal
+	 *
+	 * -- hosokawa
+	 */
+	case PIOCSVIR:
+		pwval = *(int *)data;
+		/* virtual removal */
+		if (!pwval) {
+			if (slt->state != filled) {
+				return EINVAL;
+			}
+			s = splhigh();
+			disable_slot(slt);
+			slt->state = inactive;
+			splx(s);
+			pccard_remove_beep();
+			selwakeup(&slt->selp);
+		}
+		/* virtual insertion */
+		else {
+			if (slt->state != inactive) {
+				return EINVAL;
+			}
+			slt->insert_seq = 1;
+			timeout(inserted, (void *)slt, hz/4);
+			pccard_insert_beep();
+			break;
+		}
+		break;
+	case PIOCSBEEP:
+		if (pccard_beep_select(*(int *)data)) {
+			return EINVAL;
+		}
+		break;
 	}
 	return(0);
 }
Index: pccard_beep.c
===================================================================
RCS file: /home/ncvs/src/sys/pccard/pccard_beep.c,v
retrieving revision 1.1
diff -u -r1.1 pccard_beep.c
--- pccard_beep.c	1997/10/26 06:06:48	1.1
+++ pccard_beep.c	1999/02/07 14:20:48
@@ -64,7 +64,11 @@
 	sysbeep(PCCARD_BEEP_PITCH2, PCCARD_BEEP_DURATION2);
 }
 
-void pccard_beep_select(enum beepstate state)
+int pccard_beep_select(enum beepstate state)
 {
-	allow_beep = state;
+	if (state == BEEP_ON || state == BEEP_OFF) {
+		allow_beep = state;
+		return 0;
+	}
+	return 1;
 }

--------------6331448DC47966073EBB6A88--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36BDB2D0.CA3FE4BB>