#ifndef _NEC86HWVAR_H_
#define _NEC86HWVAR_H_
struct nec86hw_softc;
typedef int (*func_fifo_output_t) (struct nec86hw_softc *, int);
typedef void (*func_fifo_input_t) (struct nec86hw_softc *, int);
struct nec86hw_softc {
struct device sc_dev;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
u_int sc_cfgflags;
#define NEC86HW_RATE_TYPE(flags) ((flags) & 1)
#define NEC86HW_NRATE_TYPE 2
u_short sc_open;
u_long sc_irate;
u_long sc_orate;
u_long hw_irate;
u_char hw_irate_bits;
u_long hw_orate;
u_char hw_orate_bits;
u_int encoding;
u_int precision;
int channels;
int in_port;
#define NEC86HW_INPUT_MIXER 0
int out_port;
#define NEC86HW_OUTPUT_MIXER 0
int model;
u_long conv_acc;
u_short conv_last0;
u_short conv_last0_l;
u_short conv_last0_r;
u_short conv_last1;
u_short conv_last1_l;
u_short conv_last1_r;
void (*sc_intr)(void *);
void *sc_arg;
char intr_busy;
u_char *pdma_ptr;
int pdma_count;
int pdma_nchunk;
int pdma_watermark;
char pdma_padded;
char pdma_mode;
#define PDMA_MODE_NONE 0
#define PDMA_MODE_OUTPUT 1
#define PDMA_MODE_INPUT 2
func_fifo_output_t func_fifo_output;
func_fifo_input_t func_fifo_input;
};
struct nec86hw_functable_entry {
int precision;
int channels;
func_fifo_output_t func_fifo_output_direct;
func_fifo_input_t func_fifo_input_direct;
func_fifo_output_t func_fifo_output_resamp;
func_fifo_input_t func_fifo_input_resamp;
};
#define WATERMARK_MAX_RATIO 100
#define WATERMARK_RATIO_OUT 50
#define WATERMARK_RATIO_IN 50
#ifdef _KERNEL
void nec86hw_attach(struct nec86hw_softc *);
int nec86hw_open(void *, int);
void nec86hw_close(void *);
int nec86hw_set_params(void *, int, int, struct audio_params *,
struct audio_params *);
int nec86hw_round_blocksize(void *, int);
int nec86hw_set_out_port(void *, int);
int nec86hw_get_out_port(void *);
int nec86hw_set_in_port(void *, int);
int nec86hw_get_in_port(void *);
int nec86hw_commit_settings(void *);
int nec86hw_mixer_set_port(void *, mixer_ctrl_t *);
int nec86hw_mixer_get_port(void *, mixer_ctrl_t *);
int nec86hw_mixer_query_devinfo(void *, mixer_devinfo_t *);
int nec86hw_pdma_init_output(void *, void *, int);
int nec86hw_pdma_init_input(void *, void *, int);
int nec86hw_pdma_output(void *, void *, int, void (*)(void *), void *);
int nec86hw_pdma_input(void *, void *, int, void (*)(void *), void *);
int nec86hw_speaker_ctl(void *, int);
int nec86hw_halt_pdma(void *);
int nec86hw_cont_pdma(void *);
u_char nec86hw_rate_bits(struct nec86hw_softc *, u_long);
int nec86hw_round_watermark(int);
int nec86hw_reset(struct nec86hw_softc *);
void nec86hw_set_mode_playing(struct nec86hw_softc *);
void nec86hw_set_mode_recording(struct nec86hw_softc *);
void nec86hw_set_volume(struct nec86hw_softc *, int, u_char);
void nec86hw_start_fifo(struct nec86hw_softc *);
void nec86hw_stop_fifo(struct nec86hw_softc *);
void nec86hw_enable_fifointr(struct nec86hw_softc *);
void nec86hw_disable_fifointr(struct nec86hw_softc *);
int nec86hw_seeif_intrflg(struct nec86hw_softc *);
void nec86hw_clear_intrflg(struct nec86hw_softc *);
void nec86hw_reset_fifo(struct nec86hw_softc *);
void nec86hw_set_watermark(struct nec86hw_softc *, int);
void nec86hw_set_precision_real(struct nec86hw_softc *, u_int);
void nec86hw_set_rate_real(struct nec86hw_softc *, u_char);
void nec86hw_output_chunk(struct nec86hw_softc *);
void nec86hw_input_chunk(struct nec86hw_softc *);
int nec86fifo_output_mono_8_direct(struct nec86hw_softc *, int);
int nec86fifo_output_mono_16_direct(struct nec86hw_softc *, int);
int nec86fifo_output_stereo_8_direct(struct nec86hw_softc *, int);
int nec86fifo_output_stereo_16_direct(struct nec86hw_softc *, int);
int nec86fifo_output_mono_8_resamp(struct nec86hw_softc *, int);
int nec86fifo_output_mono_16_resamp(struct nec86hw_softc *, int);
int nec86fifo_output_stereo_8_resamp(struct nec86hw_softc *, int);
int nec86fifo_output_stereo_16_resamp(struct nec86hw_softc *, int);
void nec86fifo_input_mono_8_direct(struct nec86hw_softc *, int);
void nec86fifo_input_mono_16_direct(struct nec86hw_softc *, int);
void nec86fifo_input_stereo_8_direct(struct nec86hw_softc *, int);
void nec86fifo_input_stereo_16_direct(struct nec86hw_softc *, int);
void nec86fifo_input_mono_8_resamp(struct nec86hw_softc *, int);
void nec86fifo_input_mono_16_resamp(struct nec86hw_softc *, int);
void nec86fifo_input_stereo_8_resamp(struct nec86hw_softc *, int);
void nec86fifo_input_stereo_16_resamp(struct nec86hw_softc *, int);
void nec86fifo_padding(struct nec86hw_softc *, int);
int nec86hw_intr(void *);
#endif
#endif