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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 wfjm
# $Id: util.tcl 603 2014-11-09 22:50:26Z mueller $
2 10 wfjm
#
3 27 wfjm
# Copyright 2011-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 10 wfjm
#
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 27 wfjm
# 2014-11-09   603   2.0    use rlink v4 address layout
17 11 wfjm
# 2011-04-17   376   1.0.1  add proc scan_baud
18 10 wfjm
# 2011-04-02   375   1.0    Initial version
19
# 2011-03-19   372   0.1    First draft
20
#
21
 
22
package provide tst_rlink 1.0
23
 
24
package require rlink
25
package require rbtest
26
package require rbmoni
27
package require rbbram
28
package require rbs3hio
29
package require rbemon
30
 
31
namespace eval tst_rlink {
32
  #
33
  # setup: amap definitions for tst_rlink
34
  # 
35
  proc setup {} {
36
    rlc amap -clear;                    # clear first to allow re-run
37 27 wfjm
    rlink::setup;
38
    rbtest::setup  0xffe0;
39
    rbmoni::setup  0xffe8;
40
    rbemon::setup  0xffd0;
41
    rbbram::setup  0xfe00;
42
    rlc amap -insert timer.1 0xfe11;
43
    rlc amap -insert timer.0 0xfe10;
44
    rbs3hio::setup 0xfef0;
45 10 wfjm
  }
46
 
47
  #
48
  # init: reset tst_rlink design to initial state
49
  #
50
  proc init {} {
51
    rlink::init;                        # reset rlink
52 27 wfjm
    rbtest::init;
53
    rbmoni::init;
54
    rbbram::init;
55
    rbemon::init;
56
    rbs3hio::init;
57 10 wfjm
    rlink::init;                        # re-reset rlink
58
  }
59 11 wfjm
 
60
  #
61
  # scan_baud: scan through baud rates, show uart clkdiv value
62
  #
63
  proc scan_baud {{bmax 500000}} {
64
    if {! [rlink::isopen]} {error "-E: rlink port not open"}
65
    set rlpath [rlc open]
66
    regexp -- {^term:(.*)\?} $rlpath dummy rldev
67
    if {$rldev eq ""} {error "-E: rlink not connected to a term: device"}
68
 
69
    set rval "   baud  hi.dsp   clkdiv  sysclk"
70
    set blist {9600 19200 38400 57600 115200 230400 460800
71
               500000 921600 1000000 2000000 3000000}
72
 
73
    foreach baud $blist {
74
      if {$baud > $bmax} { break }
75
      rlc close
76
      rlc open "term:$rldev?baud=${baud};break"
77
      rlc exec -rreg hi.dsp hidsp
78 21 wfjm
      set mhz [expr {double($baud*$hidsp) / 1.e6}]
79 11 wfjm
      append rval [format "\n%7d  0x%4.4x   %6d  %6.2f" \
80 21 wfjm
                     $baud $hidsp [expr {$hidsp + 1}] $mhz]
81 11 wfjm
    }
82
 
83
    rlc close
84
    if {! [regexp -- {;break} $rlpath]} {append rlpath ";break"}
85
    rlc open "${rlpath}"
86
    return $rval
87
  }
88 10 wfjm
}

powered by: WebSVN 2.1.0

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