| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: audio.c,v 1.399 2017/08/15 08:30:21 isaki Exp $ */ | | 1 | /* $NetBSD: audio.c,v 1.400 2017/08/17 04:33:22 isaki Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au> | | 4 | * Copyright (c) 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 7 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
10 | * This code is derived from software contributed to The NetBSD Foundation | | 10 | * This code is derived from software contributed to The NetBSD Foundation |
11 | * by Andrew Doran. | | 11 | * by Andrew Doran. |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -138,27 +138,27 @@ | | | @@ -138,27 +138,27 @@ |
138 | * query_devinfo - x | | 138 | * query_devinfo - x |
139 | * allocm - - Called at attach time | | 139 | * allocm - - Called at attach time |
140 | * freem - - Called at attach time | | 140 | * freem - - Called at attach time |
141 | * round_buffersize - x | | 141 | * round_buffersize - x |
142 | * mappage - - Mem. unchanged after attach | | 142 | * mappage - - Mem. unchanged after attach |
143 | * get_props - x | | 143 | * get_props - x |
144 | * trigger_output x x | | 144 | * trigger_output x x |
145 | * trigger_input x x | | 145 | * trigger_input x x |
146 | * dev_ioctl - x | | 146 | * dev_ioctl - x |
147 | * get_locks - - Called at attach time | | 147 | * get_locks - - Called at attach time |
148 | */ | | 148 | */ |
149 | | | 149 | |
150 | #include <sys/cdefs.h> | | 150 | #include <sys/cdefs.h> |
151 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.399 2017/08/15 08:30:21 isaki Exp $"); | | 151 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.400 2017/08/17 04:33:22 isaki Exp $"); |
152 | | | 152 | |
153 | #ifdef _KERNEL_OPT | | 153 | #ifdef _KERNEL_OPT |
154 | #include "audio.h" | | 154 | #include "audio.h" |
155 | #include "midi.h" | | 155 | #include "midi.h" |
156 | #endif | | 156 | #endif |
157 | | | 157 | |
158 | #if NAUDIO > 0 | | 158 | #if NAUDIO > 0 |
159 | | | 159 | |
160 | #include <sys/types.h> | | 160 | #include <sys/types.h> |
161 | #include <sys/param.h> | | 161 | #include <sys/param.h> |
162 | #include <sys/ioctl.h> | | 162 | #include <sys/ioctl.h> |
163 | #include <sys/fcntl.h> | | 163 | #include <sys/fcntl.h> |
164 | #include <sys/file.h> | | 164 | #include <sys/file.h> |
| @@ -2010,27 +2010,27 @@ audio_init_ringbuffer(struct audio_softc | | | @@ -2010,27 +2010,27 @@ audio_init_ringbuffer(struct audio_softc |
2010 | rp->needfill = false; | | 2010 | rp->needfill = false; |
2011 | rp->mmapped = false; | | 2011 | rp->mmapped = false; |
2012 | memset(rp->s.start, 0, blksize * 2); | | 2012 | memset(rp->s.start, 0, blksize * 2); |
2013 | } | | 2013 | } |
2014 | | | 2014 | |
2015 | int | | 2015 | int |
2016 | audio_initbufs(struct audio_softc *sc, struct virtual_channel *vc) | | 2016 | audio_initbufs(struct audio_softc *sc, struct virtual_channel *vc) |
2017 | { | | 2017 | { |
2018 | const struct audio_hw_if *hw; | | 2018 | const struct audio_hw_if *hw; |
2019 | int error; | | 2019 | int error; |
2020 | | | 2020 | |
2021 | if (vc == NULL) { | | 2021 | if (vc == NULL) { |
2022 | vc = sc->sc_hwvc; | | 2022 | vc = sc->sc_hwvc; |
2023 | sc->sc_pr.blksize = vc->sc_mrr.blksize; | | 2023 | sc->sc_pr.blksize = vc->sc_mpr.blksize; |
2024 | sc->sc_rr.blksize = vc->sc_mrr.blksize; | | 2024 | sc->sc_rr.blksize = vc->sc_mrr.blksize; |
2025 | } | | 2025 | } |
2026 | | | 2026 | |
2027 | DPRINTF(("audio_initbufs: mode=0x%x\n", vc->sc_mode)); | | 2027 | DPRINTF(("audio_initbufs: mode=0x%x\n", vc->sc_mode)); |
2028 | hw = sc->hw_if; | | 2028 | hw = sc->hw_if; |
2029 | if (audio_can_capture(sc) && | | 2029 | if (audio_can_capture(sc) && |
2030 | ((vc->sc_open & AUOPEN_READ) || vc == sc->sc_hwvc)) { | | 2030 | ((vc->sc_open & AUOPEN_READ) || vc == sc->sc_hwvc)) { |
2031 | audio_init_ringbuffer(sc, &vc->sc_mrr, | | 2031 | audio_init_ringbuffer(sc, &vc->sc_mrr, |
2032 | AUMODE_RECORD); | | 2032 | AUMODE_RECORD); |
2033 | if (sc->sc_opens == 0 && hw->init_input && | | 2033 | if (sc->sc_opens == 0 && hw->init_input && |
2034 | (vc->sc_mode & AUMODE_RECORD)) { | | 2034 | (vc->sc_mode & AUMODE_RECORD)) { |
2035 | error = hw->init_input(sc->hw_hdl, vc->sc_mrr.s.start, | | 2035 | error = hw->init_input(sc->hw_hdl, vc->sc_mrr.s.start, |
2036 | vc->sc_mrr.s.end - vc->sc_mrr.s.start); | | 2036 | vc->sc_mrr.s.end - vc->sc_mrr.s.start); |