ld: Move the .note.build-id section to near the start of the memory map.
[binutils-gdb.git] / sim / testsuite / bfin / c_mmr_timer.S
blobac34e17e409927d2003bba79bd1866660c75efaf
1 //Original:/proj/frio/dv/testcases/core/c_mmr_timer/c_mmr_timer.dsp
2 // Spec Reference: mmr timer
3 # mach: bfin
4 # sim: --environment operating
6 #include "test.h"
7 .include "testutils.inc"
8 start
10 include(gen_int.inc)
11 include(selfcheck.inc)
12 include(std.inc)
13 include(mmrs.inc)
15 #ifndef STACKSIZE
16 #define STACKSIZE 0x10
17 #endif
20 ////MY_GEN_INT_INIT(0xF0000000) // set location for interrupt table
23 // Reset/Bootstrap Code
24 //   (Here we set the processor operating modes, initialize registers
25 //    etc.)
28 BOOT:
30 INIT_R_REGS(0);
31 INIT_P_REGS(0);
32 INIT_I_REGS(0);     // initialize the dsp address regs
33 INIT_M_REGS(0);
34 INIT_L_REGS(0);
35 INIT_B_REGS(0);
36     //CHECK_INIT(p5, 0xe0000000);
37 include(symtable.inc)
38 CHECK_INIT_DEF(p5);
40 CLI R1;           // inhibit events during MMR writes
42 LD32_LABEL(sp, USTACK);   // setup the user stack pointer
43 USP = SP;                  // and frame pointer
45 LD32_LABEL(sp, KSTACK);   // setup the stack pointer
46 FP = SP;                  // and frame pointer
48 LD32(p0, EVT0);      // Setup Event Vectors and Handlers
49 LD32_LABEL(r0, EHANDLE);  // Emulation Handler (Int0)
50     [ P0 ++ ] = R0;
52 LD32_LABEL(r0, RHANDLE);  // Reset Handler (Int1)
53     [ P0 ++ ] = R0;
55 LD32_LABEL(r0, NHANDLE);  // NMI Handler (Int2)
56     [ P0 ++ ] = R0;
58 LD32_LABEL(r0, XHANDLE);  // Exception Handler (Int3)
59     [ P0 ++ ] = R0;
61     [ P0 ++ ] = R0;          // EVT4 not used global Interr Enable (INT4)
63 LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
64     [ P0 ++ ] = R0;
66 LD32_LABEL(r0, THANDLE);  // Timer Handler (Int6)
67     [ P0 ++ ] = R0;
68 LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
69     [ P0 ++ ] = R0;
71 LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
72     [ P0 ++ ] = R0;
74 LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
75     [ P0 ++ ] = R0;
77 LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
78     [ P0 ++ ] = R0;
80 LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
81     [ P0 ++ ] = R0;
83 LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
84     [ P0 ++ ] = R0;
86 LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
87     [ P0 ++ ] = R0;
89 LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
90     [ P0 ++ ] = R0;
92 LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
93     [ P0 ++ ] = R0;
95 LD32(p0, EVT_OVERRIDE);
96     R0 = 0;
97     [ P0 ++ ] = R0;
99     R1 = -1;     // Change this to mask interrupts (*)
100 CSYNC;       // wait for MMR writes to finish
101 STI R1;      // sync and reenable events (implicit write to IMASK)
103 DUMMY:
105     R0 = 0 (Z);
107 LT0 = r0;       // set loop counters to something deterministic
108 LB0 = r0;
109 LC0 = r0;
110 LT1 = r0;
111 LB1 = r0;
112 LC1 = r0;
114 ASTAT = r0;     // reset other internal regs
115 SYSCFG = r0;
116 RETS = r0;      // prevent X's breaking LINK instruction
118 // The following code sets up the test for running in USER mode
120 LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
121                         // ReturnFromInterrupt (RTI)
122 RETI = r0;      // We need to load the return address
124 // Comment the following line for a USER Mode test
126 JUMP    STARTSUP;   // jump to code start for SUPERVISOR mode
128 RTI;
130 STARTSUP:
131 LD32_LABEL(p1, BEGIN);
133 LD32(p0, EVT15);
135 CLI R1;    // inhibit events during write to MMR
136     [ P0 ] = P1;   // IVG15 (General) handler (Int 15) load with start
137 CSYNC;       // wait for it
138 STI R1;      // reenable events with proper imask
140 RAISE 15;       // after we RTI, INT 15 should be taken
142 RTI;
145 // The Main Program
147 STARTUSER:
148 LINK 0;     // change for how much stack frame space you need.
150 JUMP BEGIN;
153 //*********************************************************************
155 BEGIN:
157                 // COMMENT the following line for USER MODE tests
158     [ -- SP ] = RETI;  // enable interrupts in supervisor mode
160                 // **** YOUR CODE GOES HERE ****
162     // TCNTL: 4 bits, rw=1          = 0xFFE03000
163 LD32(p0, 0xFFE03000);
164 LD32(r0, 0x0000000D);
165     [ P0 ] = R0;
166 CSYNC;                  // without this it read out zero
167     R1 = [ P0 ];
169     // TPERIOD: 32 bits, rw=1       = 0xFFE03004
170 LD32(p0, 0xFFE03004);
171 LD32(r0, 0x11112222);
172     [ P0 ] = R0;
173 CSYNC;                  // without this it read out zero
174     R2 = [ P0 ];
176     // TSCALE: 8 bits, rw=1         = 0xFFE03008
177 LD32(p0, 0xFFE03008);
178 LD32(r0, 0x00000050);
179     [ P0 ] = R0;
180 CSYNC;                  // without this it read out zero
181     R3 = [ P0 ];
184     //  TCOUNT: 32 bits, rw=1       = 0xFFE0300C
185 LD32(p0, 0xFFE0300C);
186 LD32(r0, 0x00000100);
187     [ P0 ] = R0;
188 CSYNC;                  // without this it read out zero
189     R4 = [ P0 ];
192 CHECKREG(r1, 0x0000000D);
193 CHECKREG(r2, 0x11112222);
194 CHECKREG(r3, 0x00000050);
195 CHECKREG(r4, 0x00000100);
197 dbg_pass;            // End the test
199 //*********************************************************************
202 // Handlers for Events
205 EHANDLE:            // Emulation Handler 0
206 RTE;
208 RHANDLE:            // Reset Handler 1
209 RTI;
211 NHANDLE:            // NMI Handler 2
212     R0 = 2;
213 RTN;
215 XHANDLE:            // Exception Handler 3
217 RTX;
219 HWHANDLE:           // HW Error Handler 5
220     R2 = 5;
221 RTI;
223 THANDLE:            // Timer Handler 6
224     R3 = 6;
225 RTI;
227 I7HANDLE:           // IVG 7 Handler
228     R4 = 7;
229 RTI;
231 I8HANDLE:           // IVG 8 Handler
232     R5 = 8;
233 RTI;
235 I9HANDLE:           // IVG 9 Handler
236     R6 = 9;
237 RTI;
239 I10HANDLE:          // IVG 10 Handler
240     R7 = 10;
241 RTI;
243 I11HANDLE:          // IVG 11 Handler
244     R0 = 11;
245 RTI;
247 I12HANDLE:          // IVG 12 Handler
248     R1 = 12;
249 RTI;
251 I13HANDLE:          // IVG 13 Handler
252     R2 = 13;
253 RTI;
255 I14HANDLE:          // IVG 14 Handler
256     R3 = 14;
257 RTI;
259 I15HANDLE:          // IVG 15 Handler
260     R4 = 15;
261 RTI;
263 NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
266 // Data Segment
269 .data
270 DATA:
271     .space (0x10);
273 // Stack Segments (Both Kernel and User)
275     .space (STACKSIZE);
276 KSTACK:
278     .space (STACKSIZE);
279 USTACK:
281 //.data 0xFFE03000
282 //.dd 0x00000000