\documentstyle[11pt,a4wide]{farticle} \title{Database for the VXI cards testing} \author{Contact: Christophe DIARRA (diarra@borsu6.in2p3.fr)} \date{October 1991; last updated Wed 12 Feb 1992} %Last updated THU 10 OCT 1991 11:45:57 \begin{document} \begin{titlepage} { \hoffset=1truein \hsize=5.25truein \vsize=10.25truein \font\small=cmssbx10 at 14.4truept \font\medium=cmssbx10 at 17.28truept \font\large=cmssbx10 at 20.74truept \hrule height 0pt \parindent=0pt %\parskip=0pt \hskip 3.9truein \large EDOC133\par \vskip .5truein \large EUROGAM PROJECT\par \vskip 1.5truein \hrule height 2pt \vskip 20pt \medium Database for the VXI cards testing\par \vskip 1.5truein \vskip 15pt \hrule height 2pt \vskip 1truein \medium \vskip 5pt October 1991\par Last updated Thu 11 February 1992\par \vskip .5truein M.M.ALEONARD, B.HUMBERT, C.DIARRA, P. KADIONIK, C.RING, G.ZEHNACKER. \vfill \medium CENBG Bordeaux\par \vskip 5pt SATD\par \vskip 5pt Centre de Recherche Nucleaire de Strasbourg \vskip 5pt CNRS-IN2P3 France\par \vskip .5truein } \end{titlepage} %\tableofcontents \maketitle \section{Introduction} To access a register in the VXI cards, a command line has to be generated. This may be done from a keyboard or sent by the Graphical User Interface (GUI). The first field of the command line is an executable file name (ex: read\_database, write\_vxi, load\_vxi, ...). For each specific operation, an executable file is provided: \\ \begin{itemize} \item read\_vxi, to read a register \item write\_vxi, to write a value into a register \item write\_database, to save a value into the database \item ... \end{itemize} This programs always make an access to the database files to get some informations that will be used to make a call to the register server or to modify other files of the database.\\ \vbox{ \begin{verbatim} +--------------------+ +--------------+ +-----------------+ | | | | | | | command line from a| | | | | | Keyboard or a GUI |<====>| Database |<====>| Register Server | | | | | | | +--------------------+ +--------------+ +-----------------+ \end{verbatim} } Supposed you need the entry of the register 1 (this number must be converted into the effective register number) into to ROCI 1 of the germanium detector 1. You will have two possiblities:\\ \begin{itemize} \item {\bf with the GUI:} You click on the register one (ge card synoptique). The GUI will generates the following command line: {\bf read\_database germanium\_roci\_1 1 r1}\\ The program read\_database is executed and sends a reply to the GUI (see EDOC126: "Protocoles between electronic card and software tcard" for further informations).\\ \item {\bf from a keyboard:} you must type {\bf read\_database ge\_roci\_1 1 r1 $<$ENTER$>$}\\ \end{itemize} \section{Database files} There are two types of files: those common to the whole environment (Config file) and those specific to each card (Setup files).\\ \subsection{The file {\bf "VXIConfig.target"}} This file must be edited by hand and indicates the position of each crate.\\ Example: a configuration with 3 crates:\\ \% cat VXIConfig.target \begin{verbatim} POSITION NAME % - 1 peony 2 daisy 3 poppy END END \end{verbatim} In this configuration, the first crate is peony (POSITION=1). This crate is the one including the Master Trigger or the ROCO 1. The second crate is daisy and the last crate is poppy.\\ You don't need this file if you want to edit by hand the {\bf VXIConfig} and {\bf Array\_Setup} files. But if you want to generate them with the command {\bf update\_vxi\_database} (see the section {\bf The different commands}) the first thing to do \subsection{The {\bf VXIConfig} files} They can be built using the structure resulting of the VXI "Autoconfiguration" or edited by hand.\\ Format:\\ \vbox{ \begin{verbatim} DET_NUM CRATE SLOT CHAN SER_NUMB % - - - - <...................DATA...................> END END END END END \end{verbatim} } Example of file VXIConfig.G\\ \vbox{ \begin{verbatim} DET_NUM CRATE SLOT CHAN SER_NUMB % - - - - 1 peony 4 1 0000 2 peony 4 2 0000 3 peony 4 3 0000 4 peony 4 4 0000 5 peony 4 5 0000 6 peony 4 6 0000 7 lily 7 1 0001 8 lily 7 2 0001 9 lily 7 3 0001 10 lily 7 4 0001 11 lily 7 5 0001 12 lily 7 6 0001 END END END END END \end{verbatim} } In this file, we have:\\ \begin{itemize} \item one header: {\it "DETECTOR CRATE\_NAME SLOT CHAN SER\_NUMB"} (5 fields). \item one comment line begining by {\bf \%} (5 fields). \item the entry for each detector (5 fields).. \item the last line with all the fields set to {\bf "END"} (5 fields). \end{itemize} This file can be updated every time you make the autoconfiguration by typing the command {\bf update\_vxi\_database}. But each time you generate the {\bf VXIConfig} files, check them to be sure that never two cards have the same serial numbers in the same {\bf VXIConfig} file. If you find the same serial number for all the cards, modify it in order to assign a diffe a card in the {\bf VXIConfif} file but allway assign the same number to this card in case you have to move this cards to an other slot or an other crate.\\ \subsection{The {\bf Array\_Setup} files} They can be built using the structure resulting of the VXI "Autoconfiguration" or edited by hand.\\ Format:\\ \vbox{ \begin{verbatim} DET_NUM DET_REF PLUG % - - <............DATA.........> END END END \end{verbatim} } This file is edited by hand before the setup and indicates the channels used on each card (PLUG$/$NONE). For example the Ge detector 7 must be on the first channel of the second Ge card. If there is no detector on this channel or if there is a problem on this channel you will have a line like this: {\it "7 GUOCxxx NONE"} in the file Array\_Setup.G. If the channel is unused, the detector reference may be any string or character. So, the entry for the detector 7 could be {\it 7 \_ NONE}. But you must always have at least one character in the field DET\_REF.\\ \vbox{ \begin{verbatim} DETECTOR DET_REF PLUG % - - 1 GUOCxxx PLUG 2 GUOCxxx PLUG 3 GUOCxxx PLUG 4 GUOCxxx NONE 5 GUOCxxx NONE 6 GUOCxxx NONE 7 GUOCxxx NONE 8 GUOCxxx NONE 9 GUOCxxx NONE 10 GUOCxxx NONE 11 GUOCxxx NONE 12 GUOCxxx NONE END END END \end{verbatim} } {\bf Note:} in this file we could have replaced {\it "GUOCxxx"} per {\it "\_"} from the detector 4 to 12 because these channels are unused.\\ This file is overwritten when you use the command {\bf update\_vxi\_database}. To avoid this, use the command with the option {\bf [NOTARRAY]} : {\bf update\_vxi\_database NOTARRAY $<$ENTER$>$}.\\ Supposed you have edited by hand the file {\bf Array\_Setup.G}, and have updated in the field {\bf DET\_REF} the effective references for each connected detector. Executing the command {\bf update\_vxi\_database} will overwrite the file {\bf Array\_Setup.G} and all the changes done by hand will be lost: the field {\bf DET\_REF} will be set to {\bf "GERMANIUM"} for all the detectors and the field {\bf PLUG} to {\bf "PLUG"} for all the detectors.\\ \subsection{{\bf Reg\_Setup} files} These files contain for each register the informations needed by tcard and the setup grograms.\\ Note that the name of the setup file integrates both the card ID (serial number) and a character for card selection (G, S, T, ...).\\ Examples: {\bf Reg\_Setup\_0000.G}\\ \vbox{ 1. Reg\_Setup\_0000.G \begin{verbatim} REGNAME REGNUM MIN MAX STEP SETUP UNIT MODE % - - - - - - - channel_0 - - - - - - - % - - - - - - - CFDWidth 1 10 255 1 255 ns W FTSample 2 0 2000 8 340 ns W ValSample 3 0 10000 40 4750 ns W StartRdOut 4 0 10000 40 10000 ns W TestGen 5 0 65535 1 24941 keV W emptyFIFO 19 0 1 1 0 dec RW TstWFifo 21 0 65535 1 4750 dec W TstRFifo 22 0 65535 1 0 dec R \end{verbatim} } \vbox{ \begin{verbatim} % - - - - - - - channel_1 - - - - - - - % - - - - - - - CFDThresh 23 0 5000 20 250 keV W CFDDelay 24 0 255 1 129 ns W PZAdj 25 0 255 1 80 dec W PDSGate 26 0 10000 40 4550 ns W RO20MTh 27 0 65535 1 0 dec RW RO4MTh 28 0 65535 1 0 dec RW ROTiTh 29 0 65535 1 0 dec RW ROCOTh 30 0 65535 1 0 dec RW ROAdd20MGr 31 1 70 1 1 dec W_ ROAdd20MIt 32 0 7 1 1 dec W ROAdd4MGr 33 1 70 1 1 dec W_ ROAdd4MIt 34 0 7 1 0 dec W ROAddTiGr 35 1 70 1 1 dec W_ ROAddTiIt 36 0 7 1 3 dec W ROAddCOGr 37 1 70 1 1 dec W_ ROAddCOIt 38 0 7 1 7 dec W ROTstR20M 39 0 65535 1 0 dec R ROTstR4M 40 0 65535 1 0 dec R ROTstRTi 41 0 65535 1 0 dec R ROTstRCO 42 0 65535 1 0 dec R ROSlSReg 51 0 65535 1 0 dec R ROTstReg 52 0 $ffffffff 1 6553 dec W % - - - - - - - channel_2 - - - - - - - % - - - - - - - : : : \end{verbatim} } \vbox{ \begin{verbatim} % - - - - - - - channel_6 - - - - - - - % - - - - - - - CFDThresh 23 0 5000 20 250 keV W CFDDelay 24 0 255 1 129 ns W PZAdj 25 0 255 1 80 dec W PDSGate 26 0 10000 40 4550 ns W RO20MTh 27 0 65535 1 0 dec RW RO4MTh 28 0 65535 1 0 dec RW ROTiTh 29 0 65535 1 0 dec RW ROCOTh 30 0 65535 1 0 dec RW ROAdd20MGr 31 1 70 1 1 dec W_ ROAdd20MIt 32 0 7 1 1 dec W ROAdd4MGr 33 1 70 1 1 dec W_ ROAdd4MIt 34 0 7 1 0 dec W ROAddTiGr 35 1 70 1 1 dec W_ ROAddTiIt 36 0 7 1 3 dec W ROAddCOGr 37 1 70 1 1 dec W_ ROAddCOIt 38 0 7 1 7 dec W ROTstR20M 39 0 65535 1 0 dec R ROTstR4M 40 0 65535 1 0 dec R ROTstRTi 41 0 65535 1 0 dec R ROTstRCO 42 0 65535 1 0 dec R ROSlSReg 51 0 65535 1 0 dec R ROTstReg 52 0 $ffffffff 1 6553 dec W END END END END END END END END \end{verbatim} } {\bf Note:} a register number is given by the mapping of the card.\\ The range (MIN, MAX) are fixed by the hardware and the step (also fixed by the hardware) is used as a conversion factor for writing and reading operations.\\ The step of the register 26 (PDSGate) is 40 (ns). This means that incrementing this register by 1 increments the PDSGate by 40 ns. \\ That is, all the values to be written (values given with a unit: ns, keV, ...) will be devided by the step before writing them. For a read operation, the value from the register is muliplied by the step to give a value with a unit (ns, keV, ...).\\ The value in the field {\bf SETUP} is the value used to set the register (see the command {\bf load\_vxi}). This value is modified by the command {\bf write\_database} each time you click on the button {\bf save} using the GUI. The value stored is the one selected by the slider. You can also restore the saved value by clicking on the button {\bf restore}: the slider will move and indicates the value extracted from the database.\\ The values with {\bf "\$"} (ex: \$ffffffff) are in hexadecimal.\\ The mode "W\_" means that the register is write$-$able but the setup value depends to the location of the card in the crate: the value to be written is determined during the setup.\\ The separator "channel\_", must be the same in all the setup files. But you can change it and the change must be reported in the file "constantes.h". The variable CHANNEL\_DELIMIT must be modified (default value: \# define CHANNEL\_DELIMIT "channel\_").\\ {\bf Note:} for the Ge and BGO cards separator is channel\_$<$ channel number on the card$>$. "channel\_0" means that the data following are common to the card and channel\_$<$i$>$ means that the followind data are specific to the channel i of the card.\\ For the Master Trigger the separator will be {\bf "groupe\_"}. \subsection{The {\bf Button\_Setup} files} These files contain the entry for each switch. The field SETUP indicates the state (a string) of the switch at the setup, and the fields {\bf STATE1} and {\bf STATE2} the value (0 or 1) to be written. \\ Example: {\bf Button\_Setup\_0000.G} \vbox{ \begin{verbatim} REGNAME REGNUM STATE1 STATE2 SETUP MODE % - - - - - channel_0 - - - - - % - - - - - CtlFEna 16 enable=1 disable=0 disable RW Endmodule 17 yes=1 no=0 no RW PileUpRej 18 mark=1 rejct=0 mark RW TstGenAtt 20 atten=1 _=0 atten RW \end{verbatim} } \vbox{ \begin{verbatim} % - - - - - channel_1 - - - - - % - - - - - ROSlS20MEna 43 en=1 dis=0 dis RW ROSlS4MEna 44 en=1 dis=0 dis RW ROSlSTiEna 45 en=1 dis=0 dis RW ROSlSCoEna 46 en=1 dis=0 dis RW RO20MEna 47 enable=1 disable=0 enable RW RO4MEna 48 enable=1 disable=0 enable RW ROTiEna 49 enable=1 disable=0 enable RW ROCOEna 50 enable=1 disable=0 enable RW CCRAmpext 53 int=0 ext=1 int RW CCRVetLem 54 lbus=0 lemo=1 lbus RW CCRTFAGai 55 high=0 low=1 high RW CCRBDCEna 56 on=1 off=0 off RW CCRTstEna 57 on=1 off=0 off RW CCRChDis 58 enable=1 disable=0 disable RW % - - - - - channel_2 - - - - - : : \end{verbatim} } \vbox{ \begin{verbatim} % - - - - - channel_6 - - - - - % - - - - - ROSlS20MEna 43 en=1 dis=0 dis RW ROSlS4MEna 44 en=1 dis=0 dis RW ROSlSTiEna 45 en=1 dis=0 dis RW ROSlSCoEna 46 en=1 dis=0 dis RW RO20MEna 47 enable=1 disable=0 enable RW RO4MEna 48 enable=1 disable=0 enable RW ROTiEna 49 enable=1 disable=0 enable RW ROCOEna 50 enable=1 disable=0 enable RW CCRAmpext 53 int=0 ext=1 int RW CCRVetLem 54 lbus=0 lemo=1 lbus RW CCRTFAGai 55 high=0 low=1 high RW CCRBDCEna 56 on=1 off=0 off RW CCRTstEna 57 on=1 off=0 off RW CCRChDis 58 enable=1 disable=0 disable RW END END END END END END \end{verbatim} } The entry for the register 16 (CtlFEna) indicates that the {\it Controle des Fenetres} must be disabled at the setup. And this is done by writing 0 (disable=0) to one bit in the "Controle des Fenetres" register.\\ \subsection{The {\bf Button\_Status} files} This files are the copy of the {\bf Button\_Setup} files at the setup. They will contains at any moment the last state of each switch: each time you change the value of a switch in a VXI card, the string (disable, enable, low, ...) used to get the value (0 or 1) is saved in the field {\bf SETUP} of the {\bf Button\_Status} file. \\ For your next setup, the files used are the {\bf Button\_Setup} files. Since these files are never modified, you will lost the last changes you made on the switches. So if you to retrieve the last states of each switch for a card, just copy the file {\bf Button\_Status} to the file {\bf Button\_Setup} for this card.\\ Example: cp Button\_Status\_0000.G Button\_Setup\_0000.G\\ \subsection{The {\bf Reg\_Setup\_default\_config} and {\bf Button\_Setup\_default\_config} files} This files contain the name of the files you want to use for a new card.\\ For example the file {\bf Reg\_Setup\_default\_config.G} could contain the following line : {\bf current$/$Reg\_Setup\_0000.G}.\\ This means that all new Ge cards will have a {\bf Reg\_Setup} file which is just a copy of the file {\bf Reg\_Setup\_0000.G}.\\ Note that the name of the default file must begin by {\bf current}\\ \section{The different commands} The GUI executes programs using the protocole defined in EDOC126. After the execution completed, a reply is sent to the GUI in a format defined in EDOC126. \\ {\bf Note:} All the registers and "buttons" numbers from the GUI must be converted in real numbers corresponding to the numbers fixed by the mapping structure. The same lines are sent to the GUI.\\ If you type the commands by hand, You can give the effective register. In this case, the register number needs no conversion and is use directely in the call to Register Server. If you give directely the real register number, you must use an argument to indicate it: this argument is the last one.\\ For the Ge and BGO cards, this argument is any character or number.\\ For the Master Trigger card, this argument is the group of the register (see theMaster Trigger mapping structure).\\ Example: you want to read the CFD threshold DAC of the Ge detector number 5. \\ On the GUI this DAC has the number 2 and on the mapping structure the number 23 (real number). \\ When you click on this DAC on the GUI, the following command will be generated:\\ {\bf read\_vxi ge 5 2}\\ The register number {\bf 2} is converted into {\bf 23} which is the CFD threshold DAC.\\ But if you can use the number {\bf 23}, in this case, you have to type :\\ {\bf read\_vxi ge 5 23 -}\\ Here the character {\bf "$-$"} indicates that the register number {\bf 23} will not have to converted. {\bf "$-$} can be replaced by any other character. But for the Master Trigger card, {\bf "$-$} is replaced by only a number which specifies the group the register belong to. Remember that for the Master Trigger mapping structur In all the following examples, we considered only the case where the command line is sent by the GUI. \\ Each field of the command line is used to found particular information.\\ \begin{itemize} \item {\it $<$card\_name$>$ :} is used to found the files extension : {\it "G", "S", "T", ...} \item {\it $<$detector\_number$>$ :} is used to get the VXI crate name, the slot number (with the ID of the card in this slot) and the channel number where the detector is based. These informations are in the {\bf VXIConfig} files. \\ \item {\it $<$rbs$>$$<$number$>$ :} this number is the number of a {\bf r}egister, a "{\bf b}utton" or a {\bf s}cope on the GUI and is converted (if necessary) to the effective number in the mapping.\\ \item {\it $<$value$>$ :} if specified, it is devided by the step of the register to give the value which will be written (conversion operation).\\ \end{itemize} Each time a register is accessed (read\_vxi, write\_vxi, button\_vxi, ...) a variable {\it request} of type data\_in (see the document about the register server written by Patrice Kadionik) is given as the input parameter to a RPC which makes the call to the register server. The program (read\_vxi, ...) extracts from the database all the values to set the fields of the structure request.\\ For all the following commands, the card type and the serial number of the card are used to find the rigth file.\\ \subsection{The command dbformat} The files which must be handle with care are:\\ the {\bf VXIConfig} files\\ the {\bf Array\_Setup} files\\ the {\bf Reg\_Setup} files\\ the {\bf Button\_Setup} files\\ You can edit them if needed but before you use them with the database commands (read\_database, write\_database, ...) you must use {\bf dbformat}\\ Usage: {\bf dbformat [-if] files ...} Supposed you have edited the file {\bf Reg\_Setup\_0000.G}. You will have to type one of the following commands:\\ \% {\bf dbformat -i Reg\_Setup\_0000.G}\\ The [-i] option is the default option of dbformat and this option need you to confirm your request.\\ \% {\bf dbformat -f Reg\_Setup\_0000.G} \\ In this case, no confirmation is needed.\\ If you have edited many files, you can type {\bf dbformat -f *} and only the files that have the suitable format will be formated the other files wil not be modified by this command. {\bf dbformat} test first the last line of a file to know if it can format it (the last line must have all the fields set to {\bf "END"}. \\ \subsection{read\_database} Read from the database the entry of a register.\\ \noindent {\it Syntaxe:}\\ {\bf read\_database $<$card\_name$>$ $<$detector\_number$>$ r$<$number$>$ [option]\\ read\_database $<$card\_name$>$ $<$detector\_number$>$ b$<$number$>$ [option]\\ read\_database $<$card\_name$>$ $<$detector\_number$>$ s$<$number$>$ [option]\\ } \noindent {\it symboles}\\ r used for registers\\ b used for buttons (switches)\\ s used for scope\\ {\bf [option]} may be '-' for the Ge and BGO cards or the group of the register for the Master Trigger card.\\ The format of the reply line is :\\ {\it commande: $<$the command you have generated$>$\\ status: $<$Status$>$\\ value: $<$reg\_numb$>$ $<$reg\_name$>$ $<$setup value$>$ $<$unit$>$ $<$min$>$ $<$max$>$ }\\ \noindent {\it Function:} \\ sends to the GUI the entry of a register and is generated each time you click to adjust the value of a register. This cammand is also executed to restore the last saved value of a regsiter.\\ {\it Examples:}\\ \begin{itemize} \item example 1: {\bf read\_database germanium 1 r1\\} This command may be typed by hand or generated by the GUI.\\ {\it Reply:}\\ commande: read\_database germanium 1 r1\\ status: ok\\ value: 5 TestGen 24941 keV 0 65535\\ \noindent {\bf signification:} \\ {\-} {\large 5:} the register number in the mapping structure. Note that this register has the number {\large 1} in the GUI.\\ {\-} {\large TestGen:} the register name. Here it is the test generator DAC.\\ {\-} {\large 24941:} the value loaded in the register at the {\it setup} (see load\_vxi).\\ {\-} {\large keV:} the unit in which the values are given (24941 is in keV).\\ {\-} {\large 0 65535:} the range of the test generator DAC in keV.\\ \item example 2: {\bf read\_database germanium 1 r100\\} {\it Reply:}\\ commande: read\_database germanium 1 r100\\ status: undefined register number\\ There is no register number 100 recorded in the GUI.\\ \item example 3: {\bf read\_database germanium 1 b1\\} {\it Reply:}\\ commande: read\_database germanium 1 b1\\ status: ok\\ value: 55 CCRTFAGai low \_ high low \end{itemize} The signe "\_" (underscore) is sent to make the reply compatible with the register's one.\\ Here the {\it "button"} number 1 (b1) has an effective number 55 in the mapping structure. \subsection{write\_database} Will save the value (in the field SETUP) of a register in a file {\bf Reg\_Setup} using the serial number (for the file name) of the card where the detector is.\\ \noindent {\it Syntaxe:}\\ {\bf write\_database $<$card\_name$>$ $<$detector\_number$>$ r$<$number$>$ $<$value$>$ $<$unit$>$ [option]\\} \noindent {\it Function:} \\ save in the database the value you want to write into a register at the setup.\\ The command {\bf write\_database} is executed when you click on the button {\bf save}. The value indicated by the slider is saved for the right register in the rigth file.\\ \noindent {\it Examples:\\} \begin{itemize} \item example 1: {\bf write\_database germanium 1 r1 1000 keV\\} This command may be typed by hand or generated by the GUI.\\ {\it Reply:}\\ commande: write\_database germanium 1 r1 1000 keV\\ status: ok\\ Here we have only the status: "ok" means that the value "1000" (in keV) has been written in the database. \item example 2: {\bf write\_database germanium 1-3,10,17 r1 1000 keV\\} This command may be typed by hand or generated by the GUI.\\ {\it Reply:}\\ commande: write\_database germanium 1-3,10,17 r1 1000 keV\\ status: ok\\ \end{itemize} In this example, the database is updated for many channels.\\ \subsection{write\_vxi} Write a value in a register in a VXI card.\\ \noindent {\it Syntaxe:}\\ {\bf write\_vxi $<$card\_name$>$ $<$detector\_number$>$ $<$register$>$ $<$value$>$ $<$unit$>$ [option]\\ write\_vxi $<$card\_name$>$ $<$detector\_numberi$>$ [[$-$,]$<$detector\_numberj$>$]\\ $<$register\_number$>$ $<$value$>$ $<$unit$>$ [option]\\ } \noindent {\it Function:} \\ write into a register (into the VXI card) the converted value.\\ example: {\bf write\_vxi germanium 1-5,22 1 665 keV\\} {\it reply:}\\ commande: write germanium 1-5,22 1 665 keV\\ status: ok\\ The status {\it "ok"} indicates that the register 1 (5 in reality) has now the value 83 (665 keV) : 83 = (665 keV)\/(8 keV per bit)).\\ The step of the Test Generator DAC is 8 (8 keV per bit).\\ The DAC is modified for all the germanium cards where the detectors 1-5 and 22 are connected.\\ \subsection{read\_vxi} \noindent {\it Syntaxe:}\\ {\bf read\_vxi $<$card\_name$>$ $<$detector\_number$>$ $<$register$>$ [option] \\ read\_vxi $<$card\_name$>$ $<$detector\_numberi$>$ $<$detector\_numberj$>$ $<$register\_number$>$ [option]\\ read\_vxi $<$card\_name$>$ $<$detector\_numberi$>$ [[$-$,]$<$detector\_numberj$>$ ] $<$register\_number$>$ [option]\\ } \noindent {\it Function: } \\ read a register (from the VXI card) and sends the content in the reply structure.\\ The processing of the call depend on the register type. If the register is readable {\it(mode = "R" or "RW")} the register is read and the value converted (multiplied by the step) is sent back to the GUI.\\ If the register is a DAC, the output of the DAC is measured (in volts). The value measured is converted into a value with unit (keV, ns, ...).\\ Example: {\bf read\_vxi germanium 22 1\\} {\it reply:}\\ commande: read\_vxi germanium 22 1\\ status: ok\\ value: 665 keV\\ \subsection{button\_vxi} \noindent {\it Syntaxe:}\\ {\bf button\_vxi $<$card\_name$>$ $<$detector\_number $<$button\_number $<$status$>$} [option]\\ {\it Function: } \\ Make a call to the register server to set a bit to 0 or 1. The reply is the same as with write\_vxi.\\ \noindent Example: {\bf button\_vxi germanium 1 1 low}\\ On the GUI the {\it "button" 1} is used to select the TFA gain (low or high). The real register number of the TFA gain select bit is 55.\\ The problem is to know if "low" means setting this register to 0 or 1. The entry of this register in the file Button\_Setup\_xxx.G is used to determined at which value the bit must be set.\\ The entry of the register 55 ("button 1") is : {\it "CCRTFAGai 55 high=0 low=1 high RW"} and indicates that to set the TFA Gain low, t 1.\\ Each time you execute the {\bf button\_vxi} program, the new status of the button is stored in the {\bf Button\_Status} file.\\ \subsection{scope\_vxi} \noindent {\it Syntaxe:}\\ {\bf scope\_vxi $<$card\_type$>$ $<$detector\_number$>$ $<$test\_point$>$ $<$scope\_channel$>$} \\ \noindent {\it Function: } initializes the structure request and make a call to the register server to connect the test point to a channel of the scope.\\ The reply remains the same as in the write{\_vxi} operation.\\ \noindent Example: scope\_vxi bgo 1 1 L2\\ {\it reply:\\} commande: scope\_vxi bgo 1 1 L2\\ status: ok\\ value:\\ \noindent This command will has as effect to connect the parameter output of the test point 1 to the logical input 2 of the scope.\\ \subsection{scope\_reset\_vxi} \noindent {\it Syntaxe:}\\ {\bf scope\_reset\_vxi $<$detector name$>$ $<$detector number$>$}\\ \noindent {\it Function:} disconnects all the parameters to the scope. This is done only for the crate where {\bf $<$detector number$>$} is found.\\ \subsection{load\_vxi} This command is use to set a card with the values from the {\bf Reg\_Setup} and the {\bf Button\_Setup} files.\\ If a new card is found (a card having no setup files) {\bf load\_vxi} will create setup files for this card by copying the default files (whose names are in the files Reg\_Setup\_default\_config, ...) to files whose names include the serial number and the type of the card.\\ {\bf load\_vxi} also creates the {\bf Button\_Status} files ({\it see the section {\bf Button\_Status} files}).\\ {\bf load\_vxi} has 3 usages:\\ {\bf Usage 1: loading of only one card}\\ \noindent Usage: {\bf load\_vxi $<$card name$>$ $<$detector number$>$}\\ \noindent {\bf $<$detector number$>$} is used to get a slot number (using the file VXIConfig.$<$?$>$). The card in this slot will be loaded using the setup file. All the channels of the card are loaded if possible (the file Array\_Setup tells if a channel could be use or not). \\ \noindent Example: {\bf load\_vxi ge 1} will load the germanium card where the detector 1 is found.\\ \noindent {\bf Usage 2: loading of all the cards of the same type in all the crates}\\ \noindent Usage: {\bf load\_vxi $<$card name$>$}\\ \noindent Example: {\bf load\_vxi ge} will load all the germanium cards in all the crates.\\ \noindent {\bf Usage 3: loading of all the cards in all the crates}\\ \noindent Usage: {\bf load\_vxi "all"}\\ \noindent Example: {\bf load\_vxi all} will load all the cards (Ge, BGO, Trigger) in all the crates.\\ \subsection{{\bf init\_database and save\_current\_database}} The command {\bf save\_current\_database} copy all the files from the directory \$DATABASE$/$current into the directory \$DATABASE$/$default.\\ The command {\bf init\_database} restore all the files from the directory \$DATABASE$/$default into the directory \$DATABASE$/$current.\\ These command are available from a menu of the GUI.\\ {\large Be very carefull when using the command {\bf init\_database}}: if the directory \$DATABASE$/$default contains corrupted files that have the same name as in \$DATABASE$/$current, you will overwrite the files in the directory \$DATABASE$/$current and then loose some of the files you need to work.\\ If possible, do these two operation by hand.\\ \section{Directories} If your home directory is \$HOME, you must set the environment variables \$DATABASE, \$DATABASE\_VXI, \$COMMON, \$DBMS:\\ {\bf \$DATABASE = \$HOME$/$DATABASE\\} {\bf \$COMMON = \$HOME$/$DATABASE$/$SOURCE\_C$/$common\\} {\bf \$DBMS = \$HOME$/$DATABASE$/$SOURCE\_C$/$dbms\\} In the directory \$DATABASE be sure that the subdirectory {\bf current} exist and contain all the files necessary for the database.\\ The environment variable \$DATABASE\_VXI indicates where to find the files created after the VXI autoconfiguration. This directory will contain a file for each crate (example: the file VXIConfig.peony refers to the crate peony and tells which slot is occupied by which card (card type, serial number)). Use {\bf setenv DATABASE\_VXI \$HOME$/$DATABASE\_VXI} to set the environment variable \$DATABASE\_VXI.\\ In the directory \$DATABASE$/$current you will find all the files you need to configure your experiment. Some of this files have a specific format and you must be very carefull when editing them by hand. Each time a file is edited by hand, the format of this file is altered and you have to use the command {\bf dbformat} to update the format.\\ To set \$DATABASE, use {\bf setenv DATABASE \$HOME$/$DATABASE}\\ \$COMMON is the directory where are all the source files common to all the Makefiles.\\ Use {\bf setenv COMMON \$DATABASE$/$SOURCE\_C$/$common} to set this variable. \\ \$DBMS is the directory where you will find the functions (the sources) to extract (or modify) data from (into) the database.\\ Use {\bf setenv COMMON \$DATABASE$/$SOURCE\_C$/$dbms} to set this variable.\\ The following organisation of the files must be respected, but you can't modify it if you set correctly your environment variables.\\ \vbox{ \begin{verbatim} $HOME --------------------> DATABASE ->---> default : : : :----> current SOURCE_C : :-------: common <- : :---> plus1 : : read_database <- : :----> test write_database <-: : read_vxi <-: :----> update_VXIdb write_vxi <-: :----> save_current scope_vxi <-: :---> restore_default : : : scope <-: : : reset <-: : : mt <-: : setup <-: :--> dbms --:-> h button_vxi <-: :-> dbformat :->fdbase \end{verbatim} } \section{Warning} The commands to access to the database file (extract values or modify values) are linked to the files structures. For example when you want to extract the entry of a register for the channel 5, the {\bf read\_database} command knows how many lines to skip. All this lines before the "separtor" {\bf channel\_5} are spikped and the search of the entry of the specified register can begin.\\ That is, you can't remove or add any line in the files {\bf Reg\_Setup}, {\bf Button\_Setup} and {\bf Button\_Status} if the changes are not reported in the file {\bf dbconst.h} in the directory \$DBMS$/$h.\\ If you make modifications in the file \$COMMON$/$constantes.h or the file \$DBMS$/$h, you will have to build new executables commands: move in the directories, look for the file makefile or Makefile and type {\bf make}.\\ After this is done, copy the executable file in the directory \$HOME$/$bin.\\ In all the files, all the entries(lines) must have the same number of fields ( or columns). If the line is a comment line, the first field must be set to {\bf "\%"} and the other fields set to {\bf "-"}. \\ In the files {\bf Reg\_Setup} and {\bf Button\_Setup}, the separator {\bf "channel\_"} don't begin by {\bf "\%"} because the separator is considered as usefull information.\\ \end{document}