Changes in kernel/arch/ppc32/src/drivers/pic.c [c5429fe:ebbc03c7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/drivers/pic.c
rc5429fe rebbc03c7 37 37 #include <byteorder.h> 38 38 #include <bitops.h> 39 #include <typedefs.h> 39 40 40 static volatile uint32_t *pic = NULL;41 static ioport32_t *pic = NULL; 41 42 42 43 void pic_init(uintptr_t base, size_t size, cir_t *cir, void **cir_arg) … … 50 51 void pic_enable_interrupt(inr_t intnum) 51 52 { 52 if (pic) { 53 if (intnum < 32) 54 pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] | (1 << intnum); 55 else 56 pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] | (1 << (intnum - 32)); 53 if (!pic) 54 return; 55 56 if (intnum < 32) { 57 pio_write_32(&pic[PIC_MASK_LOW], 58 pio_read_32(&pic[PIC_MASK_LOW]) | (1 << intnum)); 59 } else { 60 pio_write_32(&pic[PIC_MASK_HIGH], 61 pio_read_32(&pic[PIC_MASK_HIGH]) | (1 << (intnum - 32))); 57 62 } 58 59 63 } 60 64 61 65 void pic_disable_interrupt(inr_t intnum) 62 66 { 63 if (pic) { 64 if (intnum < 32) 65 pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] & (~(1 << intnum)); 66 else 67 pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] & (~(1 << (intnum - 32))); 67 if (!pic) 68 return; 69 70 if (intnum < 32) { 71 pio_write_32(&pic[PIC_MASK_LOW], 72 pio_read_32(&pic[PIC_MASK_LOW]) & (~(1 << intnum))); 73 } else { 74 pio_write_32(&pic[PIC_MASK_HIGH], 75 pio_read_32(&pic[PIC_MASK_HIGH]) & (~(1 << (intnum - 32)))); 68 76 } 69 77 } … … 71 79 void pic_ack_interrupt(void *arg, inr_t intnum) 72 80 { 73 if (pic) { 74 if (intnum < 32) 75 pic[PIC_ACK_LOW] = 1 << intnum; 76 else 77 pic[PIC_ACK_HIGH] = 1 << (intnum - 32); 81 if (!pic) 82 return; 83 84 if (intnum < 32) { 85 pio_write_32(&pic[PIC_ACK_LOW], 1 << intnum); 86 } else { 87 pio_write_32(&pic[PIC_ACK_HIGH], 1 << (intnum - 32)); 78 88 } 79 89 } … … 87 97 uint32_t pending; 88 98 89 pending = pi c[PIC_PENDING_LOW];99 pending = pio_read_32(&pic[PIC_PENDING_LOW]); 90 100 if (pending != 0) 91 101 return fnzb32(pending); 92 102 93 pending = pi c[PIC_PENDING_HIGH];103 pending = pio_read_32(&pic[PIC_PENDING_HIGH]); 94 104 if (pending != 0) 95 105 return fnzb32(pending) + 32;
Note:
See TracChangeset
for help on using the changeset viewer.