6 set prompt
\e[30;1m(
\e[34;1mgdb
\e[30;1m)
\e[0m
11 #handle SIGINT nostop noprint pass
12 #handle SIGQUIT stop print nopass
26 target remote localhost:2000
31 target remote /dev/ttyS0
33 target remote /dev/tty$arg0
40 target remote udp:bfin:6443
43 target remote vapier:2000
46 target remote bfin:1234
51 disassemble $pc ($pc + 0x40)
54 disassemble $arg0 ($arg0 + 0x40)
62 disassemble $arg0,+0x40
71 # Misc Blackfin helper functions
75 printf "R0: %08x %-11i P0: %08x RETS: %08x LC0: %08x %u\n", $r0, $r0, $p0, $rets, $lc0, $lc0
76 printf "R1: %08x %-11i P1: %08x RETI: %08x LT0: %08x\n", $r1, $r1, $p1, $reti, $lt0
77 printf "R2: %08x %-11i P2: %08x RETX: %08x LB0: %08x\n", $r2, $r2, $p2, $retx, $lb0
78 printf "R3: %08x %-11i P3: %08x RETE: %08x LC1: %08x %u\n", $r3, $r3, $p3, $rete, $lc1, $lc1
79 printf "R4: %08x %-11i P4: %08x RETN: %08x LT1: %08x\n", $r4, $r4, $p4, $retn, $lt1
80 printf "R5: %08x %-11i P5: %08x ASTAT: %08x LB1: %08x\n", $r5, $r5, $p5, $astat, $lb1
81 printf "R6: %08x %-11i SP: %08x CC: %08x\n", $r6, $r6, $sp, $cc
82 printf "R7: %08x %-11i USP: %08x CYC1: %08x SEQSTAT: %08x\n", $r7, $r7, $usp, $cycles, $seqstat
83 printf "PC: %08x FP: %08x CYC2: %08x SYSCFG: %08x\n", $pc, $fp, $cycles2, $syscfg
87 Display the common core registers in a compact format.
92 printf " B0 : %08x L0 : %08x M0 : %08x I0 : %08x\n", $b0, $l0, $m0, $i0
93 printf " B1 : %08x L1 : %08x M1 : %08x I1 : %08x\n", $b1, $l1, $m1, $i1
94 printf " B2 : %08x L2 : %08x M2 : %08x I2 : %08x\n", $b2, $l2, $m2, $i2
95 printf " B3 : %08x L3 : %08x M3 : %08x I3 : %08x\n", $b3, $l3, $m3, $i3
96 printf "A0.w: %08x A0.x: %08x A1.w: %08x A1.x: %08x\n", $a0w, $a0x, $a1w, $a1x
100 Display all core registers in a compact format.
104 printf "ASTAT: %#x ( ", $astat
105 if $astat & (1 << 25)
108 if $astat & (1 << 24)
111 if $astat & (1 << 19)
114 if $astat & (1 << 18)
117 if $astat & (1 << 17)
120 if $astat & (1 << 16)
123 if $astat & (1 << 13)
126 if $astat & (1 << 12)
151 set $$inv = $astat & 0xfcf0ce90
153 printf "Invalid bits: %#x\n", $$inv
159 set $$seqstat = $arg0
161 set $$seqstat = $seqstat
163 set $$excause = ($$seqstat & 0x3f)
164 set $$sftreset = ($$seqstat & (0x1 << 13)) >> 13
165 set $$hwerrcause = ($$seqstat & (0x1f << 14)) >> 14
166 printf "SEQSTAT: %08x\n", $$seqstat
167 printf " EXCAUSE: 0x%x\t", $$excause
168 if $$excause >= 0x0 && $$excause <= 0xf
169 printf "(custom exception)"
172 printf "(single step)"
175 printf "(trace buffer full)"
178 printf "(undef inst)"
181 printf "(illegal inst)"
184 printf "(dcplb prot violation)"
187 printf "(misaligned data)"
190 printf "(unrecoverable event)"
193 printf "(dcplb miss)"
196 printf "(multiple dcplb hit)"
199 printf "(emulation watchpoint)"
202 printf "(misaligned inst)"
205 printf "(icplb prot violation)"
208 printf "(icplb miss)"
211 printf "(multiple icplb hit)"
214 printf "(illegal use of supervisor resource)"
217 printf " SFTRESET: 0x%x\t(last reset was ", $$sftreset
221 printf "a software reset)\n"
222 printf " HWERRCAUSE: 0x%x\t", $$hwerrcause
223 if $$hwerrcause == 0x2
224 printf "(system mmr error)"
226 if $$hwerrcause == 0x3
227 printf "(external memory addressing error)"
229 if $$hwerrcause == 0x12
230 printf "(performance monitor overflow)"
232 if $$hwerrcause == 0x18
233 printf "(raise 5 instruction)"
238 Usage: seqstat [value=$seqstat]
239 Parse the bits of the seqstat [value] into the human readable definitions.
244 set $$l1 = 0xffa00000
251 set *(unsigned short *)($$l1) = 0x0024
255 set *(unsigned long *)($$l1) = 0xffc0e14a
259 set *(unsigned long *)($$l1) = 0x0100e10a
263 set *(unsigned short *)($$l1) = 0x6038
267 set *(unsigned short *)($$l1) = 0x9310
271 set *(unsigned short *)($$l1) = 0x0024
275 set *(unsigned short *)($$l1) = 0x6000
279 set *(unsigned short *)($$l1) = 0x9310
283 set *(unsigned short *)($$l1) = 0x0024
287 set *(unsigned short *)($$l1) = 0x0091
291 if ($$l1 - $$pc) != 0x18
292 echo ERROR: jump.s has wrong offset
296 set *(unsigned short *)($$l1) = 0x2ff4
299 printf "Continuing.\n"
303 Usage: reset [L1 Instruction address=0xffa00000]
304 Cram the software reset code into [L1 Instruction address] and execute it.
305 This will perform both a system reset and a core reset.
309 set $$TBUFCTL = (unsigned long *)0xFFE06000
313 set $$TBUFCTL = (unsigned long *)0xFFE06000
317 set $$TBUFSTAT = (unsigned long *)0xFFE06004
318 set $$TBUF = (unsigned long *)0xFFE06100
320 if (!(*$$TBUFSTAT & 0x1F))
321 printf "Hardware trace buffer is empty\n"
323 while (*$$TBUFSTAT & 0x1F)
324 printf "%2i Target: ", $$i
335 Dump the hardware trace buffer. Remember, this is a destructive operation,
336 so it can only be dumped once.
340 printf "PLL_LOCKCNT: 0x%04x\n", *(unsigned short *)0xFFC00010
341 printf "VR_CTL: 0x%04x\n", *(unsigned short *)0xFFC00008
342 printf "PLL_DIV: 0x%04x\n", *(unsigned short *)0xFFC00004
343 printf "PLL_CTL: 0x%04x\n", *(unsigned short *)0xFFC00000
347 printf "SDRRC: 0x%04x\n", *(unsigned short *)0xFFC00A18
349 set $$SDBCTL = *(unsigned short *)0xFFC00A14
350 set $$EBCAW = ($$SDBCTL & 0x30) >> 4
351 set $$EBSZ = ($$SDBCTL & 0xe) >> 1
352 printf "SDBCTL: 0x%04x ", $$SDBCTL
390 set $$SDSTAT = *(unsigned short *)0xFFC00A1C
391 printf "SDSTAT: 0x%04x ", $$SDSTAT
392 if ($$SDSTAT & (1 << 0))
397 if ($$SDSTAT & (1 << 1))
398 printf "(self-refresh) "
400 if ($$SDSTAT & (1 << 2))
403 if ($$SDSTAT & (1 << 3))
404 printf "(will power up) "
406 if ($$SDSTAT & (1 << 4))
407 printf "(EAB error) "
411 printf "SDGCTL: 0x%08x\n", *(unsigned long *)0xFFC00A10
415 printf "DDRCTL0: 0x%08x\n", *(unsigned long *)0xFFC00A20
416 printf "DDRCTL1: 0x%08x\n", *(unsigned long *)0xFFC00A24
417 printf "DDRCTL2: 0x%08x\n", *(unsigned long *)0xFFC00A28
418 printf "DDRCTL3: 0x%08x\n", *(unsigned long *)0xFFC00A2C
419 printf "DDRQUE: 0x%08x\n", *(unsigned long *)0xFFC00A30
421 output/a *(unsigned long *)0xFFC00A34
424 set $$ERRMST = *(unsigned short *)0xFFC00A38
425 printf "ERRMST: 0x%04x ( ", $$ERRMST
426 if ($$ERRMST & (1 << 7))
427 printf "core_merror "
429 if ($$ERRMST & (1 << 6))
430 printf "deb2_merror "
432 if ($$ERRMST & (1 << 5))
433 printf "deb1_merror "
435 if ($$ERRMST & (1 << 4))
436 printf "deb0_merror "
438 if ($$ERRMST & (1 << 3))
441 if ($$ERRMST & (1 << 2))
444 if ($$ERRMST & (1 << 1))
447 if ($$ERRMST & (1 << 0))
452 set $$RSTCTL = *(unsigned short *)0xFFC00A3C
453 printf "RSTCTL: 0x%04x ( ", $$RSTCTL
454 if ($$RSTCTL & (1 << 4))
457 if ($$RSTCTL & (1 << 3))
460 if (!($$RSTCTL & (1 << 1)))
461 printf "!!! ERROR: bit 1 needs to be 1, but it is 0 !!! "
463 if ($$RSTCTL & (1 << 0))
470 printf "EBIU_AMGCTL: 0x%04x\n", *(unsigned short *)0xFFC00A00
471 printf "EBIU_AMBCTL0: 0x%08x\n", *(unsigned long *)0xFFC00A04
472 printf "EBIU_AMBCTL1: 0x%08x\n", *(unsigned long *)0xFFC00A08
473 printf "EBIU_MBSCTL: 0x%08x\n", *(unsigned long *)0xFFC00A0C
475 set $$EBIU_ARBSTAT = *(unsigned long *)0xFFC00A10
476 printf "EBIU_ARBSTAT: 0x%08x ( ", $$EBIU_ARBSTAT
477 if ($$EBIU_ARBSTAT & (1 << 1))
480 if ($$EBIU_ARBSTAT & (1 << 0))
485 printf "EBIU_MODE: 0x%08x\n", *(unsigned long *)0xFFC00A14
486 printf "EBIU_FCTL: 0x%08x\n", *(unsigned long *)0xFFC00A18
490 set $$cec = *(unsigned long *)$arg0
491 printf "0x%08x: ", $$cec
492 if ($$cec & (1 << 0))
497 if ($$cec & (1 << 1))
502 if ($$cec & (1 << 2))
507 if ($$cec & (1 << 3))
512 if ($$cec & (1 << 4))
517 if ($$cec & (1 << 5))
522 if ($$cec & (1 << 6))
529 if ($$cec & (1 << $$ceci))
530 printf "G%i ", $$ceci
537 set $$ceci = $$ceci + 1
549 set $$EVT = 0xFFE02000
552 printf "EVT%-2i ", $$EVTi
553 output/a *(unsigned long *)($$EVT + $$EVTi * 4)
555 set $$EVTi = $$EVTi + 1
564 set $$data_val = *(unsigned long *)($$data + $$i * 4)
565 printf " 0x%08x 0x%08x ( ", *(unsigned long *)($$addr + $$i * 4), $$data_val
566 if (($$data_val & (0x3 << 16)) == (0x0 << 16))
569 if (($$data_val & (0x3 << 16)) == (0x1 << 16))
572 if (($$data_val & (0x3 << 16)) == (0x2 << 16))
575 if (($$data_val & (0x3 << 16)) == (0x3 << 16))
578 if ($$data_val & (0x1 << 14))
583 if ($$data_val & (0x1 << 7))
586 if ($$data_val & (0x1 << 4))
589 if ($$data_val & (0x1 << 3))
592 if ($$data_val & (0x1 << 2))
595 if ($$data_val & (0x1 << 1))
598 if ($$data_val & (0x1 << 0))
608 set $$IMEM_CONTROL = 0xFFE01004
609 printf "ICPLBS (0x%08x)\n", *(unsigned long *)$$IMEM_CONTROL
610 _show_cplbs 0xFFE01100 0xFFE01200
613 set $$DMEM_CONTROL = 0xFFE00004
614 printf "DCPLBS (0x%08x)\n", *(unsigned long *)$$DMEM_CONTROL
615 _show_cplbs 0xFFE00100 0xFFE00200
622 define _show_cplbstatus
623 set $$CPLB_STATUS = *(unsigned long *)$arg0
624 printf " STATUS = 0x%08x ( ", $$CPLB_STATUS
625 if ($$CPLB_STATUS & (1 << 19))
628 if ($$CPLB_STATUS & (1 << 18))
633 if ($$CPLB_STATUS & (1 << 17))
638 if ($$CPLB_STATUS & (1 << 16))
645 if ($$CPLB_STATUS & (1 << $$i))
652 set $$CPLB_FAULT_ADDR = *(unsigned long *)$arg1
653 printf " FAULT_ADDR = "
654 output/a $$CPLB_FAULT_ADDR
657 define show_icplbstatus
658 printf "ICPLB Status\n"
659 _show_cplbstatus 0xFFE01008 0xFFE0100C
661 define show_dcplbstatus
662 printf "DCPLB Status\n"
663 _show_cplbstatus 0xFFE00008 0xFFE0000C
665 define show_cplbstatus
672 set $r0 = $r1 = $r2 = $r3 = $r4 = $r5 = $r6 = $r7 = 0xffb00000
673 set $sp = $fp = $usp = $r0 + 0x100
674 set $p0 = $p1 = $p2 = $p3 = $p4 = $p5 = 0xffa00000
675 set $pc = $rets = $reti = $retx = $retn = $p0
676 set $lt0 = $lt1 = $lb0 = $lb1 = 1
678 set $i0 = $i1 = $i2 = $i3 = $r0
679 set $b0 = $b1 = $b2 = $b3 = $r0
680 set $l0 = $l1 = $l2 = $l3 = $r0
681 set $m0 = $m1 = $m2 = $m3 = $r0
685 set $$DMA_BASE = $arg0
686 set $$NEXT_DESC_PTR = *(unsigned long *) ($$DMA_BASE + 0x00)
687 set $$START_ADDR = *(unsigned long *) ($$DMA_BASE + 0x04)
688 set $$CONFIG = *(unsigned short *) ($$DMA_BASE + 0x08)
689 set $$X_COUNT = *(unsigned short *) ($$DMA_BASE + 0x10)
690 set $$X_MODIFY = *(unsigned short *) ($$DMA_BASE + 0x14)
691 set $$Y_COUNT = *(unsigned short *) ($$DMA_BASE + 0x18)
692 set $$Y_MODIFY = *(unsigned short *) ($$DMA_BASE + 0x1C)
693 set $$CURR_DESC_PTR = *(unsigned long *) ($$DMA_BASE + 0x20)
694 set $$CURR_ADDR = *(unsigned long *) ($$DMA_BASE + 0x24)
695 set $$IRQ_STATUS = *(unsigned short *) ($$DMA_BASE + 0x28)
696 set $$CURR_X_COUNT = *(unsigned short *) ($$DMA_BASE + 0x30)
697 set $$CURR_Y_COUNT = *(unsigned short *) ($$DMA_BASE + 0x38)
698 printf "desc: curr: 0x%08x next: 0x%08x\n", $$CURR_DESC_PTR, $$NEXT_DESC_PTR
699 printf "addr: curr: 0x%08x start: 0x%08x\n", $$CURR_ADDR, $$START_ADDR
700 printf "X: curr: 0x%04x count: 0x%04x mod: 0x%04x (%i)\n", $$CURR_X_COUNT, $$X_COUNT, $$X_MODIFY, (short)$$X_MODIFY
701 printf "Y: curr: 0x%04x count: 0x%04x mod: 0x%04x (%i)\n", $$CURR_Y_COUNT, $$Y_COUNT, $$Y_MODIFY, (short)$$Y_MODIFY
702 printf "dma config: 0x%04x (", $$CONFIG
703 if ($$CONFIG & (1 << 0))
708 if ($$CONFIG & (0x1 << 1))
713 set $$WDSIZE = ($$CONFIG & (0x3 << 2)) >> 2
715 printf "WDSIZE:INVALID "
726 if ($$CONFIG & (0x1 << 4))
731 if ($$CONFIG & (0x1 << 5))
734 if ($$CONFIG & (0x1 << 6))
737 if ($$CONFIG & (0x1 << 7))
740 set $$NDSIZE = ($$CONFIG & (0xF << 8)) >> 8
741 if ($$NDSIZE > 0 && $$NDSIZE < 10)
742 printf "NDSIZE_%i ", $$NDSIZE
745 printf "NDSIZE:INVALID:%i ", $$NDSIZE
747 set $$FLOW = ($$CONFIG & (0x7 << 12)) >> 12
755 printf "descriptor_array"
758 printf "descriptor_list_small"
761 printf "descriptor_list_large"
763 printf "FLOW:INVALID:%i", $$FLOW
770 printf "irq status: 0x%04x (", $$IRQ_STATUS
771 if ($$IRQ_STATUS & (0x1 << 0))
774 if ($$IRQ_STATUS & (0x1 << 1))
777 if ($$IRQ_STATUS & (0x1 << 2))
780 if ($$IRQ_STATUS & (0x1 << 3))
787 set $$CTIMER = 0xFFE03000
788 set $$TCNTL = *(unsigned long *) ($$CTIMER + 0x0)
789 set $$TPERIOD = *(unsigned long *) ($$CTIMER + 0x4)
790 set $$TSCALE = *(unsigned long *) ($$CTIMER + 0x8)
791 set $$TCOUNT = *(unsigned long *) ($$CTIMER + 0xC)
792 printf "TCNTL: %#x ( ", $$TCNTL
793 if ($$TCNTL & (1 << 0))
796 if ($$TCNTL & (1 << 1))
799 if ($$TCNTL & (1 << 2))
802 if ($$TCNTL & (1 << 3))
803 printf "int-enabled "
806 printf "TPERIOD: %#x\n", $$TPERIOD
807 printf "TSCALE: %#x\n", $$TSCALE
808 printf "TCOUNT: %#x\n", $$TCOUNT
813 set $$SPI_BASE = $arg0
815 set $$SPI_BASE = 0xFFC00500
817 set $$SPI_BAUD = *(unsigned short *) ($$SPI_BASE + 0x14)
818 set $$SPI_CTL = *(unsigned short *) ($$SPI_BASE + 0x00)
819 set $$SPI_FLG = *(unsigned short *) ($$SPI_BASE + 0x04)
820 set $$SPI_STAT = *(unsigned short *) ($$SPI_BASE + 0x08)
821 set $$SPI_TDBR = *(unsigned short *) ($$SPI_BASE + 0x0C)
822 set $$SPI_RDBR = *(unsigned short *) ($$SPI_BASE + 0x10)
823 set $$SPI_SHAD = *(unsigned short *) ($$SPI_BASE + 0x18)
824 printf "BAUD: %04x (%i)\n", $$SPI_BAUD, $$SPI_BAUD
825 printf "CTL: %04x (", $$SPI_CTL
826 set $$TIMOD = $$SPI_CTL & 0x3
827 printf "timod:%i ", $$TIMOD
828 if ($$SPI_CTL & (1 << 2))
831 if ($$SPI_CTL & (1 << 3))
834 if ($$SPI_CTL & (1 << 4))
837 if ($$SPI_CTL & (1 << 5))
840 if ($$SPI_CTL & (1 << 8))
845 if ($$SPI_CTL & (1 << 9))
848 if ($$SPI_CTL & (1 << 10))
851 if ($$SPI_CTL & (1 << 11))
854 if ($$SPI_CTL & (1 << 12))
859 if ($$SPI_CTL & (1 << 13))
862 if ($$SPI_CTL & (1 << 14))
868 printf "STAT: %04x (", $$SPI_STAT
869 if ($$SPI_STAT & (1 << 0))
872 if ($$SPI_STAT & (1 << 1))
875 if ($$SPI_STAT & (1 << 2))
878 if ($$SPI_STAT & (1 << 3))
881 if ($$SPI_STAT & (1 << 4))
884 if ($$SPI_STAT & (1 << 5))
887 if ($$SPI_STAT & (1 << 6))
891 printf "FLG: %04x\n", $$SPI_FLG
892 printf "TDBR: %04x RDBR: %04x\n", $$SPI_TDBR, $$SPI_SHAD
897 printf "LCR: 0x%02x ( ", $$LCR
898 set $$WLS = $$LCR & 0x3
911 if ($$LCR & (1 << 2))
914 if ($$LCR & (1 << 3))
917 if ($$LCR & (1 << 4))
920 if ($$LCR & (1 << 5))
923 if ($$LCR & (1 << 6))
931 printf "LSR: 0x%02x ( ", $$LSR
932 if ($$LSR & (1 << 0))
935 if ($$LSR & (1 << 1))
938 if ($$LSR & (1 << 2))
941 if ($$LSR & (1 << 3))
944 if ($$LSR & (1 << 4))
947 if ($$LSR & (1 << 5))
950 if ($$LSR & (1 << 6))
953 if ($$LSR & (1 << 7))
961 printf "IER: 0x%02x ( ", $$IER
962 if ($$IER & (1 << 0))
965 if ($$IER & (1 << 1))
968 if ($$IER & (1 << 2))
971 if ($$IER & (1 << 3))
974 if ($$IER & (1 << 4))
977 if ($$IER & (1 << 5))
980 if ($$IER & (1 << 6))
988 printf "MCR: 0x%02x ( ", $$MCR
989 if ($$MCR & (1 << 0))
992 if ($$MCR & (1 << 1))
995 if ($$MCR & (1 << 2))
998 if ($$MCR & (1 << 3))
1001 if ($$MCR & (1 << 4))
1004 if ($$MCR & (1 << 5))
1007 if ($$MCR & (1 << 6))
1010 if ($$MCR & (1 << 7))
1016 define show_uart_msr
1018 printf "MSR: 0x%02x ( ", $$MSR
1019 if ($$MSR & (1 << 0))
1022 if ($$MSR & (1 << 4))
1025 if ($$MSR & (1 << 5))
1031 define show_uart_gctl
1033 printf "GCTL: 0x%02x ( ", $$GCTL
1034 if ($$GCTL & (1 << 0))
1037 if ($$GCTL & (1 << 1))
1040 if ($$GCTL & (1 << 2))
1043 if ($$GCTL & (1 << 3))
1046 if ($$GCTL & (1 << 4))
1049 if ($$GCTL & (1 << 5))
1052 if ($$GCTL & (1 << 6))
1055 if ($$GCTL & (1 << 7))
1063 set $$UART_BASE = $arg0
1065 set $$UART_BASE = 0xffc00400
1067 set $$UART_DLL = (unsigned short *) ($$UART_BASE + 0x00)
1068 set $$UART_RBR = (unsigned short *) ($$UART_BASE + 0x00)
1069 set $$UART_DLH = (unsigned short *) ($$UART_BASE + 0x04)
1070 set $$UART_IER = (unsigned short *) ($$UART_BASE + 0x04)
1071 set $$UART_IIR = (unsigned short *) ($$UART_BASE + 0x08)
1072 set $$UART_LCR = (unsigned short *) ($$UART_BASE + 0x0C)
1073 set $$UART_MCR = (unsigned short *) ($$UART_BASE + 0x10)
1074 set $$UART_LSR = (unsigned short *) ($$UART_BASE + 0x14)
1075 set $$UART_MSR = (unsigned short *) ($$UART_BASE + 0x18)
1076 set $$UART_SCR = (unsigned short *) ($$UART_BASE + 0x1C)
1077 set $$UART_GCTL = (unsigned short *) ($$UART_BASE + 0x24)
1079 set $$DLAB = (1 << 7)
1080 set $$LCR = *$$UART_LCR
1081 set *$$UART_LCR = ($$LCR | $$DLAB)
1082 printf "DLL: 0x%02x DLH: 0x%02x\n", *$$UART_DLL, *$$UART_DLH
1083 set *$$UART_LCR = $$LCR & ~$$DLAB
1084 printf "RBR: 0x%02x SCR: 0x%02x\n", *$$UART_RBR, *$$UART_SCR
1085 set *$$UART_LCR = $$LCR
1087 printf "IIR: 0x%02x ", *$$UART_IIR
1088 show_uart_ier *$$UART_IER
1090 show_uart_mcr *$$UART_MCR
1091 show_uart_lsr *$$UART_LSR
1092 show_uart_msr *$$UART_MSR
1093 show_uart_gctl *$$UART_GCTL
1098 set $$UART_BASE = $arg0
1100 set $$UART_BASE = 0xffc00400
1102 set $$UART_DLL = (unsigned short *) ($$UART_BASE + 0x00)
1103 set $$UART_DLH = (unsigned short *) ($$UART_BASE + 0x04)
1104 set $$UART_GCTL = (unsigned short *) ($$UART_BASE + 0x08)
1105 set $$UART_LCR = (unsigned short *) ($$UART_BASE + 0x0C)
1106 set $$UART_MCR = (unsigned short *) ($$UART_BASE + 0x10)
1107 set $$UART_LSR = (unsigned short *) ($$UART_BASE + 0x14)
1108 set $$UART_MSR = (unsigned short *) ($$UART_BASE + 0x18)
1109 set $$UART_SCR = (unsigned short *) ($$UART_BASE + 0x1C)
1110 set $$UART_IER = (unsigned short *) ($$UART_BASE + 0x20)
1111 set $$UART_RBR = (unsigned short *) ($$UART_BASE + 0x2C)
1113 printf "DLL: 0x%02x DLH: 0x%02x\n", *$$UART_DLL, *$$UART_DLH
1114 printf "RBR: 0x%02x SCR: 0x%02x\n", *$$UART_RBR, *$$UART_SCR
1117 show_uart_ier *$$UART_IER
1118 show_uart_lcr *$$UART_LCR
1119 show_uart_mcr *$$UART_MCR
1120 show_uart_lsr *$$UART_LSR
1121 show_uart_msr *$$UART_MSR
1122 show_uart_gctl *$$UART_GCTL
1127 set $$UART_BASE = $arg0
1129 set $$UART_BASE = 0xffc02000
1131 set $$UART_REVID = (unsigned long *) ($$UART_BASE + 0x00)
1132 set $$UART_CTL = (unsigned long *) ($$UART_BASE + 0x04)
1133 set $$UART_STAT = (unsigned long *) ($$UART_BASE + 0x08)
1134 set $$UART_SCR = (unsigned long *) ($$UART_BASE + 0x0C)
1135 set $$UART_CLK = (unsigned long *) ($$UART_BASE + 0x10)
1136 set $$UART_IMASK = (unsigned long *) ($$UART_BASE + 0x14)
1137 set $$UART_RBR = (unsigned long *) ($$UART_BASE + 0x20)
1138 set $$UART_THR = (unsigned long *) ($$UART_BASE + 0x24)
1139 set $$UART_TAIP = (unsigned long *) ($$UART_BASE + 0x28)
1140 set $$UART_TSR = (unsigned long *) ($$UART_BASE + 0x2C)
1141 set $$UART_RSR = (unsigned long *) ($$UART_BASE + 0x30)
1142 set $$UART_TXCNT = (unsigned long *) ($$UART_BASE + 0x34)
1143 set $$UART_RXCNT = (unsigned long *) ($$UART_BASE + 0x38)
1145 printf "REVID: 0x%08x SCR: 0x%08x\n", *$$UART_REVID, *$$UART_SCR
1146 printf " CLK: 0x%08x TAIP: 0x%08x\n", *$$UART_CLK, *$$UART_TAIP
1148 set $$CTL = *$$UART_CTL
1149 printf " CTL: 0x%08x ( ", $$CTL
1150 if ($$CTL & (1 << 0))
1153 if ($$CTL & (1 << 1))
1156 set $$UMOD = ($$CTL & (3 << 4)) >> 4
1170 set $$WLS = ($$CTL & (3 << 8)) >> 8
1184 if ($$CTL & (1 << 12))
1187 if ($$CTL & (1 << 13))
1190 if ($$CTL & (1 << 14))
1193 if ($$CTL & (1 << 15))
1196 if ($$CTL & (1 << 16))
1199 if ($$CTL & (1 << 17))
1202 if ($$CTL & (1 << 18))
1205 if ($$CTL & (1 << 19))
1208 if ($$CTL & (1 << 22))
1211 if ($$CTL & (1 << 23))
1214 if ($$CTL & (1 << 24))
1217 if ($$CTL & (1 << 25))
1220 if ($$CTL & (1 << 26))
1223 if ($$CTL & (1 << 27))
1226 if ($$CTL & (1 << 28))
1229 if ($$CTL & (1 << 29))
1232 if ($$CTL & (1 << 30))
1237 set $$STAT = *$$UART_STAT
1238 printf " STAT: 0x%08x ( ", $$STAT
1239 if ($$STAT & (1 << 0))
1242 if ($$STAT & (1 << 1))
1245 if ($$STAT & (1 << 2))
1248 if ($$STAT & (1 << 3))
1251 if ($$STAT & (1 << 4))
1254 if ($$STAT & (1 << 5))
1257 if ($$STAT & (1 << 7))
1260 if ($$STAT & (1 << 8))
1263 if ($$STAT & (1 << 9))
1266 if ($$STAT & (1 << 10))
1269 if ($$STAT & (1 << 11))
1272 if ($$STAT & (1 << 12))
1275 if ($$STAT & (1 << 16))
1278 if ($$STAT & (1 << 17))
1283 printf "IMASK: 0x%08x\n", *$$UART_IMASK
1284 printf " RSR: 0x%04x TSR: 0x%04x\n", *$$UART_RSR, *$$UART_TSR
1285 printf " RBR: 0x%02x THR: 0x%02x\n", *$$UART_RBR, *$$UART_THR
1286 printf "RXCNT: 0x%02x TXCNT: 0x%02x\n", *$$UART_RXCNT, *$$UART_TXCNT
1294 set $$s_mm = (unsigned long *)0xFFB00000
1295 set $$s_m0 = $$s_mm[0]
1296 set $$s_m1 = $$s_mm[1]
1303 set $$s_mm[0] = $$s_m0
1304 set $$s_mm[1] = $$s_m1
1308 set $pc = 0xef00001a
1311 set $r2 = 0xFFB00000
1318 set $$OTP_PAGE = $arg0
1321 printf "OTP Page 0x%02x: ", $$OTP_PAGE
1323 _otp_read $$OTP_PAGE, 0
1324 _otp_read $$OTP_PAGE, 1
1332 printf "0x%02x: ", $$page
1334 printf "%08x %08x ", $$OTP_PAGE_L, $$OTP_PAGE_H
1336 printf "%08x %08x ", $$OTP_PAGE_L, $$OTP_PAGE_H
1344 # Provide U-Boot-style functions in gdb
1347 define uboot_jtag_load
1348 set remotetimeout 300
1352 call memset(&_bss_vma, 0, &_bss_len)
1358 # U-Boot style memory display functions
1373 Usage: md <unit type> <address> [count=64]
1374 Display [count] <unit type> starting at <address>.
1378 # dummy func for "document" to work
1381 Usage: md[cbwl] <address> [count=64]
1382 Display [count] <chars|bytes|words|longs> starting at <address>.
1460 # U-Boot style memory modify functions
1474 Usage: mw[bwl] <address> <value> <count>
1475 Set <count> <bytes|words|longs> at <address> to <value>.
1480 set $$addr = (unsigned long *)$arg0
1481 _mw $$addr $arg1 $arg2
1491 set $$addr = (unsigned short *)$arg0
1492 _mw $$addr $arg1 $arg2
1502 set $$addr = (unsigned char *)$arg0
1503 _mw $$addr $arg1 $arg2
1514 # U-Boot style memory compare functions
1518 set $$base = (unsigned long)$arg0
1523 if (*$$addr1 != *$$addr2)
1524 printf "Data mismatch at %#x units (@%#x != @%#x)\n", $arg2, $$addr1, $$addr2
1531 printf "Data matches for %#x units\n", $arg2
1536 Usage: cmp[bwl] <address> <address> <count>
1537 Compare <count> <bytes|words|longs> between <address> and <address>.
1542 set $$addr1 = (unsigned char *)$arg0
1543 set $$addr2 = (unsigned char *)$arg1
1544 _cmp $$addr1 $$addr2 $arg2
1554 set $$addr1 = (unsigned short *)$arg0
1555 set $$addr2 = (unsigned short *)$arg1
1556 _cmp $$addr1 $$addr2 $arg2
1566 set $$addr1 = (unsigned long *)$arg0
1567 set $$addr2 = (unsigned long *)$arg1
1568 _cmp $$addr1 $$addr2 $arg2
1579 # U-Boot style memory copy functions
1591 printf "Copied %#x units from %#x to %#x\n", $arg2, $arg0, $arg1
1595 Usage: cp[bwl] <src> <dst> <count>
1596 Copy <count> <bytes|words|longs> from <src> to <dst>.
1601 set $$addr1 = (unsigned char *)$arg0
1602 set $$addr2 = (unsigned char *)$arg1
1603 _cp $$addr1 $$addr2 $arg2
1613 set $$addr1 = (unsigned short *)$arg0
1614 set $$addr2 = (unsigned short *)$arg1
1615 _cp $$addr1 $$addr2 $arg2
1625 set $$addr1 = (unsigned long *)$arg0
1626 set $$addr2 = (unsigned long *)$arg1
1627 _cp $$addr1 $$addr2 $arg2
1637 #set extended-prompt \[\e[30;1m\](\[\e[34;1m\]gdb\[\e[30;1m\])\[\e[0m\]