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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 wfjm
# $Id: util.tcl 661 2015-04-03 18:28:41Z 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 28 wfjm
# 2014-12-21   617   2.0.1  add rbtout definition in STAT
17 27 wfjm
# 2014-12-07   609   2.0    use new rlink v4 iface; remove SINIT again
18
# 2014-08-09   580   1.0.2  add run_rri
19 12 wfjm
# 2011-08-06   403   1.0.1  add SINT and SINIT defs for serport init
20 10 wfjm
# 2011-03-26   373   1.0    Initial version
21
# 2011-03-19   372   0.1    First draft
22
#
23
 
24
package provide rlink 1.0
25
 
26
package require rutil 1.0
27
 
28
namespace eval rlink {
29 28 wfjm
  regdsc STAT   {stat 7 4} {attn 3} {rbtout 2} {rbnak 1} {rberr 0}
30 30 wfjm
  variable STAT_DEFMASK [regbld rlink::STAT rbtout rbnak rberr]
31
 
32 27 wfjm
  regdsc RLCNTL {anena 15} {atoena 14} {atoval 7 8}
33
  regdsc RLSTAT {lcmd 15 8} {babo 7} {rbsize 2 3}
34 30 wfjm
 
35 10 wfjm
  # 'pseudo register', describes 3rd word in return list element for -rlist
36
  regdsc FLAGS {vol 16} \
37
    {chkdata 13} {chkstat 12} \
38
    {errcrc 11} {errcmd 10}  {errmiss 9} {errnak 8} \
39
    {resend 7} {recov 6} {pktend 5} {pktbeg 4} \
40
    {done 2} {send 1} {init 0}
41
 
42 27 wfjm
  # define rlink core regs addresses (are system constants)
43
  variable ADDR_RLCNTL 0xffff
44
  variable ADDR_RLSTAT 0xfffe
45
  variable ADDR_RLID1  0xfffd
46
  variable ADDR_RLID0  0xfffc
47 10 wfjm
 
48
  #
49 27 wfjm
  # setup: amap definitions for core config regs
50
  # 
51
  proc setup {} {
52
    rlc amap -insert rl.cntl $rlink::ADDR_RLCNTL
53
    rlc amap -insert rl.stat $rlink::ADDR_RLSTAT
54
    rlc amap -insert rl.id1  $rlink::ADDR_RLID1
55
    rlc amap -insert rl.id0  $rlink::ADDR_RLID0
56
  }
57
  #
58 12 wfjm
  # init: reset rlink: disable enables; clear attn register
59 10 wfjm
  #
60
  proc init {} {
61
    rlc exec \
62 27 wfjm
      -wreg $rlink::ADDR_RLCNTL 0 \
63 10 wfjm
      -attn
64
    return ""
65
  }
66
  #
67 27 wfjm
  # anena: enable/disable attn notify messages
68
  #
69
  proc anena {{ena 0}} {
70
    rlc exec \
71
      -wreg $rlink::ADDR_RLCNTL [regbld rlink::RLCNTL [list anena $ena]]
72
  }
73
  #
74 10 wfjm
  # isopen: returns 1 if open and 0 if close
75
  #
76
  proc isopen {} {
77
    if {[rlc open] eq ""} { return 0 }
78
    return 1
79
  }
80
  #
81
  # isfifo: returns 1 if open and fifo, 0 otherwise
82
  #
83
  proc isfifo {} {
84
    set name [rlc open]
85
    if {$name ne "" && [regexp -- {^fifo:} $name]} { return 1 }
86
    return 0
87
  }
88
  #
89
  # issim: returns 1 if open and in simulation mode, 0 otherwise
90
  #
91
  proc issim {} {
92
    if {![info exists rlink::sim_mode]} { return 0}
93
    return $rlink::sim_mode
94
  }
95 27 wfjm
 
96
  #
97
  # run_rri: execute rri type command file
98
  #
99
  proc run_rri {fname} {
100
    rlc errcnt -clear
101
    set code [exec ticonv_rri $fname]
102
    eval $code
103
    set errcnt [rlc errcnt]
104
    if { $errcnt } {
105
      puts [format "run_rri: FAIL after %d errors" $errcnt]
106
    }
107
    return $errcnt
108
  }
109
 
110 10 wfjm
}

powered by: WebSVN 2.1.0

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