struct gus_voice {
unsigned char voccntl;
unsigned char volcntl;
unsigned char pan_pos;
int rate;
u_long start_addr;
u_long end_addr;
u_long current_addr;
int start_volume;
int current_volume;
int end_volume;
};
struct gus_softc {
struct device sc_dev;
struct device *sc_isa;
void *sc_ih;
struct timeout sc_dma_tmo;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh1;
bus_space_handle_t sc_ioh2;
bus_space_handle_t sc_ioh3;
bus_space_handle_t sc_ioh4;
int sc_iobase;
int sc_irq;
int sc_drq;
int sc_recdrq;
int sc_flags;
#define GUS_MIXER_INSTALLED 0x01
#define GUS_LOCKED 0x02
#define GUS_CODEC_INSTALLED 0x04
#define GUS_PLAYING 0x08
#define GUS_DMAOUT_ACTIVE 0x10
#define GUS_DMAIN_ACTIVE 0x20
#define GUS_OPEN 0x100
int sc_dsize;
int sc_voices;
u_char sc_revision;
u_char sc_mixcontrol;
u_long sc_orate;
u_long sc_irate;
int sc_encoding;
int sc_precision;
int sc_channels;
int sc_blocksize;
int sc_chanblocksize;
short sc_nbufs;
short sc_bufcnt;
void *sc_deintr_buf;
int sc_ogain;
u_char sc_out_port;
u_char sc_in_port;
void (*sc_dmaoutintr)(void *);
void *sc_outarg;
u_char *sc_dmaoutaddr;
u_long sc_gusaddr;
int sc_dmaoutcnt;
void (*sc_dmainintr)(void *);
void *sc_inarg;
u_char *sc_dmainaddr;
int sc_dmaincnt;
struct stereo_dma_intr {
void (*intr)(void *);
void *arg;
u_char *buffer;
u_long dmabuf;
int size;
int flags;
} sc_stereo;
int sc_dmabuf;
int sc_playbuf;
struct gus_voice sc_voc[32];
union {
struct ics2101_softc sc_mixer_u;
struct ad1848_softc sc_codec_u;
} u;
#define sc_mixer u.sc_mixer_u
#define sc_codec u.sc_codec_u
};
struct ics2101_volume {
u_char left;
u_char right;
};
#define HAS_CODEC(sc) ((sc)->sc_flags & GUS_CODEC_INSTALLED)
#define HAS_MIXER(sc) ((sc)->sc_flags & GUS_MIXER_INSTALLED)
#define GUSICS_MIC_IN_MUTE 0
#define GUSICS_LINE_IN_MUTE 1
#define GUSICS_MASTER_MUTE 2
#define GUSICS_CD_MUTE 3
#define GUSICS_DAC_MUTE 4
#define GUSICS_MIC_IN_LVL 5
#define GUSICS_LINE_IN_LVL 6
#define GUSICS_CD_LVL 7
#define GUSICS_DAC_LVL 8
#define GUSICS_MASTER_LVL 9
#define GUSICS_RECORD_SOURCE 10
#define GUSICS_INPUT_CLASS 11
#define GUSICS_OUTPUT_CLASS 12
#define GUSICS_RECORD_CLASS 13
#define GUSMAX_MONO_LVL 0
#define GUSMAX_DAC_LVL 1
#define GUSMAX_LINE_IN_LVL 2
#define GUSMAX_CD_LVL 3
#define GUSMAX_MONITOR_LVL 4
#define GUSMAX_OUT_LVL 5
#define GUSMAX_SPEAKER_LVL 6
#define GUSMAX_LINE_IN_MUTE 7
#define GUSMAX_DAC_MUTE 8
#define GUSMAX_CD_MUTE 9
#define GUSMAX_MONO_MUTE 10
#define GUSMAX_MONITOR_MUTE 11
#define GUSMAX_SPEAKER_MUTE 12
#define GUSMAX_REC_LVL 13
#define GUSMAX_RECORD_SOURCE 14
#define GUSMAX_INPUT_CLASS 15
#define GUSMAX_RECORD_CLASS 16
#define GUSMAX_MONITOR_CLASS 17
#define GUSMAX_OUTPUT_CLASS 18
#ifdef AUDIO_DEBUG
#define GUSPLAYDEBUG
#define DPRINTF(x) if (gusdebug) printf x
#define DMAPRINTF(x) if (gusdmadebug) printf x
extern int gusdebug;
extern int gusdmadebug;
#else
#define DPRINTF(x)
#define DMAPRINTF(x)
#endif
extern int gus_dostereo;
#define NDMARECS 2048
#ifdef GUSPLAYDEBUG
extern int gusstats;
struct dma_record {
struct timeval tv;
u_long gusaddr;
caddr_t bsdaddr;
u_short count;
u_char channel;
u_char direction;
};
extern struct dma_record dmarecords[NDMARECS];
extern int dmarecord_index;
#endif
int gusopen(void *, int);
void gusclose(void *);
void gusmax_close(void *);
int gusintr(void *);
int gus_set_in_gain(caddr_t, u_int, u_char);
int gus_get_in_gain(caddr_t);
int gus_get_out_gain(caddr_t);
int gus_set_params(void *, int, int, struct audio_params *, struct audio_params *);
int gusmax_set_params(void *, int, int, struct audio_params *, struct audio_params *);
int gus_round_blocksize(void *, int);
int gus_commit_settings(void *);
int gus_dma_output(void *, void *, int, void (*)(void *), void *);
int gus_dma_input(void *, void *, int, void (*)(void *), void *);
int gus_halt_out_dma(void *);
int gus_halt_in_dma(void *);
int gus_speaker_ctl(void *, int);
int gusmaxopen(void *, int);
int gusmax_round_blocksize(void *, int);
int gusmax_commit_settings(void *);
int gusmax_dma_output(void *, void *, int, void (*)(void *), void *);
int gusmax_dma_input(void *, void *, int, void (*)(void *), void *);
int gusmax_halt_out_dma(void *);
int gusmax_halt_in_dma(void *);
void gus_deinterleave(struct gus_softc *, void *, int);
int gus_mic_ctl(void *, int);
int gus_linein_ctl(void *, int);
int gus_test_iobase(bus_space_tag_t, int);
void guspoke(bus_space_tag_t, bus_space_handle_t, long, u_char);
void gusdmaout(struct gus_softc *, int, u_long, caddr_t, int);
int gus_init_cs4231(struct gus_softc *);
void gus_init_ics2101(struct gus_softc *);
void gus_set_chan_addrs(struct gus_softc *);
void gusreset(struct gus_softc *, int);
void gus_set_voices(struct gus_softc *, int);
void gus_set_volume(struct gus_softc *, int, int);
void gus_set_samprate(struct gus_softc *, int, int);
void gus_set_recrate(struct gus_softc *, u_long);
void gus_start_voice(struct gus_softc *, int, int);
void gus_stop_voice(struct gus_softc *, int, int);
void gus_set_endaddr(struct gus_softc *, int, u_long);
#ifdef GUSPLAYDEBUG
void gus_set_curaddr(struct gus_softc *, int, u_long);
u_long gus_get_curaddr(struct gus_softc *, int);
#endif
int gus_dmaout_intr(struct gus_softc *);
void gus_dmaout_dointr(struct gus_softc *);
void gus_dmaout_timeout(void *);
int gus_dmain_intr(struct gus_softc *);
int gus_voice_intr(struct gus_softc *);
void gus_start_playing(struct gus_softc *, int);
int gus_continue_playing(struct gus_softc *, int);
u_char guspeek(bus_space_tag_t, bus_space_handle_t, u_long);
u_long convert_to_16bit(u_long);
int gus_mixer_set_port(void *, mixer_ctrl_t *);
int gus_mixer_get_port(void *, mixer_ctrl_t *);
int gusmax_mixer_set_port(void *, mixer_ctrl_t *);
int gusmax_mixer_get_port(void *, mixer_ctrl_t *);
int gus_mixer_query_devinfo(void *, mixer_devinfo_t *);
int gusmax_mixer_query_devinfo(void *, mixer_devinfo_t *);
void *gus_malloc(void *, int, size_t, int, int);
void gus_free(void *, void *, int);
size_t gus_round(void *, int, size_t);
void gusics_master_mute(struct ics2101_softc *, int);
void gusics_dac_mute(struct ics2101_softc *, int);
void gusics_mic_mute(struct ics2101_softc *, int);
void gusics_linein_mute(struct ics2101_softc *, int);
void gusics_cd_mute(struct ics2101_softc *, int);
void stereo_dmaintr(void *);
extern const int gus_irq_map[];
extern const int gus_drq_map[];
extern const int gus_base_addrs[];
extern const int gus_addrs;
#define SELECT_GUS_REG(iot,ioh1,x) bus_space_write_1(iot,ioh1,GUS_REG_SELECT,x)
#define ADDR_HIGH(x) (unsigned int) ((x >> 7L) & 0x1fffL)
#define ADDR_LOW(x) (unsigned int) ((x & 0x7fL) << 9L)
#define GUS_MIN_VOICES 14
#define GUS_MAX_VOICES 32
#define GUS_VOICE_LEFT 0
#define GUS_VOICE_RIGHT 1
#define GUS_MEM_OFFSET 32
#define GUS_BUFFER_MULTIPLE 1024
#define GUS_MEM_FOR_BUFFERS 131072
#define GUS_LEFT_RIGHT_OFFSET (sc->sc_nbufs * sc->sc_chanblocksize + GUS_MEM_OFFSET)
#define GUS_PREC_BYTES (sc->sc_precision >> 3)
#define splgus splaudio
extern const struct audio_hw_if gus_hw_if;
#define FLIP_REV 5
void gus_subattach(struct gus_softc *, struct isa_attach_args *);