| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uaudio.c,v 1.134 2013/01/22 12:40:43 jmcneill Exp $ */ | | 1 | /* $NetBSD: uaudio.c,v 1.135 2013/01/24 08:22:38 mrg Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999, 2012 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 Lennart Augustsson (lennart@augustsson.net) at | | 8 | * by Lennart Augustsson (lennart@augustsson.net) at |
9 | * Carlstedt Research & Technology, and Matthew R. Green (mrg@eterna.com.au). | | 9 | * Carlstedt Research & Technology, and Matthew R. Green (mrg@eterna.com.au). |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | /* | | 33 | /* |
34 | * USB audio specs: http://www.usb.org/developers/devclass_docs/audio10.pdf | | 34 | * USB audio specs: http://www.usb.org/developers/devclass_docs/audio10.pdf |
35 | * http://www.usb.org/developers/devclass_docs/frmts10.pdf | | 35 | * http://www.usb.org/developers/devclass_docs/frmts10.pdf |
36 | * http://www.usb.org/developers/devclass_docs/termt10.pdf | | 36 | * http://www.usb.org/developers/devclass_docs/termt10.pdf |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.134 2013/01/22 12:40:43 jmcneill Exp $"); | | 40 | __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.135 2013/01/24 08:22:38 mrg Exp $"); |
41 | | | 41 | |
42 | #include <sys/param.h> | | 42 | #include <sys/param.h> |
43 | #include <sys/systm.h> | | 43 | #include <sys/systm.h> |
44 | #include <sys/kernel.h> | | 44 | #include <sys/kernel.h> |
45 | #include <sys/malloc.h> | | 45 | #include <sys/malloc.h> |
46 | #include <sys/device.h> | | 46 | #include <sys/device.h> |
47 | #include <sys/ioctl.h> | | 47 | #include <sys/ioctl.h> |
48 | #include <sys/file.h> | | 48 | #include <sys/file.h> |
49 | #include <sys/reboot.h> /* for bootverbose */ | | 49 | #include <sys/reboot.h> /* for bootverbose */ |
50 | #include <sys/select.h> | | 50 | #include <sys/select.h> |
51 | #include <sys/proc.h> | | 51 | #include <sys/proc.h> |
52 | #include <sys/vnode.h> | | 52 | #include <sys/vnode.h> |
53 | #include <sys/poll.h> | | 53 | #include <sys/poll.h> |
| @@ -80,27 +80,27 @@ __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1 | | | @@ -80,27 +80,27 @@ __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1 |
80 | printf("%s[%d:%d]: "x, __func__, l->l_proc->p_pid, l->l_lid, y); \ | | 80 | printf("%s[%d:%d]: "x, __func__, l->l_proc->p_pid, l->l_lid, y); \ |
81 | } \ | | 81 | } \ |
82 | } while (0) | | 82 | } while (0) |
83 | #define DPRINTFN_CLEAN(n,x...) do { \ | | 83 | #define DPRINTFN_CLEAN(n,x...) do { \ |
84 | if (uaudiodebug > (n)) \ | | 84 | if (uaudiodebug > (n)) \ |
85 | printf(x); \ | | 85 | printf(x); \ |
86 | } while (0) | | 86 | } while (0) |
87 | #define DPRINTFN(n,x,y...) do { \ | | 87 | #define DPRINTFN(n,x,y...) do { \ |
88 | if (uaudiodebug > (n)) { \ | | 88 | if (uaudiodebug > (n)) { \ |
89 | struct lwp *l = curlwp; \ | | 89 | struct lwp *l = curlwp; \ |
90 | printf("%s[%d:%d]: "x, __func__, l->l_proc->p_pid, l->l_lid, y); \ | | 90 | printf("%s[%d:%d]: "x, __func__, l->l_proc->p_pid, l->l_lid, y); \ |
91 | } \ | | 91 | } \ |
92 | } while (0) | | 92 | } while (0) |
93 | int uaudiodebug = 6; | | 93 | int uaudiodebug = 0; |
94 | #else | | 94 | #else |
95 | #define DPRINTF(x,y...) | | 95 | #define DPRINTF(x,y...) |
96 | #define DPRINTFN_CLEAN(n,x...) | | 96 | #define DPRINTFN_CLEAN(n,x...) |
97 | #define DPRINTFN(n,x,y...) | | 97 | #define DPRINTFN(n,x,y...) |
98 | #endif | | 98 | #endif |
99 | | | 99 | |
100 | #define UAUDIO_NCHANBUFS 6 /* number of outstanding request */ | | 100 | #define UAUDIO_NCHANBUFS 6 /* number of outstanding request */ |
101 | #define UAUDIO_NFRAMES 10 /* ms of sound in each request */ | | 101 | #define UAUDIO_NFRAMES 10 /* ms of sound in each request */ |
102 | | | 102 | |
103 | | | 103 | |
104 | #define MIX_MAX_CHAN 8 | | 104 | #define MIX_MAX_CHAN 8 |
105 | struct mixerctl { | | 105 | struct mixerctl { |
106 | uint16_t wValue[MIX_MAX_CHAN]; /* using nchan */ | | 106 | uint16_t wValue[MIX_MAX_CHAN]; /* using nchan */ |