修改格式

This commit is contained in:
Huang bo 2021-11-18 09:37:05 +08:00
parent 2b13e2fa57
commit 341e52d940
4 changed files with 289 additions and 291 deletions

View File

@ -75,6 +75,6 @@ void main(void)
/* startup RT-Thread RTOS */
rtthread_startup();
for ( ; ; );
for(;;){}
}

View File

@ -35,7 +35,7 @@ void rt_hw_systick_isr(void)
void rt_hw_system_timer_init(void)
{
// initial system timer interrupt, map local timer interrupt to INT14
gpCGEM_regs->INTMUX3 = (CSL_GEM_TINTLN<<CSL_CGEM_INTMUX3_INTSEL14_SHIFT);
gpCGEM_regs->INTMUX3=(CSL_GEM_TINTLN<<CSL_CGEM_INTMUX3_INTSEL14_SHIFT);
// enable CPU INT14
CPU_interrupt_enable(1<<14);
@ -55,10 +55,10 @@ void rt_hw_system_timer_start(void)
gpBootCfgRegs->TOUTSEL = (DNUM*2)<<CSL_BOOTCFG_TOUTSEL_TOUTSEL0_SHIFT;
// configure the timer to generate clocks and interrupts
tmrCfg.timer_num= DNUM;
tmrCfg.timerMode= TIMER_PERIODIC_CLOCK;
tmrCfg.period= (unsigned long long) RT_TICK_PER_SECOND*gDSP_Core_Speed_Hz/6000;
tmrCfg.reload_period= 0;
tmrCfg.timer_num=DNUM;
tmrCfg.timerMode=TIMER_PERIODIC_CLOCK;
tmrCfg.period = (unsigned long long) RT_TICK_PER_SECOND*gDSP_Core_Speed_Hz/6000;
tmrCfg.reload_period=0;
// initial timer
Timer64_Init(&tmrCfg);

View File

@ -37,7 +37,7 @@ RT_WEAK void rt_hw_cpu_shutdown(void)
void nested_exception_handler(void)
{
for ( ; ; );
for(;;){}
}
/*------------ hw_nmi_handler() function --------------------------------------
@ -48,7 +48,7 @@ void nested_exception_handler(void)
-----------------------------------------------------------------------------*/
void hw_nmi_handler(struct rt_hw_exp_stack_register *regs)
{
for ( ; ; );
for(;;){}
}
/*------------ hw_bad_handler() function --------------------------------------
@ -59,7 +59,7 @@ void hw_nmi_handler(struct rt_hw_exp_stack_register *regs)
-----------------------------------------------------------------------------*/
void hw_bad_handler(void)
{
for ( ; ; );
for(;;){}
}
/*------------ hw_int4_handler() function -------------------------------------
@ -181,7 +181,7 @@ void hw_int13_handler(void)
void hw_int14_handler(void)
{
extern void rt_hw_systick_isr();
rt_hw_systick_isr();
rt_hw_systick_isr();
}
/*------------ hw_int15_handler() function ------------------------------------

View File

@ -16,7 +16,7 @@
#include <rtdef.h>
#define RT_SYS_STACK_SIZE 4096
#define RT_SYS_STACK_SIZE 4096
extern void rt_hw_enable_exception(void);
rt_uint8_t rt_system_stack[RT_SYS_STACK_SIZE];
@ -24,111 +24,110 @@ rt_uint8_t *rt_system_stack_top;
void rt_trap_init(void)
{
rt_system_stack_top = &rt_system_stack[RT_SYS_STACK_SIZE-1];
rt_system_stack_top = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)rt_system_stack_top, 8);
rt_system_stack_top = &rt_system_stack[RT_SYS_STACK_SIZE-1];
rt_system_stack_top = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)rt_system_stack_top, 8);
ack_exception(EXCEPT_TYPE_NXF);
ack_exception(EXCEPT_TYPE_EXC);
ack_exception(EXCEPT_TYPE_IXF);
ack_exception(EXCEPT_TYPE_SXF);
rt_hw_enable_exception();
ack_exception(EXCEPT_TYPE_NXF);
ack_exception(EXCEPT_TYPE_EXC);
ack_exception(EXCEPT_TYPE_IXF);
ack_exception(EXCEPT_TYPE_SXF);
rt_hw_enable_exception();
}
void show_regs(struct rt_hw_exp_stack_register *regs)
{
rt_kprintf("\n");
rt_kprintf("PC: %08lx SP: %08lx\n",
regs->pc, regs->hw_register.sp);
rt_kprintf("Status: %08lx ORIG_A4: %08lx\n",
regs->csr, regs->orig_a4);
rt_kprintf("A0: %08lx B0: %08lx\n",
regs->hw_register.a0, regs->hw_register.b0);
rt_kprintf("A1: %08lx B1: %08lx\n",
regs->hw_register.a1, regs->hw_register.b1);
rt_kprintf("A2: %08lx B2: %08lx\n",
regs->hw_register.a2, regs->hw_register.b2);
rt_kprintf("A3: %08lx B3: %08lx\n",
regs->hw_register.a3, regs->hw_register.b3);
rt_kprintf("A4: %08lx B4: %08lx\n",
regs->hw_register.a4, regs->hw_register.b4);
rt_kprintf("A5: %08lx B5: %08lx\n",
regs->hw_register.a5, regs->hw_register.b5);
rt_kprintf("A6: %08lx B6: %08lx\n",
regs->hw_register.a6, regs->hw_register.b6);
rt_kprintf("A7: %08lx B7: %08lx\n",
regs->hw_register.a7, regs->hw_register.b7);
rt_kprintf("A8: %08lx B8: %08lx\n",
regs->hw_register.a8, regs->hw_register.b8);
rt_kprintf("A9: %08lx B9: %08lx\n",
regs->hw_register.a9, regs->hw_register.b9);
rt_kprintf("A10: %08lx B10: %08lx\n",
regs->hw_register.a10, regs->hw_register.b10);
rt_kprintf("A11: %08lx B11: %08lx\n",
regs->hw_register.a11, regs->hw_register.b11);
rt_kprintf("A12: %08lx B12: %08lx\n",
regs->hw_register.a12, regs->hw_register.b12);
rt_kprintf("A13: %08lx B13: %08lx\n",
regs->hw_register.a13, regs->hw_register.b13);
rt_kprintf("A14: %08lx B14: %08lx\n",
regs->hw_register.a14, regs->hw_register.dp);
rt_kprintf("A15: %08lx B15: %08lx\n",
regs->hw_register.a15, regs->hw_register.sp);
rt_kprintf("A16: %08lx B16: %08lx\n",
regs->hw_register.a16, regs->hw_register.b16);
rt_kprintf("A17: %08lx B17: %08lx\n",
regs->hw_register.a17, regs->hw_register.b17);
rt_kprintf("A18: %08lx B18: %08lx\n",
regs->hw_register.a18, regs->hw_register.b18);
rt_kprintf("A19: %08lx B19: %08lx\n",
regs->hw_register.a19, regs->hw_register.b19);
rt_kprintf("A20: %08lx B20: %08lx\n",
regs->hw_register.a20, regs->hw_register.b20);
rt_kprintf("A21: %08lx B21: %08lx\n",
regs->hw_register.a21, regs->hw_register.b21);
rt_kprintf("A22: %08lx B22: %08lx\n",
regs->hw_register.a22, regs->hw_register.b22);
rt_kprintf("A23: %08lx B23: %08lx\n",
regs->hw_register.a23, regs->hw_register.b23);
rt_kprintf("A24: %08lx B24: %08lx\n",
regs->hw_register.a24, regs->hw_register.b24);
rt_kprintf("A25: %08lx B25: %08lx\n",
regs->hw_register.a25, regs->hw_register.b25);
rt_kprintf("A26: %08lx B26: %08lx\n",
regs->hw_register.a26, regs->hw_register.b26);
rt_kprintf("A27: %08lx B27: %08lx\n",
regs->hw_register.a27, regs->hw_register.b27);
rt_kprintf("A28: %08lx B28: %08lx\n",
regs->hw_register.a28, regs->hw_register.b28);
rt_kprintf("A29: %08lx B29: %08lx\n",
regs->hw_register.a29, regs->hw_register.b29);
rt_kprintf("A30: %08lx B30: %08lx\n",
regs->hw_register.a30, regs->hw_register.b30);
rt_kprintf("A31: %08lx B31: %08lx\n",
regs->hw_register.a31, regs->hw_register.b31);
rt_kprintf("\n");
rt_kprintf("PC: %08lx SP: %08lx\n",
regs->pc, regs->hw_register.sp);
rt_kprintf("Status: %08lx ORIG_A4: %08lx\n",
regs->csr, regs->orig_a4);
rt_kprintf("A0: %08lx B0: %08lx\n",
regs->hw_register.a0, regs->hw_register.b0);
rt_kprintf("A1: %08lx B1: %08lx\n",
regs->hw_register.a1, regs->hw_register.b1);
rt_kprintf("A2: %08lx B2: %08lx\n",
regs->hw_register.a2, regs->hw_register.b2);
rt_kprintf("A3: %08lx B3: %08lx\n",
regs->hw_register.a3, regs->hw_register.b3);
rt_kprintf("A4: %08lx B4: %08lx\n",
regs->hw_register.a4, regs->hw_register.b4);
rt_kprintf("A5: %08lx B5: %08lx\n",
regs->hw_register.a5, regs->hw_register.b5);
rt_kprintf("A6: %08lx B6: %08lx\n",
regs->hw_register.a6, regs->hw_register.b6);
rt_kprintf("A7: %08lx B7: %08lx\n",
regs->hw_register.a7, regs->hw_register.b7);
rt_kprintf("A8: %08lx B8: %08lx\n",
regs->hw_register.a8, regs->hw_register.b8);
rt_kprintf("A9: %08lx B9: %08lx\n",
regs->hw_register.a9, regs->hw_register.b9);
rt_kprintf("A10: %08lx B10: %08lx\n",
regs->hw_register.a10, regs->hw_register.b10);
rt_kprintf("A11: %08lx B11: %08lx\n",
regs->hw_register.a11, regs->hw_register.b11);
rt_kprintf("A12: %08lx B12: %08lx\n",
regs->hw_register.a12, regs->hw_register.b12);
rt_kprintf("A13: %08lx B13: %08lx\n",
regs->hw_register.a13, regs->hw_register.b13);
rt_kprintf("A14: %08lx B14: %08lx\n",
regs->hw_register.a14, regs->hw_register.dp);
rt_kprintf("A15: %08lx B15: %08lx\n",
regs->hw_register.a15, regs->hw_register.sp);
rt_kprintf("A16: %08lx B16: %08lx\n",
regs->hw_register.a16, regs->hw_register.b16);
rt_kprintf("A17: %08lx B17: %08lx\n",
regs->hw_register.a17, regs->hw_register.b17);
rt_kprintf("A18: %08lx B18: %08lx\n",
regs->hw_register.a18, regs->hw_register.b18);
rt_kprintf("A19: %08lx B19: %08lx\n",
regs->hw_register.a19, regs->hw_register.b19);
rt_kprintf("A20: %08lx B20: %08lx\n",
regs->hw_register.a20, regs->hw_register.b20);
rt_kprintf("A21: %08lx B21: %08lx\n",
regs->hw_register.a21, regs->hw_register.b21);
rt_kprintf("A22: %08lx B22: %08lx\n",
regs->hw_register.a22, regs->hw_register.b22);
rt_kprintf("A23: %08lx B23: %08lx\n",
regs->hw_register.a23, regs->hw_register.b23);
rt_kprintf("A24: %08lx B24: %08lx\n",
regs->hw_register.a24, regs->hw_register.b24);
rt_kprintf("A25: %08lx B25: %08lx\n",
regs->hw_register.a25, regs->hw_register.b25);
rt_kprintf("A26: %08lx B26: %08lx\n",
regs->hw_register.a26, regs->hw_register.b26);
rt_kprintf("A27: %08lx B27: %08lx\n",
regs->hw_register.a27, regs->hw_register.b27);
rt_kprintf("A28: %08lx B28: %08lx\n",
regs->hw_register.a28, regs->hw_register.b28);
rt_kprintf("A29: %08lx B29: %08lx\n",
regs->hw_register.a29, regs->hw_register.b29);
rt_kprintf("A30: %08lx B30: %08lx\n",
regs->hw_register.a30, regs->hw_register.b30);
rt_kprintf("A31: %08lx B31: %08lx\n",
regs->hw_register.a31, regs->hw_register.b31);
}
void do_trap(struct rt_exception_info *except_info, struct rt_hw_exp_stack_register *regs)
{
rt_kprintf("Enter exception: %s\n", except_info->kernel_str);
rt_kprintf("Enter exception: %s\n", except_info->kernel_str);
show_regs(regs);
show_regs(regs);
for( ; ; );
for(;;){}
}
static struct rt_exception_info iexcept_table[10] = {
{ " - instruction fetch", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - fetch packet", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - execute packet", ABORT_TYPE_UNDDEF, ABORT_OPCODE_ILL },
{ " - undefined instruction", ABORT_TYPE_UNDDEF, ABORT_OPCODE_ILL },
{ " - resource conflict", ABORT_TYPE_UNDDEF, ABORT_OPCODE_ILL },
{ " - resource access", ABORT_TYPE_UNDDEF, ABORT_PRVREG_ILL },
{ " - privilege", ABORT_TYPE_UNDDEF, ABORT_PRVOPC_ILL },
{ " - loops buffer", ABORT_TYPE_UNDDEF, ABORT_PRVOPC_ILL },
{ " - software exception", ABORT_TYPE_UNDDEF, ABORT_ILLTRP_ILL },
{ " - unknown exception", ABORT_TYPE_UNDDEF, ABORT_PRVOPC_ILL }
{ " - instruction fetch", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - fetch packet", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - execute packet", ABORT_TYPE_UNDDEF, ABORT_OPCODE_ILL },
{ " - undefined instruction", ABORT_TYPE_UNDDEF, ABORT_OPCODE_ILL },
{ " - resource conflict", ABORT_TYPE_UNDDEF, ABORT_OPCODE_ILL },
{ " - resource access", ABORT_TYPE_UNDDEF, ABORT_PRVREG_ILL },
{ " - privilege", ABORT_TYPE_UNDDEF, ABORT_PRVOPC_ILL },
{ " - loops buffer", ABORT_TYPE_UNDDEF, ABORT_PRVOPC_ILL },
{ " - software exception", ABORT_TYPE_UNDDEF, ABORT_ILLTRP_ILL },
{ " - unknown exception", ABORT_TYPE_UNDDEF, ABORT_PRVOPC_ILL }
};
/*
@ -136,163 +135,162 @@ static struct rt_exception_info iexcept_table[10] = {
*/
static int process_iexcept(struct rt_hw_exp_stack_register *regs)
{
unsigned int iexcept_report = get_iexcept();
unsigned int iexcept_num;
unsigned int iexcept_report = get_iexcept();
unsigned int iexcept_num;
ack_exception(EXCEPT_TYPE_IXF);
ack_exception(EXCEPT_TYPE_IXF);
while(iexcept_report) {
iexcept_num = __ffs(iexcept_report);
iexcept_report &= ~(1 << iexcept_num);
set_iexcept(iexcept_report);
while(iexcept_report) {
iexcept_num = __ffs(iexcept_report);
iexcept_report &= ~(1 << iexcept_num);
set_iexcept(iexcept_report);
if (*(unsigned int *)regs->pc == BKPT_OPCODE) {
/* This is a breakpoint */
struct rt_exception_info bkpt_exception = { " - undefined instruction", ABORT_TYPE_UNDDEF, ABORT_BRKPT_ILL };
do_trap(&bkpt_exception, regs);
iexcept_report &= ~(0xFF);
set_iexcept(iexcept_report);
continue;
}
do_trap(&iexcept_table[iexcept_num], regs);
}
return 0;
if (*(unsigned int *)regs->pc == BKPT_OPCODE) {
/* This is a breakpoint */
struct rt_exception_info bkpt_exception = { " - undefined instruction", ABORT_TYPE_UNDDEF, ABORT_BRKPT_ILL };
do_trap(&bkpt_exception, regs);
iexcept_report &= ~(0xFF);
set_iexcept(iexcept_report);
continue;
}
do_trap(&iexcept_table[iexcept_num], regs);
}
return 0;
}
static struct rt_exception_info except_table[128] = {
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - external exception", ABORT_TYPE_BUS, ABORT_BUS_ADDRERR },
{ " - CPU memory protection fault", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - CPU memory protection fault in L1P", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - DMA memory protection fault in L1P", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - CPU memory protection fault in L1D", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - DMA memory protection fault in L1D", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - CPU memory protection fault in L2", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - DMA memory protection fault in L2", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - EMC CPU memory protection fault", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - EMC bus error", ABORT_TYPE_MAP, ABORT_BUS_ADDRERR }
{ " - CPU memory protection fault", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - CPU memory protection fault in L1P", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - DMA memory protection fault in L1P", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - CPU memory protection fault in L1D", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - DMA memory protection fault in L1D", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - CPU memory protection fault in L2", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - DMA memory protection fault in L2", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - EMC CPU memory protection fault", ABORT_TYPE_MAP, ABORT_BUS_ACCERR },
{ " - EMC bus error", ABORT_TYPE_MAP, ABORT_BUS_ADDRERR }
};
/*
@ -300,22 +298,22 @@ static struct rt_exception_info except_table[128] = {
*/
static void process_except(struct rt_hw_exp_stack_register *regs)
{
int except_num;
int bank = 0;
int i;
int except_num;
int bank = 0;
int i;
for (i = 0; i <= 3; i++) {
while (INTC_MEXPMASK[i]) {
__dint();
except_num = __ffs(INTC_MEXPMASK[i]);
INTC_MEXPMASK[i] &= ~(1 << except_num); /* ack the external exception */
__rint();
do_trap(&except_table[except_num + (bank << 5)], regs);
}
bank++;
}
for (i = 0; i <= 3; i++) {
while (INTC_MEXPMASK[i]) {
__dint();
except_num = __ffs(INTC_MEXPMASK[i]);
INTC_MEXPMASK[i] &= ~(1 << except_num); /* ack the external exception */
__rint();
do_trap(&except_table[except_num + (bank << 5)], regs);
}
bank++;
}
ack_exception(EXCEPT_TYPE_EXC);
ack_exception(EXCEPT_TYPE_EXC);
}
extern void hw_nmi_handler(struct rt_hw_exp_stack_register *regs);
@ -325,39 +323,39 @@ extern void hw_nmi_handler(struct rt_hw_exp_stack_register *regs);
*/
int rt_hw_process_exception(struct rt_hw_exp_stack_register *regs)
{
int type;
int type_num;
int ie_num = 9; /* default is unknown exception */
int type;
int type_num;
int ie_num = 9; /* default is unknown exception */
while ((type = get_except_type()) != 0) {
type_num = __fls(type) - 1;
while ((type = get_except_type()) != 0) {
type_num = __fls(type) - 1;
switch(type_num) {
case EXCEPT_TYPE_NXF: /* NMI exception */
ack_exception(EXCEPT_TYPE_NXF); /* clear exception */
if (hw_nmi_handler != RT_NULL)
hw_nmi_handler(regs);
break;
switch(type_num) {
case EXCEPT_TYPE_NXF: /* NMI exception */
ack_exception(EXCEPT_TYPE_NXF); /* clear exception */
if (hw_nmi_handler != RT_NULL)
hw_nmi_handler(regs);
break;
case EXCEPT_TYPE_IXF: /* internal exception */
if (process_iexcept(regs))
return 1;
break;
case EXCEPT_TYPE_IXF: /* internal exception */
if (process_iexcept(regs))
return 1;
break;
case EXCEPT_TYPE_EXC: /* external exception */
process_except(regs);
break;
case EXCEPT_TYPE_EXC: /* external exception */
process_except(regs);
break;
case EXCEPT_TYPE_SXF: /* software exception */
ie_num = 8;
ack_exception(type_num);
break;
default: /* clear exception */
ack_exception(type_num);
do_trap(&iexcept_table[ie_num], regs);
break;
}
}
return 0;
case EXCEPT_TYPE_SXF: /* software exception */
ie_num = 8;
ack_exception(type_num);
break;
default: /* clear exception */
ack_exception(type_num);
do_trap(&iexcept_table[ie_num], regs);
break;
}
}
return 0;
}