Home | History | Annotate | Line # | Download | only in ic
      1 /*	$NetBSD: am7930var.h,v 1.15 2020/09/12 05:19:16 isaki Exp $	*/
      2 
      3 struct am7930_softc;
      4 
      5 struct am7930_glue {
      6 	uint8_t	(*codec_dread)(struct am7930_softc *sc, int);
      7 	void	(*codec_dwrite)(struct am7930_softc *sc, int, uint8_t);
      8 };
      9 
     10 struct am7930_buf {
     11 	uint8_t *start;
     12 	uint8_t *end;
     13 	uint8_t *data;
     14 	uint8_t *blkend;
     15 	uint blksize;
     16 
     17 	void (*intr)(void *);
     18 	void *arg;
     19 	uint intr_pending;
     20 };
     21 
     22 struct am7930_softc {
     23 	device_t sc_dev;	/* base device */
     24 
     25 	uint8_t	sc_rlevel;	/* record level */
     26 	uint8_t	sc_plevel;	/* play level */
     27 	uint8_t	sc_mlevel;	/* monitor level */
     28 	uint8_t	sc_out_port;	/* output port */
     29 	uint8_t	sc_mic_mute;
     30 
     31 	struct am7930_glue *sc_glue;
     32 	struct am7930_buf sc_p;	/* for play */
     33 	struct am7930_buf sc_r;	/* for rec */
     34 
     35 	kmutex_t sc_lock;
     36 	kmutex_t sc_intr_lock;
     37 	void *sc_sicookie;		/* softint(9) cookie */
     38 	struct evcnt sc_intrcnt;	/* statistics */
     39 };
     40 
     41 extern int     am7930debug;
     42 
     43 void	am7930_init(struct am7930_softc *, int);
     44 int	am7930_hwintr(void *);
     45 void	am7930_swintr(void *);
     46 
     47 /* direct access functions */
     48 #define AM7930_DWRITE(x,y,z)	(*(x)->sc_glue->codec_dwrite)((x),(y),(z))
     49 #define AM7930_DREAD(x,y)	(*(x)->sc_glue->codec_dread)((x),(y))
     50 
     51 
     52 #define AUDIOAMD_POLL_MODE	0
     53 #define AUDIOAMD_DMA_MODE	1
     54 
     55 /*
     56  * audio channel definitions.
     57  */
     58 
     59 #define AUDIOAMD_SPEAKER_VOL	0	/* speaker volume */
     60 #define AUDIOAMD_HEADPHONES_VOL	1	/* headphones volume */
     61 #define AUDIOAMD_OUTPUT_CLASS	2
     62 
     63 #define AUDIOAMD_MONITOR_VOL	3	/* monitor input volume */
     64 #define AUDIOAMD_MONITOR_OUTPUT	4	/* output selector */
     65 #define AUDIOAMD_MONITOR_CLASS	5
     66 
     67 #define AUDIOAMD_MIC_VOL	6	/* microphone volume */
     68 #define AUDIOAMD_MIC_MUTE	7
     69 #define AUDIOAMD_INPUT_CLASS	8
     70 
     71 #define AUDIOAMD_RECORD_SOURCE	9	/* source selector */
     72 #define AUDIOAMD_RECORD_CLASS	10
     73 
     74 /*
     75  * audio(9) MI callbacks from upper-level audio layer.
     76  */
     77 
     78 int	am7930_query_format(void *, audio_format_query_t *);
     79 int	am7930_set_format(void *, int,
     80 	    const audio_params_t *, const audio_params_t *,
     81 	    audio_filter_reg_t *, audio_filter_reg_t *);
     82 int	am7930_commit_settings(void *);
     83 int	am7930_trigger_output(void *, void *, void *, int, void (*)(void *),
     84 	    void *, const audio_params_t *);
     85 int	am7930_trigger_input(void *, void *, void *, int, void (*)(void *),
     86 	    void *, const audio_params_t *);
     87 int	am7930_halt_output(void *);
     88 int	am7930_halt_input(void *);
     89 int	am7930_getdev(void *, struct audio_device *);
     90 int	am7930_get_props(void *);
     91 int	am7930_set_port(void *, mixer_ctrl_t *);
     92 int	am7930_get_port(void *, mixer_ctrl_t *);
     93 int	am7930_query_devinfo(void *, mixer_devinfo_t *);
     94 void	am7930_get_locks(void *, kmutex_t **, kmutex_t **);
     95