MFNetBSD:

One of a set of patches submitted by  Kazuhito HONDA
	to make the usb audio driver a lot more capable.

PR:	75274
Submitted by:	Kazuhito HONDA (kazuhito at ph dot noda dot tus dot ac dot jp)
Obtained from:	NetBSD (indirectly)
MFC after:	2 weeks
This commit is contained in:
Julian Elischer 2004-12-25 06:20:49 +00:00
parent 98331badc2
commit d28a81455e
4 changed files with 1770 additions and 732 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
/* Defined in uaudio.c, used in uaudio_pcm,c */
void uaudio_chan_set_param_pcm_dma_buff(device_t dev, u_char *start,
u_char *end, struct pcm_channel *pc);
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
@ -38,12 +38,11 @@ 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);
void uaudio_chan_set_param_speed(device_t dev, u_int32_t speed);
void uaudio_chan_set_param_format(device_t dev, u_int32_t format);
int uaudio_chan_getptr(device_t dev);
void uaudio_chan_set_param_blocksize(device_t dev, u_int32_t blocksize, int dir);
void uaudio_chan_set_param_speed(device_t dev, u_int32_t speed, int dir);
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_query_mix_info(device_t dev);
void uaudio_query_formats(device_t dev, u_int32_t *pfmt, u_int32_t *rfmt);

View File

@ -89,7 +89,7 @@ ua_chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *
buf = end = sndbuf_getbuf(b);
end += sndbuf_getsize(b);
uaudio_chan_set_param_pcm_dma_buff(pa_dev, buf, end, ch->channel);
uaudio_chan_set_param_pcm_dma_buff(pa_dev, buf, end, ch->channel, dir);
ch->dir = dir;
#ifndef NO_RECORDING
@ -113,7 +113,7 @@ ua_chan_setformat(kobj_t obj, void *data, u_int32_t format)
ua = ch->parent;
pa_dev = device_get_parent(ua->sc_dev);
uaudio_chan_set_param_format(pa_dev, format);
uaudio_chan_set_param_format(pa_dev, format, ch->dir);
ch->fmt = format;
return 0;
@ -130,7 +130,7 @@ ua_chan_setspeed(kobj_t obj, void *data, u_int32_t speed)
ua = ch->parent;
pa_dev = device_get_parent(ua->sc_dev);
uaudio_chan_set_param_speed(pa_dev, speed);
uaudio_chan_set_param_speed(pa_dev, speed, ch->dir);
return ch->spd;
}
@ -151,7 +151,7 @@ ua_chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
/* XXXXX */
ua = ch->parent;
pa_dev = device_get_parent(ua->sc_dev);
uaudio_chan_set_param_blocksize(pa_dev, blocksize);
uaudio_chan_set_param_blocksize(pa_dev, blocksize, ch->dir);
return ch->blksz;
}
@ -198,7 +198,7 @@ ua_chan_getptr(kobj_t obj, void *data)
ua = ch->parent;
pa_dev = device_get_parent(ua->sc_dev);
return uaudio_chan_getptr(pa_dev);
return uaudio_chan_getptr(pa_dev, ch->dir);
}
static struct pcmchan_caps *

View File

@ -1,4 +1,4 @@
/* $NetBSD: uaudioreg.h,v 1.7 2000/12/28 00:29:58 augustss Exp $ */
/* $NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $ */
/* $FreeBSD$ */
/*
@ -40,7 +40,6 @@
#define UAUDIO_VERSION 0x100
#define UDESC_CS_DEVICE 0x21
#define UDESC_CS_CONFIG 0x22
#define UDESC_CS_STRING 0x23
#define UDESC_CS_INTERFACE 0x24
@ -98,6 +97,9 @@ struct usb_audio_streaming_endpoint_descriptor {
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;
@ -121,9 +123,29 @@ struct usb_audio_streaming_type1_descriptor {
struct usb_audio_cluster {
uByte bNrChannels;
uWord wChannelConfig;
#define UA_CHANNEL_LEFT 0x0001
#define UA_CHANNEL_RIGHT 0x0002
#define UA_CHANNEL_CENTER 0x0004
#define UA_CHANNEL_LFE 0x0008
#define UA_CHANNEL_L_SURROUND 0x0010
#define UA_CHANNEL_R_SURROUND 0x0020
#define UA_CHANNEL_L_CENTER 0x0040
#define UA_CHANNEL_R_CENTER 0x0080
#define UA_CHANNEL_SURROUND 0x0100
#define UA_CHANNEL_L_SIDE 0x0200
#define UA_CHANNEL_R_SIDE 0x0400
#define UA_CHANNEL_TOP 0x0800
uByte iChannelNames;
} UPACKED;
/* Shared by all units and terminals */
struct usb_audio_unit {
uByte bLength;
uByte bDescriptorType;
uByte bDescriptorSubtype;
uByte bUnitId;
};
/* UDESCSUB_AC_INPUT */
struct usb_audio_input_terminal {
uByte bLength;
@ -340,8 +362,11 @@ struct usb_audio_extension_unit_1 {
#define UA_FMT_IEEE_FLOAT 3
#define UA_FMT_ALAW 4
#define UA_FMT_MULAW 5
#define UA_FMT_MPEG 0x1001
#define UA_FMT_AC3 0x1002
#define SAMPLING_FREQ_CONTROL 0x01
#define SAMPLING_FREQ_CONTROL 0x01
#define PITCH_CONTROL 0x02
#define FORMAT_TYPE_UNDEFINED 0
#define FORMAT_TYPE_I 1
@ -377,4 +402,3 @@ struct usb_audio_extension_unit_1 {
#define DR_THRESHOLD_CONTROL 4
#define DR_ATTACK_TIME_CONTROL 5
#define DR_RELEASE_TIME_CONTROL 6