| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: audio.c,v 1.255.2.4 2012/04/29 23:04:47 mrg Exp $ */ | | 1 | /* $NetBSD: audio.c,v 1.255.2.5 2012/04/30 02:42:32 mrg Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -145,27 +145,27 @@ | | | @@ -145,27 +145,27 @@ |
145 | * query_devinfo - x | | 145 | * query_devinfo - x |
146 | * allocm - - Called at attach time | | 146 | * allocm - - Called at attach time |
147 | * freem - - Called at attach time | | 147 | * freem - - Called at attach time |
148 | * round_buffersize - x | | 148 | * round_buffersize - x |
149 | * mappage - - Mem. unchanged after attach | | 149 | * mappage - - Mem. unchanged after attach |
150 | * get_props - x | | 150 | * get_props - x |
151 | * trigger_output x x | | 151 | * trigger_output x x |
152 | * trigger_input x x | | 152 | * trigger_input x x |
153 | * dev_ioctl - x | | 153 | * dev_ioctl - x |
154 | * get_locks - - Called at attach time | | 154 | * get_locks - - Called at attach time |
155 | */ | | 155 | */ |
156 | | | 156 | |
157 | #include <sys/cdefs.h> | | 157 | #include <sys/cdefs.h> |
158 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.255.2.4 2012/04/29 23:04:47 mrg Exp $"); | | 158 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.255.2.5 2012/04/30 02:42:32 mrg Exp $"); |
159 | | | 159 | |
160 | #include "audio.h" | | 160 | #include "audio.h" |
161 | #if NAUDIO > 0 | | 161 | #if NAUDIO > 0 |
162 | | | 162 | |
163 | #include <sys/param.h> | | 163 | #include <sys/param.h> |
164 | #include <sys/ioctl.h> | | 164 | #include <sys/ioctl.h> |
165 | #include <sys/fcntl.h> | | 165 | #include <sys/fcntl.h> |
166 | #include <sys/vnode.h> | | 166 | #include <sys/vnode.h> |
167 | #include <sys/select.h> | | 167 | #include <sys/select.h> |
168 | #include <sys/poll.h> | | 168 | #include <sys/poll.h> |
169 | #include <sys/kmem.h> | | 169 | #include <sys/kmem.h> |
170 | #include <sys/malloc.h> | | 170 | #include <sys/malloc.h> |
171 | #include <sys/proc.h> | | 171 | #include <sys/proc.h> |
| @@ -1981,27 +1981,27 @@ audio_read(struct audio_softc *sc, struc | | | @@ -1981,27 +1981,27 @@ audio_read(struct audio_softc *sc, struc |
1981 | | | 1981 | |
1982 | sc->sc_rustream->outp = audio_stream_add_outp | | 1982 | sc->sc_rustream->outp = audio_stream_add_outp |
1983 | (sc->sc_rustream, outp, n); | | 1983 | (sc->sc_rustream, outp, n); |
1984 | cb->copying = false; | | 1984 | cb->copying = false; |
1985 | } | | 1985 | } |
1986 | mutex_exit(sc->sc_intr_lock); | | 1986 | mutex_exit(sc->sc_intr_lock); |
1987 | return error; | | 1987 | return error; |
1988 | } | | 1988 | } |
1989 | | | 1989 | |
1990 | void | | 1990 | void |
1991 | audio_clear(struct audio_softc *sc) | | 1991 | audio_clear(struct audio_softc *sc) |
1992 | { | | 1992 | { |
1993 | | | 1993 | |
1994 | KASSERT(mutex_owned(sc->sc_lock)); | | 1994 | KASSERT(mutex_owned(sc->sc_intr_lock)); |
1995 | | | 1995 | |
1996 | if (sc->sc_rbus) { | | 1996 | if (sc->sc_rbus) { |
1997 | cv_broadcast(&sc->sc_rchan); | | 1997 | cv_broadcast(&sc->sc_rchan); |
1998 | sc->hw_if->halt_input(sc->hw_hdl); | | 1998 | sc->hw_if->halt_input(sc->hw_hdl); |
1999 | sc->sc_rbus = false; | | 1999 | sc->sc_rbus = false; |
2000 | sc->sc_rr.pause = false; | | 2000 | sc->sc_rr.pause = false; |
2001 | } | | 2001 | } |
2002 | if (sc->sc_pbus) { | | 2002 | if (sc->sc_pbus) { |
2003 | cv_broadcast(&sc->sc_wchan); | | 2003 | cv_broadcast(&sc->sc_wchan); |
2004 | sc->hw_if->halt_output(sc->hw_hdl); | | 2004 | sc->hw_if->halt_output(sc->hw_hdl); |
2005 | sc->sc_pbus = false; | | 2005 | sc->sc_pbus = false; |
2006 | sc->sc_pr.pause = false; | | 2006 | sc->sc_pr.pause = false; |
2007 | } | | 2007 | } |
| @@ -2377,28 +2377,28 @@ audio_ioctl(struct audio_softc *sc, u_lo | | | @@ -2377,28 +2377,28 @@ audio_ioctl(struct audio_softc *sc, u_lo |
2377 | error = EBUSY; | | 2377 | error = EBUSY; |
2378 | else | | 2378 | else |
2379 | sc->sc_async_audio = curproc->p_pid; | | 2379 | sc->sc_async_audio = curproc->p_pid; |
2380 | DPRINTF(("audio_ioctl: FIOASYNC pid %d\n", | | 2380 | DPRINTF(("audio_ioctl: FIOASYNC pid %d\n", |
2381 | curproc->p_pid)); | | 2381 | curproc->p_pid)); |
2382 | } else | | 2382 | } else |
2383 | sc->sc_async_audio = 0; | | 2383 | sc->sc_async_audio = 0; |
2384 | break; | | 2384 | break; |
2385 | | | 2385 | |
2386 | case AUDIO_FLUSH: | | 2386 | case AUDIO_FLUSH: |
2387 | DPRINTF(("AUDIO_FLUSH\n")); | | 2387 | DPRINTF(("AUDIO_FLUSH\n")); |
2388 | rbus = sc->sc_rbus; | | 2388 | rbus = sc->sc_rbus; |
2389 | pbus = sc->sc_pbus; | | 2389 | pbus = sc->sc_pbus; |
2390 | audio_clear(sc); | | | |
2391 | mutex_enter(sc->sc_intr_lock); | | 2390 | mutex_enter(sc->sc_intr_lock); |
| | | 2391 | audio_clear(sc); |
2392 | error = audio_initbufs(sc); | | 2392 | error = audio_initbufs(sc); |
2393 | if (error) { | | 2393 | if (error) { |
2394 | mutex_exit(sc->sc_intr_lock); | | 2394 | mutex_exit(sc->sc_intr_lock); |
2395 | return error; | | 2395 | return error; |
2396 | } | | 2396 | } |
2397 | if ((sc->sc_mode & AUMODE_PLAY) && !sc->sc_pbus && pbus) | | 2397 | if ((sc->sc_mode & AUMODE_PLAY) && !sc->sc_pbus && pbus) |
2398 | error = audiostartp(sc); | | 2398 | error = audiostartp(sc); |
2399 | if (!error && | | 2399 | if (!error && |
2400 | (sc->sc_mode & AUMODE_RECORD) && !sc->sc_rbus && rbus) | | 2400 | (sc->sc_mode & AUMODE_RECORD) && !sc->sc_rbus && rbus) |
2401 | error = audiostartr(sc); | | 2401 | error = audiostartr(sc); |
2402 | mutex_exit(sc->sc_intr_lock); | | 2402 | mutex_exit(sc->sc_intr_lock); |
2403 | break; | | 2403 | break; |
2404 | | | 2404 | |