xref: /haiku/src/add-ons/kernel/drivers/network/wlan/iprowifi2200/glue.c (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
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_TASKQUEUES | FBSD_WLAN);
24 HAIKU_FIRMWARE_VERSION(300);
25 HAIKU_FIRMWARE_NAME_MAP(3) = {{"iwi_bss", "ipw2200-bss.fw"},
26 	{"iwi_ibss", "ipw2200-ibss.fw"}, {"iwi_monitor", "ipw2200-sniffer.fw"}};
27 
28 
29 int
30 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
31 {
32 	struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
33 	uint32 r;
34 
35 	r = CSR_READ_4(sc, IWI_CSR_INTR);
36 	if (r  == 0 || r == 0xffffffff)
37 		return 0;
38 
39 	atomic_set((int32*)&sc->sc_intr_status, r);
40 
41 	CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, 0);
42 		// disable interrupts
43 	return 1;
44 }
45 
46 
47 void
48 HAIKU_REENABLE_INTERRUPTS(device_t dev)
49 {
50 	struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
51 
52 	CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, IWI_INTR_MASK);
53 		// reenable interrupts
54 }
55