From owner-freebsd-current Fri Sep 22 8: 1: 6 2000 Delivered-To: freebsd-current@freebsd.org Received: from lavender.sanpei.org (ppp155.dialup.st.keio.ac.jp [131.113.27.155]) by hub.freebsd.org (Postfix) with ESMTP id 3FC6C37B424 for ; Fri, 22 Sep 2000 08:00:58 -0700 (PDT) Received: (from sanpei@localhost) by lavender.sanpei.org (8.11.0/3.7W) id e8MF0Me01325; Sat, 23 Sep 2000 00:00:22 +0900 (JST) Message-Id: <200009221500.e8MF0Me01325@lavender.sanpei.org> To: bde@zeta.org.au Cc: imp@village.org, current@FreeBSD.ORG From: sanpei@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. In-Reply-To: Your message of "Mon, 18 Sep 2000 23:47:49 +1100 (EST)" References: X-Mailer: Mew version 1.70 on Emacs 19.34.1 / Mule 2.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 23 Sep 2000 00:00:21 +0900 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Bruce Evans 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