Move TCL script files -- Step 1 of 2:
[fw/openocd] / src / tcl / readable.tcl
1 proc iswithin { ADDRESS BASE LEN } {
2     return [expr ((($ADDRESS - $BASE) > 0) && (($ADDRESS - $BASE + $LEN) > 0))]
3 }
4
5 proc memorytype { ADDRESS } {
6     for { set chip 0 } { $chip < $N_CHIP } { incr chip } {
7         if { iswithin $ADDRESS $FLASH($chip,BASE) $FLASH($chip,LEN) } {
8             return "flash"
9         }
10     }
11
12     for { set chip 0 } { $chip < $N_RAM } { incr chip } {
13         if { iswithin $ADDRESS $RAM($chip,BASE) $RAM($chip,LEN) } {
14             return "ram"
15         }
16     }
17 }
18
19 # default to 32bit reads.
20 proc isreadable { ADDRESS } {
21      return isreadable32 $ADDRESS
22 }
23
24 proc isreadable32 { ADDRESS } {
25