Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Start of implementation of UpDown processing uni...



details:   https://anonhg.NetBSD.org/src/rev/00857109fc61
branches:  trunk
changeset: 480573:00857109fc61
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sun Jan 16 09:32:56 2000 +0000

description:
Start of implementation of UpDown processing unit control.

diffstat:

 sys/dev/usb/uaudio.c    |  47 ++++++++++++++++++++++++++++++++++++++++++++++-
 sys/dev/usb/uaudioreg.h |  24 +++++++++++++++---------
 2 files changed, 61 insertions(+), 10 deletions(-)

diffs (162 lines):

diff -r de5b1d1a0c00 -r 00857109fc61 sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Sun Jan 16 09:15:51 2000 +0000
+++ b/sys/dev/usb/uaudio.c      Sun Jan 16 09:32:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaudio.c,v 1.15 2000/01/06 21:13:55 augustss Exp $     */
+/*     $NetBSD: uaudio.c,v 1.16 2000/01/16 09:32:56 augustss Exp $     */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -209,6 +209,9 @@
                            usb_descriptor_t *v, usb_descriptor_t **dps));
 static void            uaudio_add_feature __P((struct uaudio_softc *sc,
                            usb_descriptor_t *v, usb_descriptor_t **dps));
+static void            uaudio_add_processing_updown
+                           __P((struct uaudio_softc *sc,
+                                usb_descriptor_t *v, usb_descriptor_t **dps));
 static void            uaudio_add_processing __P((struct uaudio_softc *sc,
                            usb_descriptor_t *v, usb_descriptor_t **dps));
 static void            uaudio_add_extension __P((struct uaudio_softc *sc,
@@ -887,6 +890,46 @@
 }
 
 void
+uaudio_add_processing_updown(sc, v, dps)
+       struct uaudio_softc *sc;
+       usb_descriptor_t *v;
+       usb_descriptor_t **dps;
+{
+       struct usb_audio_processing_unit *d = 
+           (struct usb_audio_processing_unit *)v;
+       struct usb_audio_processing_unit_1 *d1 =
+           (struct usb_audio_processing_unit_1 *)&d->baSourceId[d->bNrInPins];
+       struct usb_audio_processing_unit_updown *ud =
+           (struct usb_audio_processing_unit_updown *)
+               &d1->bmControls[d1->bControlSize];
+       struct mixerctl mix;
+       int i;
+
+       DPRINTFN(2,("uaudio_add_processing_updown: bUnitId=%d bNrModes=%d\n",
+                   d->bUnitId, ud->bNrModes));
+
+       if (!(d1->bmControls[0] & UA_PROC_MASK(UD_MODE_SELECT_CONTROL))) {
+               DPRINTF(("uaudio_add_processing_updown: no mode select\n"));
+               return;
+       }
+
+       mix.wIndex = MAKE(d->bUnitId, sc->sc_ac_iface);
+       mix.nchan = 1;
+       mix.wValue[0] = MAKE(UD_MODE_SELECT_CONTROL, 0);
+       mix.class = -1;
+       mix.type = MIX_ON_OFF;  /* XXX */
+       mix.ctlunit = "";
+       sprintf(mix.ctlname, "pro%d-mode", d->bUnitId);
+
+       for (i = 0; i < ud->bNrModes; i++) {
+               DPRINTFN(2,("uaudio_add_processing_updown: i=%d bm=0x%x\n",
+                           i, UGETW(ud->waModes[i])));
+               /* XXX */
+       }
+       uaudio_mixer_add_ctl(sc, &mix);
+}
+
+void
 uaudio_add_processing(sc, v, dps)
        struct uaudio_softc *sc;
        usb_descriptor_t *v;
@@ -915,6 +958,8 @@
 
        switch(ptype) {
        case UPDOWNMIX_PROCESS:
+               uaudio_add_processing_updown(sc, v, dps);
+               break;
        case DOLBY_PROLOGIC_PROCESS:
        case P3D_STEREO_EXTENDER_PROCESS:
        case REVERBATION_PROCESS:
diff -r de5b1d1a0c00 -r 00857109fc61 sys/dev/usb/uaudioreg.h
--- a/sys/dev/usb/uaudioreg.h   Sun Jan 16 09:15:51 2000 +0000
+++ b/sys/dev/usb/uaudioreg.h   Sun Jan 16 09:32:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaudioreg.h,v 1.3 2000/01/06 21:13:56 augustss Exp $   */
+/*     $NetBSD: uaudioreg.h,v 1.4 2000/01/16 09:32:56 augustss Exp $   */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -155,14 +155,14 @@
        uByte           bDescriptorSubtype;
        uByte           bUnitId;
        uByte           bNrInPins;
-       uByte           baSourceId[255]; /* length is really bNrInPins */
+       uByte           baSourceId[255]; /* [bNrInPins] */
        /* struct usb_audio_mixer_unit_1 */
 };
 struct usb_audio_mixer_unit_1 {
        uByte           bNrChannels;
        uWord           wChannelConfig;
        uByte           iChannelNames;
-       uByte           bmControls[255];
+       uByte           bmControls[255]; /* [bNrChannels] */
        /*uByte         iMixer;*/
 };
 
@@ -173,7 +173,7 @@
        uByte           bDescriptorSubtype;
        uByte           bUnitId;
        uByte           bNrInPins;
-       uByte           baSourceId[255];
+       uByte           baSourceId[255]; /* [bNrInPins] */
        /* uByte        iSelector; */
 };
 
@@ -197,7 +197,7 @@
        uByte           bUnitId;
        uWord           wProcessType;
        uByte           bNrInPins;
-       uByte           baSourceId[255];
+       uByte           baSourceId[255]; /* [bNrInPins] */
        /* struct usb_audio_processing_unit_1 */
 };
 struct usb_audio_processing_unit_1{
@@ -205,9 +205,14 @@
        uWord           wChannelConfig;
        uByte           iChannelNames;
        uByte           bControlSize;
-       uByte           bmControls[255];
+       uByte           bmControls[255]; /* [bControlSize] */
 #define UA_PROC_ENABLE_MASK 1
-       /*uByte         iProcessing;*/
+};
+
+struct usb_audio_processing_unit_updown {
+       uByte           iProcessing;
+       uByte           bNrModes;
+       uWord           waModes[255]; /* [bNrModes] */
 };
 
 /* UDESCSUB_AC_EXTENSION */
@@ -218,7 +223,7 @@
        uByte           bUnitId;
        uWord           wExtensionCode;
        uByte           bNrInPins;
-       uByte           baSourceId[255];
+       uByte           baSourceId[255]; /* [bNrInPins] */
        /* struct usb_audio_extension_unit_1 */
 };
 struct usb_audio_extension_unit_1 {
@@ -226,7 +231,7 @@
        uWord           wChannelConfig;
        uByte           iChannelNames;
        uByte           bControlSize;
-       uByte           bmControls[255];
+       uByte           bmControls[255]; /* [bControlSize] */
 #define UA_EXT_ENABLE_MASK 1
 #define UA_EXT_ENABLE 1
        /*uByte         iExtension;*/
@@ -278,6 +283,7 @@
 #define FORMAT_TYPE_II 2
 #define FORMAT_TYPE_III 3
 
+#define UA_PROC_MASK(n) (1<< ((n)-1))
 #define PROCESS_UNDEFINED              0
 #define  XX_ENABLE_CONTROL                     1
 #define UPDOWNMIX_PROCESS              1



Home | Main Index | Thread Index | Old Index