NetBSD/sys/dev/ic/am7930var.h

82 lines
2.5 KiB
C
Raw Normal View History

2005-01-15 18:19:51 +03:00
/* $NetBSD: am7930var.h,v 1.10 2005/01/15 15:19:52 kent Exp $ */
struct am7930_softc;
struct am7930_glue {
2005-01-15 18:19:51 +03:00
uint8_t (*codec_iread)(struct am7930_softc *sc, int);
void (*codec_iwrite)(struct am7930_softc *sc, int, uint8_t);
uint16_t (*codec_iread16)(struct am7930_softc *sc, int);
void (*codec_iwrite16)(struct am7930_softc *sc, int, uint16_t);
void (*onopen)(struct am7930_softc *sc);
void (*onclose)(struct am7930_softc *sc);
int factor;
merge kent-audio1 branch, which introduces audio filter pipeline to the MI audio framework Summary of changes: * struct audio_params - remove sw_code, factor, factor_denom, hw_sample_rate, hw_encoding ,hw_precision, and hw_channels. Conversion information is conveyed by stream_filter_list_t. - change the type of sample_rate: u_long -> u_int - add `validbits,' which represents the valid data size in precision bits. It is required in order to distinguish 24/32bit from 24/24bit or 32/32bit. * audio_hw_if - add two parameters to set_params() stream_filter_list_t *pfil, stream_filter_list *rfil A HW driver should set filter recipes for requested formats - constify audio_params parameters of trigger_output() and trigger_input(). They represent audio formats for the hardware. - make open() and close() optional - add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters to round_blocksize() * sw_code is replaced with stream_filter_t. stream_filer_t converts audio data in an input buffer and writes into another output buffer unlike sw_code, which converts data in single buffer. converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c, dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are reimplemented as stream_filter_t * MI audio - audiosetinfo() builds filter pipelines from stream_filter_list_t filled by audio_hw_if::set_params() - audiosetinfo() returns with EINVAL if mmapped and set_params() requests filters - audio_write(), audio_pint(), and audio_rint() invoke a filter pipeline. - ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS, AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for AUDIO_GETINFO handle values for a buffer nearest to userland. * add `struct device *' parameter to ac97_attach() * all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
stream_filter_factory_t *input_conv;
stream_filter_factory_t *output_conv;
};
struct am7930_softc {
struct device sc_dev; /* base device */
2005-01-15 18:19:51 +03:00
uint8_t sc_rlevel; /* record level */
uint8_t sc_plevel; /* play level */
uint8_t sc_mlevel; /* monitor level */
uint8_t sc_out_port; /* output port */
uint8_t sc_mic_mute;
struct am7930_glue *sc_glue;
};
extern int am7930debug;
2005-01-15 18:19:51 +03:00
void am7930_init(struct am7930_softc *, int);
#define AM7930_IWRITE(x,y,z) (*(x)->sc_glue->codec_iwrite)((x),(y),(z))
#define AM7930_IREAD(x,y) (*(x)->sc_glue->codec_iread)((x),(y))
#define AM7930_IWRITE16(x,y,z) (*(x)->sc_glue->codec_iwrite16)((x),(y),(z))
#define AM7930_IREAD16(x,y) (*(x)->sc_glue->codec_iread16)((x),(y))
#define AUDIOAMD_POLL_MODE 0
#define AUDIOAMD_DMA_MODE 1
/*
* audio channel definitions.
*/
#define AUDIOAMD_SPEAKER_VOL 0 /* speaker volume */
#define AUDIOAMD_HEADPHONES_VOL 1 /* headphones volume */
2005-01-15 18:19:51 +03:00
#define AUDIOAMD_OUTPUT_CLASS 2
#define AUDIOAMD_MONITOR_VOL 3 /* monitor input volume */
#define AUDIOAMD_MONITOR_OUTPUT 4 /* output selector */
2005-01-15 18:19:51 +03:00
#define AUDIOAMD_MONITOR_CLASS 5
#define AUDIOAMD_MIC_VOL 6 /* microphone volume */
#define AUDIOAMD_MIC_MUTE 7
2005-01-15 18:19:51 +03:00
#define AUDIOAMD_INPUT_CLASS 8
#define AUDIOAMD_RECORD_SOURCE 9 /* source selector */
2005-01-15 18:19:51 +03:00
#define AUDIOAMD_RECORD_CLASS 10
/*
* audio(9) MI callbacks from upper-level audio layer.
*/
struct audio_device;
struct audio_encoding;
struct audio_params;
2005-01-15 18:19:51 +03:00
int am7930_open(void *, int);
void am7930_close(void *);
int am7930_query_encoding(void *, struct audio_encoding *);
int am7930_set_params(void *, int, int, audio_params_t *,
audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
int am7930_commit_settings(void *);
int am7930_round_blocksize(void *, int, int, const audio_params_t *);
int am7930_halt_output(void *);
int am7930_halt_input(void *);
int am7930_getdev(void *, struct audio_device *);
int am7930_get_props(void *);
int am7930_set_port(void *, mixer_ctrl_t *);
int am7930_get_port(void *, mixer_ctrl_t *);
int am7930_query_devinfo(void *, mixer_devinfo_t *);