source: trunk/softs/tests_ccvcache_v4/test_interrupt_delayslot/test.S @ 232

Last change on this file since 232 was 232, checked in by alain, 12 years ago

Introducing the elementary tests for a TSAR mono-cluster
mono-processor platform with MMU using the vci_cc_vcache_v4
such as the "tsarv4_mono_mmu".
(assemby level tests written by Manuel Bouyer)

File size: 1.7 KB
Line 
1/*
2 * Check that we can take an interrupt from the xicu timer0
3 */
4#include <registers.h>
5#include <misc.h>
6#include <xicu.h>
7
8        .text
9        .globl  _start
10_start:
11        .set noreorder
12        la      k0, TTY_BASE
13        la      k1, EXIT_BASE
14
15        /* reset cause, make sure IV is off */
16        mtc0    zero, COP0_CAUSE
17
18        PRINT(startstr)
19
20        /* program xicu */
21        la      t0, XICU_BASE
22        /* clear pending interrupt */
23        lw      a0, XICU_PTI_ACK(0)(t0)
24        /* route PTI0 to irq 0 */
25        li      a0, 1 << 0
26        sw      a0, XICU_MSK_PTI_E(0)(t0)
27        /* init s0 */
28        li      s0, MAGIC2
29        /*
30         * interrupt in 42 cycles.
31         * Without cache this takes us to the delay slot of the jump.
32         */
33        li      a0, 42
34        sw      a0, XICU_PTI_PER(0)(t0)
35        /* clear pending interrupt */
36        lw      a0, XICU_PTI_ACK(0)(t0)
37        /* reset cop0 status (keep BEV), enable interrupt 0 */
38        lui     a0, 0x0040;
39        addiu   a0, 0x0401;
40        mtc0    a0, COP0_STATUS
41
42        nop
43        nop
44        nop
45        j       end
46        li      s0, MAGIC1
47        nop
48        /* we should not end there */
49        EXIT(1)
50
51end:
52        PRINT(endstr)
53        move    a0, s0
54        PRINTX
55        PUTCHAR('\n')
56        EXIT(0)
57
58        .globl excep
59excep:
60        .set noreorder
61        /* disable timer0 */
62        la      t0, XICU_BASE
63        sw      zero, XICU_PTI_PER(0)(t0)
64        PRINT(statusstr)
65        mfc0    a0, COP0_STATUS
66        PRINTX
67
68        PRINT(causestr)
69        mfc0    a0, COP0_CAUSE
70        PRINTX
71
72        PRINT(pcstr)
73        mfc0    a0, COP0_EXPC
74        PRINTX
75
76        PRINT(badvastr)
77        mfc0    a0, COP_0_BADVADDR
78        PRINTX
79
80        PRINT(xicustr)
81        la      t0, XICU_BASE
82        lw      a0, XICU_PRIO(0)(t0)
83        PRINTX
84
85        PUTCHAR('\n')
86        /* clear interrupt */
87        mfc0    a0, COP0_CAUSE
88        andi    t0, a0, 0xff00
89        xor     a0, a0, t0
90        mtc0    a0, COP0_CAUSE
91        eret
92        /* we should not end there */
93        EXIT(1)
94
95        .rodata:
96statusstr: .ascii "status \0"
97causestr: .ascii " cause \0"
98pcstr: .ascii " pc \0"
99badvastr: .ascii " badva \0"
100xicustr: .ascii " xicu \0"
101startstr: .ascii "start\n\0"
102endstr: .ascii "end \0"
103
104        .org EXCEP_ADDRESS - BOOT_ADDRESS
105        .globl evect
106evect:
107        j       excep
108        nop
109        .data
110myvar:  .word 0
Note: See TracBrowser for help on using the repository browser.