1/* $NetBSD: eapvar.h,v 1.4 2011/11/23 23:07:35 jmcneill Exp $ */
2
3#include <dev/pci/pcivar.h>
4
5#include <dev/ic/ac97var.h>
6
7struct eap_gameport_args {
8 bus_space_tag_t gpa_iot;
9 bus_space_handle_t gpa_ioh;
10};
11
12struct eap_dma {
13 bus_dmamap_t map;
14 void *addr;
15 bus_dma_segment_t segs[1];
16 int nsegs;
17 size_t size;
18 struct eap_dma *next;
19};
20
21#define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr)
22#define KERNADDR(p) ((void *)((p)->addr))
23
24/*
25 * The card has two DACs. Using them is a bit twisted: we use DAC2
26 * as default and DAC1 as the optional secondary DAC.
27 */
28#define EAP_DAC1 1
29#define EAP_DAC2 0
30#define EAP_I1 EAP_DAC2
31#define EAP_I2 EAP_DAC1
32struct eap_instance {
33 device_t parent;
34 int index;
35
36 void (*ei_pintr)(void *); /* DMA completion intr handler */
37 void *ei_parg; /* arg for ei_intr() */
38 device_t ei_audiodev; /* audio device, for detach */
39#ifdef DIAGNOSTIC
40 char ei_prun;
41#endif
42};
43
44struct eap_softc {
45 device_t sc_dev; /* base device */
46 void *sc_ih; /* interrupt vectoring */
47 bus_space_tag_t iot;
48 bus_space_handle_t ioh;
49 bus_size_t iosz;
50 bus_dma_tag_t sc_dmatag; /* DMA tag */
51 kmutex_t sc_intr_lock;
52 kmutex_t sc_lock;
53
54 struct eap_dma *sc_dmas;
55
56 void (*sc_rintr)(void *); /* DMA completion intr handler */
57 void *sc_rarg; /* arg for sc_intr() */
58#ifdef DIAGNOSTIC
59 char sc_rrun;
60#endif
61
62#if NMIDI > 0
63 void (*sc_iintr)(void *, int); /* midi input ready handler */
64 void (*sc_ointr)(void *); /* midi output ready handler */
65 void *sc_arg;
66 device_t sc_mididev;
67#endif
68#if NJOY_EAP > 0
69 device_t sc_gameport;
70#endif
71
72 u_short sc_port[AK_NPORTS]; /* mirror of the hardware setting */
73 u_int sc_record_source; /* recording source mask */
74 u_int sc_input_source; /* input source mask */
75 u_int sc_mic_preamp;
76 char sc_1371; /* Using ES1371/AC97 codec */
77
78 struct ac97_codec_if *codec_if;
79 struct ac97_host_if host_if;
80
81 struct eap_instance sc_ei[2];
82
83 pci_chipset_tag_t sc_pc; /* For detach */
84};
85
86
87device_t eap_joy_attach(device_t, struct eap_gameport_args *);
88int eap_joy_detach(device_t, struct eap_gameport_args *);
89