\hypertarget{data_8c}{
\section{data.c File Reference}
\label{data_8c}\index{data.c@{data.c}}
}
Functions manipulating the data attached to a configuration tree. 

{\tt \#include \char`\"{}RIM/rim.h\char`\"{}}\par
{\tt \#include \char`\"{}data\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}error\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}addr.h\char`\"{}}\par
{\tt \#include \char`\"{}number.ic\char`\"{}}\par
{\tt \#include \char`\"{}data.ic\char`\"{}}\par
{\tt \#include \char`\"{}AG\_\-init\-RIM\_\-p.h\char`\"{}}\par


Include dependency graph for data.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=356pt]{data_8c__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{data_8c_a0}{CHECK\_\-TYPE}(t\_\-)
\begin{CompactList}\small\item\em Check that the type is valid. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{data_8c_a1}{RIM\_\-compare} (const \hyperlink{rim_8h_a0}{RIM} $\ast$this, const \hyperlink{rim_8h_a0}{RIM} $\ast$that, \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map)
\begin{CompactList}\small\item\em Compares all the nodes of {\em this\/} and {\em that\/}, marking differences in the {\em map\/}. \item\end{CompactList}\item 
unsigned \hyperlink{data_8c_a2}{RIM\_\-contrast} (const \hyperlink{rim_8h_a0}{RIM} $\ast$this, const \hyperlink{rim_8h_a0}{RIM} $\ast$that, const \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ign, \hyperlink{lrd_8h_a0}{RIM\_\-type} $\ast$r\_\-type, \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$r\_\-addr)
\begin{CompactList}\small\item\em Compares all the nodes of {\em this\/} and {\em that\/}, that are not marked to be ignored. \item\end{CompactList}\item 
unsigned \hyperlink{data_8c_a3}{RIM\_\-get} (const \hyperlink{rim_8h_a0}{RIM} $\ast$rim, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr, int reg\-Id, void $\ast$value)
\begin{CompactList}\small\item\em Puts the contents of the requested register and field into {\em value\/}. \item\end{CompactList}\item 
unsigned \hyperlink{data_8c_a4}{RIM\_\-set} (\hyperlink{rim_8h_a0}{RIM} $\ast$rim, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr, int reg\-Id, const void $\ast$value)
\begin{CompactList}\small\item\em Set the value of a register field. \item\end{CompactList}\item 
unsigned \hyperlink{data_8c_a5}{RIM\_\-delete\-Data} (\hyperlink{rim_8h_a0}{RIM} $\ast$rim, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr)
\begin{CompactList}\small\item\em Delete all the register field settings for the targetted compoent and clear the corresponding bit in the map. \item\end{CompactList}\item 
void \hyperlink{data_8c_a6}{RIM\_\-set\-Reg} (void $\ast$cpt, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, int reg\-Id, const void $\ast$value)
\begin{CompactList}\small\item\em Sets the {\em reg\-Idister\/} of {\em cpt\/} structure to {\em value\/}. \item\end{CompactList}\item 
void \hyperlink{data_8c_a7}{RIM\_\-set\-Fld} (void $\ast$cpt, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, int reg\-Id, int fld\-Id, const void $\ast$value)
\begin{CompactList}\small\item\em Sets the {\em tgt\-Fiels\/} of the {\em register\/} of {\em cpt\/} structure to {\em value\/}. \item\end{CompactList}\item 
void \hyperlink{data_8c_a8}{RIM\_\-get\-Reg} (const void $\ast$cpt, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, int reg\-Id, void $\ast$value)
\begin{CompactList}\small\item\em Puts the contents of the target register {\em reg\-Id\/} into {\em value\/}. \item\end{CompactList}\item 
void \hyperlink{data_8c_a9}{RIM\_\-get\-Fld} (const void $\ast$cpt, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, int reg\-Id, int fld\-Id, void $\ast$value)
\begin{CompactList}\small\item\em Puts the contents of the target register {\em reg\-Id\/} into {\em value\/}. \item\end{CompactList}\item 
int \hyperlink{data_8c_a10}{RIM\_\-reg\-Enum} (\hyperlink{lrd_8h_a0}{RIM\_\-type} type, int reg\-Id)
\begin{CompactList}\small\item\em Convert the public register ID in to the RIM internal register ID. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Functions manipulating the data attached to a configuration tree. 

\begin{Desc}
\item[Author:]James Swain -- \href{mailto:jswain@slac.stanford.edu}{\tt jswain@slac.stanford.edu}\end{Desc}


\subsection{Define Documentation}
\hypertarget{data_8c_a0}{
\index{data.c@{data.c}!CHECK_TYPE@{CHECK\_\-TYPE}}
\index{CHECK_TYPE@{CHECK\_\-TYPE}!data.c@{data.c}}
\subsubsection[CHECK\_\-TYPE]{\setlength{\rightskip}{0pt plus 5cm}\#define CHECK\_\-TYPE(t\_\-)}}
\label{data_8c_a0}


{\bf Value:}

\footnotesize\begin{verbatim}{ \
  if(N_RIM_TYPES <= t_) return RIM_TYPE_UK;  \
  if(!ld[t_])           return RIM_CPT_NONE; \
}
\end{verbatim}\normalsize 
Check that the type is valid. 



\subsection{Function Documentation}
\hypertarget{data_8c_a1}{
\index{data.c@{data.c}!RIM_compare@{RIM\_\-compare}}
\index{RIM_compare@{RIM\_\-compare}!data.c@{data.c}}
\subsubsection[RIM\_\-compare]{\setlength{\rightskip}{0pt plus 5cm}int RIM\_\-compare (const \hyperlink{rim_8h_a0}{RIM} $\ast$ {\em this}, const \hyperlink{rim_8h_a0}{RIM} $\ast$ {\em that}, \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map})}}
\label{data_8c_a1}


Compares all the nodes of {\em this\/} and {\em that\/}, marking differences in the {\em map\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]First in-memory configuration structure \item[{\em that}]Second in-memory configuration structure \item[{\em map}]Indicates which nodes are different \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Number of different nodes\end{Desc}
If a node is NULL, then the default node is used.\hypertarget{data_8c_a2}{
\index{data.c@{data.c}!RIM_contrast@{RIM\_\-contrast}}
\index{RIM_contrast@{RIM\_\-contrast}!data.c@{data.c}}
\subsubsection[RIM\_\-contrast]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-contrast (const \hyperlink{rim_8h_a0}{RIM} $\ast$ {\em this}, const \hyperlink{rim_8h_a0}{RIM} $\ast$ {\em that}, const \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em ign}, \hyperlink{lrd_8h_a0}{RIM\_\-type} $\ast$ {\em r\_\-type}, \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em r\_\-addr})}}
\label{data_8c_a2}


Compares all the nodes of {\em this\/} and {\em that\/}, that are not marked to be ignored. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]First in memory configuration model \item[{\em that}]Second in memory configuration model \item[{\em ign}]Pointer to a bit-map of sections of the LAT to ignore \item[{\em r\_\-type}]Location to fill with the type of the first different node (can be NULL if not interested) \item[{\em r\_\-addr}]Pointer to an address structure to populate with the first different node (can be NULL if not interested) \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]If the two in-memory models are functionally identical \item[{\em RIM\_\-DIFFER}]If the two in-memory models are different\end{description}
\end{Desc}
If a node is NULL then the default node is used.\hypertarget{data_8c_a5}{
\index{data.c@{data.c}!RIM_deleteData@{RIM\_\-deleteData}}
\index{RIM_deleteData@{RIM\_\-deleteData}!data.c@{data.c}}
\subsubsection[RIM\_\-deleteData]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-delete\-Data (\hyperlink{rim_8h_a0}{RIM} $\ast$ {\em rim}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr})}}
\label{data_8c_a5}


Delete all the register field settings for the targetted compoent and clear the corresponding bit in the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rim}]In memory configuration structure to be manipulated \item[{\em type}]Type of data sought \item[{\em addr}]Address of the leaf to delete \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]if all the parameters are in bounds and the data is successfully retrieved. \item[{\em RIM\_\-TYPE\_\-UK}]if {\em type\/} is not a valid RIM\_\-type\end{description}
\end{Desc}
\hypertarget{data_8c_a3}{
\index{data.c@{data.c}!RIM_get@{RIM\_\-get}}
\index{RIM_get@{RIM\_\-get}!data.c@{data.c}}
\subsubsection[RIM\_\-get]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-get (const \hyperlink{rim_8h_a0}{RIM} $\ast$ {\em rim}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr}, int {\em reg\-Id}, void $\ast$ {\em value})}}
\label{data_8c_a3}


Puts the contents of the requested register and field into {\em value\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rim}]In memory configuration structure to be interogated \item[{\em type}]Type of data sought \item[{\em addr}]Address of the leaf requested \item[{\em reg\-Id}]Register to get \item[{\em value}]Location to put the contents of the target field \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]if all the parameters are in bounds and the data is successfully retrieved. \item[{\em RIM\_\-TYPE\_\-UK}]if {\em type\/} is not a valid RIM\_\-type \item[{\em RIM\_\-CPT\_\-NONE}]if the requested type has no real data \item[{\em RIM\_\-ADDR\_\-BCAST}]if the address contains a mixture of broadcast and unicast components \item[{\em RIM\_\-ADDR\_\-RANGE}]if any component of the address is outside the allowable range for this type \item[{\em RIM\_\-REG\_\-ID}]if {\em reg\-Id\/} is outside the acceptable range of register IDs for this type \item[{\em RIM\_\-NOT\_\-SET}]if the requested node has not been previously set\end{description}
\end{Desc}
\hypertarget{data_8c_a9}{
\index{data.c@{data.c}!RIM_getFld@{RIM\_\-getFld}}
\index{RIM_getFld@{RIM\_\-getFld}!data.c@{data.c}}
\subsubsection[RIM\_\-getFld]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-get\-Fld (const void $\ast$ {\em cpt}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, int {\em reg\-Id}, int {\em fld\-Id}, void $\ast$ {\em value})}}
\label{data_8c_a9}


Puts the contents of the target register {\em reg\-Id\/} into {\em value\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]Type of data sought \item[{\em cpt}]Pointer to start of the component data. \item[{\em reg\-Id}]Target tgt \item[{\em fld\-Id}]Target field \item[{\em value}]Location to put the contents of the target field\end{description}
\end{Desc}
\hypertarget{data_8c_a8}{
\index{data.c@{data.c}!RIM_getReg@{RIM\_\-getReg}}
\index{RIM_getReg@{RIM\_\-getReg}!data.c@{data.c}}
\subsubsection[RIM\_\-getReg]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-get\-Reg (const void $\ast$ {\em cpt}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, int {\em reg\-Id}, void $\ast$ {\em value})}}
\label{data_8c_a8}


Puts the contents of the target register {\em reg\-Id\/} into {\em value\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cpt}]Pointer to start of the component data. \item[{\em type}]Type of data sought \item[{\em reg\-Id}]Target tgt \item[{\em value}]Location to put the contents of the target reg\end{description}
\end{Desc}
\hypertarget{data_8c_a10}{
\index{data.c@{data.c}!RIM_regEnum@{RIM\_\-regEnum}}
\index{RIM_regEnum@{RIM\_\-regEnum}!data.c@{data.c}}
\subsubsection[RIM\_\-regEnum]{\setlength{\rightskip}{0pt plus 5cm}int RIM\_\-reg\-Enum (\hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, int {\em reg\-Id})}}
\label{data_8c_a10}


Convert the public register ID in to the RIM internal register ID. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]Component type \item[{\em reg\-Id}]Register ID in terms of hardware numbering (the Huffer docs and LEM) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The index of the register in the array of register descriptions within the component description\end{Desc}
\hypertarget{data_8c_a4}{
\index{data.c@{data.c}!RIM_set@{RIM\_\-set}}
\index{RIM_set@{RIM\_\-set}!data.c@{data.c}}
\subsubsection[RIM\_\-set]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-set (\hyperlink{rim_8h_a0}{RIM} $\ast$ {\em rim}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr}, int {\em reg\-Id}, const void $\ast$ {\em value})}}
\label{data_8c_a4}


Set the value of a register field. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rim}]In memory configuration structure to manipulated \item[{\em type}]Type of data sought \item[{\em addr}]Address of the leaf requested \item[{\em reg\-Id}]Register to set \item[{\em value}]Ptr to value to set the register field to \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]if all the parameters are in bounds and the data is successfully retrieved. \item[{\em RIM\_\-TYPE\_\-UK}]if {\em type\/} is not a valid RIM\_\-type \item[{\em RIM\_\-CPT\_\-NONE}]if the requested type has no real data \item[{\em RIM\_\-ADDR\_\-BCAST}]if the address contains a mixture of broadcast and unicast components \item[{\em RIM\_\-ADDR\_\-RANGE}]if any component of the address is outside the allowable range for this type \item[{\em RIM\_\-REG\_\-ID}]if {\em reg\-Id\/} is outside the acceptable range of register IDs for this type \item[{\em RIM\_\-FLD\_\-ID}]if {\em fld\-Id\/} is outside the acceptable range of field IDs\end{description}
\end{Desc}
\hypertarget{data_8c_a7}{
\index{data.c@{data.c}!RIM_setFld@{RIM\_\-setFld}}
\index{RIM_setFld@{RIM\_\-setFld}!data.c@{data.c}}
\subsubsection[RIM\_\-setFld]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-set\-Fld (void $\ast$ {\em cpt}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, int {\em reg\-Id}, int {\em fld\-Id}, const void $\ast$ {\em value})}}
\label{data_8c_a7}


Sets the {\em tgt\-Fiels\/} of the {\em register\/} of {\em cpt\/} structure to {\em value\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]Type of data sought \item[{\em cpt}]Pointer to start of the component data. \item[{\em reg\-Id}]Enum specifying register to write to \item[{\em fld\-Id}]Enum specifying field to write to \item[{\em value}]Value to set the field to.\end{description}
\end{Desc}
\hypertarget{data_8c_a6}{
\index{data.c@{data.c}!RIM_setReg@{RIM\_\-setReg}}
\index{RIM_setReg@{RIM\_\-setReg}!data.c@{data.c}}
\subsubsection[RIM\_\-setReg]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-set\-Reg (void $\ast$ {\em cpt}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, int {\em reg\-Id}, const void $\ast$ {\em value})}}
\label{data_8c_a6}


Sets the {\em reg\-Idister\/} of {\em cpt\/} structure to {\em value\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cpt}]Pointer to start of the component data. \item[{\em type}]Type of data sought \item[{\em reg\-Id}]Enum specifing register to write to \item[{\em value}]Value to set register to\end{description}
\end{Desc}
