\hypertarget{map_8h}{
\section{map.h File Reference}
\label{map_8h}\index{map.h@{map.h}}
}
Configuration map creation, initialisation and manipulation functions. 

{\tt \#include \char`\"{}RIM/lrd.h\char`\"{}}\par
{\tt \#include $<$unistd.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par


Include dependency graph for map.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=151pt]{map_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]{map_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{map_8h_a0}{
typedef \hyperlink{structRIM__map__}{RIM\_\-map\_\-} \hyperlink{map_8h_a0}{RIM\_\-map}}
\label{map_8h_a0}

\begin{CompactList}\small\item\em Forward declaration of the RIM\_\-map structure, a bit-map of all the LAT components. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
size\_\-t \hyperlink{map_8h_a1}{RIM\_\-sizeof\-Map} (void)
\begin{CompactList}\small\item\em Calculate the total size of a RIM\_\-map object. \item\end{CompactList}\item 
\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ \hyperlink{map_8h_a2}{RIM\_\-construct\-Map} (void $\ast$buffer)
\begin{CompactList}\small\item\em Initialise the supplied memory as a RIM\_\-map object. \item\end{CompactList}\item 
unsigned \hyperlink{map_8h_a3}{RIM\_\-set\-Bit} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr)
\begin{CompactList}\small\item\em Set a bit in the map. \item\end{CompactList}\item 
unsigned \hyperlink{map_8h_a4}{RIM\_\-clear\-Bit} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr)
\begin{CompactList}\small\item\em Clear a bit in the map. \item\end{CompactList}\item 
int \hyperlink{map_8h_a5}{RIM\_\-check\-Bit} (const \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$addr)
\begin{CompactList}\small\item\em Check a bit in the map. \item\end{CompactList}\item 
int \hyperlink{map_8h_a6}{RIM\_\-count\-Bits} (const \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, \hyperlink{lrd_8h_a0}{RIM\_\-type} type)
\begin{CompactList}\small\item\em Clear a bit in the map. \item\end{CompactList}\item 
void \hyperlink{map_8h_a7}{RIM\_\-set\-ACD} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map)
\begin{CompactList}\small\item\em Set all the bits in the ARC and AFE submaps. \item\end{CompactList}\item 
void \hyperlink{map_8h_a8}{RIM\_\-clear\-ACD} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map)
\begin{CompactList}\small\item\em Clear all the bits in the ARC and AFE submaps. \item\end{CompactList}\item 
unsigned \hyperlink{map_8h_a9}{RIM\_\-set\-TWR} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, unsigned twr)
\begin{CompactList}\small\item\em Set all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower. \item\end{CompactList}\item 
unsigned \hyperlink{map_8h_a10}{RIM\_\-clear\-TWR} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, unsigned twr)
\begin{CompactList}\small\item\em Clear all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower. \item\end{CompactList}\item 
unsigned \hyperlink{map_8h_a11}{RIM\_\-set\-By\-TWR} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, unsigned twr)
\item 
unsigned \hyperlink{map_8h_a12}{RIM\_\-clear\-By\-TWR} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, \hyperlink{lrd_8h_a0}{RIM\_\-type} type, unsigned twr)
\item 
void \hyperlink{map_8h_a13}{RIM\_\-set\-Map} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map)
\begin{CompactList}\small\item\em Set the map. \item\end{CompactList}\item 
void \hyperlink{map_8h_a14}{RIM\_\-clear\-Map} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map)
\begin{CompactList}\small\item\em Clear the map. \item\end{CompactList}\item 
void \hyperlink{map_8h_a15}{RIM\_\-dump\-Map} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, FILE $\ast$fp)
\begin{CompactList}\small\item\em Print out the map. \item\end{CompactList}\item 
unsigned \hyperlink{map_8h_a16}{RIM\_\-create\-Map} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, int fd)
\begin{CompactList}\small\item\em Write out the data of a RIM\_\-map structure. \item\end{CompactList}\item 
unsigned \hyperlink{map_8h_a17}{RIM\_\-consume\-Map} (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$map, int fd)
\begin{CompactList}\small\item\em Read map data into the map structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Configuration map creation, initialisation and manipulation functions. 

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


\subsection{Function Documentation}
\hypertarget{map_8h_a5}{
\index{map.h@{map.h}!RIM_checkBit@{RIM\_\-checkBit}}
\index{RIM_checkBit@{RIM\_\-checkBit}!map.h@{map.h}}
\subsubsection[RIM\_\-checkBit]{\setlength{\rightskip}{0pt plus 5cm}int RIM\_\-check\-Bit (const \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr})}}
\label{map_8h_a5}


Check a bit in the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Structure being manipulated \item[{\em type}]Identifies map to manipulate \item[{\em addr}]bit to check \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]if the bit is clear \item[{\em 1}]if the bit is set\end{description}
\end{Desc}
\hypertarget{map_8h_a8}{
\index{map.h@{map.h}!RIM_clearACD@{RIM\_\-clearACD}}
\index{RIM_clearACD@{RIM\_\-clearACD}!map.h@{map.h}}
\subsubsection[RIM\_\-clearACD]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-clear\-ACD (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map})}}
\label{map_8h_a8}


Clear all the bits in the ARC and AFE submaps. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to a RIM\_\-map structure\end{description}
\end{Desc}
\hypertarget{map_8h_a4}{
\index{map.h@{map.h}!RIM_clearBit@{RIM\_\-clearBit}}
\index{RIM_clearBit@{RIM\_\-clearBit}!map.h@{map.h}}
\subsubsection[RIM\_\-clearBit]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-clear\-Bit (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr})}}
\label{map_8h_a4}


Clear a bit in the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Structure being manipulated \item[{\em type}]Identifies map to manipulate \item[{\em addr}]bit to clear \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-TYPE\_\-UK}]if the type does not exist \item[{\em RIM\_\-MAP\_\-NONE}]if there is no sub-map corresponding to this type \item[{\em RIM\_\-ADDR\_\-BCAST}]if the address contains a mixture of broadcast and singlecast addresses \item[{\em RIM\_\-ADDR\_\-RANGE}]if any component of the address is out of range \item[{\em RIM\_\-ADDR\_\-INDEX}]if the final index exceeds the total number of bits in the map \item[{\em RIM\_\-SUCCESS}]if everything goes well\end{description}
\end{Desc}
\hypertarget{map_8h_a12}{
\index{map.h@{map.h}!RIM_clearByTWR@{RIM\_\-clearByTWR}}
\index{RIM_clearByTWR@{RIM\_\-clearByTWR}!map.h@{map.h}}
\subsubsection[RIM\_\-clearByTWR]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-clear\-By\-TWR (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, unsigned {\em twr})}}
\label{map_8h_a12}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to a RIM\_\-map structure \item[{\em type}]Identifies the sub-map to manipulate \item[{\em twr}]Index of a tower \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-TYPE\_\-UK}]if the type does not exist \item[{\em RIM\_\-MAP\_\-NONE}]if there is no sub-map corresponding to this type \item[{\em RIM\_\-ADDR\_\-BCAST}]if the address contains a mixture of broadcast and singlecast addresses \item[{\em RIM\_\-ADDR\_\-RANGE}]if any component of the address is out of range \item[{\em RIM\_\-ADDR\_\-INDEX}]if the final index exceeds the total number of bits in the map \item[{\em RIM\_\-SUCCESS}]if everything goes well\end{description}
\end{Desc}
\hypertarget{map_8h_a14}{
\index{map.h@{map.h}!RIM_clearMap@{RIM\_\-clearMap}}
\index{RIM_clearMap@{RIM\_\-clearMap}!map.h@{map.h}}
\subsubsection[RIM\_\-clearMap]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-clear\-Map (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map})}}
\label{map_8h_a14}


Clear the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Structure being manipulated\end{description}
\end{Desc}
\hypertarget{map_8h_a10}{
\index{map.h@{map.h}!RIM_clearTWR@{RIM\_\-clearTWR}}
\index{RIM_clearTWR@{RIM\_\-clearTWR}!map.h@{map.h}}
\subsubsection[RIM\_\-clearTWR]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-clear\-TWR (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, unsigned {\em twr})}}
\label{map_8h_a10}


Clear all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to a RIM\_\-map structure \item[{\em twr}]Index of a tower \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-ADDR\_\-RANGE}]if the twr ID is out of range \item[{\em RIM\_\-SUCCESS}]if everything goes well\end{description}
\end{Desc}
\hypertarget{map_8h_a2}{
\index{map.h@{map.h}!RIM_constructMap@{RIM\_\-constructMap}}
\index{RIM_constructMap@{RIM\_\-constructMap}!map.h@{map.h}}
\subsubsection[RIM\_\-constructMap]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structRIM__map__}{RIM\_\-map}$\ast$ RIM\_\-construct\-Map (void $\ast$ {\em buf})}}
\label{map_8h_a2}


Initialise the supplied memory as a RIM\_\-map object. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buf}]Block of memory, at least as large as RIM\_\-sizeof\-Map, to initalise as a RIM\_\-map object \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an initialise RIM\_\-map object\end{Desc}
\hypertarget{map_8h_a17}{
\index{map.h@{map.h}!RIM_consumeMap@{RIM\_\-consumeMap}}
\index{RIM_consumeMap@{RIM\_\-consumeMap}!map.h@{map.h}}
\subsubsection[RIM\_\-consumeMap]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-consume\-Map (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, int {\em fd})}}
\label{map_8h_a17}


Read map data into the map structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Map structure to populate from file \item[{\em fd}]Descriptor of a file opened for reading \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]if all goes well \item[{\em RIM\_\-FILE\_\-READ}]if an error occures whilst the file is being read \item[{\em RIM\_\-FILE\_\-END}]if the end of the file is unexpectedly encountered\end{description}
\end{Desc}
\hypertarget{map_8h_a6}{
\index{map.h@{map.h}!RIM_countBits@{RIM\_\-countBits}}
\index{RIM_countBits@{RIM\_\-countBits}!map.h@{map.h}}
\subsubsection[RIM\_\-countBits]{\setlength{\rightskip}{0pt plus 5cm}int RIM\_\-count\-Bits (const \hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type})}}
\label{map_8h_a6}


Clear a bit in the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Structure being manipulated \item[{\em type}]Identifies map to count \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Number of bits set in the map, or -1 for an illegal type\end{Desc}
\hypertarget{map_8h_a16}{
\index{map.h@{map.h}!RIM_createMap@{RIM\_\-createMap}}
\index{RIM_createMap@{RIM\_\-createMap}!map.h@{map.h}}
\subsubsection[RIM\_\-createMap]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-create\-Map (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, int {\em fd})}}
\label{map_8h_a16}


Write out the data of a RIM\_\-map structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to the RIM\_\-map whose data should be written to file \item[{\em fd}]Descriptor of a file opened for writing \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-SUCCESS}]if all goes well \item[{\em RIM\_\-FILE\_\-WRITE}]if one of the file write operations failed\end{description}
\end{Desc}
\hypertarget{map_8h_a15}{
\index{map.h@{map.h}!RIM_dumpMap@{RIM\_\-dumpMap}}
\index{RIM_dumpMap@{RIM\_\-dumpMap}!map.h@{map.h}}
\subsubsection[RIM\_\-dumpMap]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-dump\-Map (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, FILE $\ast$ {\em fp})}}
\label{map_8h_a15}


Print out the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fp}]Pointer to file to dump the map to \item[{\em map}]Pointer to an initialised map structure\end{description}
\end{Desc}
\hypertarget{map_8h_a7}{
\index{map.h@{map.h}!RIM_setACD@{RIM\_\-setACD}}
\index{RIM_setACD@{RIM\_\-setACD}!map.h@{map.h}}
\subsubsection[RIM\_\-setACD]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-set\-ACD (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map})}}
\label{map_8h_a7}


Set all the bits in the ARC and AFE submaps. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to a RIM\_\-map structure\end{description}
\end{Desc}
\hypertarget{map_8h_a3}{
\index{map.h@{map.h}!RIM_setBit@{RIM\_\-setBit}}
\index{RIM_setBit@{RIM\_\-setBit}!map.h@{map.h}}
\subsubsection[RIM\_\-setBit]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-set\-Bit (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, const \hyperlink{unionRIM__addr}{RIM\_\-addr} $\ast$ {\em addr})}}
\label{map_8h_a3}


Set a bit in the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Structure being manipulated \item[{\em type}]Identifies map to manipulate \item[{\em addr}]bit to set \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-TYPE\_\-UK}]if the type does not exist \item[{\em RIM\_\-MAP\_\-NONE}]if there is no sub-map corresponding to this type \item[{\em RIM\_\-ADDR\_\-BCAST}]if the address contains a mixture of broadcast and singlecast addresses \item[{\em RIM\_\-ADDR\_\-RANGE}]if any component of the address is out of range \item[{\em RIM\_\-ADDR\_\-INDEX}]if the final index exceeds the total number of bits in the map \item[{\em RIM\_\-SUCCESS}]if everything goes well\end{description}
\end{Desc}
\hypertarget{map_8h_a11}{
\index{map.h@{map.h}!RIM_setByTWR@{RIM\_\-setByTWR}}
\index{RIM_setByTWR@{RIM\_\-setByTWR}!map.h@{map.h}}
\subsubsection[RIM\_\-setByTWR]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-set\-By\-TWR (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, \hyperlink{lrd_8h_a0}{RIM\_\-type} {\em type}, unsigned {\em twr})}}
\label{map_8h_a11}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to a RIM\_\-map structure \item[{\em type}]Identifies the sub-map to manipulate \item[{\em twr}]Index of a tower \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-TYPE\_\-UK}]if the type does not exist \item[{\em RIM\_\-MAP\_\-NONE}]if there is no sub-map corresponding to this type \item[{\em RIM\_\-ADDR\_\-BCAST}]if the address contains a mixture of broadcast and singlecast addresses \item[{\em RIM\_\-ADDR\_\-RANGE}]if any component of the address is out of range \item[{\em RIM\_\-ADDR\_\-INDEX}]if the final index exceeds the total number of bits in the map \item[{\em RIM\_\-SUCCESS}]if everything goes well\end{description}
\end{Desc}
\hypertarget{map_8h_a13}{
\index{map.h@{map.h}!RIM_setMap@{RIM\_\-setMap}}
\index{RIM_setMap@{RIM\_\-setMap}!map.h@{map.h}}
\subsubsection[RIM\_\-setMap]{\setlength{\rightskip}{0pt plus 5cm}void RIM\_\-set\-Map (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map})}}
\label{map_8h_a13}


Set the map. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to a RIM\_\-map structure\end{description}
\end{Desc}
\hypertarget{map_8h_a9}{
\index{map.h@{map.h}!RIM_setTWR@{RIM\_\-setTWR}}
\index{RIM_setTWR@{RIM\_\-setTWR}!map.h@{map.h}}
\subsubsection[RIM\_\-setTWR]{\setlength{\rightskip}{0pt plus 5cm}unsigned RIM\_\-set\-TWR (\hyperlink{structRIM__map__}{RIM\_\-map} $\ast$ {\em map}, unsigned {\em twr})}}
\label{map_8h_a9}


Set all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em map}]Pointer to a RIM\_\-map structure \item[{\em twr}]Index of a tower \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em RIM\_\-ADDR\_\-RANGE}]if the twr ID is out of range \item[{\em RIM\_\-SUCCESS}]if everything goes well\end{description}
\end{Desc}
\hypertarget{map_8h_a1}{
\index{map.h@{map.h}!RIM_sizeofMap@{RIM\_\-sizeofMap}}
\index{RIM_sizeofMap@{RIM\_\-sizeofMap}!map.h@{map.h}}
\subsubsection[RIM\_\-sizeofMap]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t RIM\_\-sizeof\-Map (void)}}
\label{map_8h_a1}


Calculate the total size of a RIM\_\-map object. 

\begin{Desc}
\item[Returns:]Amount of memory required to accomodate a RIM\_\-map object\end{Desc}
