Tcl command "rockmfifo"


The tcl command "rockmfifo" is a specialized tcl command. It is the interface to the ROCKM FIFO library.

If used, nobody else should read out the related FIFOs!


Index


FIFO id

The access to the FIFOs is implemented via channels. Each channel have its own FIFO id. In this way one application can access many different FIFOs simply using different ids.

All the routines present in rockmfifo have a parameter of this type.


The cache

Because the FIFO is constantly updated, a cache must be used to avoid data loss.

Five types of cache are implemented:

off
This is the more conservative type of cached. Only the strict minimum is cache.
Useful for short runs.
minimal
This is the default cache type. It is like the off cache type, if the FIFO is less than half full. Else, it reads half FIFO in block transfer.
Allows fast transfers while maintaining low the cache size.
advanced
This type of cache is the more liberal possible. It will read the FIFO while the cache get full or the FIFO empty.
Useful for long runs.
block
Same as minimal, but always forse a block transfer.
block_advanced
Same as advanced, plus always try to read the entiry FIFO in block transfer.

You can change the cache type at any time using rockmfifo cache set.

You can also access the cache at a very low level using rockmfifo cache flush and rockmfifo cache refill , but this can be very dangerous.


Initialization

As stated before, the access to a FIFO is implemented via a FIFO id. To obtain such an id you have to open a channel to the FIFO using
rockmfifo open. This id will than be used for all the accesses to the FIFO.
Each id must identify a different FIFO.

When you finish using the FIFO, please call rockmfifo close to close the channel associated to the id.


Is the FIFO empty

Because of the cache, the hardware FIFO empty is not the same as the software FIFO empty. Use
rockmfifo isempty to query the FIFO empty.


Decode the FIFO

Use
rockmfifo decode to decode the FIFO and rockmfifo read_frame to read a frame in raw mode.

If the status is not empty, call the rockmfifo synch to syncronize the FIFO to the next frame.


Read raw data from the FIFO

While is the decoding the most usual operation during the run, during the test raw read can be even more important.

Use rockmfifo read for this task.

Do not use the "rockm" command!


Find out the type of an element

Especcialy when reading raw data, it isefull to know what type of element is the currently read data. Use
rockmfifo conv whatis for this task.


Convert commands

To convert raw data to formatted one or viceversa use
rockmfifo conv frame2raw and rockmfifo conv raw2frame.


An example

#open the ROCKM
set rid [rockm open 5 10]
#open a FIFO
set fid [rockfifo open efifo $rid]
...
# decode the FIFO
set decode [rockmfifo decode $fid 8192]

set alist [lindex $decode 1]

foreach {el} $alist {
 ...
}
#if there was an error, synch
if {[lindex $decode 0]==""} {
 set adump [rockmfifo synch $fid]
 ...
}
...
# read the FIFO
set alist [rockmfifo read $fid 8192]

foreach {el} $alist {
 ...
}
...
#close the FIFO
set acache [rockmfifo close $fid]
...
#close the ROCKM
rockm close $rid


Top of the page. ROCKM documention.
Send comments to: Igor Sfiligoi

Created:19.8.1997
Last modified:19.8.1997