]>
Commit | Line | Data |
---|---|---|
1 | define jtag | |
2 | target remote localhost:2000 | |
3 | end | |
4 | define kgdboc | |
5 | set remotebaud 57600 | |
6 | if $argc == 0 | |
7 | target remote /dev/ttyS0 | |
8 | else | |
9 | target remote /dev/tty$arg0 | |
10 | end | |
11 | end | |
12 | define kgdbocusb | |
13 | kgdboc USB0 | |
14 | end | |
15 | define kgdboe | |
16 | target remote udp:bfin:6443 | |
17 | end | |
18 | define vapier | |
19 | target remote vapier:2000 | |
20 | end | |
21 | define bfin | |
22 | target remote bfin:1234 | |
23 | end | |
24 | ||
25 | ||
26 | # | |
27 | # Misc Blackfin helper functions | |
28 | # | |
29 | ||
30 | define regs | |
31 | printf "R0: %08x %-11i P0: %08x RETS: %08x LC0: %08x %u\n", $r0, $r0, $p0, $rets, $lc0, $lc0 | |
32 | printf "R1: %08x %-11i P1: %08x RETI: %08x LT0: %08x\n", $r1, $r1, $p1, $reti, $lt0 | |
33 | printf "R2: %08x %-11i P2: %08x RETX: %08x LB0: %08x\n", $r2, $r2, $p2, $retx, $lb0 | |
34 | printf "R3: %08x %-11i P3: %08x RETE: %08x LC1: %08x %u\n", $r3, $r3, $p3, $rete, $lc1, $lc1 | |
35 | printf "R4: %08x %-11i P4: %08x RETN: %08x LT1: %08x\n", $r4, $r4, $p4, $retn, $lt1 | |
36 | printf "R5: %08x %-11i P5: %08x ASTAT: %08x LB1: %08x\n", $r5, $r5, $p5, $astat, $lb1 | |
37 | printf "R6: %08x %-11i SP: %08x CC: %08x\n", $r6, $r6, $sp, $cc | |
38 | printf "R7: %08x %-11i USP: %08x CYC1: %08x SEQSTAT: %08x\n", $r7, $r7, $usp, $cycles, $seqstat | |
39 | printf "PC: %08x FP: %08x CYC2: %08x SYSCFG: %08x\n", $pc, $fp, $cycles2, $syscfg | |
40 | end | |
41 | document regs | |
42 | Usage: regs | |
43 | Display the common core registers in a compact format. | |
44 | end | |
45 | ||
46 | define all_regs | |
47 | regs | |
48 | printf " B0 : %08x L0 : %08x M0 : %08x I0 : %08x\n", $b0, $l0, $m0, $i0 | |
49 | printf " B1 : %08x L1 : %08x M1 : %08x I1 : %08x\n", $b1, $l1, $m1, $i1 | |
50 | printf " B2 : %08x L2 : %08x M2 : %08x I2 : %08x\n", $b2, $l2, $m2, $i2 | |
51 | printf " B3 : %08x L3 : %08x M3 : %08x I3 : %08x\n", $b3, $l3, $m3, $i3 | |
52 | printf "A0.w: %08x A0.x: %08x A1.w: %08x A1.x: %08x\n", $a0w, $a0x, $a1w, $a1x | |
53 | end | |
54 | document all_regs | |
55 | Usage: all_regs | |
56 | Display all core registers in a compact format. | |
57 | end | |
58 | ||
59 | define astat | |
60 | printf "ASTAT: %#x ( ", $astat | |
61 | if $astat & (1 << 25) | |
62 | printf "VS " | |
63 | end | |
64 | if $astat & (1 << 24) | |
65 | printf "V " | |
66 | end | |
67 | if $astat & (1 << 19) | |
68 | printf "AV1S " | |
69 | end | |
70 | if $astat & (1 << 18) | |
71 | printf "AV1 " | |
72 | end | |
73 | if $astat & (1 << 17) | |
74 | printf "AV0S " | |
75 | end | |
76 | if $astat & (1 << 16) | |
77 | printf "AV0 " | |
78 | end | |
79 | if $astat & (1 << 13) | |
80 | printf "AC1 " | |
81 | end | |
82 | if $astat & (1 << 12) | |
83 | printf "AC0 " | |
84 | end | |
85 | if $astat & (1 << 8) | |
86 | printf "RND_MOD " | |
87 | end | |
88 | if $astat & (1 << 6) | |
89 | printf "AQ " | |
90 | end | |
91 | if $astat & (1 << 5) | |
92 | printf "CC " | |
93 | end | |
94 | if $astat & (1 << 3) | |
95 | printf "V_COPY " | |
96 | end | |
97 | if $astat & (1 << 2) | |
98 | printf "AC0_COPY " | |
99 | end | |
100 | if $astat & (1 << 1) | |
101 | printf "AN " | |
102 | end | |
103 | if $astat & (1 << 0) | |
104 | printf "AZ " | |
105 | end | |
106 | printf ")\n" | |
107 | set $$inv = $astat & 0xfcf0ce90 | |
108 | if $$inv | |
109 | printf "Invalid bits: %#x\n", $$inv | |
110 | end | |
111 | end | |
112 | ||
113 | define seqstat | |
114 | if $argc == 1 | |
115 | set $$seqstat = $arg0 | |
116 | else | |
117 | set $$seqstat = $seqstat | |
118 | end | |
119 | set $$excause = ($$seqstat & 0x3f) | |
120 | set $$sftreset = ($$seqstat & (0x1 << 13)) >> 13 | |
121 | set $$hwerrcause = ($$seqstat & (0x1f << 14)) >> 14 | |
122 | printf "SEQSTAT: %08x\n", $$seqstat | |
123 | printf " EXCAUSE: 0x%x\t", $$excause | |
124 | if $$excause >= 0x0 && $$excause <= 0xf | |
125 | printf "(custom exception)" | |
126 | end | |
127 | if $$excause == 0x10 | |
128 | printf "(single step)" | |
129 | end | |
130 | if $$excause == 0x11 | |
131 | printf "(trace buffer full)" | |
132 | end | |
133 | if $$excause == 0x21 | |
134 | printf "(undef inst)" | |
135 | end | |
136 | if $$excause == 0x22 | |
137 | printf "(illegal inst)" | |
138 | end | |
139 | if $$excause == 0x23 | |
140 | printf "(dcplb prot violation)" | |
141 | end | |
142 | if $$excause == 0x24 | |
143 | printf "(misaligned data)" | |
144 | end | |
145 | if $$excause == 0x25 | |
146 | printf "(unrecoverable event)" | |
147 | end | |
148 | if $$excause == 0x26 | |
149 | printf "(dcplb miss)" | |
150 | end | |
151 | if $$excause == 0x27 | |
152 | printf "(multiple dcplb hit)" | |
153 | end | |
154 | if $$excause == 0x28 | |
155 | printf "(emulation watchpoint)" | |
156 | end | |
157 | if $$excause == 0x2a | |
158 | printf "(misaligned inst)" | |
159 | end | |
160 | if $$excause == 0x2b | |
161 | printf "(icplb prot violation)" | |
162 | end | |
163 | if $$excause == 0x2c | |
164 | printf "(icplb miss)" | |
165 | end | |
166 | if $$excause == 0x2d | |
167 | printf "(multiple icplb hit)" | |
168 | end | |
169 | if $$excause == 0x2e | |
170 | printf "(illegal use of supervisor resource)" | |
171 | end | |
172 | printf "\n" | |
173 | printf " SFTRESET: 0x%x\t(last reset was ", $$sftreset | |
174 | if $$sftreset == 0 | |
175 | printf "not " | |
176 | end | |
177 | printf "a software reset)\n" | |
178 | printf " HWERRCAUSE: 0x%x\t", $$hwerrcause | |
179 | if $$hwerrcause == 0x2 | |
180 | printf "(system mmr error)" | |
181 | end | |
182 | if $$hwerrcause == 0x3 | |
183 | printf "(external memory addressing error)" | |
184 | end | |
185 | if $$hwerrcause == 0x12 | |
186 | printf "(performance monitor overflow)" | |
187 | end | |
188 | if $$hwerrcause == 0x18 | |
189 | printf "(raise 5 instruction)" | |
190 | end | |
191 | printf "\n" | |
192 | end | |
193 | document seqstat | |
194 | Usage: seqstat [value=$seqstat] | |
195 | Parse the bits of the seqstat [value] into the human readable definitions. | |
196 | end | |
197 | ||
198 | define reset | |
199 | if $argc == 0 | |
200 | set $$l1 = 0xffa00000 | |
201 | else | |
202 | set $$l1 = $arg0 | |
203 | end | |
204 | set $$pc = $$l1 | |
205 | ||
206 | # SSYNC | |
207 | set *(unsigned short *)($$l1) = 0x0024 | |
208 | set $$l1 += 2 | |
209 | ||
210 | # P2.H = 0xffc0 | |
211 | set *(unsigned long *)($$l1) = 0xffc0e14a | |
212 | set $$l1 += 4 | |
213 | ||
214 | # P2.L = 0x100 | |
215 | set *(unsigned long *)($$l1) = 0x0100e10a | |
216 | set $$l1 += 4 | |
217 | ||
218 | # R0 = 0x7 (X) | |
219 | set *(unsigned short *)($$l1) = 0x6038 | |
220 | set $$l1 += 2 | |
221 | ||
222 | # [P2] = R0 | |
223 | set *(unsigned short *)($$l1) = 0x9310 | |
224 | set $$l1 += 2 | |
225 | ||
226 | # SSYNC | |
227 | set *(unsigned short *)($$l1) = 0x0024 | |
228 | set $$l1 += 2 | |
229 | ||
230 | # R0 = 0x0 (X) | |
231 | set *(unsigned short *)($$l1) = 0x6000 | |
232 | set $$l1 += 2 | |
233 | ||
234 | # [P2] = R0 | |
235 | set *(unsigned short *)($$l1) = 0x9310 | |
236 | set $$l1 += 2 | |
237 | ||
238 | # SSYNC | |
239 | set *(unsigned short *)($$l1) = 0x0024 | |
240 | set $$l1 += 2 | |
241 | ||
242 | # RAISE 0x1 | |
243 | set *(unsigned short *)($$l1) = 0x0091 | |
244 | set $$l1 += 2 | |
245 | ||
246 | # JUMP.S -0x18 | |
247 | if ($$l1 - $$pc) != 0x18 | |
248 | echo ERROR: jump.s has wrong offset | |
249 | else | |
250 | set $pc == $$pc | |
251 | end | |
252 | set *(unsigned short *)($$l1) = 0x2ff4 | |
253 | set $$l1 += 2 | |
254 | ||
255 | printf "Continuing.\n" | |
256 | continue | |
257 | end | |
258 | document reset | |
259 | Usage: reset [L1 Instruction address=0xffa00000] | |
260 | Cram the software reset code into [L1 Instruction address] and execute it. | |
261 | This will perform both a system reset and a core reset. | |
262 | end | |
263 | ||
264 | define hwtrace_on | |
265 | set $$TBUFCTL = (unsigned long *)0xFFE06000 | |
266 | set *$$TBUFCTL = 0x3 | |
267 | end | |
268 | define hwtrace_off | |
269 | set $$TBUFCTL = (unsigned long *)0xFFE06000 | |
270 | set *$$TBUFCTL = 0x1 | |
271 | end | |
272 | define hwtrace | |
273 | set $$TBUFSTAT = (unsigned long *)0xFFE06004 | |
274 | set $$TBUF = (unsigned long *)0xFFE06100 | |
275 | set $$i = 0 | |
276 | if (!(*$$TBUFSTAT & 0x1F)) | |
277 | printf "Hardware trace buffer is empty\n" | |
278 | end | |
279 | while (*$$TBUFSTAT & 0x1F) | |
280 | printf "%2i Target: ", $$i | |
281 | output/a *$$TBUF | |
282 | printf "\n" | |
283 | printf " Source: " | |
284 | output/a *$$TBUF | |
285 | printf "\n" | |
286 | set $$i++ | |
287 | end | |
288 | end | |
289 | document hwtrace | |
290 | Usage: hwtrace | |
291 | Dump the hardware trace buffer. Remember, this is a destructive operation, | |
292 | so it can only be dumped once. | |
293 | end | |
294 | ||
295 | define show_clocks | |
296 | printf "PLL_LOCKCNT: 0x%04x\n", *(unsigned short *)0xFFC00010 | |
297 | printf "VR_CTL: 0x%04x\n", *(unsigned short *)0xFFC00008 | |
298 | printf "PLL_DIV: 0x%04x\n", *(unsigned short *)0xFFC00004 | |
299 | printf "PLL_CTL: 0x%04x\n", *(unsigned short *)0xFFC00000 | |
300 | end | |
301 | ||
302 | define show_sdram | |
303 | printf "SDRRC: 0x%04x\n", *(unsigned short *)0xFFC00A18 | |
304 | ||
305 | set $$SDBCTL = *(unsigned short *)0xFFC00A14 | |
306 | set $$EBCAW = ($$SDBCTL & 0x30) >> 4 | |
307 | set $$EBSZ = ($$SDBCTL & 0xe) >> 1 | |
308 | printf "SDBCTL: 0x%04x ", $$SDBCTL | |
309 | if ($$SDBCTL & 0x1) | |
310 | printf "(enabled) " | |
311 | else | |
312 | printf "(disabled) " | |
313 | end | |
314 | if $$EBCAW == 0x0 | |
315 | printf "(8-bit) " | |
316 | end | |
317 | if $$EBCAW == 0x1 | |
318 | printf "(9-bit) " | |
319 | end | |
320 | if $$EBCAW == 0x2 | |
321 | printf "(10-bit) " | |
322 | end | |
323 | if $$EBCAW == 0x3 | |
324 | printf "(11-bit) " | |
325 | end | |
326 | if $$EBSZ == 0x0 | |
327 | printf "(16MB)" | |
328 | end | |
329 | if $$EBSZ == 0x1 | |
330 | printf "(32MB)" | |
331 | end | |
332 | if $$EBSZ == 0x2 | |
333 | printf "(64MB)" | |
334 | end | |
335 | if $$EBSZ == 0x3 | |
336 | printf "(128MB)" | |
337 | end | |
338 | if $$EBSZ == 0x4 | |
339 | printf "(256MB)" | |
340 | end | |
341 | if $$EBSZ == 0x5 | |
342 | printf "(512MB)" | |
343 | end | |
344 | printf "\n" | |
345 | ||
346 | set $$SDSTAT = *(unsigned short *)0xFFC00A1C | |
347 | printf "SDSTAT: 0x%04x ", $$SDSTAT | |
348 | if ($$SDSTAT & (1 << 0)) | |
349 | printf "(idle) " | |
350 | else | |
351 | printf "(busy) " | |
352 | end | |
353 | if ($$SDSTAT & (1 << 1)) | |
354 | printf "(self-refresh) " | |
355 | end | |
356 | if ($$SDSTAT & (1 << 2)) | |
357 | printf "(powerup) " | |
358 | end | |
359 | if ($$SDSTAT & (1 << 3)) | |
360 | printf "(will power up) " | |
361 | end | |
362 | if ($$SDSTAT & (1 << 4)) | |
363 | printf "(EAB error) " | |
364 | end | |
365 | printf "\n" | |
366 | ||
367 | printf "SDGCTL: 0x%08x\n", *(unsigned long *)0xFFC00A10 | |
368 | end | |
369 | ||
370 | define show_ddr | |
371 | printf "DDRCTL0: 0x%08x\n", *(unsigned long *)0xFFC00A20 | |
372 | printf "DDRCTL1: 0x%08x\n", *(unsigned long *)0xFFC00A24 | |
373 | printf "DDRCTL2: 0x%08x\n", *(unsigned long *)0xFFC00A28 | |
374 | printf "DDRCTL3: 0x%08x\n", *(unsigned long *)0xFFC00A2C | |
375 | printf "DDRQUE: 0x%08x\n", *(unsigned long *)0xFFC00A30 | |
376 | printf "ERRADD: " | |
377 | output/a *(unsigned long *)0xFFC00A34 | |
378 | printf "\n" | |
379 | ||
380 | set $$ERRMST = *(unsigned short *)0xFFC00A38 | |
381 | printf "ERRMST: 0x%04x ( ", $$ERRMST | |
382 | if ($$ERRMST & (1 << 7)) | |
383 | printf "core_merror " | |
384 | end | |
385 | if ($$ERRMST & (1 << 6)) | |
386 | printf "deb2_merror " | |
387 | end | |
388 | if ($$ERRMST & (1 << 5)) | |
389 | printf "deb1_merror " | |
390 | end | |
391 | if ($$ERRMST & (1 << 4)) | |
392 | printf "deb0_merror " | |
393 | end | |
394 | if ($$ERRMST & (1 << 3)) | |
395 | printf "core_error " | |
396 | end | |
397 | if ($$ERRMST & (1 << 2)) | |
398 | printf "deb2_error " | |
399 | end | |
400 | if ($$ERRMST & (1 << 1)) | |
401 | printf "deb1_error " | |
402 | end | |
403 | if ($$ERRMST & (1 << 0)) | |
404 | printf "deb0_error " | |
405 | end | |
406 | printf ")\n" | |
407 | ||
408 | set $$RSTCTL = *(unsigned short *)0xFFC00A3C | |
409 | printf "RSTCTL: 0x%04x ( ", $$RSTCTL | |
410 | if ($$RSTCTL & (1 << 4)) | |
411 | printf "srack " | |
412 | end | |
413 | if ($$RSTCTL & (1 << 3)) | |
414 | printf "srreq " | |
415 | end | |
416 | if (!($$RSTCTL & (1 << 1))) | |
417 | printf "!!! ERROR: bit 1 needs to be 1, but it is 0 !!! " | |
418 | end | |
419 | if ($$RSTCTL & (1 << 0)) | |
420 | printf "ddr_sreset " | |
421 | end | |
422 | printf ")\n" | |
423 | end | |
424 | ||
425 | define show_ebiu | |
426 | printf "EBIU_AMGCTL: 0x%04x\n", *(unsigned short *)0xFFC00A00 | |
427 | printf "EBIU_AMBCTL0: 0x%08x\n", *(unsigned long *)0xFFC00A04 | |
428 | printf "EBIU_AMBCTL1: 0x%08x\n", *(unsigned long *)0xFFC00A08 | |
429 | printf "EBIU_MBSCTL: 0x%08x\n", *(unsigned long *)0xFFC00A0C | |
430 | ||
431 | set $$EBIU_ARBSTAT = *(unsigned long *)0xFFC00A10 | |
432 | printf "EBIU_ARBSTAT: 0x%08x ( ", $$EBIU_ARBSTAT | |
433 | if ($$EBIU_ARBSTAT & (1 << 1)) | |
434 | printf "bgstat " | |
435 | end | |
436 | if ($$EBIU_ARBSTAT & (1 << 0)) | |
437 | printf "arbstat " | |
438 | end | |
439 | printf ")\n" | |
440 | ||
441 | printf "EBIU_MODE: 0x%08x\n", *(unsigned long *)0xFFC00A14 | |
442 | printf "EBIU_FCTL: 0x%08x\n", *(unsigned long *)0xFFC00A18 | |
443 | end | |
444 | ||
445 | define _show_cec | |
446 | set $$cec = *(unsigned long *)$arg0 | |
447 | printf "0x%08x: ", $$cec | |
448 | if ($$cec & (1 << 0)) | |
449 | printf "EMU " | |
450 | else | |
451 | printf " " | |
452 | end | |
453 | if ($$cec & (1 << 1)) | |
454 | printf "RST " | |
455 | else | |
456 | printf " " | |
457 | end | |
458 | if ($$cec & (1 << 2)) | |
459 | printf "NMI " | |
460 | else | |
461 | printf " " | |
462 | end | |
463 | if ($$cec & (1 << 3)) | |
464 | printf "EVX " | |
465 | else | |
466 | printf " " | |
467 | end | |
468 | if ($$cec & (1 << 4)) | |
469 | printf "GBL " | |
470 | else | |
471 | printf " " | |
472 | end | |
473 | if ($$cec & (1 << 5)) | |
474 | printf "HW " | |
475 | else | |
476 | printf " " | |
477 | end | |
478 | if ($$cec & (1 << 6)) | |
479 | printf "TMR " | |
480 | else | |
481 | printf " " | |
482 | end | |
483 | set $$ceci = 7 | |
484 | while ($$ceci < 16) | |
485 | if ($$cec & (1 << $$ceci)) | |
486 | printf "G%i ", $$ceci | |
487 | else | |
488 | printf " " | |
489 | if ($$ceci > 9) | |
490 | printf " " | |
491 | end | |
492 | end | |
493 | set $$ceci = $$ceci + 1 | |
494 | end | |
495 | printf "\n" | |
496 | end | |
497 | define show_cec | |
498 | printf "IMASK: " | |
499 | _show_cec 0xFFE02104 | |
500 | printf "IPEND: " | |
501 | _show_cec 0xFFE02108 | |
502 | printf "ILAT: " | |
503 | _show_cec 0xFFE0210C | |
504 | ||
505 | set $$EVT = 0xFFE02000 | |
506 | set $$EVTi = 0 | |
507 | while ($$EVTi < 16) | |
508 | printf "EVT%-2i ", $$EVTi | |
509 | output/a *(unsigned long *)($$EVT + $$EVTi * 4) | |
510 | printf "\n" | |
511 | set $$EVTi = $$EVTi + 1 | |
512 | end | |
513 | end | |
514 | ||
515 | define _show_cplbs | |
516 | set $$addr = $arg0 | |
517 | set $$data = $arg1 | |
518 | set $$i = 0 | |
519 | while ($$i < 16) | |
520 | set $$data_val = *(unsigned long *)($$data + $$i * 4) | |
521 | printf " 0x%08x 0x%08x ( ", *(unsigned long *)($$addr + $$i * 4), $$data_val | |
522 | if (($$data_val & (0x3 << 16)) == (0x0 << 16)) | |
523 | printf "1K " | |
524 | end | |
525 | if (($$data_val & (0x3 << 16)) == (0x1 << 16)) | |
526 | printf "4K " | |
527 | end | |
528 | if (($$data_val & (0x3 << 16)) == (0x2 << 16)) | |
529 | printf "1M " | |
530 | end | |
531 | if (($$data_val & (0x3 << 16)) == (0x3 << 16)) | |
532 | printf "4M " | |
533 | end | |
534 | if ($$data_val & (0x1 << 14)) | |
535 | printf "wt " | |
536 | else | |
537 | printf "wb " | |
538 | end | |
539 | if ($$data_val & (0x1 << 7)) | |
540 | printf "dirty " | |
541 | end | |
542 | if ($$data_val & (0x1 << 4)) | |
543 | printf "supv-wr " | |
544 | end | |
545 | if ($$data_val & (0x1 << 3)) | |
546 | printf "user-wr " | |
547 | end | |
548 | if ($$data_val & (0x1 << 2)) | |
549 | printf "user-rd " | |
550 | end | |
551 | if ($$data_val & (0x1 << 1)) | |
552 | printf "locked " | |
553 | end | |
554 | if ($$data_val & (0x1 << 0)) | |
555 | printf "valid " | |
556 | else | |
557 | printf "invalid " | |
558 | end | |
559 | printf ")\n" | |
560 | set $$i = $$i + 1 | |
561 | end | |
562 | end | |
563 | define show_icplbs | |
564 | set $$IMEM_CONTROL = 0xFFE01004 | |
565 | printf "ICPLBS (0x%08x)\n", *(unsigned long *)$$IMEM_CONTROL | |
566 | _show_cplbs 0xFFE01100 0xFFE01200 | |
567 | end | |
568 | define show_dcplbs | |
569 | set $$DMEM_CONTROL = 0xFFE00004 | |
570 | printf "DCPLBS (0x%08x)\n", *(unsigned long *)$$DMEM_CONTROL | |
571 | _show_cplbs 0xFFE00100 0xFFE00200 | |
572 | end | |
573 | define show_cplbs | |
574 | show_icplbs | |
575 | show_dcplbs | |
576 | end | |
577 | ||
578 | define _show_cplbstatus | |
579 | set $$CPLB_STATUS = *(unsigned long *)$arg0 | |
580 | printf " STATUS = 0x%08x ( ", $$CPLB_STATUS | |
581 | if ($$CPLB_STATUS & (1 << 19)) | |
582 | printf "illaddr " | |
583 | end | |
584 | if ($$CPLB_STATUS & (1 << 18)) | |
585 | printf "dag1 " | |
586 | else | |
587 | printf "dag0 " | |
588 | end | |
589 | if ($$CPLB_STATUS & (1 << 17)) | |
590 | printf "super " | |
591 | else | |
592 | printf "user " | |
593 | end | |
594 | if ($$CPLB_STATUS & (1 << 16)) | |
595 | printf "write " | |
596 | else | |
597 | printf "read " | |
598 | end | |
599 | set $$i = 15 | |
600 | while ($$i >= 0) | |
601 | if ($$CPLB_STATUS & (1 << $$i)) | |
602 | printf "%i ", $$i | |
603 | end | |
604 | set $$i-- | |
605 | end | |
606 | printf ")\n" | |
607 | ||
608 | set $$CPLB_FAULT_ADDR = *(unsigned long *)$arg1 | |
609 | printf " FAULT_ADDR = " | |
610 | output/a $$CPLB_FAULT_ADDR | |
611 | printf "\n" | |
612 | end | |
613 | define show_icplbstatus | |
614 | printf "ICPLB Status\n" | |
615 | _show_cplbstatus 0xFFE01008 0xFFE0100C | |
616 | end | |
617 | define show_dcplbstatus | |
618 | printf "DCPLB Status\n" | |
619 | _show_cplbstatus 0xFFE00008 0xFFE0000C | |
620 | end | |
621 | define show_cplbstatus | |
622 | seqstat | |
623 | show_icplbstatus | |
624 | show_dcplbstatus | |
625 | end | |
626 | ||
627 | define safe_regs | |
628 | set $r0 = $r1 = $r2 = $r3 = $r4 = $r5 = $r6 = $r7 = 0xffb00000 | |
629 | set $sp = $fp = $usp = $r0 + 0x100 | |
630 | set $p0 = $p1 = $p2 = $p3 = $p4 = $p5 = 0xffa00000 | |
631 | set $pc = $rets = $reti = $retx = $retn = $p0 | |
632 | set $lt0 = $lt1 = $lb0 = $lb1 = 1 | |
633 | set $lc0 = $lc1 = 0 | |
634 | set $i0 = $i1 = $i2 = $i3 = $r0 | |
635 | set $b0 = $b1 = $b2 = $b3 = $r0 | |
636 | set $l0 = $l1 = $l2 = $l3 = $r0 | |
637 | set $m0 = $m1 = $m2 = $m3 = $r0 | |
638 | end | |
639 | ||
640 | define _show_dma | |
641 | set $$DMA_BASE = $arg0 | |
642 | set $$NEXT_DESC_PTR = *(unsigned long *) ($$DMA_BASE + 0x00) | |
643 | set $$START_ADDR = *(unsigned long *) ($$DMA_BASE + 0x04) | |
644 | set $$CONFIG = *(unsigned short *) ($$DMA_BASE + 0x08) | |
645 | set $$X_COUNT = *(unsigned short *) ($$DMA_BASE + 0x10) | |
646 | set $$X_MODIFY = *(unsigned short *) ($$DMA_BASE + 0x14) | |
647 | set $$Y_COUNT = *(unsigned short *) ($$DMA_BASE + 0x18) | |
648 | set $$Y_MODIFY = *(unsigned short *) ($$DMA_BASE + 0x1C) | |
649 | set $$CURR_DESC_PTR = *(unsigned long *) ($$DMA_BASE + 0x20) | |
650 | set $$CURR_ADDR = *(unsigned long *) ($$DMA_BASE + 0x24) | |
651 | set $$IRQ_STATUS = *(unsigned short *) ($$DMA_BASE + 0x28) | |
652 | set $$CURR_X_COUNT = *(unsigned short *) ($$DMA_BASE + 0x30) | |
653 | set $$CURR_Y_COUNT = *(unsigned short *) ($$DMA_BASE + 0x38) | |
654 | printf "desc: curr: 0x%08x next: 0x%08x\n", $$CURR_DESC_PTR, $$NEXT_DESC_PTR | |
655 | printf "addr: curr: 0x%08x start: 0x%08x\n", $$CURR_ADDR, $$START_ADDR | |
656 | printf "X: curr: 0x%04x count: 0x%04x mod: 0x%04x (%i)\n", $$CURR_X_COUNT, $$X_COUNT, $$X_MODIFY, (short)$$X_MODIFY | |
657 | printf "Y: curr: 0x%04x count: 0x%04x mod: 0x%04x (%i)\n", $$CURR_Y_COUNT, $$Y_COUNT, $$Y_MODIFY, (short)$$Y_MODIFY | |
658 | printf "dma config: 0x%04x (", $$CONFIG | |
659 | if ($$CONFIG & (1 << 0)) | |
660 | printf "enabled " | |
661 | else | |
662 | printf "disabled " | |
663 | end | |
664 | if ($$CONFIG & (0x1 << 1)) | |
665 | printf "write " | |
666 | else | |
667 | printf "read " | |
668 | end | |
669 | set $$WDSIZE = ($$CONFIG & (0x3 << 2)) >> 2 | |
670 | if ($$WDSIZE == 0x3) | |
671 | printf "WDSIZE:INVALID " | |
672 | end | |
673 | if ($$WDSIZE == 0x2) | |
674 | printf "32-bit " | |
675 | end | |
676 | if ($$WDSIZE == 0x1) | |
677 | printf "16-bit " | |
678 | end | |
679 | if ($$WDSIZE == 0x0) | |
680 | printf "8-bit " | |
681 | end | |
682 | if ($$CONFIG & (0x1 << 4)) | |
683 | printf "2D " | |
684 | else | |
685 | printf "1D " | |
686 | end | |
687 | if ($$CONFIG & (0x1 << 5)) | |
688 | printf "sync " | |
689 | end | |
690 | if ($$CONFIG & (0x1 << 6)) | |
691 | printf "di_sel " | |
692 | end | |
693 | if ($$CONFIG & (0x1 << 7)) | |
694 | printf "interrupt " | |
695 | end | |
696 | set $$NDSIZE = ($$CONFIG & (0xF << 8)) >> 8 | |
697 | if ($$NDSIZE > 0 && $$NDSIZE < 10) | |
698 | printf "NDSIZE_%i ", $$NDSIZE | |
699 | end | |
700 | if ($$NDSIZE >= 10) | |
701 | printf "NDSIZE:INVALID:%i ", $$NDSIZE | |
702 | end | |
703 | set $$FLOW = ($$CONFIG & (0x7 << 12)) >> 12 | |
704 | if ($$FLOW == 0) | |
705 | printf "stop" | |
706 | else | |
707 | if ($$FLOW == 1) | |
708 | printf "autobuffer" | |
709 | else | |
710 | if ($$FLOW == 4) | |
711 | printf "descriptor_array" | |
712 | else | |
713 | if ($$FLOW == 6) | |
714 | printf "descriptor_list_small" | |
715 | else | |
716 | if ($$FLOW == 7) | |
717 | printf "descriptor_list_large" | |
718 | else | |
719 | printf "FLOW:INVALID:%i", $$FLOW | |
720 | end | |
721 | end | |
722 | end | |
723 | end | |
724 | end | |
725 | printf ")\n" | |
726 | printf "irq status: 0x%04x (", $$IRQ_STATUS | |
727 | if ($$IRQ_STATUS & (0x1 << 0)) | |
728 | printf "done " | |
729 | end | |
730 | if ($$IRQ_STATUS & (0x1 << 1)) | |
731 | printf "err " | |
732 | end | |
733 | if ($$IRQ_STATUS & (0x1 << 2)) | |
734 | printf "dfetch " | |
735 | end | |
736 | if ($$IRQ_STATUS & (0x1 << 3)) | |
737 | printf "run " | |
738 | end | |
739 | printf ")\n" | |
740 | end | |
741 | ||
742 | define show_ctimer | |
743 | set $$CTIMER = 0xFFE03000 | |
744 | set $$TCNTL = *(unsigned long *) ($$CTIMER + 0x0) | |
745 | set $$TPERIOD = *(unsigned long *) ($$CTIMER + 0x4) | |
746 | set $$TSCALE = *(unsigned long *) ($$CTIMER + 0x8) | |
747 | set $$TCOUNT = *(unsigned long *) ($$CTIMER + 0xC) | |
748 | printf "TCNTL: %#x ( ", $$TCNTL | |
749 | if ($$TCNTL & (1 << 0)) | |
750 | printf "power " | |
751 | end | |
752 | if ($$TCNTL & (1 << 1)) | |
753 | printf "enable " | |
754 | end | |
755 | if ($$TCNTL & (1 << 2)) | |
756 | printf "autoreload " | |
757 | end | |
758 | if ($$TCNTL & (1 << 3)) | |
759 | printf "int-enabled " | |
760 | end | |
761 | printf ")\n" | |
762 | printf "TPERIOD: %#x\n", $$TPERIOD | |
763 | printf "TSCALE: %#x\n", $$TSCALE | |
764 | printf "TCOUNT: %#x\n", $$TCOUNT | |
765 | end | |
766 | ||
767 | define show_spi | |
768 | if $argc > 0 | |
769 | set $$SPI_BASE = $arg0 | |
770 | else | |
771 | set $$SPI_BASE = 0xFFC00500 | |
772 | end | |
773 | set $$SPI_BAUD = *(unsigned short *) ($$SPI_BASE + 0x14) | |
774 | set $$SPI_CTL = *(unsigned short *) ($$SPI_BASE + 0x00) | |
775 | set $$SPI_FLG = *(unsigned short *) ($$SPI_BASE + 0x04) | |
776 | set $$SPI_STAT = *(unsigned short *) ($$SPI_BASE + 0x08) | |
777 | set $$SPI_TDBR = *(unsigned short *) ($$SPI_BASE + 0x0C) | |
778 | set $$SPI_RDBR = *(unsigned short *) ($$SPI_BASE + 0x10) | |
779 | set $$SPI_SHAD = *(unsigned short *) ($$SPI_BASE + 0x18) | |
780 | printf "BAUD: %04x (%i)\n", $$SPI_BAUD, $$SPI_BAUD | |
781 | printf "CTL: %04x (", $$SPI_CTL | |
782 | set $$TIMOD = $$SPI_CTL & 0x3 | |
783 | printf "timod:%i ", $$TIMOD | |
784 | if ($$SPI_CTL & (1 << 2)) | |
785 | printf "sz " | |
786 | end | |
787 | if ($$SPI_CTL & (1 << 3)) | |
788 | printf "gm " | |
789 | end | |
790 | if ($$SPI_CTL & (1 << 4)) | |
791 | printf "psse " | |
792 | end | |
793 | if ($$SPI_CTL & (1 << 5)) | |
794 | printf "emiso " | |
795 | end | |
796 | if ($$SPI_CTL & (1 << 8)) | |
797 | printf "16bit " | |
798 | else | |
799 | printf "8bit " | |
800 | end | |
801 | if ($$SPI_CTL & (1 << 9)) | |
802 | printf "lsbf " | |
803 | end | |
804 | if ($$SPI_CTL & (1 << 10)) | |
805 | printf "cpol " | |
806 | end | |
807 | if ($$SPI_CTL & (1 << 11)) | |
808 | printf "cpha " | |
809 | end | |
810 | if ($$SPI_CTL & (1 << 12)) | |
811 | printf "mstr " | |
812 | else | |
813 | printf "slave " | |
814 | end | |
815 | if ($$SPI_CTL & (1 << 13)) | |
816 | printf "wom " | |
817 | end | |
818 | if ($$SPI_CTL & (1 << 14)) | |
819 | printf "enabled" | |
820 | else | |
821 | printf "disabled" | |
822 | end | |
823 | printf ")\n" | |
824 | printf "STAT: %04x (", $$SPI_STAT | |
825 | if ($$SPI_STAT & (1 << 0)) | |
826 | printf "spif " | |
827 | end | |
828 | if ($$SPI_STAT & (1 << 1)) | |
829 | printf "modf " | |
830 | end | |
831 | if ($$SPI_STAT & (1 << 2)) | |
832 | printf "txe " | |
833 | end | |
834 | if ($$SPI_STAT & (1 << 3)) | |
835 | printf "txs " | |
836 | end | |
837 | if ($$SPI_STAT & (1 << 4)) | |
838 | printf "rbsy " | |
839 | end | |
840 | if ($$SPI_STAT & (1 << 5)) | |
841 | printf "rxs " | |
842 | end | |
843 | if ($$SPI_STAT & (1 << 6)) | |
844 | printf "txcol " | |
845 | end | |
846 | printf ")\n" | |
847 | printf "FLG: %04x\n", $$SPI_FLG | |
848 | printf "TDBR: %04x RDBR: %04x\n", $$SPI_TDBR, $$SPI_SHAD | |
849 | end | |
850 | ||
851 | define show_uart_lcr | |
852 | set $$LCR = $arg0 | |
853 | printf "LCR: 0x%02x ( ", $$LCR | |
854 | set $$WLS = $$LCR & 0x3 | |
855 | if ($$WLS == 0) | |
856 | printf "5-bit " | |
857 | end | |
858 | if ($$WLS == 1) | |
859 | printf "6-bit " | |
860 | end | |
861 | if ($$WLS == 2) | |
862 | printf "7-bit " | |
863 | end | |
864 | if ($$WLS == 3) | |
865 | printf "8-bit " | |
866 | end | |
867 | if ($$LCR & (1 << 2)) | |
868 | printf "stb " | |
869 | end | |
870 | if ($$LCR & (1 << 3)) | |
871 | printf "pen " | |
872 | end | |
873 | if ($$LCR & (1 << 4)) | |
874 | printf "eps " | |
875 | end | |
876 | if ($$LCR & (1 << 5)) | |
877 | printf "stp " | |
878 | end | |
879 | if ($$LCR & (1 << 6)) | |
880 | printf "sb " | |
881 | end | |
882 | printf ")\n" | |
883 | end | |
884 | ||
885 | define show_uart_lsr | |
886 | set $$LSR = $arg0 | |
887 | printf "LSR: 0x%02x ( ", $$LSR | |
888 | if ($$LSR & (1 << 0)) | |
889 | printf "dr " | |
890 | end | |
891 | if ($$LSR & (1 << 1)) | |
892 | printf "oe " | |
893 | end | |
894 | if ($$LSR & (1 << 2)) | |
895 | printf "pe " | |
896 | end | |
897 | if ($$LSR & (1 << 3)) | |
898 | printf "fe " | |
899 | end | |
900 | if ($$LSR & (1 << 4)) | |
901 | printf "bi " | |
902 | end | |
903 | if ($$LSR & (1 << 5)) | |
904 | printf "thre " | |
905 | end | |
906 | if ($$LSR & (1 << 6)) | |
907 | printf "temt " | |
908 | end | |
909 | if ($$LSR & (1 << 7)) | |
910 | printf "tfi " | |
911 | end | |
912 | printf ")\n" | |
913 | end | |
914 | ||
915 | define show_uart_ier | |
916 | set $$IER = $arg0 | |
917 | printf "IER: 0x%02x ( ", $$IER | |
918 | if ($$IER & (1 << 0)) | |
919 | printf "erbfi " | |
920 | end | |
921 | if ($$IER & (1 << 1)) | |
922 | printf "etbei " | |
923 | end | |
924 | if ($$IER & (1 << 2)) | |
925 | printf "elsi " | |
926 | end | |
927 | if ($$IER & (1 << 3)) | |
928 | printf "edssi " | |
929 | end | |
930 | if ($$IER & (1 << 4)) | |
931 | printf "edtpti " | |
932 | end | |
933 | if ($$IER & (1 << 5)) | |
934 | printf "etfi " | |
935 | end | |
936 | if ($$IER & (1 << 6)) | |
937 | printf "erfci " | |
938 | end | |
939 | printf ")\n" | |
940 | end | |
941 | ||
942 | define show_uart_mcr | |
943 | set $$MCR = $arg0 | |
944 | printf "MCR: 0x%02x ( ", $$MCR | |
945 | if ($$MCR & (1 << 0)) | |
946 | printf "xoff " | |
947 | end | |
948 | if ($$MCR & (1 << 1)) | |
949 | printf "mrts " | |
950 | end | |
951 | if ($$MCR & (1 << 2)) | |
952 | printf "rfit " | |
953 | end | |
954 | if ($$MCR & (1 << 3)) | |
955 | printf "rfrt " | |
956 | end | |
957 | if ($$MCR & (1 << 4)) | |
958 | printf "loop_ena " | |
959 | end | |
960 | if ($$MCR & (1 << 5)) | |
961 | printf "fcpol " | |
962 | end | |
963 | if ($$MCR & (1 << 6)) | |
964 | printf "arts " | |
965 | end | |
966 | if ($$MCR & (1 << 7)) | |
967 | printf "acts " | |
968 | end | |
969 | printf ")\n" | |
970 | end | |
971 | ||
972 | define show_uart_msr | |
973 | set $$MSR = $arg0 | |
974 | printf "MSR: 0x%02x ( ", $$MSR | |
975 | if ($$MSR & (1 << 0)) | |
976 | printf "scts " | |
977 | end | |
978 | if ($$MSR & (1 << 4)) | |
979 | printf "cts " | |
980 | end | |
981 | if ($$MSR & (1 << 5)) | |
982 | printf "rfcs " | |
983 | end | |
984 | printf ")\n" | |
985 | end | |
986 | ||
987 | define show_uart_gctl | |
988 | set $$GCTL = $arg0 | |
989 | printf "GCTL: 0x%02x ( ", $$GCTL | |
990 | if ($$GCTL & (1 << 0)) | |
991 | printf "ucen " | |
992 | end | |
993 | if ($$GCTL & (1 << 1)) | |
994 | printf "iren " | |
995 | end | |
996 | if ($$GCTL & (1 << 2)) | |
997 | printf "tpolc " | |
998 | end | |
999 | if ($$GCTL & (1 << 3)) | |
1000 | printf "rpolc " | |
1001 | end | |
1002 | if ($$GCTL & (1 << 4)) | |
1003 | printf "fpe " | |
1004 | end | |
1005 | if ($$GCTL & (1 << 5)) | |
1006 | printf "ffe " | |
1007 | end | |
1008 | if ($$GCTL & (1 << 6)) | |
1009 | printf "edbo " | |
1010 | end | |
1011 | if ($$GCTL & (1 << 7)) | |
1012 | printf "eglsi " | |
1013 | end | |
1014 | printf ")\n" | |
1015 | end | |
1016 | ||
1017 | define show_uart | |
1018 | if $argc > 0 | |
1019 | set $$UART_BASE = $arg0 | |
1020 | else | |
1021 | set $$UART_BASE = 0xffc00400 | |
1022 | end | |
1023 | set $$UART_DLL = (unsigned short *) ($$UART_BASE + 0x00) | |
1024 | set $$UART_RBR = (unsigned short *) ($$UART_BASE + 0x00) | |
1025 | set $$UART_DLH = (unsigned short *) ($$UART_BASE + 0x04) | |
1026 | set $$UART_IER = (unsigned short *) ($$UART_BASE + 0x04) | |
1027 | set $$UART_IIR = (unsigned short *) ($$UART_BASE + 0x08) | |
1028 | set $$UART_LCR = (unsigned short *) ($$UART_BASE + 0x0C) | |
1029 | set $$UART_MCR = (unsigned short *) ($$UART_BASE + 0x10) | |
1030 | set $$UART_LSR = (unsigned short *) ($$UART_BASE + 0x14) | |
1031 | set $$UART_MSR = (unsigned short *) ($$UART_BASE + 0x18) | |
1032 | set $$UART_SCR = (unsigned short *) ($$UART_BASE + 0x1C) | |
1033 | set $$UART_GCTL = (unsigned short *) ($$UART_BASE + 0x24) | |
1034 | ||
1035 | set $$DLAB = (1 << 7) | |
1036 | set $$LCR = *$$UART_LCR | |
1037 | set *$$UART_LCR = ($$LCR | $$DLAB) | |
1038 | printf "DLL: 0x%02x DLH: 0x%02x\n", *$$UART_DLL, *$$UART_DLH | |
1039 | set *$$UART_LCR = $$LCR & ~$$DLAB | |
1040 | printf "RBR: 0x%02x SCR: 0x%02x\n", *$$UART_RBR, *$$UART_SCR | |
1041 | set *$$UART_LCR = $$LCR | |
1042 | ||
1043 | printf "IIR: 0x%02x ", *$$UART_IIR | |
1044 | show_uart_ier *$$UART_IER | |
1045 | show_uart_lcr $$LCR | |
1046 | show_uart_mcr *$$UART_MCR | |
1047 | show_uart_lsr *$$UART_LSR | |
1048 | show_uart_msr *$$UART_MSR | |
1049 | show_uart_gctl *$$UART_GCTL | |
1050 | end | |
1051 | ||
1052 | define show_uart2 | |
1053 | if $argc > 0 | |
1054 | set $$UART_BASE = $arg0 | |
1055 | else | |
1056 | set $$UART_BASE = 0xffc00400 | |
1057 | end | |
1058 | set $$UART_DLL = (unsigned short *) ($$UART_BASE + 0x00) | |
1059 | set $$UART_DLH = (unsigned short *) ($$UART_BASE + 0x04) | |
1060 | set $$UART_GCTL = (unsigned short *) ($$UART_BASE + 0x08) | |
1061 | set $$UART_LCR = (unsigned short *) ($$UART_BASE + 0x0C) | |
1062 | set $$UART_MCR = (unsigned short *) ($$UART_BASE + 0x10) | |
1063 | set $$UART_LSR = (unsigned short *) ($$UART_BASE + 0x14) | |
1064 | set $$UART_MSR = (unsigned short *) ($$UART_BASE + 0x18) | |
1065 | set $$UART_SCR = (unsigned short *) ($$UART_BASE + 0x1C) | |
1066 | set $$UART_IER = (unsigned short *) ($$UART_BASE + 0x20) | |
1067 | set $$UART_RBR = (unsigned short *) ($$UART_BASE + 0x2C) | |
1068 | ||
1069 | printf "DLL: 0x%02x DLH: 0x%02x\n", *$$UART_DLL, *$$UART_DLH | |
1070 | printf "RBR: 0x%02x SCR: 0x%02x\n", *$$UART_RBR, *$$UART_SCR | |
1071 | ||
1072 | printf " " | |
1073 | show_uart_ier *$$UART_IER | |
1074 | show_uart_lcr *$$UART_LCR | |
1075 | show_uart_mcr *$$UART_MCR | |
1076 | show_uart_lsr *$$UART_LSR | |
1077 | show_uart_msr *$$UART_MSR | |
1078 | show_uart_gctl *$$UART_GCTL | |
1079 | end | |
1080 | ||
1081 | define show_uart4 | |
1082 | if $argc > 0 | |
1083 | set $$UART_BASE = $arg0 | |
1084 | else | |
1085 | set $$UART_BASE = 0xffc02000 | |
1086 | end | |
1087 | set $$UART_REVID = (unsigned long *) ($$UART_BASE + 0x00) | |
1088 | set $$UART_CTL = (unsigned long *) ($$UART_BASE + 0x04) | |
1089 | set $$UART_STAT = (unsigned long *) ($$UART_BASE + 0x08) | |
1090 | set $$UART_SCR = (unsigned long *) ($$UART_BASE + 0x0C) | |
1091 | set $$UART_CLK = (unsigned long *) ($$UART_BASE + 0x10) | |
1092 | set $$UART_IMASK = (unsigned long *) ($$UART_BASE + 0x14) | |
1093 | set $$UART_RBR = (unsigned long *) ($$UART_BASE + 0x20) | |
1094 | set $$UART_THR = (unsigned long *) ($$UART_BASE + 0x24) | |
1095 | set $$UART_TAIP = (unsigned long *) ($$UART_BASE + 0x28) | |
1096 | set $$UART_TSR = (unsigned long *) ($$UART_BASE + 0x2C) | |
1097 | set $$UART_RSR = (unsigned long *) ($$UART_BASE + 0x30) | |
1098 | set $$UART_TXCNT = (unsigned long *) ($$UART_BASE + 0x34) | |
1099 | set $$UART_RXCNT = (unsigned long *) ($$UART_BASE + 0x38) | |
1100 | ||
1101 | printf "REVID: 0x%08x SCR: 0x%08x\n", *$$UART_REVID, *$$UART_SCR | |
1102 | printf " CLK: 0x%08x TAIP: 0x%08x\n", *$$UART_CLK, *$$UART_TAIP | |
1103 | ||
1104 | set $$CTL = *$$UART_CTL | |
1105 | printf " CTL: 0x%08x ( ", $$CTL | |
1106 | if ($$CTL & (1 << 0)) | |
1107 | printf "uen " | |
1108 | end | |
1109 | if ($$CTL & (1 << 1)) | |
1110 | printf "loop_ena " | |
1111 | end | |
1112 | set $$UMOD = ($$CTL & (3 << 4)) >> 4 | |
1113 | printf "mode:" | |
1114 | if ($$UMOD == 0) | |
1115 | printf "uart " | |
1116 | end | |
1117 | if ($$UMOD == 1) | |
1118 | printf "mdb " | |
1119 | end | |
1120 | if ($$UMOD == 2) | |
1121 | printf "irda " | |
1122 | end | |
1123 | if ($$UMOD == 3) | |
1124 | printf "reserved " | |
1125 | end | |
1126 | set $$WLS = ($$CTL & (3 << 8)) >> 8 | |
1127 | printf "wls:" | |
1128 | if ($$WLS == 0) | |
1129 | printf "5" | |
1130 | end | |
1131 | if ($$WLS == 1) | |
1132 | printf "6 " | |
1133 | end | |
1134 | if ($$WLS == 2) | |
1135 | printf "7 " | |
1136 | end | |
1137 | if ($$WLS == 3) | |
1138 | printf "8 " | |
1139 | end | |
1140 | if ($$CTL & (1 << 12)) | |
1141 | printf "stb " | |
1142 | end | |
1143 | if ($$CTL & (1 << 13)) | |
1144 | printf "stbh " | |
1145 | end | |
1146 | if ($$CTL & (1 << 14)) | |
1147 | printf "pen " | |
1148 | end | |
1149 | if ($$CTL & (1 << 15)) | |
1150 | printf "eps " | |
1151 | end | |
1152 | if ($$CTL & (1 << 16)) | |
1153 | printf "stp " | |
1154 | end | |
1155 | if ($$CTL & (1 << 17)) | |
1156 | printf "fpe " | |
1157 | end | |
1158 | if ($$CTL & (1 << 18)) | |
1159 | printf "ffe " | |
1160 | end | |
1161 | if ($$CTL & (1 << 19)) | |
1162 | printf "sb " | |
1163 | end | |
1164 | if ($$CTL & (1 << 22)) | |
1165 | printf "fcpol " | |
1166 | end | |
1167 | if ($$CTL & (1 << 23)) | |
1168 | printf "rpolc " | |
1169 | end | |
1170 | if ($$CTL & (1 << 24)) | |
1171 | printf "tpolc " | |
1172 | end | |
1173 | if ($$CTL & (1 << 25)) | |
1174 | printf "mrts " | |
1175 | end | |
1176 | if ($$CTL & (1 << 26)) | |
1177 | printf "xoff " | |
1178 | end | |
1179 | if ($$CTL & (1 << 27)) | |
1180 | printf "arts " | |
1181 | end | |
1182 | if ($$CTL & (1 << 28)) | |
1183 | printf "acts " | |
1184 | end | |
1185 | if ($$CTL & (1 << 29)) | |
1186 | printf "rfit " | |
1187 | end | |
1188 | if ($$CTL & (1 << 30)) | |
1189 | printf "rfrt " | |
1190 | end | |
1191 | printf ")\n" | |
1192 | ||
1193 | set $$STAT = *$$UART_STAT | |
1194 | printf " STAT: 0x%08x ( ", $$STAT | |
1195 | if ($$STAT & (1 << 0)) | |
1196 | printf "dr " | |
1197 | end | |
1198 | if ($$STAT & (1 << 1)) | |
1199 | printf "oe " | |
1200 | end | |
1201 | if ($$STAT & (1 << 2)) | |
1202 | printf "pe " | |
1203 | end | |
1204 | if ($$STAT & (1 << 3)) | |
1205 | printf "fe " | |
1206 | end | |
1207 | if ($$STAT & (1 << 4)) | |
1208 | printf "bi " | |
1209 | end | |
1210 | if ($$STAT & (1 << 5)) | |
1211 | printf "thre " | |
1212 | end | |
1213 | if ($$STAT & (1 << 7)) | |
1214 | printf "temt " | |
1215 | end | |
1216 | if ($$STAT & (1 << 8)) | |
1217 | printf "tfi " | |
1218 | end | |
1219 | if ($$STAT & (1 << 9)) | |
1220 | printf "astky " | |
1221 | end | |
1222 | if ($$STAT & (1 << 10)) | |
1223 | printf "addr " | |
1224 | end | |
1225 | if ($$STAT & (1 << 11)) | |
1226 | printf "ro " | |
1227 | end | |
1228 | if ($$STAT & (1 << 12)) | |
1229 | printf "scts " | |
1230 | end | |
1231 | if ($$STAT & (1 << 16)) | |
1232 | printf "cts " | |
1233 | end | |
1234 | if ($$STAT & (1 << 17)) | |
1235 | printf "rfcs " | |
1236 | end | |
1237 | printf ")\n" | |
1238 | ||
1239 | printf "IMASK: 0x%08x\n", *$$UART_IMASK | |
1240 | printf " RSR: 0x%04x TSR: 0x%04x\n", *$$UART_RSR, *$$UART_TSR | |
1241 | printf " RBR: 0x%02x THR: 0x%02x\n", *$$UART_RBR, *$$UART_THR | |
1242 | printf "RXCNT: 0x%02x TXCNT: 0x%02x\n", *$$UART_RXCNT, *$$UART_TXCNT | |
1243 | end | |
1244 | ||
1245 | define _otp_save | |
1246 | set $$s_pc = $pc | |
1247 | set $$s_r0 = $r0 | |
1248 | set $$s_r1 = $r1 | |
1249 | set $$s_r2 = $r2 | |
1250 | set $$s_mm = (unsigned long *)0xFFB00000 | |
1251 | set $$s_m0 = $$s_mm[0] | |
1252 | set $$s_m1 = $$s_mm[1] | |
1253 | end | |
1254 | define _otp_restore | |
1255 | set $pc = $$s_pc | |
1256 | set $r0 = $$s_r0 | |
1257 | set $r1 = $$s_r1 | |
1258 | set $r2 = $$s_r2 | |
1259 | set $$s_mm[0] = $$s_m0 | |
1260 | set $$s_mm[1] = $$s_m1 | |
1261 | end | |
1262 | ||
1263 | define _otp_read | |
1264 | set $pc = 0xef00001a | |
1265 | set $r0 = $arg0 | |
1266 | set $r1 = $arg1 | |
1267 | set $r2 = 0xFFB00000 | |
1268 | ||
1269 | end | |
1270 | define otp_read | |
1271 | if $argc == 0 | |
1272 | set $$OTP_PAGE = 0 | |
1273 | else | |
1274 | set $$OTP_PAGE = $arg0 | |
1275 | end | |
1276 | ||
1277 | printf "OTP Page 0x%02x: ", $$OTP_PAGE | |
1278 | _otp_save | |
1279 | _otp_read $$OTP_PAGE, 0 | |
1280 | _otp_read $$OTP_PAGE, 1 | |
1281 | _otp_restore | |
1282 | end | |
1283 | ||
1284 | define otp_dump | |
1285 | _otp_save | |
1286 | set $$page = 0 | |
1287 | while $$page < 0xe0 | |
1288 | printf "0x%02x: ", $$page | |
1289 | _otp_read $$page, 0 | |
1290 | printf "%08x %08x ", $$OTP_PAGE_L, $$OTP_PAGE_H | |
1291 | _otp_read $$page, 1 | |
1292 | printf "%08x %08x ", $$OTP_PAGE_L, $$OTP_PAGE_H | |
1293 | $$page++ | |
1294 | end | |
1295 | _otp_restore | |
1296 | end | |
1297 | ||
1298 | ||
1299 | # | |
1300 | # Provide U-Boot-style functions in gdb | |
1301 | # | |
1302 | ||
1303 | define uboot_jtag_load | |
1304 | set remotetimeout 300 | |
1305 | load init.elf | |
1306 | continue | |
1307 | load u-boot | |
1308 | call memset(&_bss_vma, 0, &_bss_len) | |
1309 | continue | |
1310 | end |