\hypertarget{ASC_8c}{
\section{ASC.c File Reference}
\label{ASC_8c}\index{ASC.c@{ASC.c}}
}
ACD Software Rate Counters, implementation file. 

{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}PBS/FFS.ih\char`\"{}}\par
{\tt \#include \char`\"{}PBI/Endianness.h\char`\"{}}\par
{\tt \#include \char`\"{}ASC/ASC.h\char`\"{}}\par


Include dependency graph for ASC.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=112pt]{ASC_8c__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__LCB__header}{\_\-LCB\_\-header}
\begin{CompactList}\small\item\em Layouts out the header for an LCB packet. The header is represented in terms of 32-bit quantities to avoid BIG/ LITTLE endian problems. \item\end{CompactList}\item 
struct \hyperlink{struct__EBF__gemAcd}{\_\-EBF\_\-gem\-Acd}
\begin{CompactList}\small\item\em Lays out the format of the ACD data block from the event builder. \item\end{CompactList}\item 
struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem}
\begin{CompactList}\small\item\em Lays out the format of the GEM data block from the event builder. This does not include the LCB header. \item\end{CompactList}\item 
struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem}
\begin{CompactList}\small\item\em Lays out the format of the ACD data block from the event builder. This does not include the LCB header. \item\end{CompactList}\item 
struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd}
\begin{CompactList}\small\item\em Holds the unpacked ACD information. \item\end{CompactList}\item 
struct \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remap\-Brd}
\begin{CompactList}\small\item\em Structure defining the remapping the ACD data on a single board from electronics space into the standard 4 geographically oriented lists. \item\end{CompactList}\item 
struct \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap}
\begin{CompactList}\small\item\em Defines the information necessary to remap all ACD information laid out in electronics space to a geographical space. \item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{ASC_8c_a0}{
\#define \hyperlink{ASC_8c_a0}{EBF\_\-K\_\-CID\_\-GEM}~16}
\label{ASC_8c_a0}

\begin{CompactList}\small\item\em The id of the GEM contribution. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a1}{
\#define \hyperlink{ASC_8c_a1}{EBF\_\-K\_\-CID\_\-ACD}~17}
\label{ASC_8c_a1}

\begin{CompactList}\small\item\em The id of the ACD contribution. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a2}{
\#define \hyperlink{ASC_8c_a2}{LCB\_\-M\_\-PACKET\_\-ALIGN}~0xf}
\label{ASC_8c_a2}

\begin{CompactList}\small\item\em The size of a contributor must be an even multiple of this number. Currently an LCB packet is 128 bits or 16 bytes. This means that the low nibble of each length contributor's field must be zero. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_a3}{LCB\_\-EXTRACT\_\-CID}(hdr\_\-clen)~(((hdr\_\-clen) $>$$>$ 17) \& 0x1f)
\begin{CompactList}\small\item\em Extracts the contributor id from the first word of the LCB header. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_a4}{LCB\_\-EXTRACT\_\-CLEN}(hdr\_\-clen)~((hdr\_\-clen) \& 0xffff)
\begin{CompactList}\small\item\em Extracts the contributor length (in bytes) from the first word of the LCB header. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_a5}{\_\-ADVANCE}(\_\-ptr, \_\-nbytes)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr) + (\_\-nbytes))
\begin{CompactList}\small\item\em Advances {\em \_\-ptr\/} by {\em \_\-nbytes\/}. The return value is always recast to the type of {\em \_\-ptr\/}. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_a6}{\_\-SKIP\_\-EHDR}(\_\-ptr)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr)+sizeof(\hyperlink{struct__LCB__header}{LCB\_\-header}))
\begin{CompactList}\small\item\em Skips over the event header (LATp header + summary word) recast to the type of {\em \_\-ptr\/}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a7}{
\#define \hyperlink{ASC_8c_a7}{EBF\_\-K\_\-ACD\_\-NBRDS}~12}
\label{ASC_8c_a7}

\begin{CompactList}\small\item\em Number of ACD front end boards. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a8}{
\#define \hyperlink{ASC_8c_a8}{EBF\_\-K\_\-ACD\_\-NCHNS\_\-PER\_\-BRD}~18}
\label{ASC_8c_a8}

\begin{CompactList}\small\item\em Number of ACD front end channels serviced by one board. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a9}{
\#define \hyperlink{ASC_8c_a9}{EBF\_\-K\_\-ACD\_\-VETOES\_\-CNT}~7}
\label{ASC_8c_a9}

\begin{CompactList}\small\item\em The number of words in the ACD veto hit map array. \item\end{CompactList}\item 
\#define \hyperlink{ASC_8c_a10}{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT}~9
\begin{CompactList}\small\item\em The number of words in the ACD accept map array. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{ASC_8c_a11}{
typedef \hyperlink{struct__LCB__header}{\_\-LCB\_\-header} \hyperlink{ASC_8c_a11}{LCB\_\-header}}
\label{ASC_8c_a11}

\begin{CompactList}\small\item\em Typedef for {\em struct\/} \hyperlink{struct__LCB__header}{\_\-LCB\_\-header}. \item\end{CompactList}\item 
typedef enum \hyperlink{ASC_8c_a48}{\_\-EBF\_\-K\_\-gem\_\-acd\_\-veto} \hyperlink{ASC_8c_a12}{EBF\_\-K\_\-gem\_\-acd\_\-veto}
\begin{CompactList}\small\item\em Typedef for enum {\bf \_\-EBF\_\-K\_\-gem\_\-acd\_\-veto}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a13}{
typedef \hyperlink{struct__EBF__gemAcd}{\_\-EBF\_\-gem\-Acd} \hyperlink{ASC_8c_a13}{EBF\_\-gem\-Acd}}
\label{ASC_8c_a13}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__EBF__gemAcd}{\_\-EBF\_\-gem\-Acd}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a14}{
typedef \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} \hyperlink{ASC_8c_a14}{EBF\_\-gem}}
\label{ASC_8c_a14}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem}. \item\end{CompactList}\item 
typedef enum \hyperlink{ASC_8c_a49}{\_\-EBF\_\-K\_\-acd\_\-list} \hyperlink{ASC_8c_a15}{EBF\_\-K\_\-acd\_\-list}
\begin{CompactList}\small\item\em Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-list}. \item\end{CompactList}\item 
typedef enum \hyperlink{ASC_8c_a50}{\_\-EBF\_\-K\_\-acd\_\-side} \hyperlink{ASC_8c_a16}{EBF\_\-K\_\-acd\_\-side}
\begin{CompactList}\small\item\em Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-side}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a17}{
typedef \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} \hyperlink{ASC_8c_a17}{EBF\_\-aem}}
\label{ASC_8c_a17}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem}. \item\end{CompactList}\item 
\hypertarget{ASC_8c_a18}{
typedef \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} \hyperlink{ASC_8c_a18}{ASC\_\-acd}}
\label{ASC_8c_a18}

\begin{CompactList}\small\item\em typedef for struct {\em \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd}\/} \item\end{CompactList}\item 
typedef \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remap\-Brd} \hyperlink{ASC_8c_a19}{ACD\_\-remap\-Brd}
\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remap\-Brd}\/}. \item\end{CompactList}\item 
typedef \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap} \hyperlink{ASC_8c_a20}{ACD\_\-remap}
\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{ASC_8c_a48}{\_\-EBF\_\-K\_\-gem\_\-acd\_\-veto} \{ \par
{\bf EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-XZ} =  0, 
\par
{\bf EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-YZ} =  1, 
\par
{\bf EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-XY} =  2, 
\par
{\bf EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-RU} =  3, 
\par
{\bf EBF\_\-K\_\-GEM\_\-ACD\_\-VETO\_\-CNT} =  4
 \}
\begin{CompactList}\small\item\em Enumerates the elements of the GEM's ACD veto block. \item\end{CompactList}\item 
enum \hyperlink{ASC_8c_a49}{\_\-EBF\_\-K\_\-acd\_\-list} \{ \par
\hyperlink{ASC_8c_a49a26}{EBF\_\-K\_\-ACD\_\-LIST\_\-XZ} =  0, 
\par
\hyperlink{ASC_8c_a49a27}{EBF\_\-K\_\-ACD\_\-LIST\_\-YZ} =  1, 
\par
\hyperlink{ASC_8c_a49a28}{EBF\_\-K\_\-ACD\_\-LIST\_\-XY} =  2, 
\par
\hyperlink{ASC_8c_a49a29}{EBF\_\-K\_\-ACD\_\-LIST\_\-RU} =  3, 
\par
\hyperlink{ASC_8c_a49a30}{EBF\_\-K\_\-ACD\_\-LIST\_\-CNT} =  4
 \}
\begin{CompactList}\small\item\em Enumerates the bit lists. \item\end{CompactList}\item 
enum \hyperlink{ASC_8c_a50}{\_\-EBF\_\-K\_\-acd\_\-side} \{ \par
\hyperlink{ASC_8c_a50a31}{EBF\_\-K\_\-ACD\_\-SIDE\_\-A} =  0, 
\par
\hyperlink{ASC_8c_a50a32}{EBF\_\-K\_\-ACD\_\-SIDE\_\-B} =  1, 
\par
\hyperlink{ASC_8c_a50a33}{EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT} =  2
 \}
\begin{CompactList}\small\item\em Enumerates the side A and side B values. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static void \hyperlink{ASC_8c_a34}{clear} (void $\ast$ptr, int nbytes)
\begin{CompactList}\small\item\em Zeroes the specified memory. \item\end{CompactList}\item 
static void \hyperlink{ASC_8c_a35}{accumulate\_\-cno} (\hyperlink{struct__ASC__cno}{ASC\_\-cno} $\ast$cno, unsigned int cno\-Req\-Vec)
\begin{CompactList}\small\item\em Accumulates the number of CNO triggers from each FREE board. \item\end{CompactList}\item 
static void \hyperlink{ASC_8c_a36}{accumulate} (\hyperlink{struct__ASC__list}{ASC\_\-list} $\ast$list, unsigned int v, unsigned int hb, unsigned int ha, unsigned int pb, unsigned int pa)
\begin{CompactList}\small\item\em Accumulates the statistics for list (32-bits) of ACD hits. \item\end{CompactList}\item 
static int \hyperlink{ASC_8c_a37}{unpack} (struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$acd, const unsigned short int $\ast$data)
\begin{CompactList}\small\item\em Unpacks an ACD record from the AEM into a standard structure. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{ASC_8c_a38}{prepare} (unsigned int w)
\begin{CompactList}\small\item\em Prepares the initial word of being used in the formation of the pattern word. \item\end{CompactList}\item 
static \_\-\_\-inline const \hyperlink{struct__EBF__aem}{EBF\_\-aem} $\ast$ \hyperlink{ASC_8c_a39}{locate\_\-aem} (const unsigned int $\ast$evt, int elen)
\begin{CompactList}\small\item\em Composes the directory of the contributors. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{ASC_8c_a40}{form} (unsigned int v, unsigned int hb, unsigned int ha, unsigned int pb, unsigned int pa, int left)
\begin{CompactList}\small\item\em Forms the 5 bit pattern word from the bits in column {\em left\/} {\bf and} appropriately shifts the pattern word so that it may be used directly as a byte offset into the correct statistics counters. \item\end{CompactList}\item 
void \hyperlink{ASC_8c_a41}{ASC\_\-clear} (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$counters)
\begin{CompactList}\small\item\em Clears the specified statistics counters. \item\end{CompactList}\item 
void \hyperlink{ASC_8c_a42}{ASC\_\-accumulate\-U} (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$counters, const struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} $\ast$gem, const struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$acd)
\begin{CompactList}\small\item\em Accumulates the proper pattern words for each ACD hit. \item\end{CompactList}\item 
const \_\-\_\-inline struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} $\ast$ \hyperlink{ASC_8c_a43}{ASC\_\-gem\_\-locate} (const unsigned int $\ast$edata, int esize)
\begin{CompactList}\small\item\em Locates GEM contribution in an event. \item\end{CompactList}\item 
const \_\-\_\-inline struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} $\ast$ \hyperlink{ASC_8c_a44}{ASC\_\-aem\_\-locate} (const unsigned int $\ast$edata, int esize)
\begin{CompactList}\small\item\em Locates ACD contribution in an event. \item\end{CompactList}\item 
int \hyperlink{ASC_8c_a45}{ASC\_\-accumulate} (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$counters, const unsigned int $\ast$edata, int esize)
\begin{CompactList}\small\item\em Accumulate the counters for the specified event. \item\end{CompactList}\item 
int \hyperlink{ASC_8c_a46}{ASC\_\-acd\_\-sizeof} (void)
\begin{CompactList}\small\item\em Returns the size, in bytes, of the data structure needed to hold an unpacked ACD event. \item\end{CompactList}\item 
int \hyperlink{ASC_8c_a47}{ASC\_\-acd\_\-unpack} (struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$acd, const struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} $\ast$aem)
\begin{CompactList}\small\item\em Unpacks an ACD record from the AEM into a standard structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
ACD Software Rate Counters, implementation file. 

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


\footnotesize\begin{verbatim}    CVS $Id: ASC.c,v 1.1.1.1 2005/12/01 21:55:31 ebacho Exp $
\end{verbatim}
\normalsize


\begin{Desc}
\item[SYNOPSIS]Defines the the implementation for accumulating the ACD software rate counters\end{Desc}


\subsection{Define Documentation}
\hypertarget{ASC_8c_a5}{
\index{ASC.c@{ASC.c}!_ADVANCE@{\_\-ADVANCE}}
\index{_ADVANCE@{\_\-ADVANCE}!ASC.c@{ASC.c}}
\subsubsection[\_\-ADVANCE]{\setlength{\rightskip}{0pt plus 5cm}\#define \_\-ADVANCE(\_\-ptr, \_\-nbytes)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr) + (\_\-nbytes))}}
\label{ASC_8c_a5}


Advances {\em \_\-ptr\/} by {\em \_\-nbytes\/}. The return value is always recast to the type of {\em \_\-ptr\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ptr}]The pointer to advance \item[{\em \_\-nbytes}]The number of nbytes to advance {\em \_\-ptr\/} by. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The advanced pointer, the pointer is recast to a void $\ast$.\end{Desc}
\hypertarget{ASC_8c_a6}{
\index{ASC.c@{ASC.c}!_SKIP_EHDR@{\_\-SKIP\_\-EHDR}}
\index{_SKIP_EHDR@{\_\-SKIP\_\-EHDR}!ASC.c@{ASC.c}}
\subsubsection[\_\-SKIP\_\-EHDR]{\setlength{\rightskip}{0pt plus 5cm}\#define \_\-SKIP\_\-EHDR(\_\-ptr)~(void $\ast$)((unsigned char $\ast$)(\_\-ptr)+sizeof(\hyperlink{struct__LCB__header}{LCB\_\-header}))}}
\label{ASC_8c_a6}


Skips over the event header (LATp header + summary word) recast to the type of {\em \_\-ptr\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ptr}]The pointer to advance \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The advanced pointer, the pointer is recast to a void $\ast$.\end{Desc}
\hypertarget{ASC_8c_a10}{
\index{ASC.c@{ASC.c}!EBF_K_ACD_ACCEPTS_CNT@{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT}}
\index{EBF_K_ACD_ACCEPTS_CNT@{EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT}!ASC.c@{ASC.c}}
\subsubsection[EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT]{\setlength{\rightskip}{0pt plus 5cm}\#define EBF\_\-K\_\-ACD\_\-ACCEPTS\_\-CNT~9}}
\label{ASC_8c_a10}


The number of words in the ACD accept map array. 

The ACD data structure consists of the standard header word followed by 3 major blocks. The first two blocks, the {\em veto hit map\/} and the {\em accept block\/} are fixed length. The final block is a variable length block containing the ADC pulse values. The number of ADC values is determined by the count field in the {\em accept\/} block.

Header Word Event sequence number and contributor id Veto Hit Map One 18 bit vector for each of the 12 ACD FREE boards Accept Block One 24 bit vector for each of the 12 ACD FREE boards ACD ADCs The ACD ADC pulse values, variable length.

{\bf Veto Hit Map}\par
 The Veto Hit Map is packed densely into 7 32 bit words. There is one unused byte at the end. Picturally this block looks like



\footnotesize\begin{verbatim}        11111111 11111111
        fedcba98 76543210 fedcba98 76543210                 
       +--------+--------+--------+--------+
     0 |11111111 11111100 00000000 00000000| 
     1 |33333333 33222222 22222222 22221111| 
     2 |55555544 44444444 44444444 333333331
     3 |77666666 66666666 66665555 55555555|
     4 |88888888 88888888 77777777 77777777|
     5 |AAAAAAAA AAAA9999 99999999 99999988|
     6 |-------- BBBBBBBB BBBBBBBB BBAAAAAA|
       +--------+--------+--------+--------+
  \end{verbatim}
\normalsize


Where the numbers represent the 12 ADC FREE boards. (Note that each string of numbers has 18 bits.

{\bf ADC Accept Block}\par
 The Accept block is a densely packed array of words 24 bits in length. Each 24 bit word is formatted as follows



\footnotesize\begin{verbatim}        11111111
        76543210 fedcba98 76543210    
       +--------+--------+--------+   
       |aaaaaaaa aaaaaaaa aaCccccc|           
       +--------+--------+--------+
   \end{verbatim}
\normalsize


Where 

\footnotesize\begin{verbatim}       c( 5 bits)
       Count of number of ADC accepted for this board. Because the
       number of ADCs from the ACD can be limited, this count must be
       less than or equal to the number of bits set in accept mask.

       C( 1 bit )
       The CNO bit for this board.

       a(18 bits)
       A bit map of the number of pulse heights over threshold on
       this board. If the number of bits exceeds the count (c) then
       only the first 'count' are present in the ADC array.
   \end{verbatim}
\normalsize


These 12 Accept vectors are packed densely into 9 32 bit words.



\footnotesize\begin{verbatim}           11111111 11111111
           fedcba98 76543210 fedcba98 76543210                 
       +--------+--------+--------+--------+
     0 |11111111 00000000 00000000 00000000| 
     1 |22222222 22222222 11111111 11111111| 
     2 |33333333 33333333 33333333 222222221
     3 |55555555 44444444 44444444 44444444|
     4 |66666666 66666666 55555555 55555555|
     5 |77777777 77777777 77777777 66666666|
     6 |99999999 88888888 88888888 88888888|
     7 |aaaaaaaa aaaaaaaa 99999999 99999999|
     8 |bbbbbbbb bbbbbbbb bbbbbbbb aaaaaaaa|
       +--------+--------+--------+--------+
   \end{verbatim}
\normalsize


Again the numbers represent the accept words for each of the 12 ACD FREE boards.

{\bf ACD ADC Pulse Heights}\par
 Each ACD ADC pulse height is 16 bits in length. The total number of ADC values is determined by the {\em count\/} field in the accept word. The mapping is determined by {\em accept\/} map in each accept word. Only the first {\em count\/} bits of ADC values are used. That is, if there are more bits set in the accept map, there will be only {\em count\/} number of ADC pulse heights from this board.\hypertarget{ASC_8c_a3}{
\index{ASC.c@{ASC.c}!LCB_EXTRACT_CID@{LCB\_\-EXTRACT\_\-CID}}
\index{LCB_EXTRACT_CID@{LCB\_\-EXTRACT\_\-CID}!ASC.c@{ASC.c}}
\subsubsection[LCB\_\-EXTRACT\_\-CID]{\setlength{\rightskip}{0pt plus 5cm}\#define LCB\_\-EXTRACT\_\-CID(hdr\_\-clen)~(((hdr\_\-clen) $>$$>$ 17) \& 0x1f)}}
\label{ASC_8c_a3}


Extracts the contributor id from the first word of the LCB header. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hdr\_\-clen}]The first word of the LCB header \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The contributor id\end{Desc}
\hypertarget{ASC_8c_a4}{
\index{ASC.c@{ASC.c}!LCB_EXTRACT_CLEN@{LCB\_\-EXTRACT\_\-CLEN}}
\index{LCB_EXTRACT_CLEN@{LCB\_\-EXTRACT\_\-CLEN}!ASC.c@{ASC.c}}
\subsubsection[LCB\_\-EXTRACT\_\-CLEN]{\setlength{\rightskip}{0pt plus 5cm}\#define LCB\_\-EXTRACT\_\-CLEN(hdr\_\-clen)~((hdr\_\-clen) \& 0xffff)}}
\label{ASC_8c_a4}


Extracts the contributor length (in bytes) from the first word of the LCB header. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hdr\_\-clen}]The first word of the LCB header \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The contributor's length (in bytes)\end{Desc}


\subsection{Typedef Documentation}
\hypertarget{ASC_8c_a20}{
\index{ASC.c@{ASC.c}!ACD_remap@{ACD\_\-remap}}
\index{ACD_remap@{ACD\_\-remap}!ASC.c@{ASC.c}}
\subsubsection[ACD\_\-remap]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__ACD__remap}{ACD\_\-remap}}}
\label{ASC_8c_a20}


Typedef for struct \hyperlink{struct__ACD__remap}{\_\-ACD\_\-remap}. 

This is basically just an array of the remap structures {\em AFF\_\-remap\-Brd\/} for each of the 12 FREE boards.\hypertarget{ASC_8c_a19}{
\index{ASC.c@{ASC.c}!ACD_remapBrd@{ACD\_\-remapBrd}}
\index{ACD_remapBrd@{ACD\_\-remapBrd}!ASC.c@{ASC.c}}
\subsubsection[ACD\_\-remapBrd]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__ACD__remapBrd}{ACD\_\-remap\-Brd}}}
\label{ASC_8c_a19}


Typedef for struct {\em \hyperlink{struct__ACD__remapBrd}{\_\-ACD\_\-remap\-Brd}\/}. 

This is a fairly complicated structure whose layout is driven by the code. These arrays define the mapping from electronics space, {\em i.e\/}. channels on a particular FREE boards, to geometric space, {\em i.e\/}. tiles on the 5 faces, top (XY) and the 4 side planes (XZ-,XZ+,YZ-,YZ+). There are 3 remapping arrays.

The first array is a series of masks, one for each of the geometrically oriented lists. For a given list of 18 channels on a FREE board, each mask projects out only those channels of the corresponding geometrical list.

The next array is indexed by electronics channel and yields the corresponding channel within the context of its geographical list. This array may contain the same geometrical channel more than once, but, by virtue of using the first array to project out only those channels belonging to a particular geometrical list, the duplicate channels will never direct more than one electronics channel to a single geometrical channel. In fact, the first mask is just a bit list of the channels in this array belonging to a single geometrical list.

The final array remaps a PHA value in electronics space into an array indexed by geometrical index. This array is differs from the previous array only by having the geometrical list index as part of the output index. That is, the output index is in a flat space from 0 to the number of actual tiles/ribbons. The other two arrays are merely rearrangements of the information in this array.\hypertarget{ASC_8c_a15}{
\index{ASC.c@{ASC.c}!EBF_K_acd_list@{EBF\_\-K\_\-acd\_\-list}}
\index{EBF_K_acd_list@{EBF\_\-K\_\-acd\_\-list}!ASC.c@{ASC.c}}
\subsubsection[EBF\_\-K\_\-acd\_\-list]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{ASC_8c_a15}{EBF\_\-K\_\-acd\_\-list}}}
\label{ASC_8c_a15}


Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-list}. 

These definitions should be used to access the elements of the ACD hit and accept lists by name.\hypertarget{ASC_8c_a16}{
\index{ASC.c@{ASC.c}!EBF_K_acd_side@{EBF\_\-K\_\-acd\_\-side}}
\index{EBF_K_acd_side@{EBF\_\-K\_\-acd\_\-side}!ASC.c@{ASC.c}}
\subsubsection[EBF\_\-K\_\-acd\_\-side]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{ASC_8c_a16}{EBF\_\-K\_\-acd\_\-side}}}
\label{ASC_8c_a16}


Typedef for enum {\bf \_\-EBF\_\-K\_\-acd\_\-side}. 

These definitions should be used to access the elements of the ACD hit and accept sides by name.\hypertarget{ASC_8c_a12}{
\index{ASC.c@{ASC.c}!EBF_K_gem_acd_veto@{EBF\_\-K\_\-gem\_\-acd\_\-veto}}
\index{EBF_K_gem_acd_veto@{EBF\_\-K\_\-gem\_\-acd\_\-veto}!ASC.c@{ASC.c}}
\subsubsection[EBF\_\-K\_\-gem\_\-acd\_\-veto]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{ASC_8c_a12}{EBF\_\-K\_\-gem\_\-acd\_\-veto}}}
\label{ASC_8c_a12}


Typedef for enum {\bf \_\-EBF\_\-K\_\-gem\_\-acd\_\-veto}. 

These definitions should be used to access the elements of the ACD veto block by name.

\subsection{Enumeration Type Documentation}
\hypertarget{ASC_8c_a49}{
\index{ASC.c@{ASC.c}!_EBF_K_acd_list@{\_\-EBF\_\-K\_\-acd\_\-list}}
\index{_EBF_K_acd_list@{\_\-EBF\_\-K\_\-acd\_\-list}!ASC.c@{ASC.c}}
\subsubsection[\_\-EBF\_\-K\_\-acd\_\-list]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{ASC_8c_a49}{\_\-EBF\_\-K\_\-acd\_\-list}}}
\label{ASC_8c_a49}


Enumerates the bit lists. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{EBF_K_ACD_LIST_XZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-XZ}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_LIST_XZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-XZ}}\item[{\em 
\hypertarget{ASC_8c_a49a26}{
EBF\_\-K\_\-ACD\_\-LIST\_\-XZ}
\label{ASC_8c_a49a26}
}]Bit mask of tiles in the XZ plane \index{EBF_K_ACD_LIST_YZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-YZ}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_LIST_YZ@{EBF\_\-K\_\-ACD\_\-LIST\_\-YZ}}\item[{\em 
\hypertarget{ASC_8c_a49a27}{
EBF\_\-K\_\-ACD\_\-LIST\_\-YZ}
\label{ASC_8c_a49a27}
}]Bit mask of tiles in the YZ plane \index{EBF_K_ACD_LIST_XY@{EBF\_\-K\_\-ACD\_\-LIST\_\-XY}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_LIST_XY@{EBF\_\-K\_\-ACD\_\-LIST\_\-XY}}\item[{\em 
\hypertarget{ASC_8c_a49a28}{
EBF\_\-K\_\-ACD\_\-LIST\_\-XY}
\label{ASC_8c_a49a28}
}]Bit mask of tiles in the XY plane \index{EBF_K_ACD_LIST_RU@{EBF\_\-K\_\-ACD\_\-LIST\_\-RU}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_LIST_RU@{EBF\_\-K\_\-ACD\_\-LIST\_\-RU}}\item[{\em 
\hypertarget{ASC_8c_a49a29}{
EBF\_\-K\_\-ACD\_\-LIST\_\-RU}
\label{ASC_8c_a49a29}
}]Bit mask of ribbons and unused \index{EBF_K_ACD_LIST_CNT@{EBF\_\-K\_\-ACD\_\-LIST\_\-CNT}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_LIST_CNT@{EBF\_\-K\_\-ACD\_\-LIST\_\-CNT}}\item[{\em 
\hypertarget{ASC_8c_a49a30}{
EBF\_\-K\_\-ACD\_\-LIST\_\-CNT}
\label{ASC_8c_a49a30}
}]Number of bit masks \end{description}
\end{Desc}

\hypertarget{ASC_8c_a50}{
\index{ASC.c@{ASC.c}!_EBF_K_acd_side@{\_\-EBF\_\-K\_\-acd\_\-side}}
\index{_EBF_K_acd_side@{\_\-EBF\_\-K\_\-acd\_\-side}!ASC.c@{ASC.c}}
\subsubsection[\_\-EBF\_\-K\_\-acd\_\-side]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{ASC_8c_a50}{\_\-EBF\_\-K\_\-acd\_\-side}}}
\label{ASC_8c_a50}


Enumerates the side A and side B values. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{EBF_K_ACD_SIDE_A@{EBF\_\-K\_\-ACD\_\-SIDE\_\-A}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_SIDE_A@{EBF\_\-K\_\-ACD\_\-SIDE\_\-A}}\item[{\em 
\hypertarget{ASC_8c_a50a31}{
EBF\_\-K\_\-ACD\_\-SIDE\_\-A}
\label{ASC_8c_a50a31}
}]The side A block \index{EBF_K_ACD_SIDE_B@{EBF\_\-K\_\-ACD\_\-SIDE\_\-B}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_SIDE_B@{EBF\_\-K\_\-ACD\_\-SIDE\_\-B}}\item[{\em 
\hypertarget{ASC_8c_a50a32}{
EBF\_\-K\_\-ACD\_\-SIDE\_\-B}
\label{ASC_8c_a50a32}
}]The side B block \index{EBF_K_ACD_SIDE_CNT@{EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT}!ASC.c@{ASC.c}}\index{ASC.c@{ASC.c}!EBF_K_ACD_SIDE_CNT@{EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT}}\item[{\em 
\hypertarget{ASC_8c_a50a33}{
EBF\_\-K\_\-ACD\_\-SIDE\_\-CNT}
\label{ASC_8c_a50a33}
}]Count of the number of sides \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{ASC_8c_a36}{
\index{ASC.c@{ASC.c}!accumulate@{accumulate}}
\index{accumulate@{accumulate}!ASC.c@{ASC.c}}
\subsubsection[accumulate]{\setlength{\rightskip}{0pt plus 5cm}static void accumulate (\hyperlink{struct__ASC__list}{ASC\_\-list} $\ast$ {\em list}, unsigned int {\em v}, unsigned int {\em hb}, unsigned int {\em ha}, unsigned int {\em pb}, unsigned int {\em pa})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a36}


Accumulates the statistics for list (32-bits) of ACD hits. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em list}]Pointer to the statistics for this list of ACD hits \item[{\em v}]The GEM list of veto bits \item[{\em hb}]The ACD hit bits for side {\em b\/} \item[{\em ha}]The ACD hit bits for side {\em a\/} \item[{\em pb}]The ACD pulse height accept bits for side {\em b\/} \item[{\em pa}]The ACD pulse height accept bits for side {\em a\/} \end{description}
\end{Desc}
\hypertarget{ASC_8c_a35}{
\index{ASC.c@{ASC.c}!accumulate_cno@{accumulate\_\-cno}}
\index{accumulate_cno@{accumulate\_\-cno}!ASC.c@{ASC.c}}
\subsubsection[accumulate\_\-cno]{\setlength{\rightskip}{0pt plus 5cm}static void accumulate\_\-cno (\hyperlink{struct__ASC__cno}{ASC\_\-cno} $\ast$ {\em cno}, unsigned int {\em cno\-Reqvec})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a35}


Accumulates the number of CNO triggers from each FREE board. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cno}]The CNO statistics block \item[{\em cno\-Reqvec}]The CNO and trigger request vector. The CNO trigger information occupies the lower 12 of the upper 16 bits.\end{description}
\end{Desc}
\hypertarget{ASC_8c_a45}{
\index{ASC.c@{ASC.c}!ASC_accumulate@{ASC\_\-accumulate}}
\index{ASC_accumulate@{ASC\_\-accumulate}!ASC.c@{ASC.c}}
\subsubsection[ASC\_\-accumulate]{\setlength{\rightskip}{0pt plus 5cm}int ASC\_\-accumulate (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$ {\em counters}, const unsigned int $\ast$ {\em edata}, int {\em esize})}}
\label{ASC_8c_a45}


Accumulate the counters for the specified event. 

\begin{Desc}
\item[Returns:]Status indicating the event was successfully processed (0) or a non-zero number indicating the event was not successfully processed.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em counters}]Pointer to the counters to increment \item[{\em edata}]Pointer to the event data \item[{\em esize}]The event size, in units of bytes. This is used as a consistency check in the unpacking.\end{description}
\end{Desc}
\hypertarget{ASC_8c_a42}{
\index{ASC.c@{ASC.c}!ASC_accumulateU@{ASC\_\-accumulateU}}
\index{ASC_accumulateU@{ASC\_\-accumulateU}!ASC.c@{ASC.c}}
\subsubsection[ASC\_\-accumulateU]{\setlength{\rightskip}{0pt plus 5cm}void ASC\_\-accumulate\-U (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$ {\em counters}, const struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} $\ast$ {\em gem}, const struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$ {\em acd})}}
\label{ASC_8c_a42}


Accumulates the proper pattern words for each ACD hit. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em counters}]The statistics counters \item[{\em gem}]Pointer to the GEM record \item[{\em acd}]Pointer to an unpacked ACD record\end{description}
\end{Desc}
This function is called on the assumption that the GEM record has been located and the ACD data has been both located and successfully unpacked.\hypertarget{ASC_8c_a46}{
\index{ASC.c@{ASC.c}!ASC_acd_sizeof@{ASC\_\-acd\_\-sizeof}}
\index{ASC_acd_sizeof@{ASC\_\-acd\_\-sizeof}!ASC.c@{ASC.c}}
\subsubsection[ASC\_\-acd\_\-sizeof]{\setlength{\rightskip}{0pt plus 5cm}int ASC\_\-acd\_\-sizeof (void)}}
\label{ASC_8c_a46}


Returns the size, in bytes, of the data structure needed to hold an unpacked ACD event. 

\begin{Desc}
\item[Returns:]The size, in bytes, of the data structure needed to hold an unpacked ACD event\end{Desc}
\hypertarget{ASC_8c_a47}{
\index{ASC.c@{ASC.c}!ASC_acd_unpack@{ASC\_\-acd\_\-unpack}}
\index{ASC_acd_unpack@{ASC\_\-acd\_\-unpack}!ASC.c@{ASC.c}}
\subsubsection[ASC\_\-acd\_\-unpack]{\setlength{\rightskip}{0pt plus 5cm}int ASC\_\-acd\_\-unpack (struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$ {\em acd}, const struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} $\ast$ {\em aem})}}
\label{ASC_8c_a47}


Unpacks an ACD record from the AEM into a standard structure. 

\begin{Desc}
\item[Returns:]Status. The only failure is if more than 18 PHAs are found to be present on an given FREE board.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em acd}]Pointer to the data structure to receive the unpacked ACD data \item[{\em aem}]Pointer to the AEM ACD data\end{description}
\end{Desc}
\hypertarget{ASC_8c_a44}{
\index{ASC.c@{ASC.c}!ASC_aem_locate@{ASC\_\-aem\_\-locate}}
\index{ASC_aem_locate@{ASC\_\-aem\_\-locate}!ASC.c@{ASC.c}}
\subsubsection[ASC\_\-aem\_\-locate]{\setlength{\rightskip}{0pt plus 5cm}const struct \hyperlink{struct__EBF__aem}{\_\-EBF\_\-aem} $\ast$ ASC\_\-aem\_\-locate (const unsigned int $\ast$ {\em edata}, int {\em esize})}}
\label{ASC_8c_a44}


Locates ACD contribution in an event. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]pointer to the GEM contribution. \item[{\em NULL}]is return if the GEM contribution cannnot be found\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em edata}]Pointer to the event data structure \item[{\em esize}]Size, in bytes, of the event\end{description}
\end{Desc}
\hypertarget{ASC_8c_a41}{
\index{ASC.c@{ASC.c}!ASC_clear@{ASC\_\-clear}}
\index{ASC_clear@{ASC\_\-clear}!ASC.c@{ASC.c}}
\subsubsection[ASC\_\-clear]{\setlength{\rightskip}{0pt plus 5cm}ASC\_\-clear (\hyperlink{struct__ASC__counters}{ASC\_\-counters} $\ast$ {\em counters})}}
\label{ASC_8c_a41}


Clears the specified statistics counters. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em counters}]The statistics counters to be cleared\end{description}
\end{Desc}
\begin{Desc}
\item[Warning:]Currently this is a NON-interlocked operation.\end{Desc}
\hypertarget{ASC_8c_a43}{
\index{ASC.c@{ASC.c}!ASC_gem_locate@{ASC\_\-gem\_\-locate}}
\index{ASC_gem_locate@{ASC\_\-gem\_\-locate}!ASC.c@{ASC.c}}
\subsubsection[ASC\_\-gem\_\-locate]{\setlength{\rightskip}{0pt plus 5cm}const struct \hyperlink{struct__EBF__gem}{\_\-EBF\_\-gem} $\ast$ ASC\_\-gem\_\-locate (const unsigned int $\ast$ {\em edata}, int {\em esize})}}
\label{ASC_8c_a43}


Locates GEM contribution in an event. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]pointer to the GEM contribution. \item[{\em NULL}]is return if the GEM contribution cannnot be found\end{description}
\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em edata}]Pointer to the event data structure \item[{\em esize}]Size, in bytes, of the event\end{description}
\end{Desc}
\hypertarget{ASC_8c_a34}{
\index{ASC.c@{ASC.c}!clear@{clear}}
\index{clear@{clear}!ASC.c@{ASC.c}}
\subsubsection[clear]{\setlength{\rightskip}{0pt plus 5cm}void clear (void $\ast$ {\em ptr}, int {\em nbytes})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a34}


Zeroes the specified memory. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]Pointer to the memory to zero \item[{\em nbytes}]The number of bytes to zero\end{description}
\end{Desc}
This provides a fast way of zeroing large chunks of memory on PPC platforms using the {\em dcbz\/} instruction. This instruction zeroes a cache line at a time. The savings in speed various by processor, but factors of 5 or more are in the ballpark. For example, on the mv2304, zeroing 32K of memory

On other platforms, the generic memset routine is used.\hypertarget{ASC_8c_a40}{
\index{ASC.c@{ASC.c}!form@{form}}
\index{form@{form}!ASC.c@{ASC.c}}
\subsubsection[form]{\setlength{\rightskip}{0pt plus 5cm}unsigned int form (unsigned int {\em v}, unsigned int {\em hb}, unsigned int {\em ha}, unsigned int {\em pb}, unsigned int {\em pa}, int {\em left})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a40}


Forms the 5 bit pattern word from the bits in column {\em left\/} {\bf and} appropriately shifts the pattern word so that it may be used directly as a byte offset into the correct statistics counters. 

\begin{Desc}
\item[Returns:]A word that can be used to increment the statistics pattern counter.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em v}]The GEM list of veto bits \item[{\em hb}]The ACD hit bits for side {\em b\/} \item[{\em ha}]The ACD hit bits for side {\em a\/} \item[{\em pb}]The ACD pulse height accept bits for side {\em b\/} \item[{\em pa}]The ACD pulse height accept bits for side {\em a\/} \item[{\em left}]The bit number of the channel (counting from the left or MSB)\end{description}
\end{Desc}
\hypertarget{ASC_8c_a39}{
\index{ASC.c@{ASC.c}!locate_aem@{locate\_\-aem}}
\index{locate_aem@{locate\_\-aem}!ASC.c@{ASC.c}}
\subsubsection[locate\_\-aem]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline const \hyperlink{struct__EBF__aem}{EBF\_\-aem} $\ast$ locate\_\-aem (const unsigned int $\ast$ {\em evt}, int {\em elen})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a39}


Composes the directory of the contributors. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]The source event. \item[{\em elen}]The size of the event in bytes \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the ACD data or NULL if it cannot be located.\end{Desc}
\hypertarget{ASC_8c_a38}{
\index{ASC.c@{ASC.c}!prepare@{prepare}}
\index{prepare@{prepare}!ASC.c@{ASC.c}}
\subsubsection[prepare]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int prepare (unsigned int {\em w})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a38}


Prepares the initial word of being used in the formation of the pattern word. 

\begin{Desc}
\item[Returns:]The prepared word\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The word to prepare\end{description}
\end{Desc}
On the Power\-PC, 1 instruction in the accumulation loop is saved by preshifting the intial word used in the formation of the pattern word. All other platforms do the straightforward thing of shifting and oring each bit and this routine is a NOOP. By doing defining this routine, the bulk of the code is portable across platforms.\hypertarget{ASC_8c_a37}{
\index{ASC.c@{ASC.c}!unpack@{unpack}}
\index{unpack@{unpack}!ASC.c@{ASC.c}}
\subsubsection[unpack]{\setlength{\rightskip}{0pt plus 5cm}static int unpack (struct \hyperlink{struct__ASC__acd}{\_\-ASC\_\-acd} $\ast$ {\em acd}, const unsigned short int $\ast$ {\em data})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{ASC_8c_a37}


Unpacks an ACD record from the AEM into a standard structure. 

\begin{Desc}
\item[Returns:]Status. The only failure is if more than 18 PHAs are found to be present on an given FREE board.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em acd}]Pointer to the data structure to receive the unpacked data \item[{\em data}]Pointer to the AEM data\end{description}
\end{Desc}
