ld: Move the .note.build-id section to near the start of the memory map.
[binutils-gdb.git] / sim / testsuite / bfin / c_progctrl_clisti_interr.S
blob78d6e67044df1ea0d8a1abdf651984f88e94d1cf
1 //Original:/proj/frio/dv/testcases/core/c_progctrl_clisti_interr/c_progctrl_clisti_interr.dsp
2 // Spec Reference: CLI STI interrupt on HW TIMER
3 # mach: bfin
4 # sim: --environment operating
6 #include "test.h"
7 .include "testutils.inc"
8 start
11 // Include Files
14 include(std.inc)
15 include(selfcheck.inc)
17 // Defines
19 #ifndef TCNTL
20 #define TCNTL            0xFFE03000
21 #endif
22 #ifndef TPERIOD
23 #define TPERIOD          0xFFE03004
24 #endif
25 #ifndef TSCALE
26 #define TSCALE           0xFFE03008
27 #endif
28 #ifndef TCOUNT
29 #define TCOUNT           0xFFE0300c
30 #endif
31 #ifndef EVT
32 #define EVT              0xFFE02000
33 #endif
34 #ifndef EVT15
35 #define EVT15            0xFFE0203c
36 #endif
37 #ifndef EVT_OVERRIDE
38 #define EVT_OVERRIDE     0xFFE02100
39 #endif
40 #ifndef ITABLE
41 #define ITABLE           0x000FF000
42 #endif
43 #ifndef PROGRAM_STACK
44 #define PROGRAM_STACK    0x000FF100
45 #endif
46 #ifndef STACKSIZE
47 #define STACKSIZE        0x00000300
48 #endif
50 // Boot code
53 INIT_R_REGS(0);                             // Initialize Dregs
54 INIT_P_REGS(0);                             // Initialize Pregs
56       //CHECK_INIT(p5,   0xE0000000);
57 include(symtable.inc)
58 CHECK_INIT_DEF(p5);
59  BOOT :
61 LD32(sp, 0x000FF200);
62 LD32(p0, EVT);              // Setup Event Vectors and Handlers
64 LD32_LABEL(r0, EHANDLE);    // Emulation Handler (Int0)
65         [ P0 ++ ] = R0;
67 LD32_LABEL(r0, RHANDLE);    // Reset Handler (Int1)
68         [ P0 ++ ] = R0;
70 LD32_LABEL(r0, NHANDLE);    // NMI Handler (Int2)
71         [ P0 ++ ] = R0;
73 LD32_LABEL(r0, XHANDLE);    // Exception Handler (Int3)
74         [ P0 ++ ] = R0;
76         [ P0 ++ ] = R0;                // IVT4 not used
78 LD32_LABEL(r0, HWHANDLE);   // HW Error Handler (Int5)
79         [ P0 ++ ] = R0;
81 LD32_LABEL(r0, THANDLE);    // Timer Handler (Int6)
82         [ P0 ++ ] = R0;
84 LD32_LABEL(r0, I7HANDLE);   // IVG7 Handler
85         [ P0 ++ ] = R0;
87 LD32_LABEL(r0, I8HANDLE);   // IVG8 Handler
88         [ P0 ++ ] = R0;
90 LD32_LABEL(r0, I9HANDLE);   // IVG9 Handler
91         [ P0 ++ ] = R0;
93 LD32_LABEL(r0, I10HANDLE);  // IVG10 Handler
94         [ P0 ++ ] = R0;
96 LD32_LABEL(r0, I11HANDLE);  // IVG11 Handler
97         [ P0 ++ ] = R0;
99 LD32_LABEL(r0, I12HANDLE);  // IVG12 Handler
100         [ P0 ++ ] = R0;
102 LD32_LABEL(r0, I13HANDLE);  // IVG13 Handler
103         [ P0 ++ ] = R0;
105 LD32_LABEL(r0, I14HANDLE);  // IVG14 Handler
106         [ P0 ++ ] = R0;
108 LD32_LABEL(r0, I15HANDLE);  // IVG15 Handler
109         [ P0 ++ ] = R0;
111 LD32(p0, EVT_OVERRIDE);
112         R0 = 0;
113         [ P0 ++ ] = R0;
114         R0 = -1;     // Change this to mask interrupts (*)
115         [ P0 ] = R0;   // IMASK
117 LD32_LABEL(p1, START);
119 LD32(p0, EVT15);
120         [ P0 ] = P1;   // IVG15 (General) handler (Int 15) load with start
122 RAISE 15;    // after we RTI, INT 15 should be taken
124 LD32_LABEL(r7, START);
125 RETI = r7;
126 NOP;        // Workaround for Bug 217
127 RTI;
128 NOP;
129 NOP;
130 NOP;
131 NOP;
132 NOP;
133 NOP;
134 NOP;
135 NOP;
136 DUMMY:
137           NOP;
138 NOP;
139 NOP;
140 NOP;
141 NOP;
142 NOP;
143 NOP;
144 NOP;
145 NOP;
146 NOP;
148  START :
149         R7 = 0x0;
150         R6 = 0x1;
151         [ -- SP ] = RETI;        // Enable Nested Interrupts
153 CLI R1;                                           // stop interrupt
154 WR_MMR(TCNTL,   0x00000001, p0, r0);        // Turn ON TMPWR (active state)
155 WR_MMR(TPERIOD, 0x00000050, p0, r0);
156 WR_MMR(TCOUNT,  0x00000013, p0, r0);
157 WR_MMR(TSCALE,  0x00000000, p0, r0);
158 CSYNC;
159         // Read the contents of the Timer
161 RD_MMR(TPERIOD, p0, r2);
162 CHECKREG(r2,    0x00000050);
164 //      RD_MMR(TCOUNT, p0, r3);
165 //      CHECKREG(r3, 0x00000013);// fsim -ro useChecker=regtrace -seed 8b8db910
168 WR_MMR(TCNTL,   0x00000003, p0, r0);        // enable Timer (TMPWR, TMREN)
169 CSYNC;
171 NOP; NOP; NOP;
172 NOP; NOP; NOP;
173 NOP; NOP; NOP;
174 NOP; NOP; NOP;
175 NOP; NOP; NOP;
176 NOP; NOP; NOP;
177 NOP; NOP; NOP;
178 NOP; NOP; NOP;
179 RD_MMR(TPERIOD, p0, r4);
180 CHECKREG(r4,    0x00000050);
182 //      RD_MMR(TCNTL, p0, r5);
183 //      CHECKREG(r5,    0x0000000B);                // INTERRUPT did happen
185 WR_MMR(TCNTL,   0x00000000, p0, r0);        // Turn OFF Timer
186 CSYNC;
187 NOP;
188 WR_MMR(TCNTL,   0x00000001, p0, r0);        // Turn ON Timer Power
189 WR_MMR(TPERIOD, 0x00000015, p0, r0);
190 WR_MMR(TCOUNT,  0x00000013, p0, r0);
191 WR_MMR(TSCALE,  0x00000002, p0, r0);
192 WR_MMR(TCNTL,   0x00000007, p0, r0);        // Turn ON Timer (TAUTORLD=1)
193 CSYNC;
194 NOP;
195 NOP;
196 NOP;
197 NOP;
198 NOP;
199 NOP;
200 NOP;
201 NOP;
202 NOP;
203 NOP;
204 NOP;
205 NOP;
206 NOP;
207 NOP;
208 NOP;
209 JUMP.S label4;
210         R4.L = 0x1111;                             // Will be killed
211         R4.H = 0x1111;                             // Will be killed
212 NOP;
213 NOP;
214 NOP;
215 label5: R5.H = 0x7777;
216         R5.L = 0x7888;
217 JUMP.S label6;
218         R5.L = 0x1111;                             // Will be killed
219         R5.H = 0x1111;                             // Will be killed
220 NOP;
221 NOP;
222 NOP;
223 NOP;
224 NOP;
225 NOP;
226 label4: R4.H = 0x5555;
227         R4.L = 0x6666;
228 NOP;
229 JUMP.S label5;
230         R5.L = 0x2222;     // Will be killed
231         R5.H = 0x2222;     // Will be killed
232 NOP;
233 NOP;
234 NOP;
235 NOP;
236 label6: R3.H = 0x7999;
237         R3.L = 0x7aaa;
238 NOP;
239 NOP;
240 NOP;
241 NOP;
242 NOP;
243 NOP;
244 NOP;
245                                                     // With auto reload
246         // Read the contents of the Timer
248 RD_MMR(TPERIOD, p0, r2);
249 CHECKREG(r2,    0x00000015);
251 //      RD_MMR(TCNTL , p0, r3);
252 //      CHECKREG(r3,    0x0000000F);
253 NOP;
254 CHECKREG(r7,    0x00000000);    // no interrupt being serviced
255 NOP;
256 STI R1;
258 NOP; NOP; NOP;
259 NOP; NOP; NOP;
260 WR_MMR(TCNTL,   0x00000000, p0, r0);        // Turn OFF Timer
261 CSYNC;
262 NOP; NOP; NOP;
268 dbg_pass;        // Call Endtest Macro
272 //*********************************************************************
274 // Handlers for Events
277 EHANDLE:            // Emulation Handler 0
278 RTE;
280 RHANDLE:            // Reset Handler 1
281 RTI;
283 NHANDLE:            // NMI Handler 2
284 RTN;
286 XHANDLE:            // Exception Handler 3
287 RTX;
289 HWHANDLE:           // HW Error Handler 5
290 RTI;
292 THANDLE:            // Timer Handler 6
293         R7 = R7 + R6;
294 RTI;
296 I7HANDLE:           // IVG 7 Handler
297 RTI;
299 I8HANDLE:           // IVG 8 Handler
300 RTI;
302 I9HANDLE:           // IVG 9 Handler
303 RTI;
305 I10HANDLE:          // IVG 10 Handler
306 RTI;
308 I11HANDLE:          // IVG 11 Handler
309 RTI;
311 I12HANDLE:          // IVG 12 Handler
312 RTI;
314 I13HANDLE:          // IVG 13 Handler
315 RTI;
317 I14HANDLE:          // IVG 14 Handler
318 RTI;
320 I15HANDLE:          // IVG 15 Handler
321         R5 = RETI;
322         P0 = R5;
323 JUMP ( P0 );
324 RTI;
326 .section MEM_PROGRAM_STACK,"aw"
328 .space (STACKSIZE);
329 STACK:
330 NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug