From owner-freebsd-mobile Mon Jan 3 5:20:19 2000 Delivered-To: freebsd-mobile@freebsd.org Received: from oxygen.yy.ics.keio.ac.jp (oxygen.yy.ics.keio.ac.jp [131.113.47.3]) by hub.freebsd.org (Postfix) with ESMTP id 76A3F15292 for ; Mon, 3 Jan 2000 05:20:11 -0800 (PST) (envelope-from sanpei@sanpei.org) Received: from lavender.yy.cs.keio.ac.jp (ppp137.dialup.st.keio.ac.jp [131.113.27.137]) by oxygen.yy.ics.keio.ac.jp (8.9.3+3.2W/3.7W) with ESMTP id WAA05356; Mon, 3 Jan 2000 22:20:00 +0900 (JST) Received: (from sanpei@localhost) by lavender.yy.cs.keio.ac.jp (8.9.3/3.7W) id WAA21504; Mon, 3 Jan 2000 22:20:02 +0900 (JST) Message-Id: <200001031320.WAA21504@lavender.yy.cs.keio.ac.jp> To: FreeBSD-mobile@FreeBSD.org Subject: Re: [Patch:pccard melody beep] experimental patch for pccard In-Reply-To: Your message of "Sat, 1 Jan 2000 00:08:37 JST". <199912311508.AAA13872@lavender.yy.cs.keio.ac.jp> 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: Mon, 03 Jan 2000 22:20:01 +0900 From: MIHIRA Sanpei Yoshiro Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > I ported pccard **melody** beep routine to 4-current from PAO3. Oops, sorry, I send broken patch, I re-create patch. If it will be commit into 4-current, I will create patch for /etc/defaults/rc.conf and pccardc.8 Enjoy it. MIHIRA Yoshiro Yokohama, Japan. --- sys/pccard/driver.h.orig Mon Jan 3 00:50:18 2000 +++ sys/pccard/driver.h Mon Jan 3 10:40:56 2000 @@ -13,12 +13,23 @@ void pccard_add_driver __P((struct pccard_device *)); +#undef PCCARD_BEEP +#ifndef PCCARD_BEEP +#define PCCARD_BEEP 2 +#endif /* !PCCARD_BEEP */ + +#ifndef PCCARD_BEEP enum beepstate { BEEP_OFF, BEEP_ON }; +#endif void pccard_insert_beep __P((void)); void pccard_remove_beep __P((void)); void pccard_success_beep __P((void)); void pccard_failure_beep __P((void)); -int pccard_beep_select __P((enum beepstate)); +#ifdef PCCARD_BEEP +int pccard_beep_select __P((int)); +#else +int pccard_beep_select __P((enum beepstate)); +#endif #endif /* !_PCCARD_DRIVER_H_ */ --- 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 */ --- sys/pccard/pccard_beep.c.orig Mon Jan 3 16:26:24 2000 +++ sys/pccard/pccard_beep.c Mon Jan 3 16:27:06 2000 @@ -20,6 +20,166 @@ #define PCCARD_BEEP_PITCH2 3200 #define PCCARD_BEEP_DURATION2 40 +#ifdef PCCARD_BEEP +static void pccard_insert_beep_type0(void) +{ + /* dummy */ +} + +static void pccard_remove_beep_type0(void) +{ + /* dummy */ +} + +static void pccard_success_beep_type0(void) +{ + /* dummy */ +} + +static void pccard_failure_beep_type0(void) +{ + /* dummy */ +} + + +static void pccard_insert_beep_type1(void) +{ + sysbeep(PCCARD_BEEP_PITCH0, PCCARD_BEEP_DURATION0); +} + +static void pccard_remove_beep_type1(void) +{ + sysbeep(PCCARD_BEEP_PITCH0, PCCARD_BEEP_DURATION0); +} + +static void pccard_success_beep_type1(void) +{ + sysbeep(PCCARD_BEEP_PITCH1, PCCARD_BEEP_DURATION1); +} + +static void pccard_failure_beep_type1(void) +{ + sysbeep(PCCARD_BEEP_PITCH2, PCCARD_BEEP_DURATION2); +} + +static void pccard_insert_beep0_type2(void *dummy) +{ + sysbeep_cancel(); + sysbeep(1200, 5); +} + +static void pccard_insert_beep_type2(void) +{ + sysbeep(1600, 20); + timeout(pccard_insert_beep0_type2, NULL, hz / 10); +} + +static void pccard_remove_beep0_type2(void *dummy) +{ + sysbeep_cancel(); + sysbeep(1600, 5); +} + +static void pccard_remove_beep_type2(void) +{ + sysbeep(1200, 20); + timeout(pccard_remove_beep0_type2, NULL, hz / 10); +} + +static void pccard_success_beep1_type2(void *dummy) +{ + sysbeep_cancel(); + sysbeep(800, 15); +} + +static void pccard_success_beep0_type2(void *dummy) +{ + sysbeep_cancel(); + sysbeep(1000, 20); + timeout(pccard_success_beep1_type2, NULL, hz / 15); +} + +static void pccard_success_beep_type2(void) +{ + sysbeep(1200, 20); + timeout(pccard_success_beep0_type2, NULL, hz / 15); +} + +static void pccard_failure_beep1_type2(void *dummy) +{ + sysbeep_cancel(); + sysbeep(2800, 15); +} + +static void pccard_failure_beep0_type2(void *dummy) +{ + sysbeep_cancel(); + sysbeep(2400, 20); + timeout(pccard_failure_beep1_type2, NULL, hz / 15); +} +static void pccard_failure_beep_type2(void) +{ + sysbeep(2000, 20); + timeout(pccard_failure_beep0_type2, NULL, hz / 15); +} + +static void (*insert)(void) = pccard_insert_beep_type0; +static void (*remove)(void) = pccard_remove_beep_type0; +static void (*success)(void) = pccard_success_beep_type0; +static void (*failure)(void) = pccard_failure_beep_type0; + +int pccard_beep_select(int type) +{ + int errcode = 0; + + switch (type) { + case 0: + insert = pccard_insert_beep_type0; + remove = pccard_remove_beep_type0; + success = pccard_success_beep_type0; + failure = pccard_failure_beep_type0; + break; + case 1: + insert = pccard_insert_beep_type1; + remove = pccard_remove_beep_type1; + success = pccard_success_beep_type1; + failure = pccard_failure_beep_type1; + break; + case 2: + insert = pccard_insert_beep_type2; + remove = pccard_remove_beep_type2; + success = pccard_success_beep_type2; + failure = pccard_failure_beep_type2; + break; + default: + errcode = 1; + break; + } + return errcode; +} + +void pccard_insert_beep(void) +{ + insert(); +} + +void pccard_remove_beep(void) +{ + remove(); +} + + +void pccard_success_beep(void) +{ + success(); +} + +void pccard_failure_beep(void) +{ + failure(); +} + +#else static struct callout_handle beeptimeout_ch = CALLOUT_HANDLE_INITIALIZER(&beeptimeout_ch); @@ -77,3 +237,4 @@ } return 1; } +#endif /* PCCARD_BEEP */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message