Line 47... |
Line 47... |
{
|
{
|
unsigned long picsr;
|
unsigned long picsr;
|
unsigned long picpr;
|
unsigned long picpr;
|
unsigned long sr;
|
unsigned long sr;
|
|
|
/* CZ 020901: Someone had previously noted that this routine was
|
|
wrong, and there were 2 sets of code, one commented out, and
|
|
both were broken. I have rewritten this so it works as I think
|
|
it should. Someone needs to correct this if there is something
|
|
I am missing... */
|
|
|
|
/* From Sections 16.3 & 16.4, bits 0 & 1 are reserved */
|
/* From Sections 16.3 & 16.4, bits 0 & 1 are reserved */
|
picsr = mfspr(SPR_PICSR);
|
picsr = mfspr(SPR_PICSR);
|
picpr = mfspr(SPR_PICPR) | 0x00000003;
|
picpr = mfspr(SPR_PICPR) | 0x00000003;
|
sr = mfspr(SPR_SR);
|
sr = mfspr(SPR_SR);
|
|
|
/* Don't do anything if interrupts not currently enabled */
|
/* Don't do anything if interrupts not currently enabled */
|
if((sr & (SPR_SR_EIR | SPR_SR_EXR)) != (SPR_SR_EIR | SPR_SR_EXR))
|
if((sr & (SPR_SR_EIR | SPR_SR_EXR)) != (SPR_SR_EIR | SPR_SR_EXR))
|
return;
|
return;
|
|
|
/* From Sections 16.3 & 16.4, bits 0 & 1 are reserved */
|
|
picsr = mfspr(SPR_PICSR) & 0xFFFFFFFC;
|
|
picpr = mfspr(SPR_PICPR) & 0xFFFFFFFC;
|
|
|
|
if(picsr & picpr) /* Report High Priority Interrupts first */
|
if(picsr & picpr) /* Report High Priority Interrupts first */
|
except_handle(EXCEPT_HPINT, 0);
|
except_handle(EXCEPT_HPINT, 0);
|
else if(picsr) /* Report a Low Priority Interrupt otherwise */
|
else if(picsr) /* Report a Low Priority Interrupt otherwise */
|
except_handle(EXCEPT_LPINT, 0);
|
except_handle(EXCEPT_LPINT, 0);
|
|
|
#if 0 /* CZ -- both of these routines are broken */
|
|
/* SIMON: This is a bug */
|
|
/* if (picsr & picpr) {
|
|
if ((mfspr(SPR_SR) & (SPR_SR_EIR | SPR_SR_EXR)) == (SPR_SR_EIR | SPR_SR_EXR)
|
|
)
|
|
except_handle(EXCEPT_HPINT, 0);
|
|
} else
|
|
if ((mfspr(SPR_SR) & (SPR_SR_EIR | SPR_SR_EXR)) == (SPR_SR_EIR | SPR_SR_EXR)
|
|
)
|
|
except_handle(EXCEPT_LPINT, 0);
|
|
*/
|
|
if ((picsr & (SPR_SR_EIR | SPR_SR_EXR)) == (SPR_SR_EIR | SPR_SR_EXR)) {
|
|
if (picsr & picpr) {
|
|
except_handle(EXCEPT_HPINT, 0);
|
|
} else if(picsr) {
|
|
except_handle(EXCEPT_LPINT, 0);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
}
|
}
|
|
|
/* Asserts interrupt to the PIC. */
|
/* Asserts interrupt to the PIC. */
|
void report_interrupt(int line)
|
void report_interrupt(int line)
|
{
|
{
|