📄 trap.c
字号:
/*
* File : trap.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.fayfayspace.org/license/LICENSE.
*
* Change Logs:
* Date Author Notes
* 2006-02-24 Bernard first version
*/
#include "AT91RM9200.h"
/*!
* \addtogroup xgAT91RM9200
*/
/*@{*/
void rt_hw_show_register (struct rt_hw_register *regs)
{
rt_kprintf ("pc : [<%08lx>] lr : [<%08lx>]\n"
"sp : %08lx ip : %08lx fp : %08lx\n",
regs->pc, regs->lr, regs->sp, regs->ip, regs->fp);
rt_kprintf ("r10: %08lx r9 : %08lx r8 : %08lx\n",
regs->r10, regs->r9, regs->r8);
rt_kprintf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
regs->r7, regs->r6, regs->r5, regs->r4);
rt_kprintf ("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
regs->r3, regs->r2, regs->r1, regs->r0);
}
/*!
* \brief trap because undefined instruction
*
* When ARM7TDMI comes across an instruction which it cannot handle,
* it takes the undefined instruction trap.
*
* \param regs system registers
*
* \note never invoke this function in application
*/
void rt_hw_trap_udef(struct rt_hw_register *regs)
{
rt_kprintf("undefined instruction\n");
rt_hw_show_register(regs);
rt_hw_cpu_shutdown();
}
/*!
* \brief trap because software interrupt
*
* The software interrupt instruction (SWI) is used for entering
* Supervisor mode, usually to request a particular supervisor
* function.
*
* \param regs system registers
*
* \note never invoke this function in application
*/
void rt_hw_trap_swi(struct rt_hw_register *regs)
{
rt_kprintf("software interrupt\n");
rt_hw_show_register(regs);
rt_hw_cpu_shutdown();
}
/*!
* \brief trap because abort occurs during an instruction prefetch.
*
* An abort indicates that the current memory access cannot be completed,
* which occurs during an instruction prefetch.
*
* \param regs system registers
*
* \note never invoke this function in application
*/
void rt_hw_trap_pabt(struct rt_hw_register *regs)
{
rt_kprintf("prefetch abort\n");
rt_hw_show_register(regs);
rt_hw_cpu_shutdown();
}
/*!
* \brief trap because abort occurs during a data access.
*
* An abort indicates that the current memory access cannot be completed,
* which occurs during a data access.
*
* \param regs system registers
*
* \note never invoke this function in application
*/
void rt_hw_trap_dabt(struct rt_hw_register *regs)
{
rt_kprintf("data abort\n");
rt_hw_show_register(regs);
rt_hw_cpu_shutdown();
}
/*!
* \brief trap because reserved reason
*
* normally, never reach here
*
* \param regs system registers
*
* \note never invoke this function in application
*/
void rt_hw_trap_resv(struct rt_hw_register *regs)
{
rt_kprintf("not used\n");
rt_hw_show_register(regs);
rt_hw_cpu_shutdown();
}
void rt_hw_trap_irq(struct rt_hw_register *regs)
{
rt_kprintf("interrupt request\n");
rt_hw_show_register(regs);
rt_hw_cpu_shutdown();
}
void rt_hw_trap_fiq(struct rt_hw_register *regs)
{
rt_kprintf("fast interrupt request\n");
rt_hw_show_register(regs);
rt_hw_cpu_shutdown();
}
/*@}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -