1 /* $NetBSD: openpic.c,v 1.6 2005/12/11 12:18:46 christos Exp $ */ 2 3 #include <sys/cdefs.h> 4 __KERNEL_RCSID(0, "$NetBSD: openpic.c,v 1.6 2005/12/11 12:18:46 christos Exp $"); 5 6 #include <sys/types.h> 7 #include <sys/param.h> 8 #include <powerpc/openpic.h> 9 10 volatile unsigned char *openpic_base; 11 12 void 13 openpic_enable_irq(int irq, int type) 14 { 15 u_int x; 16 17 x = openpic_read(OPENPIC_SRC_VECTOR(irq)); 18 x &= ~(OPENPIC_IMASK | OPENPIC_SENSE_LEVEL | OPENPIC_SENSE_EDGE); 19 if (type == IST_LEVEL) 20 x |= OPENPIC_SENSE_LEVEL; 21 else 22 x |= OPENPIC_SENSE_EDGE; 23 openpic_write(OPENPIC_SRC_VECTOR(irq), x); 24 } 25 26 void 27 openpic_disable_irq(int irq) 28 { 29 u_int x; 30 31 x = openpic_read(OPENPIC_SRC_VECTOR(irq)); 32 x |= OPENPIC_IMASK; 33 openpic_write(OPENPIC_SRC_VECTOR(irq), x); 34 } 35 36 void 37 openpic_set_priority(int cpu, int pri) 38 { 39 u_int x; 40 41 x = openpic_read(OPENPIC_CPU_PRIORITY(cpu)); 42 x &= ~OPENPIC_CPU_PRIORITY_MASK; 43 x |= pri; 44 openpic_write(OPENPIC_CPU_PRIORITY(cpu), x); 45 } 46