Tweak TCL reset script ... mostly improving descriptions of
the various steps, but also calling [target names] only once. git-svn-id: svn://svn.berlios.de/openocd/trunk@2726 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
e961bd14d9
commit
358263f484
|
@ -157,6 +157,7 @@ proc ocd_process_reset { MODE } {
|
||||||
}
|
}
|
||||||
|
|
||||||
proc ocd_process_reset_inner { MODE } {
|
proc ocd_process_reset_inner { MODE } {
|
||||||
|
set targets [target names]
|
||||||
|
|
||||||
# If this target must be halted...
|
# If this target must be halted...
|
||||||
set halt -1
|
set halt -1
|
||||||
|
@ -175,26 +176,38 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
|
|
||||||
# Target event handlers *might* change which TAPs are enabled
|
# Target event handlers *might* change which TAPs are enabled
|
||||||
# or disabled, so we fire all of them. But don't issue any
|
# or disabled, so we fire all of them. But don't issue any
|
||||||
# of the "arp_*" commands, which may issue JTAG transactions,
|
# target "arp_*" commands, which may issue JTAG transactions,
|
||||||
# unless we know the underlying TAP is active.
|
# unless we know the underlying TAP is active.
|
||||||
|
#
|
||||||
|
# NOTE: ARP == "Advanced Reset Process" ... "advanced" is
|
||||||
|
# relative to a previous restrictive scheme
|
||||||
|
|
||||||
foreach t [ target names ] {
|
foreach t $targets {
|
||||||
# New event script.
|
# New event script.
|
||||||
$t invoke-event reset-start
|
$t invoke-event reset-start
|
||||||
}
|
}
|
||||||
|
|
||||||
# Init the tap controller.
|
# Use TRST or TMS/TCK operations to reset all the tap controllers.
|
||||||
|
# TAP reset events get reported; they might enable some taps.
|
||||||
|
#
|
||||||
|
# REVISIT arp_init-reset pulses SRST (if it can) with TRST active;
|
||||||
|
# but SRST events aren't reported (unlike "jtag arp_reset", below)
|
||||||
jtag arp_init-reset
|
jtag arp_init-reset
|
||||||
|
|
||||||
# Examine all targets on enabled taps.
|
# Examine all targets on enabled taps.
|
||||||
foreach t [ target names ] {
|
foreach t $targets {
|
||||||
if {[jtag tapisenabled [$t cget -chain-position]]} {
|
if {[jtag tapisenabled [$t cget -chain-position]]} {
|
||||||
$t arp_examine
|
$t arp_examine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Let the C code know we are asserting reset.
|
# Assert SRST, and report the pre/post events.
|
||||||
foreach t [ target names ] {
|
#
|
||||||
|
# REVISIT this presumes a single-target config, since SRST
|
||||||
|
# applies to the whole device-under-test. When two targets
|
||||||
|
# both need special setup before SRST, it's only done for
|
||||||
|
# the first one...
|
||||||
|
foreach t $targets {
|
||||||
$t invoke-event reset-assert-pre
|
$t invoke-event reset-assert-pre
|
||||||
# C code needs to know if we expect to 'halt'
|
# C code needs to know if we expect to 'halt'
|
||||||
if {[jtag tapisenabled [$t cget -chain-position]]} {
|
if {[jtag tapisenabled [$t cget -chain-position]]} {
|
||||||
|
@ -203,8 +216,8 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
$t invoke-event reset-assert-post
|
$t invoke-event reset-assert-post
|
||||||
}
|
}
|
||||||
|
|
||||||
# Now de-assert reset.
|
# Now de-assert SRST, and report the pre/post events.
|
||||||
foreach t [ target names ] {
|
foreach t $targets {
|
||||||
$t invoke-event reset-deassert-pre
|
$t invoke-event reset-deassert-pre
|
||||||
# Again, de-assert code needs to know..
|
# Again, de-assert code needs to know..
|
||||||
if {[jtag tapisenabled [$t cget -chain-position]]} {
|
if {[jtag tapisenabled [$t cget -chain-position]]} {
|
||||||
|
@ -213,9 +226,11 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
$t invoke-event reset-deassert-post
|
$t invoke-event reset-deassert-post
|
||||||
}
|
}
|
||||||
|
|
||||||
# Pass 1 - Now try to halt.
|
# Pass 1 - Now wait for any halt (requested as part of reset
|
||||||
|
# assert/deassert) to happen. Ideally it takes effect without
|
||||||
|
# first executing any instructions.
|
||||||
if { $halt } {
|
if { $halt } {
|
||||||
foreach t [target names] {
|
foreach t $targets {
|
||||||
if {[jtag tapisenabled [$t cget -chain-position]] == 0} {
|
if {[jtag tapisenabled [$t cget -chain-position]] == 0} {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -239,7 +254,7 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
|
|
||||||
#Pass 2 - if needed "init"
|
#Pass 2 - if needed "init"
|
||||||
if { 0 == [string compare init $MODE] } {
|
if { 0 == [string compare init $MODE] } {
|
||||||
foreach t [target names] {
|
foreach t $targets {
|
||||||
if {[jtag tapisenabled [$t cget -chain-position]] == 0} {
|
if {[jtag tapisenabled [$t cget -chain-position]] == 0} {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -252,7 +267,7 @@ proc ocd_process_reset_inner { MODE } {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach t [ target names ] {
|
foreach t $targets {
|
||||||
$t invoke-event reset-end
|
$t invoke-event reset-end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue