aboutsummaryrefslogtreecommitdiff
path: root/baseboards/usparc-cygmon.exp
blob: 119b30a67c25a5ff3613b79b70b6fb7963b4cb2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DejaGnu is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DejaGnu; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.

load_base_board_description "cygmon"

set_board_info testcase_timeout 30

proc ${board}_init { dest } {
    global usparc_init_count
    set shell_prompt [board_info $dest shell_prompt]

    if {![info exists usparc_init_count]} {
	set usparc_init_count 0
    } else {
	incr usparc_init_count
	if { $usparc_init_count == 3 } {
	    return -1
	}

    }
    remote_close $dest
    set shell_id [remote_open $dest]
    if { $shell_id == "" || $shell_id < 0 } {
	return [remote_reboot $dest]
    } else {
	remote_binary $dest
	remote_send $dest "\n"
	set got_one 0
	remote_expect $dest 5 {
	    -re "$shell_prompt" { set got_one 1; exp_continue }
	    default {
		if { ! $got_one } {
		    remote_close $dest
		    return [remote_reboot $dest]
		}
	    }
	}
    	remote_send $dest "m \[15\]1fff1001f00 32\n"
	remote_expect $dest 5 {
	    -re "$shell_prompt" {
		unset usparc_init_count
		remote_close $dest
		return 0
	    }
	    default {
		remote_close $dest
		return [remote_reboot $dest]
	    }
	}
    }
}