\hypertarget{lrd_8c}{
\section{lrd.c File Reference}
\label{lrd_8c}\index{lrd.c@{lrd.c}}
}
LAT register description helper functions. 

{\tt \#include \char`\"{}RIM/lrd.h\char`\"{}}\par
{\tt \#include \char`\"{}addr.h\char`\"{}}\par
{\tt \#include \char`\"{}error\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}AG\_\-rim\-Type\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}AG\_\-rim\-Type\_\-s.h\char`\"{}}\par
{\tt \#include \char`\"{}AG\_\-addr\_\-s.h\char`\"{}}\par
{\tt \#include \char`\"{}AG\_\-number\_\-s.h\char`\"{}}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$ctype.h$>$}\par


Include dependency graph for lrd.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=219pt]{lrd_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned \hyperlink{lrd_8c_a2}{RIM\_\-n\-Types} (void)
\begin{CompactList}\small\item\em Return the number of component types within the LAT register description. \item\end{CompactList}\item 
\hyperlink{lrd_8h_a0}{RIM\_\-type} \hyperlink{lrd_8c_a3}{RIM\_\-lookup\-Type} (const char $\ast$string)
\begin{CompactList}\small\item\em Hunt through the list of component types and return the index of the input string. \item\end{CompactList}\item 
unsigned \hyperlink{lrd_8c_a4}{RIM\_\-name\-Type} (char $\ast$string, \hyperlink{lrd_8h_a0}{RIM\_\-type} type)
\begin{CompactList}\small\item\em Place the four character string describing this type into {\em name\/}. \item\end{CompactList}\item 
int \hyperlink{lrd_8c_a5}{RIM\_\-compare\-Type} (const char $\ast$string, \hyperlink{lrd_8h_a0}{RIM\_\-type} type)
\begin{CompactList}\small\item\em Compare {\em string\/} with the name of {\em type\/}. \item\end{CompactList}\item 
unsigned \hyperlink{lrd_8c_a6}{RIM\_\-get\-Addr\-Rng} (const char $\ast$string, \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr)
\begin{CompactList}\small\item\em Finds the address range associated with the type identifed by the string. \item\end{CompactList}\item 
unsigned \hyperlink{lrd_8c_a7}{RIM\_\-get\-Index} (const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr, unsigned $\ast$index, \hyperlink{lrd_8h_a0}{RIM\_\-type} type)
\begin{CompactList}\small\item\em Convert hierarchical bit addressing to flat addressing. \item\end{CompactList}\item 
unsigned \hyperlink{lrd_8c_a8}{RIM\_\-get\-Address} (\hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr, unsigned index, \hyperlink{lrd_8h_a0}{RIM\_\-type} type)
\begin{CompactList}\small\item\em Convert hierarchical bit addressing to flat addressing. \item\end{CompactList}\item 
void \hyperlink{lrd_8c_a9}{RIM\_\-layer\-Low} (const \hyperlink{structLayer__addr}{Layer\_\-addr} $\ast$layer, \hyperlink{structTEM__addr}{TEM\_\-addr} $\ast$tem)
\begin{CompactList}\small\item\em Convert the conceptual layer addressing of a TFE to the hierarchical form used to communicate with the LAT. \item\end{CompactList}\item 
void \hyperlink{lrd_8c_a10}{RIM\_\-layer\-High} (const \hyperlink{structLayer__addr}{Layer\_\-addr} $\ast$layer, \hyperlink{structTEM__addr}{TEM\_\-addr} $\ast$tem)
\begin{CompactList}\small\item\em Convert the conceptual layer addressing of a TFE to the hierarchical form used to communicate with the LAT. \item\end{CompactList}\item 
unsigned \hyperlink{lrd_8c_a11}{RIM\_\-get\-Layer\-ID} (char sign, char xy, char index, unsigned $\ast$layer)
\begin{CompactList}\small\item\em Take three characters and convert them to a layer ID. \item\end{CompactList}\item 
unsigned \hyperlink{lrd_8c_a12}{RIM\_\-get\-Layer\-Name} (unsigned layer, char $\ast$sign, char $\ast$xy, char $\ast$index)
\begin{CompactList}\small\item\em Get the characters of the layer name from the layer ID. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
static const char \hyperlink{lrd_8c_a0}{tkr\_\-layer} \mbox{[}2\mbox{]}\mbox{[}2\mbox{]}\mbox{[}9\mbox{]}
\begin{CompactList}\small\item\em Lookup table converting layer information to an index. \item\end{CompactList}\item 
static const char \hyperlink{lrd_8c_a1}{tcc\_\-lkup} \mbox{[}4\mbox{]}\mbox{[}2\mbox{]}
\begin{CompactList}\small\item\em Gives the TCC ID for a given \char`\"{}end\char`\"{} of the requested layer. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
LAT register description helper functions. 

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


\subsection{Function Documentation}
\hypertarget{lrd_8c_a5}{
\index{lrd.c@{lrd.c}!RIM_compareType@{RIM\_\-compareType}}
\index{RIM_compareType@{RIM\_\-compareType}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-compareType]{\setlength{\rightskip}{0pt plus 5cm}int RIM\_\-compare\-Type (const char $\ast$ {\em string}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type})}}
\label{lrd_8c_a5}


Compare {\em string\/} with the name of {\em type\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]Name of a component type \item[{\em type}]Type to compare to \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em -1}]If the {\em type\/} is unknown (exceeds the range of acceptable types) \item[{\em 0}]If the {\em type\/} is known, and the name matches the {\em string\/} \item[{\em 1}]If the {\em type\/} is known, and the name does not match the {\em string\/} \end{description}
\end{Desc}
\hypertarget{lrd_8c_a8}{
\index{lrd.c@{lrd.c}!RIM_getAddress@{RIM\_\-getAddress}}
\index{RIM_getAddress@{RIM\_\-getAddress}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-getAddress]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-get\-Address (\hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr}, unsigned {\em index}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type})}}
\label{lrd_8c_a8}


Convert hierarchical bit addressing to flat addressing. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em addr}]Address to convert \item[{\em type}]Type of address to conver \item[{\em index}]Index corresponding to address \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]if the address is successfully converted to an index \item[{\em -2}]if any component of the address is outside the allowable range for this type\end{description}
\end{Desc}
Note that GTFEs are usually referred to as being part of an X or Y layer. This identification is converted to an absolute layer number and stored in the rc space by addr-$>$rc = (layer\-Number $<$$<$ 1) $|$ is\-Ylayer. This conversion is performed by the XLM-$>$RIM converter, but is documented here since it is a storage convention.\hypertarget{lrd_8c_a6}{
\index{lrd.c@{lrd.c}!RIM_getAddrRng@{RIM\_\-getAddrRng}}
\index{RIM_getAddrRng@{RIM\_\-getAddrRng}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-getAddrRng]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-get\-Addr\-Rng (const char $\ast$ {\em string}, \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr})}}
\label{lrd_8c_a6}


Finds the address range associated with the type identifed by the string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]Identifies the address range required \item[{\em addr}]Pointer to address stucture to populate with the address range \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-TYPE\_\-STR}]If the {\em string\/} does not match a known type \item[{\em RIM\_\-SUCCESS}]If the {\em string\/} is a good type name.\end{description}
\end{Desc}
\hypertarget{lrd_8c_a7}{
\index{lrd.c@{lrd.c}!RIM_getIndex@{RIM\_\-getIndex}}
\index{RIM_getIndex@{RIM\_\-getIndex}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-getIndex]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-get\-Index (const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr}, unsigned $\ast$ {\em index}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type})}}
\label{lrd_8c_a7}


Convert hierarchical bit addressing to flat addressing. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em addr}]Address to convert \item[{\em type}]Type of address to conver \item[{\em index}]Index corresponding to address \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]if the address is successfully converted to an index \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\end{description}
\end{Desc}
Note that GTFEs are usually referred to as being part of an X or Y layer. This identification is converted to an absolute layer number and stored in the rc space by addr-$>$rc = (layer\-Number $<$$<$ 1) $|$ is\-Ylayer. This conversion is performed by the XLM-$>$binary converter, but is documented here since it is a storage convention.\hypertarget{lrd_8c_a11}{
\index{lrd.c@{lrd.c}!RIM_getLayerID@{RIM\_\-getLayerID}}
\index{RIM_getLayerID@{RIM\_\-getLayerID}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-getLayerID]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-get\-Layer\-ID (char {\em sign}, char {\em xy}, char {\em index}, unsigned $\ast$ {\em layer})}}
\label{lrd_8c_a11}


Take three characters and convert them to a layer ID. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sign}]'+' or '-' \item[{\em xy}]'x' or 'y' \item[{\em index}]'0' -$>$ '8' \item[{\em layer}]Location to store the layer ID \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-ADDR\_\-LAYER}]If the layer information is nonsensical \item[{\em RIM\_\-SUCCESS}]If the layer ID was successfully found\end{description}
\end{Desc}
\hypertarget{lrd_8c_a12}{
\index{lrd.c@{lrd.c}!RIM_getLayerName@{RIM\_\-getLayerName}}
\index{RIM_getLayerName@{RIM\_\-getLayerName}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-getLayerName]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-get\-Layer\-Name (unsigned {\em layer}, char $\ast$ {\em sign}, char $\ast$ {\em xy}, char $\ast$ {\em index})}}
\label{lrd_8c_a12}


Get the characters of the layer name from the layer ID. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em layer}]ID of the layer to name \item[{\em sign}]Pointer to location to place the sign character \item[{\em xy}]Pointer to location to place the xy character \item[{\em index}]Pointer to location to place the index character \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]If the layer is located \item[{\em LCI\_\-ADDR\_\-LAYER}]If the layer is out of range\end{description}
\end{Desc}
\hypertarget{lrd_8c_a10}{
\index{lrd.c@{lrd.c}!RIM_layerHigh@{RIM\_\-layerHigh}}
\index{RIM_layerHigh@{RIM\_\-layerHigh}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-layerHigh]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-layer\-High (const \hyperlink{structLayer__addr}{Layer\_\-addr} $\ast$ {\em layer}, \hyperlink{structTEM__addr}{TEM\_\-addr} $\ast$ {\em tem})}}
\label{lrd_8c_a10}


Convert the conceptual layer addressing of a TFE to the hierarchical form used to communicate with the LAT. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em layer}]Address of the TFE / SPT in terms of layers \item[{\em tem}]Address of the TFE / TRC in terms of CC/RC\end{description}
\end{Desc}
Note that TFEs are usually referred to as being part of an X or Y layer. This identification is converted to an absolute layer number and stored in the rc space by addr-$>$rc = (layer\-Number $<$$<$ 1) $|$ is\-Ylayer. This conversion is performed by the XLM-$>$RIM converter, but is documented here since it is a storage convention.\hypertarget{lrd_8c_a9}{
\index{lrd.c@{lrd.c}!RIM_layerLow@{RIM\_\-layerLow}}
\index{RIM_layerLow@{RIM\_\-layerLow}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-layerLow]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-layer\-Low (const \hyperlink{structLayer__addr}{Layer\_\-addr} $\ast$ {\em layer}, \hyperlink{structTEM__addr}{TEM\_\-addr} $\ast$ {\em tem})}}
\label{lrd_8c_a9}


Convert the conceptual layer addressing of a TFE to the hierarchical form used to communicate with the LAT. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em layer}]Address of the TFE / SPT in terms of layers \item[{\em tem}]Address of the TFE / TRC in terms of CC/RC\end{description}
\end{Desc}
Note that TFEs are usually referred to as being part of an X or Y layer. This identification is converted to an absolute layer number and stored in the rc space by addr-$>$rc = (layer\-Number $<$$<$ 1) $|$ is\-Ylayer. This conversion is performed by the XLM-$>$RIM converter, but is documented here since it is a storage convention.\hypertarget{lrd_8c_a3}{
\index{lrd.c@{lrd.c}!RIM_lookupType@{RIM\_\-lookupType}}
\index{RIM_lookupType@{RIM\_\-lookupType}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-lookupType]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{lrd_8h_a0}{RIM\_\-type} RIM\_\-lookup\-Type (const char $\ast$ {\em string})}}
\label{lrd_8c_a3}


Hunt through the list of component types and return the index of the input string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]String corresponding to one of the component types used in the LAT register description \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]integer corresponding to the type identified by {\em string\/} or RIM\_\-BAD\_\-TYPE if the string does not match any on the list\end{Desc}
\hypertarget{lrd_8c_a4}{
\index{lrd.c@{lrd.c}!RIM_nameType@{RIM\_\-nameType}}
\index{RIM_nameType@{RIM\_\-nameType}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-nameType]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-name\-Type (char $\ast$ {\em string}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type})}}
\label{lrd_8c_a4}


Place the four character string describing this type into {\em name\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]Type to be named \item[{\em string}]Location to place name \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]If the type is known to RIM \item[{\em RIM\_\-TYPE\_\-UK}]If the type is unknown\end{description}
\end{Desc}
\hypertarget{lrd_8c_a2}{
\index{lrd.c@{lrd.c}!RIM_nTypes@{RIM\_\-nTypes}}
\index{RIM_nTypes@{RIM\_\-nTypes}!lrd.c@{lrd.c}}
\subsubsection[RIM\_\-nTypes]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-n\-Types (void)}}
\label{lrd_8c_a2}


Return the number of component types within the LAT register description. 

\begin{Desc}
\item[Returns:]Number of component types\end{Desc}


\subsection{Variable Documentation}
\hypertarget{lrd_8c_a1}{
\index{lrd.c@{lrd.c}!tcc_lkup@{tcc\_\-lkup}}
\index{tcc_lkup@{tcc\_\-lkup}!lrd.c@{lrd.c}}
\subsubsection[tcc\_\-lkup]{\setlength{\rightskip}{0pt plus 5cm}const char \hyperlink{lrd_8c_a1}{tcc\_\-lkup}\mbox{[}4\mbox{]}\mbox{[}2\mbox{]}\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{lrd_8c_a1}


{\bf Initial value:}

\footnotesize\begin{verbatim} { {0, 1},
                                     {3, 2},
                                     {6, 7},
                                     {5, 4} }
\end{verbatim}\normalsize 
Gives the TCC ID for a given \char`\"{}end\char`\"{} of the requested layer. 

Since the pattern is repeating, take the layer index modulo 4 as the first index to the table and 0 for low or 1 for high as the second index to the table.\hypertarget{lrd_8c_a0}{
\index{lrd.c@{lrd.c}!tkr_layer@{tkr\_\-layer}}
\index{tkr_layer@{tkr\_\-layer}!lrd.c@{lrd.c}}
\subsubsection[tkr\_\-layer]{\setlength{\rightskip}{0pt plus 5cm}const char \hyperlink{lrd_8c_a0}{tkr\_\-layer}\mbox{[}2\mbox{]}\mbox{[}2\mbox{]}\mbox{[}9\mbox{]}\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{lrd_8c_a0}


{\bf Initial value:}

\footnotesize\begin{verbatim} { { { 0, 4,  8, 12, 16, 20, 24, 28, 32 },    
                                           { 1, 5,  9, 13, 17, 21, 25, 29, 33 }, }, 
                                         { { 3, 7, 11, 15, 19, 23, 27, 31, 35 },    
                                           { 2, 6, 10, 14, 18, 22, 26, 30, 34 } } }
\end{verbatim}\normalsize 
Lookup table converting layer information to an index. 

