OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [tcl/] [tst_rlink/] [util.tcl] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 wfjm
# $Id: util.tcl 516 2013-05-05 21:24:52Z mueller $
2 10 wfjm
#
3
# Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
#
5
# This program is free software; you may redistribute and/or modify it under
6
# the terms of the GNU General Public License as published by the Free
7
# Software Foundation, either version 2, or at your option any later version.
8
#
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
# for complete details.
13
#
14
#  Revision History:
15
# Date         Rev Version  Comment
16 11 wfjm
# 2011-04-17   376   1.0.1  add proc scan_baud
17 10 wfjm
# 2011-04-02   375   1.0    Initial version
18
# 2011-03-19   372   0.1    First draft
19
#
20
 
21
package provide tst_rlink 1.0
22
 
23
package require rlink
24
package require rbtest
25
package require rbmoni
26
package require rbbram
27
package require rbs3hio
28
package require rbemon
29
 
30
namespace eval tst_rlink {
31
  #
32
  # setup: amap definitions for tst_rlink
33
  # 
34
  proc setup {} {
35
    rlc amap -clear;                    # clear first to allow re-run
36
    rbmoni::setup  [bvi b 11111100]
37
    rbemon::setup  [bvi b 11111000]
38
    rbbram::setup  [bvi b 11110100]
39
    rbtest::setup  [bvi b 11110000]
40
    rlc amap -insert timer.1 [bvi b 11100001]
41
    rlc amap -insert timer.0 [bvi b 11100000]
42
    rbs3hio::setup [bvi b 11000000]
43
  }
44
 
45
  #
46
  # init: reset tst_rlink design to initial state
47
  #
48
  proc init {} {
49
    rlink::init;                        # reset rlink
50
    rbtest::init
51
    rbbram::init
52
    rbmoni::init
53
    rbs3hio::init
54
    rbemon::init
55
    rlink::init;                        # re-reset rlink
56
  }
57 11 wfjm
 
58
  #
59
  # scan_baud: scan through baud rates, show uart clkdiv value
60
  #
61
  proc scan_baud {{bmax 500000}} {
62
    if {! [rlink::isopen]} {error "-E: rlink port not open"}
63
    set rlpath [rlc open]
64
    regexp -- {^term:(.*)\?} $rlpath dummy rldev
65
    if {$rldev eq ""} {error "-E: rlink not connected to a term: device"}
66
 
67
    set rval "   baud  hi.dsp   clkdiv  sysclk"
68
    set blist {9600 19200 38400 57600 115200 230400 460800
69
               500000 921600 1000000 2000000 3000000}
70
 
71
    foreach baud $blist {
72
      if {$baud > $bmax} { break }
73
      rlc close
74
      rlc open "term:$rldev?baud=${baud};break"
75
      rlc exec -rreg hi.dsp hidsp
76 21 wfjm
      set mhz [expr {double($baud*$hidsp) / 1.e6}]
77 11 wfjm
      append rval [format "\n%7d  0x%4.4x   %6d  %6.2f" \
78 21 wfjm
                     $baud $hidsp [expr {$hidsp + 1}] $mhz]
79 11 wfjm
    }
80
 
81
    rlc close
82
    if {! [regexp -- {;break} $rlpath]} {append rlpath ";break"}
83
    rlc open "${rlpath}"
84
    return $rval
85
  }
86 10 wfjm
}

powered by: WebSVN 2.1.0

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