source: trunk/softs/tests_ccvcache_v4/test_interrupt_extended/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: 2.6 KB
Line 
1/*
2 * Check interrupt/return with interrup occuring at various points in
3 * the software. Cache is enabled to we have on interrupt/cycle
4 */
5#include <registers.h>
6#include <misc.h>
7#include <vcache.h>
8#include <xicu.h>
9
10        .text
11        .globl  _start
12_start:
13        .set noreorder
14        la      k0, TTY_BASE
15        la      k1, EXIT_BASE
16
17        /* reset cause, make sure IV is off */
18        mtc0    zero, COP0_CAUSE
19
20        la      a0, pte1
21        srl     a0, a0, 13
22        mtc2    a0, VC_PTPR
23        nop
24        nop
25
26        li      a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE
27        mtc2    a0, VC_TLB_EN
28
29        PRINT(startstr)
30
31        /* program xicu */
32        la      t0, XICU_BASE
33        /* clear pending interrupt */
34        lw      a0, XICU_PTI_ACK(0)(t0)
35        /* route PTI0 to irq 0 */
36        li      a0, 1 << 0
37        sw      a0, XICU_MSK_PTI_E(0)(t0)
38        /* init s0 */
39        li      s0, MAGIC2
40        /*
41         * interrupt in INTERRUPT_DELAY cycles.
42         */
43        li      a0, INTERRUPT_DELAY
44        sw      a0, XICU_PTI_PER(0)(t0)
45        /* clear pending interrupt */
46        lw      a0, XICU_PTI_ACK(0)(t0)
47        /* reset cop0 status (keep BEV), enable interrupt 0 */
48        lui     a0, 0x0040;
49        addiu   a0, 0x0401;
50        mtc0    a0, COP0_STATUS
51
52        li      s0, MAGIC1
53        addiu   s0, s0, -1
54        addiu   s0, s0, -1
55        addiu   s0, s0, -1
56        addiu   s0, s0, -1
57        nop
58        j       end
59        addiu   s0, s0, 5
60        nop
61        /* we should not end there */
62        EXIT(1)
63
64end:
65        PRINT(endstr)
66        move    a0, s0
67        PRINTX
68        PUTCHAR('\n')
69        EXIT(0)
70
71        .globl excep
72excep:
73        .set noreorder
74        /* disable timer0 */
75        la      t0, XICU_BASE
76        sw      zero, XICU_PTI_PER(0)(t0)
77        PRINT(statusstr)
78        mfc0    a0, COP0_STATUS
79        PRINTX
80
81        PRINT(causestr)
82        mfc0    a0, COP0_CAUSE
83        PRINTX
84
85        PRINT(pcstr)
86        mfc0    a0, COP0_EXPC
87        PRINTX
88
89        PRINT(badvastr)
90        mfc0    a0, COP_0_BADVADDR
91        PRINTX
92
93        PRINT(xicustr)
94        la      t0, XICU_BASE
95        lw      a0, XICU_PRIO(0)(t0)
96        PRINTX
97
98        PUTCHAR('\n')
99        /* clear interrupt */
100        mfc0    a0, COP0_CAUSE
101        andi    t0, a0, 0xff00
102        xor     a0, a0, t0
103        mtc0    a0, COP0_CAUSE
104        eret
105        /* we should not end there */
106        EXIT(1)
107
108        .rodata:
109statusstr: .ascii "status \0"
110causestr: .ascii " cause \0"
111pcstr: .ascii " pc \0"
112badvastr: .ascii " badva \0"
113xicustr: .ascii " xicu \0"
114startstr: .ascii "start\n\0"
115endstr: .ascii "end \0"
116
117        .org EXCEP_ADDRESS - BOOT_ADDRESS
118        .globl evect
119evect:
120        j       excep
121        nop
122        .data
123myvar:  .word 0
124pte1:
125        .align 13
126        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
127        .org pte1 + (BOOT_ADDRESS >> 21) * 4
128        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
129        .org pte1 + (TTY_BASE >> 21) * 4
130        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
131        .org pte1 + (XICU_BASE >> 21) * 4
132        .word PTE1_V | PTE1_W | (XICU_BASE >> 21) /* map PA 0xd2000000 at VA 0xd2000000 */
133        .org pte1 + (EXIT_BASE >> 21) * 4
134        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
135        .org pte1 + 8192
136        .word 0
137
Note: See TracBrowser for help on using the repository browser.