Remove annoying end-of-line whitespace from tcl/* files
[openocd.git] / tcl / chip / atmel / at91 / usarts.tcl
1 # the DBGU and USARTs are 'almost' indentical'
2 set DBGU_CR [expr $AT91C_BASE_DBGU + 0x00000000]
3 set DBGU_MR [expr $AT91C_BASE_DBGU + 0x00000004]
4 set DBGU_IER [expr $AT91C_BASE_DBGU + 0x00000008]
5 set DBGU_IDR [expr $AT91C_BASE_DBGU + 0x0000000C]
6 set DBGU_IMR [expr $AT91C_BASE_DBGU + 0x00000010]
7 set DBGU_CSR [expr $AT91C_BASE_DBGU + 0x00000014]
8 set DBGU_RHR [expr $AT91C_BASE_DBGU + 0x00000018]
9 set DBGU_THR [expr $AT91C_BASE_DBGU + 0x0000001C]
10 set DBGU_BRGR [expr $AT91C_BASE_DBGU + 0x00000020]
11 # no RTOR
12 # no TTGR
13 # no FIDI
14 # no NER
15 set DBGU_CIDR [expr $AT91C_BASE_DBGU + 0x00000040]
16 set DBGU_EXID [expr $AT91C_BASE_DBGU + 0x00000044]
17 set DBGU_FNTR [expr $AT91C_BASE_DBGU + 0x00000048]
18
19
20 set USx_CR 0x00000000
21 set USx_MR 0x00000004
22 set USx_IER 0x00000008
23 set USx_IDR 0x0000000C
24 set USx_IMR 0x00000010
25 set USx_CSR 0x00000014
26 set USx_RHR 0x00000018
27 set USx_THR 0x0000001C
28 set USx_BRGR 0x00000020
29 set USx_RTOR 0x00000024
30 set USx_TTGR 0x00000028
31 set USx_FIDI 0x00000040
32 set USx_NER 0x00000044
33 set USx_IF 0x0000004C
34
35 # Create all the uarts that exist..
36 # we blow up if there are >9
37
38
39 proc show_mmr_USx_MR_helper { NAME ADDR VAL } {
40 # First - just print it
41
42 set x [show_normalize_bitfield $VAL 3 0]
43 if { $x == 0 } {
44 puts "\tNormal operation"
45 } else {
46 puts [format "\tNon Normal operation mode: 0x%02x" $x]
47 }
48
49 set x [show_normalize_bitfield $VAL 11 9]
50 set s "unknown"
51 switch -exact $x {
52 0 { set s "Even" }
53 1 { set s "Odd" }
54 2 { set s "Force=0" }
55 3 { set s "Force=1" }
56 * {
57 set $x [expr $x & 6]
58 switch -exact $x {
59 4 { set s "None" }
60 6 { set s "Multidrop Mode" }
61 }
62 }
63 }
64 puts [format "\tParity: %s " $s]
65
66 set x [expr 5 + [show_normalize_bitfield $VAL 7 6]]
67 puts [format "\tDatabits: %d" $x]
68
69 set x [show_normalize_bitfield $VAL 13 12]
70 switch -exact $x {
71 0 { puts "\tStop bits: 1" }
72 1 { puts "\tStop bits: 1.5" }
73 2 { puts "\tStop bits: 2" }
74 3 { puts "\tStop bits: Illegal/Reserved" }
75 }
76 }
77
78 # For every possbile usart...
79 foreach WHO { US0 US1 US2 US3 US4 US5 US6 US7 US8 US9 } {
80 set n AT91C_BASE_[set WHO]
81 set str ""
82
83 # Only if it exists on the chip
84 if [ info exists $n ] {
85 # Hence: $n - is like AT91C_BASE_USx
86 # For every sub-register
87 foreach REG {CR MR IER IDR IMR CSR RHR THR BRGR RTOR TTGR FIDI NER IF} {
88 # vn = variable name
89 set vn [set WHO]_[set REG]
90 # vn = USx_IER
91 # vv = variable value
92 set vv [expr $$n + [set USx_[set REG]]]
93 # And VV is the address in memory of that register
94
95
96 # make that VN a GLOBAL so others can find it
97 global $vn
98 set $vn $vv
99
100 # Create a command for this specific register.
101 proc show_$vn { } "show_mmr32_reg $vn"
102
103 # Add this command to the Device(as a whole) command
104 set str "$str\nshow_$vn"
105 }
106 # Now - create the DEVICE(as a whole) command
107 set fn show_$WHO
108 proc $fn { } $str
109 }
110 }
111
112 # The Debug Uart is special..
113 set str ""
114
115
116 # For every sub-register
117 foreach REG {DBGU_CR DBGU_MR DBGU_IER DBGU_IDR DBGU_IMR
118 DBGU_CSR DBGU_RHR DBGU_THR DBGU_BRGR DBGU_CIDR DBGU_EXID DBGU_FNTR} {
119
120 # Create a command for this specific register.
121 proc show_$REG { } "show_mmr32_reg $REG"
122
123 # Add this command to the Device(as a whole) command
124 set str "$str\nshow_$REG"
125 }
126
127 # Now - create the DEVICE(as a whole) command
128 proc show_DBGU { } $str
129
130 unset str
131
132 proc show_DBGU_MR_helper { NAME ADDR VAL } { show_mmr_USx_MR_helper $NAME $ADDR $VAL }
133
134
135

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)