BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / drivers / network / wlan / atheroswifi / glue.c
blob0b1eaf75e775ecdb756e6900cc6d99481fa6b230
1 /*
2 * Copyright 2009, Colin Günther, coling@gmx.de.
3 * All Rights Reserved. Distributed under the terms of the MIT License.
4 */
7 #include <sys/bus.h>
8 #include <sys/kernel.h>
10 #include <net/if.h>
11 #include <net/if_media.h>
13 #include <net80211/ieee80211_var.h>
15 #include <dev/ath/if_athvar.h>
18 HAIKU_FBSD_WLAN_DRIVER_GLUE(atheroswifi, ath_pci, pci)
19 NO_HAIKU_FBSD_MII_DRIVER();
20 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
23 int
24 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
26 struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev);
27 struct ath_hal* ah = sc->sc_ah;
28 HAL_INT intr_status;
30 if (sc->sc_invalid) {
31 // The hardware is not ready/present, don't touch anything.
32 // Note this can happen early on if the IRQ is shared.
33 return 0;
36 if (!ath_hal_intrpend(ah)) {
37 // shared irq, not for us
38 return 0;
41 // We have to save the isr status right now.
42 // Some devices don't like having the interrupt disabled
43 // before accessing the isr status.
45 // Those devices return status 0, when status access
46 // occurs after disabling the interrupts with ath_hal_intrset.
48 // Note: Haiku's pcnet driver uses the same technique of
49 // appending a sc_lastisr field.
50 ath_hal_getisr(ah, &intr_status);
51 atomic_set((int32*)&sc->sc_intr_status, intr_status);
53 ath_hal_intrset(ah, 0);
54 // disable further intr's
56 return 1;
60 void
61 HAIKU_REENABLE_INTERRUPTS(device_t dev)
63 struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev);
64 struct ath_hal* ah = sc->sc_ah;
66 ath_hal_intrset(ah, sc->sc_imask);