Date: Sun, 15 Mar 2009 18:02:26 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 159254 for review Message-ID: <200903151802.n2FI2QOE050411@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=159254 Change 159254 by zec@zec_amdx2 on 2009/03/15 18:02:08 Fix misintegrations Affected files ... .. //depot/projects/vimage-commit/src/sys/dev/ata/ata-usb.c#4 edit .. //depot/projects/vimage-commit/src/sys/dev/sound/usb/uaudio.h#4 edit .. //depot/projects/vimage-commit/src/sys/dev/sound/usb/uaudio_pcm.c#4 edit .. //depot/projects/vimage-commit/src/sys/dev/sound/usb/uaudioreg.h#4 edit .. //depot/projects/vimage-commit/src/sys/dev/usb/usb_if.m#4 edit .. //depot/projects/vimage-commit/src/sys/dev/usb/usbhid.h#4 edit .. //depot/projects/vimage-commit/src/sys/modules/usb/Makefile#5 edit Differences ... ==== //depot/projects/vimage-commit/src/sys/dev/ata/ata-usb.c#4 (text) ==== ==== //depot/projects/vimage-commit/src/sys/dev/sound/usb/uaudio.h#4 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/sound/usb/uaudio.h,v 1.8 2007/03/16 17:19:03 ariff Exp $ */ +/* $FreeBSD: src/sys/dev/sound/usb/uaudio.h,v 1.10 2009/02/23 21:19:18 thompsa Exp $ */ /*- * Copyright (c) 2000-2002 Hiroyuki Aizu <aizu@navi.org> @@ -25,32 +25,39 @@ * SUCH DAMAGE. */ -#if 0 -#define NO_RECORDING /* XXX: some routines missing from uaudio.c */ -#endif +/* prototypes from "uaudio.c" used by "uaudio_pcm.c" */ + +struct uaudio_chan; +struct uaudio_softc; +struct snd_dbuf; +struct snd_mixer; +struct pcm_channel; -/* Defined in uaudio.c, used in uaudio_pcm,c */ +extern int uaudio_attach_sub(device_t dev, kobj_class_t mixer_class, + kobj_class_t chan_class); +extern int uaudio_detach_sub(device_t dev); +extern void *uaudio_chan_init(struct uaudio_softc *sc, struct snd_dbuf *b, + struct pcm_channel *c, int dir); +extern int uaudio_chan_free(struct uaudio_chan *ch); +extern int uaudio_chan_set_param_blocksize(struct uaudio_chan *ch, + uint32_t blocksize); +extern int uaudio_chan_set_param_fragments(struct uaudio_chan *ch, + uint32_t blocksize, uint32_t blockcount); +extern int uaudio_chan_set_param_speed(struct uaudio_chan *ch, + uint32_t speed); +extern int uaudio_chan_getptr(struct uaudio_chan *ch); +extern struct pcmchan_caps *uaudio_chan_getcaps(struct uaudio_chan *ch); +extern int uaudio_chan_set_param_format(struct uaudio_chan *ch, + uint32_t format); +extern int uaudio_chan_start(struct uaudio_chan *ch); +extern int uaudio_chan_stop(struct uaudio_chan *ch); +extern int uaudio_mixer_init_sub(struct uaudio_softc *sc, + struct snd_mixer *m); +extern int uaudio_mixer_uninit_sub(struct uaudio_softc *sc); +extern void uaudio_mixer_set(struct uaudio_softc *sc, unsigned type, + unsigned left, unsigned right); +extern uint32_t uaudio_mixer_setrecsrc(struct uaudio_softc *sc, uint32_t src); -void uaudio_chan_set_param_pcm_dma_buff(device_t dev, u_char *start, - u_char *end, struct pcm_channel *pc, int dir); -int uaudio_trigger_output(device_t dev); -int uaudio_halt_out_dma(device_t dev); -#ifndef NO_RECORDING -int uaudio_trigger_input(device_t dev); -int uaudio_halt_in_dma(device_t dev); -#endif -void uaudio_chan_set_param(device_t, u_char *, u_char *); -void uaudio_chan_set_param_blocksize(device_t dev, u_int32_t blocksize, int dir); -int uaudio_chan_set_param_speed(device_t dev, u_int32_t speed, int reqdir); -void uaudio_chan_set_param_format(device_t dev, u_int32_t format,int dir); -int uaudio_chan_getptr(device_t dev, int); -void uaudio_mixer_set(device_t dev, unsigned type, unsigned left, - unsigned right); -u_int32_t uaudio_mixer_setrecsrc(device_t dev, u_int32_t src); -u_int32_t uaudio_query_mix_info(device_t dev); -u_int32_t uaudio_query_recsrc_info(device_t dev); -unsigned uaudio_query_formats(device_t dev, int dir, unsigned maxfmt, struct pcmchan_caps *fmt); -void uaudio_sndstat_register(device_t dev); -int uaudio_get_vendor(device_t dev); -int uaudio_get_product(device_t dev); -int uaudio_get_release(device_t dev); +int uaudio_get_vendor(device_t dev); +int uaudio_get_product(device_t dev); +int uaudio_get_release(device_t dev); ==== //depot/projects/vimage-commit/src/sys/dev/sound/usb/uaudio_pcm.c#4 (text+ko) ==== @@ -1,7 +1,8 @@ -/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.24 2007/06/17 06:10:43 ariff Exp $ */ +/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.26 2009/02/23 21:19:18 thompsa Exp $ */ /*- * Copyright (c) 2000-2002 Hiroyuki Aizu <aizu@navi.org> + * Copyright (c) 2006 Hans Petter Selasky * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,241 +30,87 @@ #include <sys/soundcard.h> #include <dev/sound/pcm/sound.h> #include <dev/sound/chip.h> - #include <dev/sound/usb/uaudio.h> #include "mixer_if.h" -struct ua_info; - -struct ua_chinfo { - struct ua_info *parent; - struct pcm_channel *channel; - struct snd_dbuf *buffer; - u_char *buf; - int dir, hwch; - u_int32_t fmt, spd, blksz; /* XXXXX */ -}; - -struct ua_info { - device_t sc_dev; - u_int32_t bufsz; - struct ua_chinfo pch, rch; -#define FORMAT_NUM 32 - u_int32_t ua_playfmt[FORMAT_NUM*2+1]; /* FORMAT_NUM format * (stereo or mono) + endptr */ - u_int32_t ua_recfmt[FORMAT_NUM*2+1]; /* FORMAT_NUM format * (stereo or mono) + endptr */ - struct pcmchan_caps ua_playcaps; - struct pcmchan_caps ua_reccaps; - int vendor, product, release; -}; - -#define UAUDIO_DEFAULT_BUFSZ 16*1024 - -static const struct { - int vendor; - int product; - int release; - uint32_t dflags; -} ua_quirks[] = { - { 0x1130, 0xf211, 0x0101, SD_F_PSWAPLR }, -}; - /************************************************************/ static void * ua_chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir) { - device_t pa_dev; - - struct ua_info *sc = devinfo; - struct ua_chinfo *ch = (dir == PCMDIR_PLAY)? &sc->pch : &sc->rch; - - ch->parent = sc; - ch->channel = c; - ch->buffer = b; - ch->dir = dir; - - pa_dev = device_get_parent(sc->sc_dev); - - ch->buf = malloc(sc->bufsz, M_DEVBUF, M_NOWAIT); - if (ch->buf == NULL) - return NULL; - if (sndbuf_setup(b, ch->buf, sc->bufsz) != 0) { - free(ch->buf, M_DEVBUF); - return NULL; - } - uaudio_chan_set_param_pcm_dma_buff(pa_dev, ch->buf, ch->buf+sc->bufsz, ch->channel, dir); - if (bootverbose) - device_printf(pa_dev, "%s buf %p\n", (dir == PCMDIR_PLAY)? - "play" : "rec", sndbuf_getbuf(ch->buffer)); - - ch->dir = dir; -#ifndef NO_RECORDING - ch->hwch = 1; - if (dir == PCMDIR_PLAY) - ch->hwch = 2; -#else - ch->hwch = 2; -#endif - - return ch; + return (uaudio_chan_init(devinfo, b, c, dir)); } static int ua_chan_free(kobj_t obj, void *data) { - struct ua_chinfo *ua = data; - - if (ua->buf != NULL) - free(ua->buf, M_DEVBUF); - return 0; + return (uaudio_chan_free(data)); } static int -ua_chan_setformat(kobj_t obj, void *data, u_int32_t format) +ua_chan_setformat(kobj_t obj, void *data, uint32_t format) { - device_t pa_dev; - struct ua_info *ua; - - struct ua_chinfo *ch = data; - /* - * At this point, no need to query as we shouldn't select an unsorted format + * At this point, no need to query as we + * shouldn't select an unsorted format */ - ua = ch->parent; - pa_dev = device_get_parent(ua->sc_dev); - uaudio_chan_set_param_format(pa_dev, format, ch->dir); - - ch->fmt = format; - return 0; + return (uaudio_chan_set_param_format(data, format)); } static int -ua_chan_setspeed(kobj_t obj, void *data, u_int32_t speed) +ua_chan_setspeed(kobj_t obj, void *data, uint32_t speed) { - struct ua_chinfo *ch; - device_t pa_dev; - int bestspeed; - - ch = data; - pa_dev = device_get_parent(ch->parent->sc_dev); - - if ((bestspeed = uaudio_chan_set_param_speed(pa_dev, speed, ch->dir))) - ch->spd = bestspeed; - - return ch->spd; + return (uaudio_chan_set_param_speed(data, speed)); } static int -ua_chan_setfragments(kobj_t obj, void *data, u_int32_t blksz, u_int32_t blkcnt) +ua_chan_setblocksize(kobj_t obj, void *data, uint32_t blocksize) { - device_t pa_dev; - struct ua_chinfo *ch = data; - struct ua_info *ua = ch->parent; - - RANGE(blksz, 128, sndbuf_getmaxsize(ch->buffer) / 2); - RANGE(blkcnt, 2, 512); - - while ((blksz * blkcnt) > sndbuf_getmaxsize(ch->buffer)) { - if ((blkcnt >> 1) >= 2) - blkcnt >>= 1; - else if ((blksz >> 1) >= 128) - blksz >>= 1; - else - break; - } - - if ((sndbuf_getblksz(ch->buffer) != blksz || - sndbuf_getblkcnt(ch->buffer) != blkcnt) && - sndbuf_resize(ch->buffer, blkcnt, blksz) != 0) - device_printf(ua->sc_dev, "%s: failed blksz=%u blkcnt=%u\n", - __func__, blksz, blkcnt); - - ch->blksz = sndbuf_getblksz(ch->buffer); - - pa_dev = device_get_parent(ua->sc_dev); - uaudio_chan_set_param_pcm_dma_buff(pa_dev, ch->buf, - ch->buf + sndbuf_getsize(ch->buffer), ch->channel, ch->dir); - uaudio_chan_set_param_blocksize(pa_dev, ch->blksz, ch->dir); - - return 1; + return (uaudio_chan_set_param_blocksize(data, blocksize)); } static int -ua_chan_setblocksize(kobj_t obj, void *data, u_int32_t blksz) +ua_chan_setfragments(kobj_t obj, void *data, uint32_t blocksize, uint32_t blockcount) { - struct ua_chinfo *ch = data; - - ua_chan_setfragments(obj, data, blksz, - sndbuf_getmaxsize(ch->buffer) / blksz); - - return ch->blksz; + return (uaudio_chan_set_param_fragments(data, blocksize, blockcount)); } static int ua_chan_trigger(kobj_t obj, void *data, int go) { - device_t pa_dev; - struct ua_info *ua; - struct ua_chinfo *ch = data; - - if (!PCMTRIG_COMMON(go)) - return 0; - - ua = ch->parent; - pa_dev = device_get_parent(ua->sc_dev); - - /* XXXXX */ - if (ch->dir == PCMDIR_PLAY) { - if (go == PCMTRIG_START) { - uaudio_trigger_output(pa_dev); - } else { - uaudio_halt_out_dma(pa_dev); - } + if (!PCMTRIG_COMMON(go)) { + return (0); + } + if (go == PCMTRIG_START) { + return (uaudio_chan_start(data)); } else { -#ifndef NO_RECORDING - if (go == PCMTRIG_START) - uaudio_trigger_input(pa_dev); - else - uaudio_halt_in_dma(pa_dev); -#endif + return (uaudio_chan_stop(data)); } - - return 0; } static int ua_chan_getptr(kobj_t obj, void *data) { - device_t pa_dev; - struct ua_info *ua; - struct ua_chinfo *ch = data; - - ua = ch->parent; - pa_dev = device_get_parent(ua->sc_dev); - - return uaudio_chan_getptr(pa_dev, ch->dir); + return (uaudio_chan_getptr(data)); } static struct pcmchan_caps * ua_chan_getcaps(kobj_t obj, void *data) { - struct ua_chinfo *ch; - - ch = data; - return (ch->dir == PCMDIR_PLAY) ? &(ch->parent->ua_playcaps) : &(ch->parent->ua_reccaps); + return (uaudio_chan_getcaps(data)); } static kobj_method_t ua_chan_methods[] = { - KOBJMETHOD(channel_init, ua_chan_init), - KOBJMETHOD(channel_free, ua_chan_free), - KOBJMETHOD(channel_setformat, ua_chan_setformat), - KOBJMETHOD(channel_setspeed, ua_chan_setspeed), - KOBJMETHOD(channel_setblocksize, ua_chan_setblocksize), - KOBJMETHOD(channel_setfragments, ua_chan_setfragments), - KOBJMETHOD(channel_trigger, ua_chan_trigger), - KOBJMETHOD(channel_getptr, ua_chan_getptr), - KOBJMETHOD(channel_getcaps, ua_chan_getcaps), - { 0, 0 } + KOBJMETHOD(channel_init, ua_chan_init), + KOBJMETHOD(channel_free, ua_chan_free), + KOBJMETHOD(channel_setformat, ua_chan_setformat), + KOBJMETHOD(channel_setspeed, ua_chan_setspeed), + KOBJMETHOD(channel_setblocksize, ua_chan_setblocksize), + KOBJMETHOD(channel_setfragments, ua_chan_setfragments), + KOBJMETHOD(channel_trigger, ua_chan_trigger), + KOBJMETHOD(channel_getptr, ua_chan_getptr), + KOBJMETHOD(channel_getcaps, ua_chan_getcaps), + {0, 0} }; CHANNEL_DECLARE(ua_chan); @@ -272,62 +119,63 @@ static int ua_mixer_init(struct snd_mixer *m) { - u_int32_t mask; - device_t pa_dev; - struct ua_info *ua = mix_getdevinfo(m); + return (uaudio_mixer_init_sub(mix_getdevinfo(m), m)); +} - pa_dev = device_get_parent(ua->sc_dev); +static int +ua_mixer_set(struct snd_mixer *m, unsigned type, unsigned left, unsigned right) +{ + struct mtx *mtx = mixer_get_lock(m); + uint8_t do_unlock; - mask = uaudio_query_mix_info(pa_dev); - if (!(mask & SOUND_MASK_PCM)) { - /* - * Emulate missing pcm mixer controller - * through FEEDER_VOLUME - */ - pcm_setflags(ua->sc_dev, pcm_getflags(ua->sc_dev) | - SD_F_SOFTPCMVOL); + if (mtx_owned(mtx)) { + do_unlock = 0; + } else { + do_unlock = 1; + mtx_lock(mtx); } - if (!(mask & SOUND_MASK_VOLUME)) { - mix_setparentchild(m, SOUND_MIXER_VOLUME, SOUND_MASK_PCM); - mix_setrealdev(m, SOUND_MIXER_VOLUME, SOUND_MIXER_NONE); + uaudio_mixer_set(mix_getdevinfo(m), type, left, right); + if (do_unlock) { + mtx_unlock(mtx); } - mix_setdevs(m, mask); - - mask = uaudio_query_recsrc_info(pa_dev); - mix_setrecdevs(m, mask); - - return 0; + return (left | (right << 8)); } static int -ua_mixer_set(struct snd_mixer *m, unsigned type, unsigned left, unsigned right) +ua_mixer_setrecsrc(struct snd_mixer *m, uint32_t src) { - device_t pa_dev; - struct ua_info *ua = mix_getdevinfo(m); + struct mtx *mtx = mixer_get_lock(m); + int retval; + uint8_t do_unlock; - pa_dev = device_get_parent(ua->sc_dev); - uaudio_mixer_set(pa_dev, type, left, right); - - return left | (right << 8); + if (mtx_owned(mtx)) { + do_unlock = 0; + } else { + do_unlock = 1; + mtx_lock(mtx); + } + retval = uaudio_mixer_setrecsrc(mix_getdevinfo(m), src); + if (do_unlock) { + mtx_unlock(mtx); + } + return (retval); } static int -ua_mixer_setrecsrc(struct snd_mixer *m, u_int32_t src) +ua_mixer_uninit(struct snd_mixer *m) { - device_t pa_dev; - struct ua_info *ua = mix_getdevinfo(m); - - pa_dev = device_get_parent(ua->sc_dev); - return uaudio_mixer_setrecsrc(pa_dev, src); + return (uaudio_mixer_uninit_sub(mix_getdevinfo(m))); } static kobj_method_t ua_mixer_methods[] = { - KOBJMETHOD(mixer_init, ua_mixer_init), - KOBJMETHOD(mixer_set, ua_mixer_set), - KOBJMETHOD(mixer_setrecsrc, ua_mixer_setrecsrc), + KOBJMETHOD(mixer_init, ua_mixer_init), + KOBJMETHOD(mixer_uninit, ua_mixer_uninit), + KOBJMETHOD(mixer_set, ua_mixer_set), + KOBJMETHOD(mixer_setrecsrc, ua_mixer_setrecsrc), - { 0, 0 } + {0, 0} }; + MIXER_DECLARE(ua_mixer); /************************************************************/ @@ -335,137 +183,42 @@ static int ua_probe(device_t dev) { - char *s; struct sndcard_func *func; - /* The parent device has already been probed. */ + /* the parent device has already been probed */ func = device_get_ivars(dev); - if (func == NULL || func->func != SCF_PCM) + + if ((func == NULL) || + (func->func != SCF_PCM)) { return (ENXIO); + } + device_set_desc(dev, "USB audio"); - s = "USB Audio"; - - device_set_desc(dev, s); - return BUS_PROBE_DEFAULT; + return (BUS_PROBE_DEFAULT); } static int ua_attach(device_t dev) { - struct ua_info *ua; - struct sndcard_func *func; - char status[SND_STATUSLEN]; - device_t pa_dev; - u_int32_t nplay, nrec, flags; - int i; - - ua = malloc(sizeof(*ua), M_DEVBUF, M_WAITOK | M_ZERO); - ua->sc_dev = dev; - - /* Mark for existence */ - func = device_get_ivars(dev); - if (func != NULL) - func->varinfo = (void *)ua; - - pa_dev = device_get_parent(dev); - ua->vendor = uaudio_get_vendor(pa_dev); - ua->product = uaudio_get_product(pa_dev); - ua->release = uaudio_get_release(pa_dev); - - if (bootverbose) - device_printf(dev, - "USB Audio: " - "vendor=0x%04x, product=0x%04x, release=0x%04x\n", - ua->vendor, ua->product, ua->release); - - ua->bufsz = pcm_getbuffersize(dev, 4096, UAUDIO_DEFAULT_BUFSZ, 65536); - if (bootverbose) - device_printf(dev, "using a default buffer size of %jd\n", (intmax_t)ua->bufsz); - - if (mixer_init(dev, &ua_mixer_class, ua)) { - goto bad; - } - - snprintf(status, SND_STATUSLEN, "at ? %s", PCM_KLDSTRING(snd_uaudio)); - - ua->ua_playcaps.fmtlist = ua->ua_playfmt; - ua->ua_reccaps.fmtlist = ua->ua_recfmt; - nplay = uaudio_query_formats(pa_dev, PCMDIR_PLAY, FORMAT_NUM * 2, &ua->ua_playcaps); - nrec = uaudio_query_formats(pa_dev, PCMDIR_REC, FORMAT_NUM * 2, &ua->ua_reccaps); - - if (nplay > 1) - nplay = 1; - if (nrec > 1) - nrec = 1; - - flags = pcm_getflags(dev); - for (i = 0; i < (sizeof(ua_quirks) / sizeof(ua_quirks[0])); i++) { - if (ua->vendor == ua_quirks[i].vendor && - ua->product == ua_quirks[i].product && - ua->release == ua_quirks[i].release) - flags |= ua_quirks[i].dflags; - } - pcm_setflags(dev, flags); - -#ifndef NO_RECORDING - if (pcm_register(dev, ua, nplay, nrec)) { -#else - if (pcm_register(dev, ua, nplay, 0)) { -#endif - goto bad; - } - - sndstat_unregister(dev); - uaudio_sndstat_register(dev); - - for (i = 0; i < nplay; i++) { - pcm_addchan(dev, PCMDIR_PLAY, &ua_chan_class, ua); - } -#ifndef NO_RECORDING - for (i = 0; i < nrec; i++) { - pcm_addchan(dev, PCMDIR_REC, &ua_chan_class, ua); - } -#endif - pcm_setstatus(dev, status); - - return 0; - -bad: free(ua, M_DEVBUF); - return ENXIO; + return (uaudio_attach_sub(dev, &ua_mixer_class, &ua_chan_class)); } static int ua_detach(device_t dev) { - struct ua_info *sc; - struct sndcard_func *func; - int r; - - r = pcm_unregister(dev); - if (r) - return r; - - sc = pcm_getdevinfo(dev); - free(sc, M_DEVBUF); - - /* Mark for deletion */ - func = device_get_ivars(dev); - if (func != NULL) - func->varinfo = NULL; - - return 0; + return (uaudio_detach_sub(dev)); } /************************************************************/ static device_method_t ua_pcm_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, ua_probe), - DEVMETHOD(device_attach, ua_attach), - DEVMETHOD(device_detach, ua_detach), + DEVMETHOD(device_probe, ua_probe), + DEVMETHOD(device_attach, ua_attach), + DEVMETHOD(device_detach, ua_detach), - { 0, 0 } + {0, 0} }; static driver_t ua_pcm_driver = { @@ -474,7 +227,6 @@ PCM_SOFTC_SIZE, }; - DRIVER_MODULE(ua_pcm, uaudio, ua_pcm_driver, pcm_devclass, 0, 0); MODULE_DEPEND(ua_pcm, uaudio, 1, 1, 1); MODULE_DEPEND(ua_pcm, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); ==== //depot/projects/vimage-commit/src/sys/dev/sound/usb/uaudioreg.h#4 (text+ko) ==== @@ -1,5 +1,5 @@ /* $NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $ */ -/* $FreeBSD: src/sys/dev/sound/usb/uaudioreg.h,v 1.4 2005/01/06 01:43:22 imp Exp $ */ +/* $FreeBSD: src/sys/dev/sound/usb/uaudioreg.h,v 1.6 2009/02/23 21:19:18 thompsa Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -38,30 +38,30 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define UAUDIO_VERSION 0x100 +#define UAUDIO_VERSION 0x100 -#define UDESC_CS_CONFIG 0x22 -#define UDESC_CS_STRING 0x23 -#define UDESC_CS_INTERFACE 0x24 -#define UDESC_CS_ENDPOINT 0x25 +#define UDESC_CS_CONFIG 0x22 +#define UDESC_CS_STRING 0x23 +#define UDESC_CS_INTERFACE 0x24 +#define UDESC_CS_ENDPOINT 0x25 -#define UDESCSUB_AC_HEADER 1 -#define UDESCSUB_AC_INPUT 2 -#define UDESCSUB_AC_OUTPUT 3 -#define UDESCSUB_AC_MIXER 4 -#define UDESCSUB_AC_SELECTOR 5 -#define UDESCSUB_AC_FEATURE 6 -#define UDESCSUB_AC_PROCESSING 7 -#define UDESCSUB_AC_EXTENSION 8 +#define UDESCSUB_AC_HEADER 1 +#define UDESCSUB_AC_INPUT 2 +#define UDESCSUB_AC_OUTPUT 3 +#define UDESCSUB_AC_MIXER 4 +#define UDESCSUB_AC_SELECTOR 5 +#define UDESCSUB_AC_FEATURE 6 +#define UDESCSUB_AC_PROCESSING 7 +#define UDESCSUB_AC_EXTENSION 8 -/* The first fields are identical to usb_endpoint_descriptor_t */ +/* The first fields are identical to struct usb2_endpoint_descriptor */ typedef struct { - uByte bLength; - uByte bDescriptorType; - uByte bEndpointAddress; - uByte bmAttributes; - uWord wMaxPacketSize; - uByte bInterval; + uByte bLength; + uByte bDescriptorType; + uByte bEndpointAddress; + uByte bmAttributes; + uWord wMaxPacketSize; + uByte bInterval; /* * The following two entries are only used by the Audio Class. * And according to the specs the Audio Class is the only one @@ -69,60 +69,62 @@ * Who knows what goes on in the minds of the people in the USB * standardization? :-( */ - uByte bRefresh; - uByte bSynchAddress; -} UPACKED usb_endpoint_descriptor_audio_t; + uByte bRefresh; + uByte bSynchAddress; +} __packed usb2_endpoint_descriptor_audio_t; -struct usb_audio_control_descriptor { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uWord bcdADC; - uWord wTotalLength; - uByte bInCollection; - uByte baInterfaceNr[1]; -} UPACKED; +struct usb2_audio_control_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uWord bcdADC; + uWord wTotalLength; + uByte bInCollection; + uByte baInterfaceNr[1]; +} __packed; -struct usb_audio_streaming_interface_descriptor { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bTerminalLink; - uByte bDelay; - uWord wFormatTag; -} UPACKED; +struct usb2_audio_streaming_interface_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bTerminalLink; + uByte bDelay; + uWord wFormatTag; +} __packed; -struct usb_audio_streaming_endpoint_descriptor { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bmAttributes; -#define UA_SED_FREQ_CONTROL 0x01 -#define UA_SED_PITCH_CONTROL 0x02 -#define UA_SED_MAXPACKETSONLY 0x80 - uByte bLockDelayUnits; - uWord wLockDelay; -} UPACKED; +struct usb2_audio_streaming_endpoint_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bmAttributes; +#define UA_SED_FREQ_CONTROL 0x01 +#define UA_SED_PITCH_CONTROL 0x02 +#define UA_SED_MAXPACKETSONLY 0x80 + uByte bLockDelayUnits; + uWord wLockDelay; +} __packed; -struct usb_audio_streaming_type1_descriptor { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bFormatType; - uByte bNrChannels; - uByte bSubFrameSize; - uByte bBitResolution; - uByte bSamFreqType; -#define UA_SAMP_CONTNUOUS 0 - uByte tSamFreq[3*2]; /* room for low and high */ -#define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16)) -#define UA_SAMP_LO(p) UA_GETSAMP(p, 0) -#define UA_SAMP_HI(p) UA_GETSAMP(p, 1) -} UPACKED; +struct usb2_audio_streaming_type1_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bFormatType; + uByte bNrChannels; + uByte bSubFrameSize; + uByte bBitResolution; + uByte bSamFreqType; +#define UA_SAMP_CONTNUOUS 0 + uByte tSamFreq[0]; +#define UA_GETSAMP(p, n) (((p)->tSamFreq[((n)*3)+0]) | \ + ((p)->tSamFreq[((n)*3)+1] << 8) | \ + ((p)->tSamFreq[((n)*3)+2] << 16)) +#define UA_SAMP_LO(p) UA_GETSAMP(p, 0) +#define UA_SAMP_HI(p) UA_GETSAMP(p, 1) +} __packed; -struct usb_audio_cluster { - uByte bNrChannels; - uWord wChannelConfig; +struct usb2_audio_cluster { + uByte bNrChannels; + uWord wChannelConfig; #define UA_CHANNEL_LEFT 0x0001 #define UA_CHANNEL_RIGHT 0x0002 #define UA_CHANNEL_CENTER 0x0004 @@ -135,270 +137,270 @@ #define UA_CHANNEL_L_SIDE 0x0200 #define UA_CHANNEL_R_SIDE 0x0400 #define UA_CHANNEL_TOP 0x0800 - uByte iChannelNames; -} UPACKED; + uByte iChannelNames; +} __packed; /* Shared by all units and terminals */ -struct usb_audio_unit { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bUnitId; +struct usb2_audio_unit { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bUnitId; }; /* UDESCSUB_AC_INPUT */ -struct usb_audio_input_terminal { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bTerminalId; - uWord wTerminalType; - uByte bAssocTerminal; - uByte bNrChannels; - uWord wChannelConfig; - uByte iChannelNames; - uByte iTerminal; -} UPACKED; +struct usb2_audio_input_terminal { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bTerminalId; + uWord wTerminalType; + uByte bAssocTerminal; + uByte bNrChannels; + uWord wChannelConfig; + uByte iChannelNames; +/* uByte iTerminal; */ +} __packed; /* UDESCSUB_AC_OUTPUT */ -struct usb_audio_output_terminal { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bTerminalId; - uWord wTerminalType; - uByte bAssocTerminal; - uByte bSourceId; - uByte iTerminal; -} UPACKED; +struct usb2_audio_output_terminal { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bTerminalId; + uWord wTerminalType; + uByte bAssocTerminal; + uByte bSourceId; + uByte iTerminal; +} __packed; /* UDESCSUB_AC_MIXER */ -struct usb_audio_mixer_unit { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bUnitId; - uByte bNrInPins; - uByte baSourceId[255]; /* [bNrInPins] */ - /* struct usb_audio_mixer_unit_1 */ -} UPACKED; -struct usb_audio_mixer_unit_1 { - uByte bNrChannels; - uWord wChannelConfig; - uByte iChannelNames; - uByte bmControls[255]; /* [bNrChannels] */ - /*uByte iMixer;*/ -} UPACKED; +struct usb2_audio_mixer_unit_0 { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bUnitId; + uByte bNrInPins; + uByte baSourceId[0]; /* [bNrInPins] */ + /* struct usb2_audio_mixer_unit_1 */ +} __packed; +struct usb2_audio_mixer_unit_1 { + uByte bNrChannels; + uWord wChannelConfig; + uByte iChannelNames; + uByte bmControls[0]; /* [see source code] */ + /* uByte iMixer; */ +} __packed; /* UDESCSUB_AC_SELECTOR */ -struct usb_audio_selector_unit { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bUnitId; - uByte bNrInPins; - uByte baSourceId[255]; /* [bNrInPins] */ +struct usb2_audio_selector_unit { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bUnitId; + uByte bNrInPins; + uByte baSourceId[0]; /* [bNrInPins] */ /* uByte iSelector; */ -} UPACKED; +} __packed; /* UDESCSUB_AC_FEATURE */ -struct usb_audio_feature_unit { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bUnitId; - uByte bSourceId; - uByte bControlSize; - uByte bmaControls[255]; /* size for more than enough */ +struct usb2_audio_feature_unit { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bUnitId; + uByte bSourceId; + uByte bControlSize; + uByte bmaControls[0]; /* [bControlSize * x] */ /* uByte iFeature; */ -} UPACKED; +} __packed; /* UDESCSUB_AC_PROCESSING */ -struct usb_audio_processing_unit { - uByte bLength; - uByte bDescriptorType; - uByte bDescriptorSubtype; - uByte bUnitId; - uWord wProcessType; - uByte bNrInPins; - uByte baSourceId[255]; /* [bNrInPins] */ - /* struct usb_audio_processing_unit_1 */ -} UPACKED; -struct usb_audio_processing_unit_1{ - uByte bNrChannels; - uWord wChannelConfig; - uByte iChannelNames; - uByte bControlSize; - uByte bmControls[255]; /* [bControlSize] */ -#define UA_PROC_ENABLE_MASK 1 -} UPACKED; +struct usb2_audio_processing_unit_0 { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bUnitId; + uWord wProcessType; + uByte bNrInPins; + uByte baSourceId[0]; /* [bNrInPins] */ + /* struct usb2_audio_processing_unit_1 */ +} __packed; +struct usb2_audio_processing_unit_1 { + uByte bNrChannels; + uWord wChannelConfig; + uByte iChannelNames; + uByte bControlSize; + uByte bmControls[0]; /* [bControlSize] */ +#define UA_PROC_ENABLE_MASK 1 +} __packed; -struct usb_audio_processing_unit_updown { - uByte iProcessing; - uByte bNrModes; - uWord waModes[255]; /* [bNrModes] */ -} UPACKED; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903151802.n2FI2QOE050411>