Et voila! Nous avons un UART!
[rpi-open-firmware.git] / trap.c
diff --git a/trap.c b/trap.c
index 0f3d5ba..4bbb3ca 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -38,9 +38,7 @@ static const char* exception_name(uint32_t n) {
        prefix " r12: 0x%08x r13: 0x%08x r14: 0x%08x r15: 0x%08x\n" \\r
        prefix "  pc: 0x%08x  lr: 0x%08x  sr: 0x%08x\n"\r
 \r
-void sleh_fatal(vc4_saved_state_t* pcb, uint32_t n) {\r
-       printf("Fatal VPU Exception: %s\n", exception_name(n));\r
-\r
+static void print_vpu_state(vc4_saved_state_t* pcb) {\r
        printf("VPU registers:\n");\r
 \r
        printf(\r
@@ -66,7 +64,7 @@ void sleh_fatal(vc4_saved_state_t* pcb, uint32_t n) {
                pcb->sr\r
        );\r
 \r
-       printf("Exception info:\n");\r
+       printf("Exception info (IC0):\n");\r
 \r
        printf(\r
                "   src0: 0x%08x src1: 0x%08x vaddr: 0x%08x\n"\r
@@ -78,11 +76,42 @@ void sleh_fatal(vc4_saved_state_t* pcb, uint32_t n) {
                IC0_S\r
        );\r
 \r
+       printf("Exception info (IC1):\n");\r
+\r
+       printf(\r
+               "   src0: 0x%08x src1: 0x%08x vaddr: 0x%08x\n"\r
+               "      C: 0x%08x    S: 0x%08x\n",\r
+               IC1_SRC0,\r
+               IC1_SRC1,\r
+               IC1_VADDR,\r
+               IC1_C,\r
+               IC1_S\r
+       );\r
+}\r
+\r
+void sleh_fatal(vc4_saved_state_t* pcb, uint32_t n) {\r
+       printf("Fatal VPU Exception: %s\n", exception_name(n));\r
+\r
+       print_vpu_state(pcb);\r
+\r
        printf("We are hanging here ...\n");\r
        \r
        hang_cpu();\r
 }\r
 \r
-void sleh_irq(vc4_saved_state_t* pcb) {\r
-       panic("interrupt at 0x%X!", pcb->pc);\r
-}
\ No newline at end of file
+extern void arm_monitor_interrupt();\r
+\r
+void sleh_irq(vc4_saved_state_t* pcb, uint32_t tp) {\r
+       uint32_t status = IC0_S;\r
+       uint32_t source = status & 0xFF;\r
+\r
+       printf("VPU Received interrupt from source %d\n", source);\r
+\r
+       if (source == INTERRUPT_ARM) {\r
+               arm_monitor_interrupt();\r
+       }\r
+       else {\r
+               print_vpu_state(pcb);\r
+               panic("unknown interrupt source!");\r
+       }\r
+}\r
This page took 0.028107 seconds and 4 git commands to generate.