Source-Changes-HG archive

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

[src/isaki-audio2]: src/sys/dev/pci Adapt to audio2.



details:   https://anonhg.NetBSD.org/src/rev/c081f866a418
branches:  isaki-audio2
changeset: 456005:c081f866a418
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Apr 27 13:25:33 2019 +0000

description:
Adapt to audio2.
Tested on sparc64 by macallan@.  Thank you.

diffstat:

 sys/dev/pci/autri.c |  92 ++++++++--------------------------------------------
 1 files changed, 14 insertions(+), 78 deletions(-)

diffs (140 lines):

diff -r 53e1357454d6 -r c081f866a418 sys/dev/pci/autri.c
--- a/sys/dev/pci/autri.c       Sat Apr 27 13:10:03 2019 +0000
+++ b/sys/dev/pci/autri.c       Sat Apr 27 13:25:33 2019 +0000
@@ -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 @@
 
 #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 @@
 #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 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 @@
 }
 
 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)
+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)
 {
-       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;
-       }
+
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index