Changeset f817d3a in mainline for kernel/arch/ppc32/src/drivers/pic.c
- Timestamp:
- 2009-01-29T17:24:35Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 43d6401
- Parents:
- 26c67a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/drivers/pic.c
r26c67a8 rf817d3a 39 39 #include <bitops.h> 40 40 41 static volatile uint32_t *pic ;41 static volatile uint32_t *pic = NULL; 42 42 43 43 void pic_init(uintptr_t base, size_t size) … … 48 48 void pic_enable_interrupt(int intnum) 49 49 { 50 if (intnum < 32) { 51 pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] | (1 << intnum); 52 } else { 53 pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] | (1 << (intnum - 32)); 50 if (pic) { 51 if (intnum < 32) 52 pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] | (1 << intnum); 53 else 54 pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] | (1 << (intnum - 32)); 54 55 } 55 56 … … 58 59 void pic_disable_interrupt(int intnum) 59 60 { 60 if (intnum < 32) { 61 pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] & (~(1 << intnum)); 62 } else { 63 pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] & (~(1 << (intnum - 32))); 61 if (pic) { 62 if (intnum < 32) 63 pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] & (~(1 << intnum)); 64 else 65 pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] & (~(1 << (intnum - 32))); 64 66 } 65 67 } … … 67 69 void pic_ack_interrupt(int intnum) 68 70 { 69 if (intnum < 32) 70 pic[PIC_ACK_LOW] = 1 << intnum; 71 else 72 pic[PIC_ACK_HIGH] = 1 << (intnum - 32); 71 if (pic) { 72 if (intnum < 32) 73 pic[PIC_ACK_LOW] = 1 << intnum; 74 else 75 pic[PIC_ACK_HIGH] = 1 << (intnum - 32); 76 } 73 77 } 74 78 … … 76 80 int pic_get_pending(void) 77 81 { 78 int pending; 79 80 pending = pic[PIC_PENDING_LOW]; 81 if (pending) 82 return fnzb32(pending); 83 84 pending = pic[PIC_PENDING_HIGH]; 85 if (pending) 86 return fnzb32(pending) + 32; 82 if (pic) { 83 int pending; 84 85 pending = pic[PIC_PENDING_LOW]; 86 if (pending) 87 return fnzb32(pending); 88 89 pending = pic[PIC_PENDING_HIGH]; 90 if (pending) 91 return fnzb32(pending) + 32; 92 } 87 93 88 94 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.