Example programs for DDL RORC library routines
==============================================

This directory contains 4 programs showing how to use RORC library routines.
All programs open rorc and physmem, fulfill a given task, and terminates.
The tasks are chosen for simple testing of the DDL interface of the 
Front-End Electronics (FEE).

We suppose the DDL and physmem package are installed and the rorc and physmem
drivers are loaded. If you installed the DATE package then it is done.

For running and modifying the programs copy the .c files and the Makefile to 
your working directory. In the Makfile modify the following variables:

-INCDIR: set to the directory where the RORC user library include files can be 
         found, e.g.: INCDIR = /date/rorc

-LIBDIR: set to the directory where the compiled RORC user library files can be
         found, e.g.: LIBDIR = /date/rorc/Linux

-BINDIR: set to the direcory where you want to put the executable routines,
         e.g.: BINDIR = .

The short description of the example program follows:
-----------------------------------------------------
For each program you can specify the DDL channel and DDL response time-out.

The channel is given by the program switches -m <RORC minor> and -c <channel>.
If not given minor 0 and channel 0 are supposed.

The time-out value can be given by the switch -t <usec>. The default value is 
1000 us = 1 ms. You can modify this value according to your FEE needs. 
 
1./ send_command_to_FEE -w <FEE command>
    shows the usage of the routine ddlSendCommandAndWaitReply(). It sends a 
    Front-End Control (FECTRL) command containig 19 bit parameter field given 
    by the program switch. It expects only the SIU acknowledge, no reply from 
    the FEE.

2./ get_FEE_status -a <FEE address>
    shows also the usage of the routine ddlSendCommandAndWaitReply(). It sends a
    Front-End Status Read (FESTRD) command containig 19 bit address field given
    by the program switch. It expects a status word from FEE and the SIU 
    acknowledge. After receiving the FEE status the program prints its 19 bit
    parameter field.

3./ download_data_block_to_FEE -a <FEE address> -f <file name>
    shows the usage of the routine ddlWriteDataBlock(). The program reads the 
    data block from the file specified by the -f program switch and downloads
    to the FEE address given by the -a switch. Before sending the data the
    routine sends a Start Block Write (STBWR) command and expects the SIU
    acknowledge. After the block sending the routine sends an End of Block
    Transfer (EOBTR) command and expects 1 or 2 replies from SIU, according 
    to the DIU/SIU version.

4./ read_data_block_from_FEE -a <FEE address> -f <file name>
    shows the usage of the routine ddlReadDataBlock(). The program reads a data     block from the FEE address given by the -a program switch, then writes them
    into the file specified by the -f switch. For receiving the data the
    routine sends a Start Block Read (STBRD) command and expects the SIU
    acknowledge. After receiving the data block the routine sends an
    End of Block Transfer (EOBTR) command and expects again one SIU 
    acknowledge word.

The detailed description of the above routines can be found at the URL:
                      http://cern.ch/ddl, 
following the links -> "RORC documentation" -> "RORC Library User's Manual". 

The programs use some utility routines for error message printing and file
reading. These routines can be found in the rorc_aux.o library.
These have not DDL specific codes, you can use your own routines instead.


