ld: Move the .note.build-id section to near the start of the memory map.
[binutils-gdb.git] / sim / testsuite / bfin / c_progctrl_csync_mmr.S
blob0aeccdea25b14fe187e11fc81682ba7f7ecba250
1 //Original:/proj/frio/dv/testcases/core/c_progctrl_csync_mmr/c_progctrl_csync_mmr.dsp
2 // Spec Reference: csync mmr timer
3 # mach: bfin
4 # sim: --environment operating
6 #include "test.h"
7 .include "testutils.inc"
8 start
10 include(std.inc)
11 include(selfcheck.inc)
12 include(gen_int.inc)
13 INIT_R_REGS(0);
14 INIT_P_REGS(0);
15 INIT_I_REGS(0);     // initialize the dsp address regs
16 INIT_M_REGS(0);
17 INIT_L_REGS(0);
18 INIT_B_REGS(0);
19 INIT_R_REGS(-1);
20 //CHECK_INIT(p5, 0xe0000000);
21 include(symtable.inc)
22 CHECK_INIT_DEF(p5);
24 #ifndef STACKSIZE
25 #define STACKSIZE 0x10
26 #endif
27 #ifndef EVT
28 #define EVT  0xFFE02000
29 #endif
30 #ifndef EVT15
31 #define EVT15  0xFFE0203C
32 #endif
33 #ifndef EVT_OVERRIDE
34 #define EVT_OVERRIDE 0xFFE02100
35 #endif
36 #ifndef ITABLE
37 #define ITABLE 0xF0000000
38 #endif
40 GEN_INT_INIT(ITABLE) // set location for interrupt table
43 // Reset/Bootstrap Code
44 //   (Here we should set the processor operating modes, initialize registers,
45 //    etc.)
48 BOOT:
51 LD32_LABEL(sp, KSTACK);   // setup the stack pointer
52 FP = SP;        // and frame pointer
54 LD32(p0, EVT);      // Setup Event Vectors and Handlers
55 LD32_LABEL(r0, EHANDLE);  // Emulation Handler (Int0)
56     [ P0 ++ ] = R0;
58 LD32_LABEL(r0, RHANDLE);  // Reset Handler (Int1)
59     [ P0 ++ ] = R0;
61 LD32_LABEL(r0, NHANDLE);  // NMI Handler (Int2)
62     [ P0 ++ ] = R0;
64 LD32_LABEL(r0, XHANDLE);  // Exception Handler (Int3)
65     [ P0 ++ ] = R0;
67     [ P0 ++ ] = R0;        // IVT4 not used
69 LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
70     [ P0 ++ ] = R0;
72 LD32_LABEL(r0, THANDLE);  // Timer Handler (Int6)
73     [ P0 ++ ] = R0;
75 LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
76     [ P0 ++ ] = R0;
78 LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
79     [ P0 ++ ] = R0;
81 LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
82     [ P0 ++ ] = R0;
84 LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
85     [ P0 ++ ] = R0;
87 LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
88     [ P0 ++ ] = R0;
90 LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
91     [ P0 ++ ] = R0;
93 LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
94     [ P0 ++ ] = R0;
96 LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
97     [ P0 ++ ] = R0;
99 LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
100     [ P0 ++ ] = R0;
102 LD32(p0, EVT_OVERRIDE);
103     R0 = 0;
104     [ P0 ++ ] = R0;
105     R0 = -1;     // Change this to mask interrupts (*)
106     [ P0 ] = R0;   // IMASK
108 DUMMY:
110     R0 = 0 (Z);
112 LT0 = r0;       // set loop counters to something deterministic
113 LB0 = r0;
114 LC0 = r0;
115 LT1 = r0;
116 LB1 = r0;
117 LC1 = r0;
119 ASTAT = r0;     // reset other internal regs
121 // The following code sets up the test for running in USER mode
123 LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
124                         // ReturnFromInterrupt (RTI)
125 RETI = r0;      // We need to load the return address
127 // Comment the following line for a USER Mode test
129 JUMP    STARTSUP;   // jump to code start for SUPERVISOR mode
131 RTI;
133 STARTSUP:
134 LD32_LABEL(p1, BEGIN);
136 LD32(p0, EVT15);
137     [ P0 ] = P1;   // IVG15 (General) handler (Int 15) load with start
139 RAISE 15;       // after we RTI, INT 15 should be taken
141 NOP;    // Workaround for Bug 217
142 RTI;
145 // The Main Program
147 STARTUSER:
148 LD32_LABEL(sp, USTACK);   // setup the stack pointer
149 FP = SP;            // set frame pointer
150 JUMP BEGIN;
152 //*********************************************************************
154 BEGIN:
156                 // COMMENT the following line for USER MODE tests
157     [ -- SP ] = RETI;  // enable interrupts in supervisor mode
159                 // **** YOUR CODE GOES HERE ****
161     // TCNTL: 4 bits, rw=1          = 0xFFE03000
162 LD32(p0, 0xFFE03000);
163 LD32(r0, 0x00000001);
164     [ P0 ] = R0;
165 LD32(r0, 0x0000000D);
166     [ P0 ] = R0;
167 CSYNC;                  // without this it read out zero
168     R1 = [ P0 ];
170     // TPERIOD: 32 bits, rw=1       = 0xFFE03004
171 LD32(p0, 0xFFE03004);
172 LD32(r0, 0x11112222);
173     [ P0 ] = R0;
174 CSYNC;                  // without this it read out zero
175     R2 = [ P0 ];
177     // TSCALE: 8 bits, rw=1         = 0xFFE03008
178 LD32(p0, 0xFFE03008);
179 LD32(r0, 0x00000050);
180     [ P0 ] = R0;
181 CSYNC;                  // without this it read out zero
182     R3 = [ P0 ];
185     //  TCOUNT: 32 bits, rw=1       = 0xFFE0300C
186 LD32(p0, 0xFFE0300C);
187 LD32(r0, 0x00000100);
188     [ P0 ] = R0;
189 CSYNC;                  // without this it read out zero
190     R4 = [ P0 ];
193 CHECKREG(r1, 0x0000000D);
194 CHECKREG(r2, 0x11112222);
195 CHECKREG(r3, 0x00000050);
196 CHECKREG(r4, 0x00000100);
198 dbg_pass;            // End the test
200 //*********************************************************************
203 // Handlers for Events
206 EHANDLE:            // Emulation Handler 0
207 RTE;
209 RHANDLE:            // Reset Handler 1
210 RTI;
212 NHANDLE:            // NMI Handler 2
213     R0 = 2;
214 RTN;
216 XHANDLE:            // Exception Handler 3
218 RTX;
220 HWHANDLE:           // HW Error Handler 5
221     R2 = 5;
222 RTI;
224 THANDLE:            // Timer Handler 6
225     R3 = 6;
226 RTI;
228 I7HANDLE:           // IVG 7 Handler
229     R4 = 7;
230 RTI;
232 I8HANDLE:           // IVG 8 Handler
233     R5 = 8;
234 RTI;
236 I9HANDLE:           // IVG 9 Handler
237     R6 = 9;
238 RTI;
240 I10HANDLE:          // IVG 10 Handler
241     R7 = 10;
242 RTI;
244 I11HANDLE:          // IVG 11 Handler
245     R0 = 11;
246 RTI;
248 I12HANDLE:          // IVG 12 Handler
249     R1 = 12;
250 RTI;
252 I13HANDLE:          // IVG 13 Handler
253     R2 = 13;
254 RTI;
256 I14HANDLE:          // IVG 14 Handler
257     R3 = 14;
258 RTI;
260 I15HANDLE:          // IVG 15 Handler
261     R4 = 15;
262 RTI;
264 NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
267 // Data Segment
270 .data
271 DATA:
272     .space (0x10);
274 // Stack Segments (Both Kernel and User)
276     .space (STACKSIZE);
277 KSTACK:
279     .space (STACKSIZE);
280 USTACK: