Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Sep 2000 00:00:21 +0900
From:      sanpei@FreeBSD.ORG
To:        bde@zeta.org.au
Cc:        imp@village.org, current@FreeBSD.ORG
Subject:   Re: Please review: small change in sys/i386/isa/clock.c andsys/alpha/alpha/clock.c for PC-Card melody beep code. 
Message-ID:  <200009221500.e8MF0Me01325@lavender.sanpei.org>
In-Reply-To: Your message of "Mon, 18 Sep 2000 23:47:49 %2B1100 (EST)"
References:  <Pine.BSF.4.21.0009182338210.16890-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans <bde@zeta.org.au> wrote:
>On Sun, 17 Sep 2000, Warner Losh wrote:
>
>> I've seen these patches many times and think that it is a good idea.
>> This interface needs to be exported so that the pccard system sounds
>> don't interfere with normal systme sounds.
>
>It needs locking changes to be exportable:
>
>1) splhigh()/splx(), at least in RELENG_4 where there is no giant lock
>   and spl*() has a non-null effect, so that callers don't need to know
>   that it must be called at splsoftclock() or higher.
>2) Honor the current locking protocol acquire_timer2()/release_timer2()
>   -- don't do anything if (!beeping).

  Hum, is below code which was from PAO3 good for FreeBSD tree?

# But I think it has still has 1) problem....... Do you have any
# idea about this melody patch...

Cheers.
---
MIHIRA, Sanpei Yoshiro
Yokohama, Japan.


--- sys/i386/isa/clock.c.org	Mon Jan  3 10:46:36 2000
+++ sys/i386/isa/clock.c	Mon Jan  3 10:47:52 2000
@@ -188,6 +188,9 @@
 SYSCTL_OPAQUE(_debug, OID_AUTO, tsc_timecounter, CTLFLAG_RD, 
 	&tsc_timecounter, sizeof(tsc_timecounter), "S,timecounter", "");
 
+static struct callout_handle sysbeep_ch
+	= CALLOUT_HANDLE_INITIALIZER(&sysbeep_ch);
+
 static struct timecounter i8254_timecounter = {
 	i8254_get_timecount,	/* get_timecount */
 	0,			/* no poll_pps */
@@ -536,10 +539,21 @@
 		/* enable counter2 output to speaker */
 		outb(IO_PPI, inb(IO_PPI) | 3);
 		beeping = period;
-		timeout(sysbeepstop, (void *)NULL, period);
+		sysbeep_ch = timeout(sysbeepstop, (void *)NULL, period);
 	}
 	splx(x);
 	return (0);
+}    
+
+int
+sysbeep_cancel(void)
+{
+	if (beeping) {
+		untimeout(sysbeepstop, (void *)NULL, sysbeep_ch);
+		sysbeepstop((void *)NULL);
+		return 0;
+	}
+	return -1;
 }
 
 /*
--- sys/i386/include/clock.h.org	Mon Jan  3 10:58:30 2000
+++ sys/i386/include/clock.h	Mon Jan  3 10:59:13 2000
@@ -44,6 +44,7 @@
 int	release_timer1 __P((void));
 #endif
 int	sysbeep __P((int pitch, int period));
+int	sysbeep_cancel __P((void));
 void	i8254_restore __P((void));
 
 #endif /* _KERNEL */


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?200009221500.e8MF0Me01325>