xref: /netbsd/sys/dev/ic/am7930var.h (revision bf9ec67e)
1 /*	$NetBSD: am7930var.h,v 1.7 2000/05/02 06:30:51 augustss Exp $	*/
2 
3 struct am7930_softc;
4 
5 struct am7930_glue {
6 	u_int8_t	(*codec_iread) __P((struct am7930_softc *sc, int));
7 	void	(*codec_iwrite) __P((struct am7930_softc *sc, int, u_int8_t));
8 	u_int16_t	(*codec_iread16) __P((struct am7930_softc *sc, int));
9 	void	(*codec_iwrite16) __P((struct am7930_softc *sc, int, u_int16_t));
10 	void	(*onopen) __P((struct am7930_softc *sc));
11 	void	(*onclose) __P((struct am7930_softc *sc));
12 	int	factor;
13 	void	(*input_conv) __P((void *, u_int8_t *, int));
14 	void	(*output_conv) __P((void *, u_int8_t *, int));
15 };
16 
17 struct am7930_softc {
18 	struct	device sc_dev;		/* base device */
19 
20 	int	sc_open;		/* single use device */
21 	int	sc_locked;		/* true when transfering data */
22 
23 	u_int8_t	sc_rlevel;	/* record level */
24 	u_int8_t	sc_plevel;	/* play level */
25 	u_int8_t	sc_mlevel;	/* monitor level */
26 	u_int8_t	sc_out_port;	/* output port */
27 	u_int8_t	sc_mic_mute;
28 
29 	struct am7930_glue *sc_glue;
30 };
31 
32 extern int     am7930debug;
33 
34 void	am7930_init __P((struct am7930_softc *, int));
35 
36 #define AM7930_IWRITE(x,y,z)	(*(x)->sc_glue->codec_iwrite)((x),(y),(z))
37 #define AM7930_IREAD(x,y)	(*(x)->sc_glue->codec_iread)((x),(y))
38 #define AM7930_IWRITE16(x,y,z)	(*(x)->sc_glue->codec_iwrite16)((x),(y),(z))
39 #define AM7930_IREAD16(x,y)	(*(x)->sc_glue->codec_iread16)((x),(y))
40 
41 #define AUDIOAMD_POLL_MODE	0
42 #define AUDIOAMD_DMA_MODE	1
43 
44 /*
45  * audio channel definitions.
46  */
47 
48 #define AUDIOAMD_SPEAKER_VOL	0	/* speaker volume */
49 #define AUDIOAMD_HEADPHONES_VOL	1	/* headphones volume */
50 #define AUDIOAMD_OUTPUT_CLASS	2
51 
52 #define AUDIOAMD_MONITOR_VOL	3	/* monitor input volume */
53 #define AUDIOAMD_MONITOR_OUTPUT	4	/* output selector */
54 #define AUDIOAMD_MONITOR_CLASS	5
55 
56 #define AUDIOAMD_MIC_VOL	6	/* microphone volume */
57 #define AUDIOAMD_MIC_MUTE	7
58 #define AUDIOAMD_INPUT_CLASS	8
59 
60 #define AUDIOAMD_RECORD_SOURCE	9	/* source selector */
61 #define AUDIOAMD_RECORD_CLASS	10
62 
63 /*
64  * audio(9) MI callbacks from upper-level audio layer.
65  */
66 
67 struct audio_device;
68 struct audio_encoding;
69 struct audio_params;
70 
71 int	am7930_open __P((void *, int));
72 void	am7930_close __P((void *));
73 int	am7930_query_encoding __P((void *, struct audio_encoding *));
74 int	am7930_set_params __P((void *, int, int, struct audio_params *,
75 			    struct audio_params *));
76 int	am7930_commit_settings __P((void *));
77 int	am7930_round_blocksize __P((void *, int));
78 int	am7930_halt_output __P((void *));
79 int	am7930_halt_input __P((void *));
80 int	am7930_getdev __P((void *, struct audio_device *));
81 int	am7930_get_props __P((void *));
82 int	am7930_set_port __P((void *, mixer_ctrl_t *));
83 int	am7930_get_port __P((void *, mixer_ctrl_t *));
84 int	am7930_query_devinfo __P((void *, mixer_devinfo_t *));
85