OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-src/boards
    from Rev 555 to Rev 565
    Reverse comparison

Rev 555 → Rev 565

/or32-linux-sim.exp
30,11 → 30,20
# @param[in] connhost The connected host being closed.
# -----------------------------------------------------------------------------
proc telnet_close {connhost} {
global board_info
verbose "telnet_close: connhost $connhost" 3
 
# Use the standard close proc from remote.exp
standard_close $connhost
# Close the session
set spawn_id [board_info $connhost fileid]
catch close -i $spawn_id
catch wait -i $spawn_id
 
# Check we really succeeded in closing
if [board_info $connhost exists fileid] {
verbose "telnet_close: deleting remaining fileid"
unset board_info(${connhost},fileid)
}
}
 
 
88,10 → 97,8
# @return A list of the return code (-1 on failure) and any error message.
# -----------------------------------------------------------------------------
proc telnet_exec {hostname cmd args} {
global timeout
global board_info
global verbose
global spawn_id
 
# Get the connected host name, if it exists. This code matches
# telnet_open.
139,28 → 146,29
# the fileid field associated with $connhost will be set to the spawn_id
# of the new telnet process.
if ![board_info $connhost exists fileid] {
verbose "telnet_exec: opening new telnet connection"
if {[telnet_open $connhost] == -1} {
return [list -1 "telnet to $hostname failed for $cmd, couldn't begin telnet session"]
}
}
 
# Save the timeout. It's a global, which we shall mess about with, and
# restore on exit.
set timeout_orig timeout
 
# Make the telnet session the current process. Short timeout for this.
# The spawn_id we'll use throughout
set spawn_id [board_info $connhost fileid]
verbose "telnet_exec: spawn_id is now $spawn_id"
# Use a relatively short timeout for most operations. Only the command
# itself uses a long timeout.
set timeout 30
 
#Hit enter to make sure you get a shell prompt
send "\r"
send -i $spawn_id "\r"
 
expect {
# A prompt indicates the current session is alive
-re "$shell_prompt" {
-i $spawn_id -re "$shell_prompt" {
verbose "telnet_exec: got prompt at start"
}
default {
-i $spawn_id default {
# Timeout or EOF. Die if we have had too many failures
telnet_failure_check $connhost "no prompt at telnet start"
 
169,10 → 177,9
if {[telnet_open $connhost] != -1} {
set spawn_id [board_info $connhost fileid]
verbose "telnet_exec: new telnet session, spawn_id: $spawn_id"
send "\r"
send -i $spawn_id "\r"
exp_continue
} else {
set timeout timeout_orig
return [list -1 "telnet to $hostname failed for $cmd, couldn't get a shell prompt"]
}
}
180,7 → 187,7
 
# Send the command. We can't cope with any input, so only the first
# argument (group) is sent.
send "$cmd $pargs\r"
send -i $spawn_id -- "$cmd $pargs\r"
 
# We really should get the command echoed back immediately. This is a good
# way of slurping up unexpected prompts. We first swap out any characters
189,10 → 196,10
verbose "telnet_exec: command match string is \"$cmdpargs\""
expect {
-re "$cmdpargs" {
-i $spawn_id -re "$cmdpargs" {
verbose "telnet_exec: got command echoed back"
}
default {
-i $spawn_id default {
verbose "telnet_exec: command not echoed: command expect_out(buffer): \"$expect_out(buffer)\""
}
}
209,13 → 216,12
}
 
expect {
-re "$shell_prompt" {
-i $spawn_id -re "$shell_prompt" {
verbose "telnet_exec: got prompt after command"
}
default {
-i $spawn_id default {
# Give up on timeout or EOF
telnet_close $connhost
set timeout timeout_orig
return [list -1 "telnet to $hostname for $cmd $pargs failed (timeout)"]
}
}
237,16 → 243,16
# Check the return status. Use a short timeout for this and following
# commands.
set timeout 30
send "echo \$?\r"
send -i $spawn_id "echo \$?\r"
 
# Once again, look for the "echo" reflected back as a way of slurping up
# unexpected prompts. We don't worry about timeout here - we'll sort that
# out later.
expect {
-re "echo \\$\\?" {
-i $spawn_id -re "echo \\$\\?" {
verbose "telnet_exec: got \"echo\" echoed back"
}
default {
-i $spawn_id default {
verbose "telnet_exec: echo not echoed: command expect_out(buffer): \"$expect_out(buffer)\""
}
}
255,10 → 261,10
# really matters if we don't get a valid status, which we'll discover
# below.
expect {
-re "$shell_prompt" {
-i $spawn_id -re "$shell_prompt" {
verbose "telnet_exec: got status shell prompt"
}
default {
-i $spawn_id default {
verbose "telnet_exec: no status shell prompt: command expect_out(buffer): \"$expect_out(buffer)\""
}
}
280,7 → 286,6
telnet_failure_check $connhost "bad status"
}
 
set timeout timeout_orig
if {$status == 0} {
return [list "0" "$output"]
} else {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.