Line 53... |
Line 53... |
/* Exception vectors */
|
/* Exception vectors */
|
#define V_RESET 1
|
#define V_RESET 1
|
#define V_BERR 2
|
#define V_BERR 2
|
#define V_DPF 3
|
#define V_DPF 3
|
#define V_IPF 4
|
#define V_IPF 4
|
#define V_LPINT 5
|
#define V_TICK 5
|
#define V_ALIGN 6
|
#define V_ALIGN 6
|
#define V_ILLINSN 7
|
#define V_ILLINSN 7
|
#define V_HPINT 8
|
#define V_INT 8
|
#define V_DTLB_MISS 9
|
#define V_DTLB_MISS 9
|
#define V_ITLB_MISS 10
|
#define V_ITLB_MISS 10
|
#define V_RANGE 11
|
#define V_RANGE 11
|
#define V_SYS 12
|
#define V_SYS 12
|
#define V_TRAP 14
|
#define V_TRAP 14
|
Line 154... |
Line 154... |
except_mask |= 1 << V_ILLINSN;
|
except_mask |= 1 << V_ILLINSN;
|
except_count++;
|
except_count++;
|
}
|
}
|
|
|
/* Low priority interrupt handler */
|
/* Low priority interrupt handler */
|
void lp_int_handler (void)
|
void tick_handler (void)
|
{
|
{
|
|
|
/* Disable interrupt recognition */
|
/* Disable interrupt recognition */
|
mtspr(SPR_ESR_BASE, mfspr(SPR_ESR_BASE) & ~SPR_SR_EIR);
|
mtspr(SPR_ESR_BASE, mfspr(SPR_ESR_BASE) & ~SPR_SR_TEE);
|
|
|
except_mask |= 1 << V_LPINT;
|
except_mask |= 1 << V_TICK;
|
except_count++;
|
except_count++;
|
}
|
}
|
|
|
/* High priority interrupt handler */
|
/* High priority interrupt handler */
|
void hp_int_handler (void)
|
void int_handler (void)
|
{
|
{
|
|
|
/* Disable interrupt recognition */
|
/* Disable interrupt recognition */
|
mtspr(SPR_ESR_BASE, mfspr(SPR_ESR_BASE) & ~SPR_SR_EIR);
|
mtspr(SPR_ESR_BASE, mfspr(SPR_ESR_BASE) & ~SPR_SR_IEE);
|
|
|
except_mask |= 1 << V_HPINT;
|
except_mask |= 1 << V_INT;
|
except_count++;
|
except_count++;
|
}
|
}
|
|
|
/* Trap handler */
|
/* Trap handler */
|
void trap_handler (void)
|
void trap_handler (void)
|
Line 333... |
Line 333... |
}
|
}
|
|
|
/* Tick timer init */
|
/* Tick timer init */
|
void tick_init (int period, int hp_int)
|
void tick_init (int period, int hp_int)
|
{
|
{
|
/* Disable interrupt recognition */
|
/* Disable tick timer exception recognition */
|
mtspr(SPR_SR, mfspr(SPR_SR) & ~SPR_SR_EIR);
|
mtspr(SPR_SR, mfspr(SPR_SR) & ~SPR_SR_TEE);
|
|
|
/* Set period of one cycle, restartable mode */
|
/* Set period of one cycle, restartable mode */
|
mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (period & SPR_TTMR_PERIOD));
|
mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (period & SPR_TTMR_PERIOD));
|
|
|
/* Set tick priority */
|
|
if (hp_int)
|
|
mtspr(SPR_PICPR, mfspr(SPR_PICPR) | (0x00000001L << V_TICK));
|
|
else
|
|
mtspr(SPR_PICPR, mfspr(SPR_PICPR) & ~(0x00000001L << V_TICK));
|
|
|
|
/* Reset counter */
|
/* Reset counter */
|
mtspr(SPR_TTCR, 0);
|
mtspr(SPR_TTCR, 0);
|
|
|
/* Unmask tick interrupt in PIC */
|
|
mtspr(SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << V_TICK));
|
|
}
|
}
|
|
|
/* Interrupt test */
|
/* Interrupt test */
|
int interrupt_test (void)
|
int interrupt_test (void)
|
{
|
{
|
Line 370... |
Line 361... |
except_ea = 0;
|
except_ea = 0;
|
|
|
/* Test normal high priority interrupt trigger */
|
/* Test normal high priority interrupt trigger */
|
ret = call ((unsigned long)&int_trigger, 0);
|
ret = call ((unsigned long)&int_trigger, 0);
|
ASSERT(except_count == 1);
|
ASSERT(except_count == 1);
|
ASSERT(except_mask == (1 << V_HPINT));
|
ASSERT(except_mask == (1 << V_TICK));
|
ASSERT(ret == 0);
|
|
ASSERT(except_pc == (unsigned long)int_trigger + 16);
|
|
|
|
#if 0
|
|
/* Reset except counter */
|
|
except_count = 0;
|
|
except_mask = 0;
|
|
except_pc = 0;
|
|
except_ea = 0;
|
|
|
|
/* Init tick timer */
|
|
tick_init (1, 0);
|
|
|
|
/* Test normal low priority interrupt trigger */
|
|
ret = call ((unsigned long)&int_trigger, 0);
|
|
ASSERT(except_count == 1);
|
|
ASSERT(except_mask == (1 << V_LPINT));
|
|
ASSERT(ret == 0);
|
ASSERT(ret == 0);
|
ASSERT(except_pc == (unsigned long)int_trigger + 16);
|
ASSERT(except_pc == (unsigned long)int_trigger + 16);
|
ASSERT(except_ea == 0);
|
|
#endif
|
|
|
|
/* Reset except counter */
|
/* Reset except counter */
|
except_count = 0;
|
except_count = 0;
|
except_mask = 0;
|
except_mask = 0;
|
except_pc = 0;
|
except_pc = 0;
|
Line 949... |
Line 921... |
immu_enable ();
|
immu_enable ();
|
|
|
/* Check if there was INT exception */
|
/* Check if there was INT exception */
|
call_with_int (RAM_START + (RAM_SIZE) + (TLB_TEXT_SET_NB*PAGE_SIZE), 0);
|
call_with_int (RAM_START + (RAM_SIZE) + (TLB_TEXT_SET_NB*PAGE_SIZE), 0);
|
ASSERT(except_count == 1);
|
ASSERT(except_count == 1);
|
ASSERT(except_mask == (1 << V_HPINT));
|
ASSERT(except_mask == (1 << V_TICK));
|
ASSERT(except_pc == (RAM_START + (RAM_SIZE) + (TLB_TEXT_SET_NB*PAGE_SIZE)));
|
ASSERT(except_pc == (RAM_START + (RAM_SIZE) + (TLB_TEXT_SET_NB*PAGE_SIZE)));
|
ASSERT(except_ea == 0);
|
ASSERT(except_ea == 0);
|
|
|
/* Reset except counter */
|
/* Reset except counter */
|
except_count = 0;
|
except_count = 0;
|
Line 1118... |
Line 1090... |
excpt_buserr = (unsigned long)bus_err_handler;
|
excpt_buserr = (unsigned long)bus_err_handler;
|
|
|
/* Register illegal insn handler */
|
/* Register illegal insn handler */
|
excpt_illinsn = (unsigned long)ill_insn_handler;
|
excpt_illinsn = (unsigned long)ill_insn_handler;
|
|
|
/* Register low priority interrupt handler */
|
/* Register tick timer exception handler */
|
excpt_lpint = (unsigned long)lp_int_handler;
|
excpt_tick = (unsigned long)tick_handler;
|
|
|
/* Register high priority interrupt handler */
|
/* Register external interrupt handler */
|
excpt_hpint = (unsigned long)hp_int_handler;
|
excpt_int = (unsigned long)int_handler;
|
|
|
/* Register ITLB miss handler */
|
/* Register ITLB miss handler */
|
excpt_itlbmiss = (unsigned long)itlb_miss_handler;
|
excpt_itlbmiss = (unsigned long)itlb_miss_handler;
|
|
|
/* Register instruction page fault handler */
|
/* Register instruction page fault handler */
|