1 //Original:/proj/frio/dv/testcases/core/c_progctrl_csync_mmr/c_progctrl_csync_mmr.dsp
2 // Spec Reference: csync mmr timer
4 # sim: --environment operating
7 .include "testutils.inc"
11 include(selfcheck.inc)
15 INIT_I_REGS(0); // initialize the dsp address regs
20 //CHECK_INIT(p5, 0xe0000000);
25 #define STACKSIZE 0x10
28 #define EVT 0xFFE02000
31 #define EVT15 0xFFE0203C
34 #define EVT_OVERRIDE 0xFFE02100
37 #define ITABLE 0xF0000000
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,
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)
58 LD32_LABEL(r0, RHANDLE); // Reset Handler (Int1)
61 LD32_LABEL(r0, NHANDLE); // NMI Handler (Int2)
64 LD32_LABEL(r0, XHANDLE); // Exception Handler (Int3)
67 [ P0 ++ ] = R0; // IVT4 not used
69 LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
72 LD32_LABEL(r0, THANDLE); // Timer Handler (Int6)
75 LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
78 LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
81 LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
84 LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
87 LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
90 LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
93 LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
96 LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
99 LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
102 LD32(p0, EVT_OVERRIDE);
105 R0 = -1; // Change this to mask interrupts (*)
106 [ P0 ] = R0; // IMASK
112 LT0 = r0; // set loop counters to something deterministic
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
134 LD32_LABEL(p1, BEGIN);
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
148 LD32_LABEL(sp, USTACK); // setup the stack pointer
149 FP = SP; // set frame pointer
152 //*********************************************************************
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);
165 LD32(r0, 0x0000000D);
167 CSYNC; // without this it read out zero
170 // TPERIOD: 32 bits, rw=1 = 0xFFE03004
171 LD32(p0, 0xFFE03004);
172 LD32(r0, 0x11112222);
174 CSYNC; // without this it read out zero
177 // TSCALE: 8 bits, rw=1 = 0xFFE03008
178 LD32(p0, 0xFFE03008);
179 LD32(r0, 0x00000050);
181 CSYNC; // without this it read out zero
185 // TCOUNT: 32 bits, rw=1 = 0xFFE0300C
186 LD32(p0, 0xFFE0300C);
187 LD32(r0, 0x00000100);
189 CSYNC; // without this it read out zero
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
209 RHANDLE: // Reset Handler 1
212 NHANDLE: // NMI Handler 2
216 XHANDLE: // Exception Handler 3
220 HWHANDLE: // HW Error Handler 5
224 THANDLE: // Timer Handler 6
228 I7HANDLE: // IVG 7 Handler
232 I8HANDLE: // IVG 8 Handler
236 I9HANDLE: // IVG 9 Handler
240 I10HANDLE: // IVG 10 Handler
244 I11HANDLE: // IVG 11 Handler
248 I12HANDLE: // IVG 12 Handler
252 I13HANDLE: // IVG 13 Handler
256 I14HANDLE: // IVG 14 Handler
260 I15HANDLE: // IVG 15 Handler
264 NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
274 // Stack Segments (Both Kernel and User)