Source-Changes-HG archive

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

[src/isaki-audio2]: src/sys Use C99 style struct initializer to audio_format.



details:   https://anonhg.NetBSD.org/src/rev/9226b0e5eef8
branches:  isaki-audio2
changeset: 450628:9226b0e5eef8
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Apr 21 05:11:21 2019 +0000

description:
Use C99 style struct initializer to audio_format.

diffstat:

 sys/arch/arm/xscale/pxa2x0_ac97.c   |  14 ++++++-
 sys/arch/dreamcast/dev/g2/aica.c    |  30 ++++++++++-------
 sys/arch/macppc/dev/awacs.c         |  24 +++++++++----
 sys/arch/macppc/dev/snapper.c       |  33 ++++++++++++++----
 sys/arch/sgimips/mace/mavb.c        |  19 ++++++++--
 sys/arch/usermode/dev/vaudio.c      |  16 +++++++--
 sys/arch/zaurus/dev/wm8750_zaudio.c |  63 +++++++++---------------------------
 sys/dev/bluetooth/btsco.c           |  21 +++++------
 sys/dev/ic/arcofi.c                 |  22 ++++++++----
 sys/dev/ic/uda1341.c                |  27 ++++++++-------
 sys/dev/isa/ess.c                   |  39 ++++++++++++----------
 sys/dev/pci/auacer.c                |  24 +++++++++----
 sys/dev/pci/auich.c                 |  30 ++++++++++-------
 sys/dev/pci/auixpvar.h              |  25 ++++++++++----
 sys/dev/pci/autri.c                 |  39 ++++++++++++----------
 sys/dev/pci/auvia.c                 |  62 ++++++++++++++++++++++++-----------
 sys/dev/pci/cmpci.c                 |  27 +++++++++-----
 sys/dev/pci/eap.c                   |  27 +++++++++-----
 sys/dev/pci/emuxki.c                |  38 ++++++++++++++++-----
 sys/dev/pci/esa.c                   |  27 +++++++++-----
 sys/dev/pci/esm.c                   |  27 +++++++++-----
 sys/dev/pci/eso.c                   |  39 ++++++++++++----------
 sys/dev/pci/fms.c                   |  32 ++++++++++--------
 sys/dev/pci/gcscaudio.c             |  33 +++++++++++--------
 sys/dev/pci/neo.c                   |  28 ++++++++++-----
 sys/dev/pci/sv.c                    |  27 +++++++++-----
 sys/dev/pci/yds.c                   |  27 +++++++++-----
 sys/dev/sbus/dbri.c                 |  50 ++++++++++++++--------------
 28 files changed, 520 insertions(+), 350 deletions(-)

diffs (truncated from 1471 to 300 lines):

diff -r c560efc01b29 -r 9226b0e5eef8 sys/arch/arm/xscale/pxa2x0_ac97.c
--- a/sys/arch/arm/xscale/pxa2x0_ac97.c Sun Apr 21 04:28:59 2019 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_ac97.c Sun Apr 21 05:11:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pxa2x0_ac97.c,v 1.15 2019/03/16 12:09:56 isaki Exp $   */
+/*     $NetBSD: pxa2x0_ac97.c,v 1.15.2.1 2019/04/21 05:11:21 isaki Exp $       */
 
 /*
  * Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -184,8 +184,16 @@
 };
 
 static const struct audio_format acu_formats[] = {
-       {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        2, AUFMT_STEREO, 0, {4000, 48000}}
+       {
+               .mode           = AUMODE_PLAY | AUMODE_RECORD,
+               .encoding       = AUDIO_ENCODING_SLINEAR_LE,
+               .validbits      = 16,
+               .precision      = 16,
+               .channels       = 2,
+               .channel_mask   = AUFMT_STEREO,
+               .frequency_type = 0,
+               .frequency      = { 4000, 48000 },
+       },
 };
 #define        ACU_NFORMATS    (sizeof(acu_formats) / sizeof(struct audio_format))
 
diff -r c560efc01b29 -r 9226b0e5eef8 sys/arch/dreamcast/dev/g2/aica.c
--- a/sys/arch/dreamcast/dev/g2/aica.c  Sun Apr 21 04:28:59 2019 +0000
+++ b/sys/arch/dreamcast/dev/g2/aica.c  Sun Apr 21 05:11:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aica.c,v 1.25 2019/03/16 12:09:56 isaki Exp $  */
+/*     $NetBSD: aica.c,v 1.25.2.1 2019/04/21 05:11:21 isaki Exp $      */
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo <ryo%misakimix.org@localhost>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.25 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.25.2.1 2019/04/21 05:11:21 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -102,17 +102,23 @@
 };
 
 #define AICA_NFORMATS  5
+#define AICA_FORMAT(enc, prec, ch, chmask) \
+       { \
+               .mode           = AUMODE_PLAY, \
+               .encoding       = (enc), \
+               .validbits      = (prec), \
+               .precision      = (prec), \
+               .channels       = (ch), \
+               .channel_mask   = (chmask), \
+               .frequency_type = 0, \
+               .frequency      = { 1, 65536 }, \
+       }
 static const struct audio_format aica_formats[AICA_NFORMATS] = {
-       {NULL, AUMODE_PLAY, AUDIO_ENCODING_ADPCM, 4, 4,
-        1, AUFMT_MONAURAL, 0, {1, 65536}},
-       {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        1, AUFMT_MONAURAL, 0, {1, 65536}},
-       {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        2, AUFMT_STEREO, 0, {1, 65536}},
-       {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 8, 8,
-        1, AUFMT_MONAURAL, 0, {1, 65536}},
-       {NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 8, 8,
-        2, AUFMT_STEREO, 0, {1, 65536}},
+       AICA_FORMAT(AUDIO_ENCODING_ADPCM,       4, 1, AUFMT_MONAURAL),
+       AICA_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL),
+       AICA_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO),
+       AICA_FORMAT(AUDIO_ENCODING_SLINEAR_LE,  8, 1, AUFMT_MONAURAL),
+       AICA_FORMAT(AUDIO_ENCODING_SLINEAR_LE,  8, 2, AUFMT_STEREO),
 };
 
 int aica_match(device_t, cfdata_t, void *);
diff -r c560efc01b29 -r 9226b0e5eef8 sys/arch/macppc/dev/awacs.c
--- a/sys/arch/macppc/dev/awacs.c       Sun Apr 21 04:28:59 2019 +0000
+++ b/sys/arch/macppc/dev/awacs.c       Sun Apr 21 05:11:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awacs.c,v 1.46 2019/03/16 12:09:57 isaki Exp $ */
+/*     $NetBSD: awacs.c,v 1.46.2.1 2019/04/21 05:11:21 isaki Exp $     */
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.46 2019/03/16 12:09:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.46.2.1 2019/04/21 05:11:21 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/audioio.h>
@@ -189,13 +189,21 @@
 
 #define AWACS_NFORMATS         2
 #define AWACS_FORMATS_LE       0
+#define AWACS_FORMAT(enc) \
+       { \
+               .mode           = AUMODE_PLAY | AUMODE_RECORD, \
+               .encoding       = (enc), \
+               .validbits      = 16, \
+               .precision      = 16, \
+               .channels       = 2, \
+               .channel_mask   = AUFMT_STEREO, \
+               .frequency_type = 8, \
+               .frequency      = \
+                   { 7350, 8820, 11025, 14700, 17640, 22050, 29400, 44100 }, \
+       }
 static const struct audio_format awacs_formats[AWACS_NFORMATS] = {
-       {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-        2, AUFMT_STEREO, 8, 
-        {7350, 8820, 11025, 14700, 17640, 22050, 29400, 44100}},
-       {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        2, AUFMT_STEREO, 8, 
-        {7350, 8820, 11025, 14700, 17640, 22050, 29400, 44100}},
+       AWACS_FORMAT(AUDIO_ENCODING_SLINEAR_LE),
+       AWACS_FORMAT(AUDIO_ENCODING_SLINEAR_BE),
 };
 
 /* register offset */
diff -r c560efc01b29 -r 9226b0e5eef8 sys/arch/macppc/dev/snapper.c
--- a/sys/arch/macppc/dev/snapper.c     Sun Apr 21 04:28:59 2019 +0000
+++ b/sys/arch/macppc/dev/snapper.c     Sun Apr 21 05:11:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: snapper.c,v 1.49 2019/03/16 12:09:57 isaki Exp $       */
+/*     $NetBSD: snapper.c,v 1.49.2.1 2019/04/21 05:11:21 isaki Exp $   */
 /*     Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp     */
 /*     Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp         */
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.49 2019/03/16 12:09:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.49.2.1 2019/04/21 05:11:21 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/audioio.h>
@@ -523,17 +523,34 @@
 };
 
 #define SNAPPER_NFORMATS       2
+#define SNAPPER_FORMAT(prec) \
+       { \
+               .mode           = AUMODE_PLAY | AUMODE_RECORD, \
+               .encoding       = AUDIO_ENCODING_SLINEAR_BE, \
+               .validbits      = (prec), \
+               .precision      = (prec), \
+               .channels       = 2, \
+               .channel_mask   = AUFMT_STEREO, \
+               .frequency_type = 3, \
+               .frequency      = { 32000, 44100, 48000 }, \
+       }
 static const struct audio_format snapper_formats[SNAPPER_NFORMATS] = {
-       {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        2, AUFMT_STEREO, 3, {32000, 44100, 48000}},
-       {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_BE, 24, 24,
-        2, AUFMT_STEREO, 3, {32000, 44100, 48000}},
+       SNAPPER_FORMAT(16),
+       SNAPPER_FORMAT(24),
 };
 
 #define TUMBLER_NFORMATS       1
 static const struct audio_format tumbler_formats[TUMBLER_NFORMATS] = {
-       {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-        2, AUFMT_STEREO, 4, {32000, 44100, 48000, 96000}},
+       {
+               .mode           = AUMODE_PLAY | AUMODE_RECORD,
+               .encoding       = AUDIO_ENCODING_SLINEAR_BE,
+               .validbits      = 16,
+               .precision      = 16,
+               .channels       = 2,
+               .channel_mask   = AUFMT_STEREO,
+               .frequency_type = 4,
+               .frequency      = { 32000, 44100, 48000, 96000 },
+       },
 };
 
 static bus_size_t amp_mute;
diff -r c560efc01b29 -r 9226b0e5eef8 sys/arch/sgimips/mace/mavb.c
--- a/sys/arch/sgimips/mace/mavb.c      Sun Apr 21 04:28:59 2019 +0000
+++ b/sys/arch/sgimips/mace/mavb.c      Sun Apr 21 05:11:21 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mavb.c,v 1.12 2019/03/16 12:09:57 isaki Exp $ */
+/* $NetBSD: mavb.c,v 1.12.2.1 2019/04/21 05:11:21 isaki Exp $ */
 /* $OpenBSD: mavb.c,v 1.6 2005/04/15 13:05:14 mickey Exp $ */
 
 /*
@@ -109,11 +109,20 @@
 };
 
 #define MAVB_NFORMATS 2
+#define MAVB_FORMAT(ch, chmask) \
+       { \
+               .mode           = AUMODE_PLAY | AUMODE_RECORD, \
+               .encoding       = AUDIO_ENCODING_SLINEAR_BE, \
+               .validbits      = 16, \
+               .precision      = 16, \
+               .channels       = (ch), \
+               .channel_mask   = (chmask), \
+               .frequency_type = 0, \
+               .frequency      = { 8000, 48000 }, \
+       }
 static const struct audio_format mavb_formats[MAVB_NFORMATS] = {
-       { NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-         1, AUFMT_MONAURAL, 0, { 8000, 48000 } },
-       { NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-         2, AUFMT_STEREO, 0, { 8000, 48000 } },
+       MAVB_FORMAT(1, AUFMT_MONAURAL),
+       MAVB_FORMAT(2, AUFMT_STEREO),
 };
 
 struct mavb_softc {
diff -r c560efc01b29 -r 9226b0e5eef8 sys/arch/usermode/dev/vaudio.c
--- a/sys/arch/usermode/dev/vaudio.c    Sun Apr 21 04:28:59 2019 +0000
+++ b/sys/arch/usermode/dev/vaudio.c    Sun Apr 21 05:11:21 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vaudio.c,v 1.4 2014/03/26 08:29:41 christos Exp $ */
+/* $NetBSD: vaudio.c,v 1.4.32.1 2019/04/21 05:11:22 isaki Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vaudio.c,v 1.4 2014/03/26 08:29:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vaudio.c,v 1.4.32.1 2019/04/21 05:11:22 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -42,8 +42,16 @@
 #include <dev/auconv.h>
 
 static const struct audio_format vaudio_audio_formats[1] = {
-       { NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-         2, AUFMT_STEREO, 0, { 8000, 48000 } },
+       {
+               .mode           = AUMODE_PLAY | AUMODE_RECORD,
+               .encoding       = AUDIO_ENCODING_SLINEAR_LE,
+               .validbits      = 16,
+               .precision      = 16,
+               .channels       = 2,
+               .channel_mask   = AUFMT_STEREO,
+               .frequency_type = 0,
+               .frequency      = { 8000, 48000 },
+       },
 };
 
 struct vaudio_stream {
diff -r c560efc01b29 -r 9226b0e5eef8 sys/arch/zaurus/dev/wm8750_zaudio.c
--- a/sys/arch/zaurus/dev/wm8750_zaudio.c       Sun Apr 21 04:28:59 2019 +0000
+++ b/sys/arch/zaurus/dev/wm8750_zaudio.c       Sun Apr 21 05:11:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wm8750_zaudio.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $        */
+/*     $NetBSD: wm8750_zaudio.c,v 1.2.4.1 2019/04/21 05:11:22 isaki Exp $      */
 /*     $OpenBSD: zaurus_audio.c,v 1.8 2005/08/18 13:23:02 robert Exp $ */
 
 /*
@@ -51,7 +51,7 @@
 #include "opt_zaudio.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wm8750_zaudio.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wm8750_zaudio.c,v 1.2.4.1 2019/04/21 05:11:22 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -112,51 +112,22 @@
        "wm"
 };
 
+#define WM8750_FORMAT(enc, prec, ch, chmask) \
+       { \
+               .mode           = AUMODE_PLAY | AUMODE_RECORD, \
+               .encoding       = (enc), \
+               .validbits      = (prec), \
+               .precision      = (prec), \
+               .channels       = (ch), \
+               .channel_mask   = (chmask), \
+               .frequency_type = 0, \
+               .frequency      = { 4000, 48000 }, \
+       }
 static const struct audio_format wm8750_formats[] = {
-       {
-               .driver_data    = NULL,
-               .mode           = AUMODE_PLAY | AUMODE_RECORD,
-               .encoding       = AUDIO_ENCODING_SLINEAR_LE,
-               .validbits      = 16,
-               .precision      = 16,
-               .channels       = 2,
-               .channel_mask   = AUFMT_STEREO,
-               .frequency_type = 0,
-               .frequency      = { 4000, 48000 }



Home | Main Index | Thread Index | Old Index