1/* $NetBSD: openpic.c,v 1.3.26.3 2004/09/21 13:20:49 skrll Exp $ */ 2 3#include <sys/cdefs.h> 4__KERNEL_RCSID(0, "$NetBSD: openpic.c,v 1.3.26.3 2004/09/21 13:20:49 skrll Exp $"); 5 6#include <sys/types.h> 7#include <sys/param.h> 8#include <powerpc/openpic.h> 9 10volatile unsigned char *openpic_base; 11 12void 13openpic_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 26void 27openpic_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 36void 37openpic_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