Tcl command "rock"
The tcl command "rock" is a general purpose tcl command.
It is the interface to the levels 0 and 1 of the ROCK library.
Everything but the fifo decode is implemented here.
Index
ROCK id
The access to the ROCK is implemented via channels.
Each channel have its own ROCK id.
In this way one application can access many different rocks simply using
different ids.
All the routines present in rock have a parameter of this type.
Query ROCK presence
Sometimes it is usefull to check if a ROCK is present.
Use rock ispresent for this task.
Initialization
As stated before, the access to the ROCK is implemented via a ROCK id.
To obtain such an id you have to open a channel to the ROCK using rock open
(also rock raw open can be used during the tests).
This id will than be used for all the accesses to the ROCK.
Each id should identify a different ROCK.
When you finish using the ROCK, please call rock close
to close the channel associated to the id.
Get a filed
To get a field simply call rock get,
followed by the field name and the ROCK id.
Set a filed
To set a field simply call rock set,
followed by the field name, the ROCK id and the new value.
If the value is out of range, an and will be applied.
Read a register
There are two different ways to read a register:
- as a natural
- as a record of fields
rock raw read implements the first way,
while
rock read reset,
rock read FIFO,
rock read Watchdog,
rock read CSR0,
rock read CSR1,
rock read CSR2,
rock read Elapsed,
rock read Trigger,
rock read TQUE,
rock read TNOW,
rock read Rockinfo,
rock read Golden
implement the second way.
Note:
FIFOs can only be read as naturals.
Write a register
There are two different ways to write a register:
- as a natural
- as a record of fields
rock raw write implements the first way,
while
rock write reset,
rock write Watchdog,
rock write CSR0,
rock write CSR2,
rock write Trigger,
rock write Golden
implement the second way.
Note:
FIFOs can only be written as naturals.
Read a page
As with registers, there are two different ways to read a page:
- as a record of registers
- as a record of fields
rock raw readpage internal and
rock raw readpage info
implement the first way, while
rock readpage internal and
rock readpage info
implement the second way.
Block read a FIFO
While it is possible to read a FIFO using the read register
commands, reading it in block mode it is much faster.
rock readfifo EFIFO and
rock readfifo DFIFO
do exactly this.
An example
#open the ROCK
set rid [rock open 5 10]
...
#get boe bit
set aboe [rock get boe $rid]
...
# reset al on
rock raw write reset $rid 0
...
# read a FIFO
set alist [rock readfifo EFIFO $rid 8192]
foreach {el} $alist {
...
}
...
#close the rock
rock close $rid
Created | : | 11.3.1997 |
Last modified | : | 20.3.1997 |