\hypertarget{configure_8h}{
\section{configure.h File Reference}
\label{configure_8h}\index{configure.h@{configure.h}}
}
Public definitions of the configuration structure and routines. 

{\tt \#include \char`\"{}LEM/list.h\char`\"{}}\par
{\tt \#include $<$stdio.h$>$}\par


Include dependency graph for configure.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=108pt]{configure_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=219pt]{configure_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{configure_8h_a0}{
typedef \hyperlink{struct__LCI__configuration}{\_\-LCI\_\-configuration} \hyperlink{configure_8h_a0}{LCI\_\-configuration}}
\label{configure_8h_a0}

\begin{CompactList}\small\item\em Declaration of the opaque configuration structure. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ \hyperlink{configure_8h_a1}{LCI\_\-new\-Configuration} (void)
\begin{CompactList}\small\item\em Allocate memory for a configuration structure and initialise (clear) it. \item\end{CompactList}\item 
void \hyperlink{configure_8h_a2}{LCI\_\-delete\-Configuration} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Free memory previously allocated with a call to LCI\_\-new\-Configuration. \item\end{CompactList}\item 
void \hyperlink{configure_8h_a3}{LCI\_\-copy\-Configuration} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf\-In, \hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf\-Out)
\begin{CompactList}\small\item\em Copy a configuration. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a4}{LCI\_\-open\-Fid} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, unsigned fid)
\begin{CompactList}\small\item\em Open the file and associate it with this configuration structure. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a5}{LCI\_\-open} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, const char $\ast$fn)
\begin{CompactList}\small\item\em Open the file and associate it with this configuration structure. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a6}{LCI\_\-cache} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, unsigned latc\_\-fid)
\begin{CompactList}\small\item\em Read in the LATC files. \item\end{CompactList}\item 
void \hyperlink{configure_8h_a7}{LCI\_\-node\-Id} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, unsigned siu\_\-id)
\begin{CompactList}\small\item\em Set the destination address to be used in the TAM configuration. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a8}{LCI\_\-read} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Get the values for the next step of the configuration. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a9}{LCI\_\-close} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Close the file that acts as the source of the configuration. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a10}{LCI\_\-configure} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, LEM\_\-micr $\ast$cr, unsigned run\-Id)
\begin{CompactList}\small\item\em Load the configuration onto the LAT. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a11}{LCI\_\-sizeof\-Ctx32} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Calculate the number of 32-bit words required to hold the current configuration values. \item\end{CompactList}\item 
unsigned $\ast$ \hyperlink{configure_8h_a12}{LCI\_\-consign\-Ctx} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, unsigned int $\ast$buf)
\begin{CompactList}\small\item\em Copy the current configuration values into the buffer. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a13}{LCI\_\-mode} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Return the configuration type. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a14}{LCI\_\-range} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Return the readout range. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a15}{LCI\_\-triggers} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Return the number of triggers required. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a16}{LCI\_\-period} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf)
\begin{CompactList}\small\item\em Return the period between triggers. \item\end{CompactList}\item 
unsigned \hyperlink{configure_8h_a17}{LCI\_\-set\-Buffer\-Model} (unsigned select, LEM\_\-micr $\ast$cr)
\begin{CompactList}\small\item\em Set the buffer model select bit of the TEM CONFIGURATION register. \item\end{CompactList}\item 
void \hyperlink{configure_8h_a18}{LCI\_\-report} (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, FILE $\ast$fp)
\begin{CompactList}\small\item\em Produce a formatted report of the contents of a binary configuration. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Public definitions of the configuration structure and routines. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{configure_8h}{configure.h},v 1.12 2007/08/26 21:43:55 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{configure_8h_a6}{
\index{configure.h@{configure.h}!LCI_cache@{LCI\_\-cache}}
\index{LCI_cache@{LCI\_\-cache}!configure.h@{configure.h}}
\subsubsection[LCI\_\-cache]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-cache (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, unsigned {\em latc\_\-fid})}}
\label{configure_8h_a6}


Read in the LATC files. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to an initialised configuration structure\item[{\em latc\_\-fid}]ID of the LATC configuration to cache\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]if all goes well \item[{\em LATC\_\-BADFOPEN}]if the fid, or any of the names the LAT configuration master file contains, does not match a valid file. \item[{\em LATC\_\-BADTYPE}]if the LATC file contains a bad type identifier \item[{\em LATC\_\-BADREAD}]if an error occurs whilst the file is being read\end{description}
\end{Desc}
\hypertarget{configure_8h_a9}{
\index{configure.h@{configure.h}!LCI_close@{LCI\_\-close}}
\index{LCI_close@{LCI\_\-close}!configure.h@{configure.h}}
\subsubsection[LCI\_\-close]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-close (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a9}


Close the file that acts as the source of the configuration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to an opened configuration\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]If the file closes successfully \item[{\em LCI\_\-FCLOSE}]If there is an error closing the file\end{description}
\end{Desc}
\hypertarget{configure_8h_a10}{
\index{configure.h@{configure.h}!LCI_configure@{LCI\_\-configure}}
\index{LCI_configure@{LCI\_\-configure}!configure.h@{configure.h}}
\subsubsection[LCI\_\-configure]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-configure (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, LEM\_\-micr $\ast$ {\em cr}, unsigned {\em run\-Id})}}
\label{configure_8h_a10}


Load the configuration onto the LAT. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to a populated configuration structure\item[{\em cr}]Pointer to the common configuration multi-item command response list\item[{\em run\-Id}]The current run ID.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]LCI\_\-SUCCESS if all goes well, or one of the LEM errors if there is a problem loading the configuration onto the LAT\end{Desc}
\hypertarget{configure_8h_a12}{
\index{configure.h@{configure.h}!LCI_consignCtx@{LCI\_\-consignCtx}}
\index{LCI_consignCtx@{LCI\_\-consignCtx}!configure.h@{configure.h}}
\subsubsection[LCI\_\-consignCtx]{\setlength{\rightskip}{0pt plus 5cm}unsigned$\ast$ LCI\_\-consign\-Ctx (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, unsigned int $\ast$ {\em buf})}}
\label{configure_8h_a12}


Copy the current configuration values into the buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]pointer to a configuration structure\item[{\em buf}]Location to place the current configuration values\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next output location\end{Desc}
\hypertarget{configure_8h_a3}{
\index{configure.h@{configure.h}!LCI_copyConfiguration@{LCI\_\-copyConfiguration}}
\index{LCI_copyConfiguration@{LCI\_\-copyConfiguration}!configure.h@{configure.h}}
\subsubsection[LCI\_\-copyConfiguration]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-copy\-Configuration (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf\-In}, \hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf\-Out})}}
\label{configure_8h_a3}


Copy a configuration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf\-In}]The configuration structure to be copied from\item[{\em cnf\-Out}]The configuration structure to be copied to\end{description}
\end{Desc}
\hypertarget{configure_8h_a2}{
\index{configure.h@{configure.h}!LCI_deleteConfiguration@{LCI\_\-deleteConfiguration}}
\index{LCI_deleteConfiguration@{LCI\_\-deleteConfiguration}!configure.h@{configure.h}}
\subsubsection[LCI\_\-deleteConfiguration]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-delete\-Configuration (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a2}


Free memory previously allocated with a call to LCI\_\-new\-Configuration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]A configuration structure created by a call to LCI\_\-new\-Configuration\end{description}
\end{Desc}
\hypertarget{configure_8h_a13}{
\index{configure.h@{configure.h}!LCI_mode@{LCI\_\-mode}}
\index{LCI_mode@{LCI\_\-mode}!configure.h@{configure.h}}
\subsubsection[LCI\_\-mode]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-mode (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a13}


Return the configuration type. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to the configuration structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of LSEC\_\-MODE\_\-XXX\end{Desc}
\hypertarget{configure_8h_a1}{
\index{configure.h@{configure.h}!LCI_newConfiguration@{LCI\_\-newConfiguration}}
\index{LCI_newConfiguration@{LCI\_\-newConfiguration}!configure.h@{configure.h}}
\subsubsection[LCI\_\-newConfiguration]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__LCI__configuration}{LCI\_\-configuration}$\ast$ LCI\_\-new\-Configuration (void)}}
\label{configure_8h_a1}


Allocate memory for a configuration structure and initialise (clear) it. 

\begin{Desc}
\item[Returns:]Pointer to an allocated, initialised configuration structure\end{Desc}
\hypertarget{configure_8h_a7}{
\index{configure.h@{configure.h}!LCI_nodeId@{LCI\_\-nodeId}}
\index{LCI_nodeId@{LCI\_\-nodeId}!configure.h@{configure.h}}
\subsubsection[LCI\_\-nodeId]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-node\-Id (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, unsigned {\em siu\_\-id})}}
\label{configure_8h_a7}


Set the destination address to be used in the TAM configuration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to the configuration structure\item[{\em siu\_\-id}]LATp address of the node that the events will be collected on\end{description}
\end{Desc}
\hypertarget{configure_8h_a5}{
\index{configure.h@{configure.h}!LCI_open@{LCI\_\-open}}
\index{LCI_open@{LCI\_\-open}!configure.h@{configure.h}}
\subsubsection[LCI\_\-open]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-open (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, const char $\ast$ {\em fn})}}
\label{configure_8h_a5}


Open the file and associate it with this configuration structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to an initialised configuration structure\item[{\em fn}]Name of file to open\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]if the file opens successfully \item[{\em LCI\_\-FOPEN}]if the file failed to open successfully \item[{\em LCI\_\-FREAD}]if there is an error recovering the version information \item[{\em LCI\_\-VERSION}]if the file version information is bad (unknown type, major version mismatch, minor version decrease). \item[{\em LCI\_\-ENDOFILE}]if the file has no actual configurations (returned, but not reported).\end{description}
\end{Desc}
\hypertarget{configure_8h_a4}{
\index{configure.h@{configure.h}!LCI_openFid@{LCI\_\-openFid}}
\index{LCI_openFid@{LCI\_\-openFid}!configure.h@{configure.h}}
\subsubsection[LCI\_\-openFid]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-open\-Fid (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, unsigned {\em fid})}}
\label{configure_8h_a4}


Open the file and associate it with this configuration structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to an initialised configuration structure\item[{\em fid}]The ID of the file to open\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]if the file opens successfully \item[{\em LCI\_\-FOPEN}]if the file failed to open successfully \item[{\em LCI\_\-FREAD}]if there is an error recovering the version information \item[{\em LCI\_\-VERSION}]if the file version information is bad (unknown type, major version mismatch, minor version decrease). \item[{\em LCI\_\-ENDOFILE}]if the file has no actual configurations (returned, but not reported).\end{description}
\end{Desc}
\hypertarget{configure_8h_a16}{
\index{configure.h@{configure.h}!LCI_period@{LCI\_\-period}}
\index{LCI_period@{LCI\_\-period}!configure.h@{configure.h}}
\subsubsection[LCI\_\-period]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-period (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a16}


Return the period between triggers. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to an initialised, populated configuration structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The period between triggers (in 50ns clock ticks)\end{Desc}
\hypertarget{configure_8h_a14}{
\index{configure.h@{configure.h}!LCI_range@{LCI\_\-range}}
\index{LCI_range@{LCI\_\-range}!configure.h@{configure.h}}
\subsubsection[LCI\_\-range]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-range (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a14}


Return the readout range. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to the configuration structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The range for this configuration (LSEC\_\-XXX\_\-RANGE)\end{Desc}
\hypertarget{configure_8h_a8}{
\index{configure.h@{configure.h}!LCI_read@{LCI\_\-read}}
\index{LCI_read@{LCI\_\-read}!configure.h@{configure.h}}
\subsubsection[LCI\_\-read]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-read (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a8}


Get the values for the next step of the configuration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to an opened configuration\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]if a configuration was read successfully \item[{\em LCI\_\-ENDOFILE}]if there are no more configurations in the file (returned, but not reported). \item[{\em LCI\_\-READ}]if there is an error during the read or the configuration is incomplete\end{description}
\end{Desc}
\hypertarget{configure_8h_a18}{
\index{configure.h@{configure.h}!LCI_report@{LCI\_\-report}}
\index{LCI_report@{LCI\_\-report}!configure.h@{configure.h}}
\subsubsection[LCI\_\-report]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-report (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, FILE $\ast$ {\em fp})}}
\label{configure_8h_a18}


Produce a formatted report of the contents of a binary configuration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to the configuration structure to output\item[{\em fp}]Pointer to file to print report\end{description}
\end{Desc}
\hypertarget{configure_8h_a17}{
\index{configure.h@{configure.h}!LCI_setBufferModel@{LCI\_\-setBufferModel}}
\index{LCI_setBufferModel@{LCI\_\-setBufferModel}!configure.h@{configure.h}}
\subsubsection[LCI\_\-setBufferModel]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-set\-Buffer\-Model (unsigned {\em select}, LEM\_\-micr $\ast$ {\em cr})}}
\label{configure_8h_a17}


Set the buffer model select bit of the TEM CONFIGURATION register. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em select}]Zero to select the multi buffer model, non-zero to select the single buffer model\item[{\em cr}]Pointer to the multi-item command/response list.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]Success \item[{\em LCI\_\-TEMCR}]The command and response masks don't have the same TEMs present \item[{\em LEM\_\-$\ast$}]If there was an error reading or loading one of the registers\end{description}
\end{Desc}
\hypertarget{configure_8h_a11}{
\index{configure.h@{configure.h}!LCI_sizeofCtx32@{LCI\_\-sizeofCtx32}}
\index{LCI_sizeofCtx32@{LCI\_\-sizeofCtx32}!configure.h@{configure.h}}
\subsubsection[LCI\_\-sizeofCtx32]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-sizeof\-Ctx32 (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a11}


Calculate the number of 32-bit words required to hold the current configuration values. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to a configuration structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Number of 32-bit words required to hold the current configuration values\end{Desc}
\hypertarget{configure_8h_a15}{
\index{configure.h@{configure.h}!LCI_triggers@{LCI\_\-triggers}}
\index{LCI_triggers@{LCI\_\-triggers}!configure.h@{configure.h}}
\subsubsection[LCI\_\-triggers]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-triggers (\hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf})}}
\label{configure_8h_a15}


Return the number of triggers required. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cnf}]Pointer to an initialised, populated configuration structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Number of triggers to request for this configuration\end{Desc}
