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