Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/bebox/isa Don't use sleep() and callouts; just use ...



details:   https://anonhg.NetBSD.org/src/rev/bfdaddb2ad26
branches:  trunk
changeset: 486646:bfdaddb2ad26
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat May 27 04:42:14 2000 +0000

description:
Don't use sleep() and callouts; just use tsleep().

diffstat:

 sys/arch/bebox/isa/spkr.c |  32 ++++----------------------------
 1 files changed, 4 insertions(+), 28 deletions(-)

diffs (72 lines):

diff -r ddd7cc4b062d -r bfdaddb2ad26 sys/arch/bebox/isa/spkr.c
--- a/sys/arch/bebox/isa/spkr.c Sat May 27 04:26:32 2000 +0000
+++ b/sys/arch/bebox/isa/spkr.c Sat May 27 04:42:14 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spkr.c,v 1.6 2000/03/23 06:36:44 thorpej Exp $ */
+/*     $NetBSD: spkr.c,v 1.7 2000/05/27 04:42:14 thorpej Exp $ */
 
 /*
  * spkr.c -- device driver for console speaker on 80386
@@ -66,20 +66,15 @@
 
 static void endtone __P((void *));
 static void tone __P((u_int, u_int));
-static void endrest __P((void *));
 static void rest __P((int));
 static void playinit __P((void));
 static void playtone __P((int, int, int));
 static void playstring __P((char *, int));
 
-static struct callout endtone_ch = CALLOUT_INITIALIZER;
-static struct callout endreset_ch = CALLOUT_INITIALIZER;
-
 static void
 endtone(v)
     void *v;
 {
-    wakeup(endtone);
     isa_outb(PITAUX_PORT, isa_inb(PITAUX_PORT) & ~PIT_SPKR);
 }
 
@@ -106,21 +101,7 @@
     /* turn the speaker on */
     isa_outb(PITAUX_PORT, isa_inb(PITAUX_PORT) | PIT_SPKR);
 
-    /*
-     * Set timeout to endtone function, then give up the timeslice.
-     * This is so other processes can execute while the tone is being
-     * emitted.
-     */
-    callout_reset(&endtone_ch, ticks, endtone, NULL);
-    sleep(endtone, PZERO - 1);
-}
-
-static void
-endrest(v)
-/* end a rest */
-       void *v;
-{
-    wakeup(endrest);
+    (void) tsleep(endtone, PZERO - 1, "spkrtone", ticks);
 }
 
 static void
@@ -128,16 +109,11 @@
 /* rest for given number of ticks */
     int        ticks;
 {
-    /*
-     * Set timeout to endrest function, then give up the timeslice.
-     * This is so other processes can execute while the rest is being
-     * waited out.
-     */
+
 #ifdef DEBUG
     printf("rest: %d\n", ticks);
 #endif /* DEBUG */
-    callout_reset(&endrest_ch, ticks, endrest, NULL);
-    sleep(endrest, PZERO - 1);
+    (void) tsleep(rest, PZERO - 1, "spkrrest", ticks);
 }
 
 /**************** PLAY STRING INTERPRETER BEGINS HERE **********************



Home | Main Index | Thread Index | Old Index