xref: /haiku/src/add-ons/kernel/drivers/network/wlan/iprowifi2200/glue.c (revision 4a55cc230cf7566cadcbb23b1928eefff8aea9a2)
1 /*
2  * Copyright 2009, Colin Günther, coling@gmx.de.
3  * All Rights Reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <sys/bus.h>
8 #include <sys/kernel.h>
9 
10 #include <machine/bus.h>
11 
12 #include <net/if.h>
13 #include <net/if_media.h>
14 
15 #include <net80211/ieee80211_var.h>
16 
17 #include <dev/iwi/if_iwireg.h>
18 #include <dev/iwi/if_iwivar.h>
19 
20 
21 HAIKU_FBSD_WLAN_DRIVER_GLUE(iprowifi2200, iwi, pci)
22 NO_HAIKU_FBSD_MII_DRIVER();
23 HAIKU_DRIVER_REQUIREMENTS(FBSD_WLAN);
24 HAIKU_FIRMWARE_VERSION(300);
25 HAIKU_FIRMWARE_NAME_MAP({
26 	{"iwi_bss", "ipw2200-bss.fw"},
27 	{"iwi_ibss", "ipw2200-ibss.fw"},
28 	{"iwi_monitor", "ipw2200-sniffer.fw"}
29 });
30 
31 
32 int
33 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
34 {
35 	struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
36 	uint32 r;
37 
38 	r = CSR_READ_4(sc, IWI_CSR_INTR);
39 	if (r  == 0 || r == 0xffffffff)
40 		return 0;
41 
42 	atomic_set((int32*)&sc->sc_intr_status, r);
43 
44 	CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, 0);
45 		// disable interrupts
46 	return 1;
47 }
48 
49 
50 void
51 HAIKU_REENABLE_INTERRUPTS(device_t dev)
52 {
53 	struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
54 
55 	CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, IWI_INTR_MASK);
56 		// reenable interrupts
57 }
58