Module Name: src Committed By: isaki Date: Sat Apr 27 13:25:33 UTC 2019
Modified Files: src/sys/dev/pci [isaki-audio2]: autri.c Log Message: Adapt to audio2. Tested on sparc64 by macallan@. Thank you. To generate a diff of this commit: cvs rdiff -u -r1.56.2.1 -r1.56.2.2 src/sys/dev/pci/autri.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/autri.c diff -u src/sys/dev/pci/autri.c:1.56.2.1 src/sys/dev/pci/autri.c:1.56.2.2 --- src/sys/dev/pci/autri.c:1.56.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/autri.c Sat Apr 27 13:25:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: autri.c,v 1.56.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: autri.c,v 1.56.2.2 2019/04/27 13:25:33 isaki Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.56.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.56.2.2 2019/04/27 13:25:33 isaki Exp $"); #include "midi.h" @@ -52,8 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: autri.c,v 1. #include <dev/audio_if.h> #include <dev/midi_if.h> -#include <dev/mulaw.h> -#include <dev/auconv.h> #include <dev/ic/ac97reg.h> #include <dev/ic/ac97var.h> @@ -111,10 +109,10 @@ static void autri_disable_loop_interrupt #endif static int autri_open(void *, int); -static int autri_query_encoding(void *, struct audio_encoding *); -static int autri_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int autri_query_format(void *, audio_format_query_t *); +static int autri_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int autri_round_blocksize(void *, int, int, const audio_params_t *); static int autri_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -137,8 +135,8 @@ static void autri_get_locks(void *, kmut static const struct audio_hw_if autri_hw_if = { .open = autri_open, - .query_encoding = autri_query_encoding, - .set_params = autri_set_params, + .query_format = autri_query_format, + .set_format = autri_set_format, .round_blocksize = autri_round_blocksize, .halt_output = autri_halt_output, .halt_input = autri_halt_input, @@ -907,80 +905,18 @@ autri_open(void *addr, int flags) } static int -autri_query_encoding(void *addr, struct audio_encoding *fp) +autri_query_format(void *addr, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 2: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 3: - strcpy(fp->name, AudioEslinear); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 4: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 5: - strcpy(fp->name, AudioEulinear_le); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 6: - strcpy(fp->name, AudioEslinear_be); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 7: - strcpy(fp->name, AudioEulinear_be); - fp->encoding = AUDIO_ENCODING_ULINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - default: - return EINVAL; - } - - return 0; + return audio_query_format(autri_formats, AUTRI_NFORMATS, afp); } static int -autri_set_params(void *addr, int setmode, int usemode, - audio_params_t *play, audio_params_t *rec, stream_filter_list_t *pfil, - stream_filter_list_t *rfil) -{ - if (setmode & AUMODE_RECORD) { - if (auconv_set_converter(autri_formats, AUTRI_NFORMATS, - AUMODE_RECORD, rec, FALSE, rfil) < 0) - return EINVAL; - } - if (setmode & AUMODE_PLAY) { - if (auconv_set_converter(autri_formats, AUTRI_NFORMATS, - AUMODE_PLAY, play, FALSE, pfil) < 0) - return EINVAL; - } +autri_set_format(void *addr, int setmode, + const audio_params_t *play, const audio_params_t *rec, + audio_filter_reg_t *pfil, audio_filter_reg_t *rfil) +{ + return 0; }