浏览代码

cortex-r4: remove RM48x50.h and add armv7.h

Grissiom 11 年之前
父节点
当前提交
e1e563e85c

+ 0 - 39
libcpu/arm/cortex-r4/RM48x50.h

@@ -1,39 +0,0 @@
-#ifndef RM48X50_H
-#define RM48X50_H
-
-#include <system.h>
-#include <sys_vim.h>
-
-#define USERMODE	0x10
-#define FIQMODE		0x11
-#define IRQMODE		0x12
-#define SVCMODE		0x13
-#define ABORTMODE	0x17
-#define UNDEFMODE	0x1b
-#define MODEMASK	0x1f
-#define NOINT		0xc0
-
-struct rt_hw_register
-{
-	unsigned long r0;
-	unsigned long r1;
-	unsigned long r2;
-	unsigned long r3;
-	unsigned long r4;
-	unsigned long r5;
-	unsigned long r6;
-	unsigned long r7;
-	unsigned long r8;
-	unsigned long r9;
-	unsigned long r10;
-	unsigned long fp;
-	unsigned long ip;
-	unsigned long sp;
-	unsigned long lr;
-	unsigned long pc;
-	unsigned long cpsr;
-	unsigned long ORIG_r0;
-};
-
-#endif /* end of include guard: RM48X50_H */
-

+ 47 - 0
libcpu/arm/cortex-r4/armv7.h

@@ -0,0 +1,47 @@
+#ifndef __ARMV7_H__
+#define __ARMV7_H__
+
+#ifndef VFP_DATA_NR
+#define VFP_DATA_NR 32
+#endif
+
+/* the stack without VFP registers */
+struct rt_hw_base_stack
+{
+	unsigned long cpsr;
+	unsigned long r0;
+	unsigned long r1;
+	unsigned long r2;
+	unsigned long r3;
+	unsigned long r4;
+	unsigned long r5;
+	unsigned long r6;
+	unsigned long r7;
+	unsigned long r8;
+	unsigned long r9;
+	unsigned long r10;
+	unsigned long fp;
+	unsigned long ip;
+	unsigned long lr;
+	unsigned long pc;
+};
+
+#define USERMODE    0x10
+#define FIQMODE     0x11
+#define IRQMODE     0x12
+#define SVCMODE     0x13
+#define MONITORMODE 0x16
+#define ABORTMODE   0x17
+#define HYPMODE     0x1b
+#define UNDEFMODE   0x1b
+#define MODEMASK    0x1f
+#define NOINT       0xc0
+
+#define T_Bit       (1<<5)
+#define F_Bit       (1<<6)
+#define I_Bit       (1<<7)
+#define A_Bit       (1<<8)
+#define E_Bit       (1<<9)
+#define J_Bit       (1<<24)
+
+#endif

+ 5 - 1
libcpu/arm/cortex-r4/interrupt.c

@@ -15,7 +15,11 @@
 
 
 #include <rtthread.h>
 #include <rtthread.h>
 #include <rthw.h>
 #include <rthw.h>
-#include "RM48x50.h"
+
+#include <sys_vim.h>
+#include <system.h>
+
+#include "armv7.h"
 
 
 #define MAX_HANDLERS	96
 #define MAX_HANDLERS	96
 
 

+ 2 - 2
libcpu/arm/cortex-r4/stack.c

@@ -13,7 +13,8 @@
  * 2013-05-24     Grissiom     port to RM48x50
  * 2013-05-24     Grissiom     port to RM48x50
  */
  */
 #include <rtthread.h>
 #include <rtthread.h>
-#include "RM48x50.h"
+
+#include "armv7.h"
 /**
 /**
  * @addtogroup RM48x50
  * @addtogroup RM48x50
  */
  */
@@ -60,7 +61,6 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
 #if defined(__TI_VFP_SUPPORT__) || (defined (__VFP_FP__) && !defined(__SOFTFP__))
 #if defined(__TI_VFP_SUPPORT__) || (defined (__VFP_FP__) && !defined(__SOFTFP__))
 #ifndef RT_VFP_LAZY_STACKING
 #ifndef RT_VFP_LAZY_STACKING
     {
     {
-        #define VFP_DATA_NR 32
         int i;
         int i;
 
 
         for (i = 0; i < VFP_DATA_NR; i++)
         for (i = 0; i < VFP_DATA_NR; i++)

+ 12 - 14
libcpu/arm/cortex-r4/trap.c

@@ -15,8 +15,10 @@
 
 
 #include <rtthread.h>
 #include <rtthread.h>
 #include <rthw.h>
 #include <rthw.h>
-#include "RM48x50.h"
-//#define BSP_INT_DEBUG
+
+#include <sys_vim.h>
+
+#include "armv7.h"
 
 
 /**
 /**
  * @addtogroup RM48x50
  * @addtogroup RM48x50
@@ -28,26 +30,26 @@
  *
  *
  * @param regs the registers point
  * @param regs the registers point
  */
  */
-void rt_hw_show_register (struct rt_hw_register *regs)
+void rt_hw_show_register (struct rt_hw_base_stack *regs)
 {
 {
 	rt_kprintf("Execption:\n");
 	rt_kprintf("Execption:\n");
 	rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3);
 	rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3);
 	rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7);
 	rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7);
 	rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10);
 	rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10);
 	rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip);
 	rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip);
-	rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc);
+	rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs+1, regs->lr, regs->pc);
 	rt_kprintf("cpsr:0x%08x\n", regs->cpsr);
 	rt_kprintf("cpsr:0x%08x\n", regs->cpsr);
 }
 }
 
 
 /**
 /**
- * When ARM7TDMI comes across an instruction which it cannot handle,
+ * When comes across an instruction which it cannot handle,
  * it takes the undefined instruction trap.
  * it takes the undefined instruction trap.
  *
  *
  * @param regs system registers
  * @param regs system registers
  *
  *
  * @note never invoke this function in application
  * @note never invoke this function in application
  */
  */
-void rt_hw_trap_udef(struct rt_hw_register *regs)
+void rt_hw_trap_udef(struct rt_hw_base_stack *regs)
 {
 {
     rt_kprintf("undefined instruction\n");
     rt_kprintf("undefined instruction\n");
     rt_hw_show_register(regs);
     rt_hw_show_register(regs);
@@ -65,7 +67,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
  *
  *
  * @note never invoke this function in application
  * @note never invoke this function in application
  */
  */
-void rt_hw_trap_swi(struct rt_hw_register *regs)
+void rt_hw_trap_swi(struct rt_hw_base_stack *regs)
 {
 {
     rt_kprintf("software interrupt\n");
     rt_kprintf("software interrupt\n");
     rt_hw_show_register(regs);
     rt_hw_show_register(regs);
@@ -82,7 +84,7 @@ void rt_hw_trap_swi(struct rt_hw_register *regs)
  *
  *
  * @note never invoke this function in application
  * @note never invoke this function in application
  */
  */
-void rt_hw_trap_pabt(struct rt_hw_register *regs)
+void rt_hw_trap_pabt(struct rt_hw_base_stack *regs)
 {
 {
     rt_kprintf("prefetch abort\n");
     rt_kprintf("prefetch abort\n");
     rt_hw_show_register(regs);
     rt_hw_show_register(regs);
@@ -99,7 +101,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
  *
  *
  * @note never invoke this function in application
  * @note never invoke this function in application
  */
  */
-void rt_hw_trap_dabt(struct rt_hw_register *regs)
+void rt_hw_trap_dabt(struct rt_hw_base_stack *regs)
 {
 {
     rt_kprintf("Data Abort ");
     rt_kprintf("Data Abort ");
     rt_hw_show_register(regs);
     rt_hw_show_register(regs);
@@ -115,7 +117,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
  *
  *
  * @note never invoke this function in application
  * @note never invoke this function in application
  */
  */
-void rt_hw_trap_resv(struct rt_hw_register *regs)
+void rt_hw_trap_resv(struct rt_hw_base_stack *regs)
 {
 {
     rt_kprintf("not used\n");
     rt_kprintf("not used\n");
     rt_hw_show_register(regs);
     rt_hw_show_register(regs);
@@ -124,10 +126,6 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
     rt_hw_cpu_shutdown();
     rt_hw_cpu_shutdown();
 }
 }
 
 
-/*
- *#pragma CODE_STATE(rt_hw_trap_irq, 32)
- *#pragma INTERRUPT(rt_hw_trap_irq, IRQ)
- */
 extern rt_isr_handler_t isr_table[];
 extern rt_isr_handler_t isr_table[];
 void rt_hw_trap_irq(void)
 void rt_hw_trap_irq(void)
 {
 {