1 /* $NetBSD: openpic.c,v 1.3 2001/02/05 19:22:24 briggs Exp $ */ 2 3 #include <sys/types.h> 4 #include <sys/param.h> 5 #include <powerpc/openpic.h> 6 7 volatile unsigned char *openpic_base; 8 9 void 10 openpic_enable_irq(irq, type) 11 int irq, type; 12 { 13 u_int x; 14 15 x = openpic_read(OPENPIC_SRC_VECTOR(irq)); 16 x &= ~(OPENPIC_IMASK | OPENPIC_SENSE_LEVEL | OPENPIC_SENSE_EDGE); 17 if (type == IST_LEVEL) 18 x |= OPENPIC_SENSE_LEVEL; 19 else 20 x |= OPENPIC_SENSE_EDGE; 21 openpic_write(OPENPIC_SRC_VECTOR(irq), x); 22 } 23 24 void 25 openpic_disable_irq(irq) 26 int irq; 27 { 28 u_int x; 29 30 x = openpic_read(OPENPIC_SRC_VECTOR(irq)); 31 x |= OPENPIC_IMASK; 32 openpic_write(OPENPIC_SRC_VECTOR(irq), x); 33 } 34 35 void 36 openpic_set_priority(cpu, pri) 37 int cpu, 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