1 #include <sys/bus.h> 2 3 #include <net/ethernet.h> 4 #include <net/if.h> 5 #include <net/if_media.h> 6 7 #include <machine/bus.h> 8 9 #include <dev/pcn/if_pcnreg.h> 10 11 12 int check_disable_interrupts_pcn(device_t dev); 13 void reenable_interrupts_pcn(device_t dev); 14 15 16 int 17 check_disable_interrupts_pcn(device_t dev) 18 { 19 struct pcn_softc *sc = device_get_softc(dev); 20 HAIKU_INTR_REGISTER_STATE; 21 uint32_t status; 22 23 HAIKU_INTR_REGISTER_ENTER(); 24 25 /* get current flags */ 26 CSR_WRITE_4(sc, PCN_IO32_RAP, PCN_CSR_CSR); 27 status = CSR_READ_4(sc, PCN_IO32_RDP); 28 29 /* is there a pending interrupt? */ 30 if ((status & PCN_CSR_INTR) == 0) { 31 HAIKU_INTR_REGISTER_LEAVE(); 32 return 0; 33 } 34 35 /* disable interrupts */ 36 CSR_WRITE_4(sc, PCN_IO32_RDP, 0); 37 38 HAIKU_INTR_REGISTER_LEAVE(); 39 40 return 1; 41 } 42 43 44 void 45 reenable_interrupts_pcn(device_t dev) 46 { 47 struct pcn_softc *sc = device_get_softc(dev); 48 CSR_WRITE_4(sc, PCN_IO32_RAP, PCN_CSR_CSR); 49 CSR_WRITE_4(sc, PCN_IO32_RDP, PCN_CSR_INTEN); 50 } 51