\hypertarget{CACHE_8h}{
\section{CACHE.h File Reference}
\label{CACHE_8h}\index{CACHE.h@{CACHE.h}}
}
Cache manipulation routines. Currently NOOPs on all but the Vx\-Works platforms. 

{\tt \#include \char`\"{}PBS/impl/CACHE.h.xx-xxx-xxx\char`\"{}}\par


Include dependency graph for CACHE.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=159pt]{CACHE_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=120pt]{CACHE_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{CACHE_8h_a0}{
\#define \hyperlink{CACHE_8h_a0}{CACHE\_\-K\_\-DATA\_\-LINE\_\-SIZE}~(1 $<$$<$ CACHE\_\-K\_\-DATA\_\-LINE\_\-SIZE\_\-PWR2)}
\label{CACHE_8h_a0}

\begin{CompactList}\small\item\em Size, in bytes, of a data cache line. This is just a convenience symbol and is the equivalent of (1 $<$$<$ CACHE\_\-K\_\-DATA\_\-LINE\_\-SIZE\_\-PWR2). \item\end{CompactList}\item 
\hypertarget{CACHE_8h_a1}{
\#define \hyperlink{CACHE_8h_a1}{CACHE\_\-K\_\-DATA\_\-LINE\_\-MASK}~(CACHE\_\-K\_\-DATA\_\-LINE\_\-SIZE - 1)}
\label{CACHE_8h_a1}

\begin{CompactList}\small\item\em Mask of the low bits of a data address cache line. \item\end{CompactList}\item 
\hypertarget{CACHE_8h_a2}{
\#define \hyperlink{CACHE_8h_a2}{CACHE\_\-K\_\-INSTRUCTION\_\-LINE\_\-SIZE}~(1 $<$$<$ CACHE\_\-K\_\-INSTRUCTION\_\-LINE\_\-SIZE\_\-PWR2)}
\label{CACHE_8h_a2}

\begin{CompactList}\small\item\em Size, in bytes, of a instruction cache line. This is just a convenience symbol and is the equivalent of (1 $<$$<$ CACHE\_\-K\_\-DATA\_\-LINE\_\-SIZE\_\-PWR2). \item\end{CompactList}\item 
\hypertarget{CACHE_8h_a3}{
\#define \hyperlink{CACHE_8h_a3}{CACHE\_\-K\_\-INSTRUCTION\_\-LINE\_\-MASK}~(CACHE\_\-K\_\-INSTRUCTION\_\-LINE\_\-SIZE - 1)}
\label{CACHE_8h_a3}

\begin{CompactList}\small\item\em Mask of the low bits of an instruction address cache line. \item\end{CompactList}\item 
\hypertarget{CACHE_8h_a4}{
\#define \hyperlink{CACHE_8h_a4}{\_\-CACHE\_\-K\_\-INSTRUCTION}~0}
\label{CACHE_8h_a4}

\begin{CompactList}\small\item\em Internal use only symbol. \item\end{CompactList}\item 
\hypertarget{CACHE_8h_a5}{
\#define \hyperlink{CACHE_8h_a5}{\_\-CACHE\_\-K\_\-DATA}~1}
\label{CACHE_8h_a5}

\begin{CompactList}\small\item\em Internal use only symbol. \item\end{CompactList}\item 
\hypertarget{CACHE_8h_a6}{
\#define \hyperlink{CACHE_8h_a6}{\_\-CACHE\_\-K\_\-BRANCH}~2}
\label{CACHE_8h_a6}

\begin{CompactList}\small\item\em Internal use only symbol. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{CACHE_8h_a7}{
typedef enum \hyperlink{CACHE_8h_a19}{\_\-CACHE\_\-type} \hyperlink{CACHE_8h_a7}{CACHE\_\-type}}
\label{CACHE_8h_a7}

\begin{CompactList}\small\item\em Typedef for enum {\em \_\-CACHE\_\-type\/}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{CACHE_8h_a19}{\_\-CACHE\_\-type} \{ \par
\hyperlink{CACHE_8h_a19a8}{CACHE\_\-K\_\-INSTRUCTION} =  \_\-CACHE\_\-K\_\-INSTRUCTION, 
\par
\hyperlink{CACHE_8h_a19a9}{CACHE\_\-K\_\-DATA} =  \_\-CACHE\_\-K\_\-DATA, 
\par
\hyperlink{CACHE_8h_a19a10}{CACHE\_\-K\_\-BRANCH} =  \_\-CACHE\_\-K\_\-BRANCH
 \}
\begin{CompactList}\small\item\em The target cache type. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{CACHE_8h_a11}{CACHE\_\-disable} (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} type)
\begin{CompactList}\small\item\em Disable the specified cache. \item\end{CompactList}\item 
int \hyperlink{CACHE_8h_a12}{CACHE\_\-enable} (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} type)
\begin{CompactList}\small\item\em Enable the specified cache. \item\end{CompactList}\item 
int \hyperlink{CACHE_8h_a13}{CACHE\_\-clear} (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} type, void $\ast$address, int nbytes)
\begin{CompactList}\small\item\em Clear all or some entries from a cache. \item\end{CompactList}\item 
int \hyperlink{CACHE_8h_a14}{CACHE\_\-flush} (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} type, void $\ast$address, int nbytes)
\begin{CompactList}\small\item\em Flush all or some of a specified cache. \item\end{CompactList}\item 
int \hyperlink{CACHE_8h_a15}{CACHE\_\-invalidate} (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} type, void $\ast$address, int nbytes)
\begin{CompactList}\small\item\em invalidate all or some of a specified cache \item\end{CompactList}\item 
int \hyperlink{CACHE_8h_a16}{CACHE\_\-lock} (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} type, void $\ast$address, int nbytes)
\begin{CompactList}\small\item\em Lock all or part of a specified cache. \item\end{CompactList}\item 
int \hyperlink{CACHE_8h_a17}{CACHE\_\-unlock} (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} type, void $\ast$address, int nbytes)
\begin{CompactList}\small\item\em Unlock all or part of a specified cache. \item\end{CompactList}\item 
int \hyperlink{CACHE_8h_a18}{CACHE\_\-pipe\-Flush} (void)
\begin{CompactList}\small\item\em Flush the processor write buffers to memory. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Cache manipulation routines. Currently NOOPs on all but the Vx\-Works platforms. 

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


\footnotesize\begin{verbatim}   CVS $Id: CACHE.h,v 1.4 2005/10/01 01:00:11 russell Exp $
\end{verbatim}
\normalsize


\begin{Desc}
\item[SYNOPSIS]This provides a series of portable cache manipulation routines. These are implemented as either function aliases or macros depending on the platform.\end{Desc}


\subsection{Enumeration Type Documentation}
\hypertarget{CACHE_8h_a19}{
\index{CACHE.h@{CACHE.h}!_CACHE_type@{\_\-CACHE\_\-type}}
\index{_CACHE_type@{\_\-CACHE\_\-type}!CACHE.h@{CACHE.h}}
\subsubsection[\_\-CACHE\_\-type]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{CACHE_8h_a19}{\_\-CACHE\_\-type}}}
\label{CACHE_8h_a19}


The target cache type. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{CACHE_K_INSTRUCTION@{CACHE\_\-K\_\-INSTRUCTION}!CACHE.h@{CACHE.h}}\index{CACHE.h@{CACHE.h}!CACHE_K_INSTRUCTION@{CACHE\_\-K\_\-INSTRUCTION}}\item[{\em 
\hypertarget{CACHE_8h_a19a8}{
CACHE\_\-K\_\-INSTRUCTION}
\label{CACHE_8h_a19a8}
}]The instruction cache \index{CACHE_K_DATA@{CACHE\_\-K\_\-DATA}!CACHE.h@{CACHE.h}}\index{CACHE.h@{CACHE.h}!CACHE_K_DATA@{CACHE\_\-K\_\-DATA}}\item[{\em 
\hypertarget{CACHE_8h_a19a9}{
CACHE\_\-K\_\-DATA}
\label{CACHE_8h_a19a9}
}]The data cache \index{CACHE_K_BRANCH@{CACHE\_\-K\_\-BRANCH}!CACHE.h@{CACHE.h}}\index{CACHE.h@{CACHE.h}!CACHE_K_BRANCH@{CACHE\_\-K\_\-BRANCH}}\item[{\em 
\hypertarget{CACHE_8h_a19a10}{
CACHE\_\-K\_\-BRANCH}
\label{CACHE_8h_a19a10}
}]The branch cache \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{CACHE_8h_a13}{
\index{CACHE.h@{CACHE.h}!CACHE_clear@{CACHE\_\-clear}}
\index{CACHE_clear@{CACHE\_\-clear}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-clear]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-clear (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} {\em type}, void $\ast$ {\em address}, int {\em nbytes})}}
\label{CACHE_8h_a13}


Clear all or some entries from a cache. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]The cache type, i.e. one of {\em CACHE\_\-K\_\-BRANCH\/}, {\em CACHE\_\-K\_\-DATA\/} or {\em CACHE\_\-K\_\-INSTRUCTION\/}. \item[{\em address}]The address to start clearing at \item[{\em nbytes}]The number of bytes to clear \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status, OK, unless the cache type is invalid or not supported on the target architecture.\end{Desc}
Flushes and invalidates all of some of the entries in the specified cache.\hypertarget{CACHE_8h_a11}{
\index{CACHE.h@{CACHE.h}!CACHE_disable@{CACHE\_\-disable}}
\index{CACHE_disable@{CACHE\_\-disable}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-disable]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-disable (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} {\em type})}}
\label{CACHE_8h_a11}


Disable the specified cache. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]The cache type, i.e. one of {\em CACHE\_\-K\_\-DATA\/} or {\em CACHE\_\-K\_\-INSTRUCTION\/}. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status, OK, unless the cache type is invalid or not supported on the target architecture.\end{Desc}
Flushes the specified cache and disables the instruction or data cache.\hypertarget{CACHE_8h_a12}{
\index{CACHE.h@{CACHE.h}!CACHE_enable@{CACHE\_\-enable}}
\index{CACHE_enable@{CACHE\_\-enable}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-enable]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-enable (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} {\em type})}}
\label{CACHE_8h_a12}


Enable the specified cache. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]The cache type, i.e. one of {\em CACHE\_\-K\_\-DATA\/} or {\em CACHE\_\-K\_\-INSTRUCTION\/}. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status, OK, unless the cache type is invalid or not supported on the target architecture.\end{Desc}
Invalidates the cache tags and enables the instruction or date cache.\hypertarget{CACHE_8h_a14}{
\index{CACHE.h@{CACHE.h}!CACHE_flush@{CACHE\_\-flush}}
\index{CACHE_flush@{CACHE\_\-flush}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-flush]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-flush (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} {\em type}, void $\ast$ {\em address}, int {\em nbytes})}}
\label{CACHE_8h_a14}


Flush all or some of a specified cache. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]The cache type, i.e. one of {\em CACHE\_\-K\_\-BRANCH\/}, {\em CACHE\_\-K\_\-DATA\/} or {\em CACHE\_\-K\_\-INSTRUCTION\/}. \item[{\em address}]The address to start flushing at \item[{\em nbytes}]The number of bytes to flush \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status, OK, unless the cache type is invalid or not supported on the target architecture.\end{Desc}
Flushes (writes to memory) all or some of the entries in the specified cache. Depending on the cache desing, this operation may also invalidate the cache tags. For write-through caches, no work needs to be done since RAM already matches the cache entries. Note that write buffer on the chip may need to be flushed to complete the flush. See CACHE\_\-pipe\-Flush.\hypertarget{CACHE_8h_a15}{
\index{CACHE.h@{CACHE.h}!CACHE_invalidate@{CACHE\_\-invalidate}}
\index{CACHE_invalidate@{CACHE\_\-invalidate}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-invalidate]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-invalidate (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} {\em type}, void $\ast$ {\em address}, int {\em nbytes})}}
\label{CACHE_8h_a15}


invalidate all or some of a specified cache 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]The cache type, i.e. one of {\em CACHE\_\-K\_\-BRANCH\/}, a$\backslash$ CACHE\_\-K\_\-DATA or {\em CACHE\_\-K\_\-INSTRUCTION\/}. \item[{\em address}]The address to start invalidating at \item[{\em nbytes}]The number of bytes to invalidate \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status, OK, unless the cache type is invalid or not supported on the target architecture.\end{Desc}
Invalidates all or some of the entries in the specified cache. Depending on the cache design, the invalidate may be similar to the flush, or the tags may be invalidate directly.\hypertarget{CACHE_8h_a16}{
\index{CACHE.h@{CACHE.h}!CACHE_lock@{CACHE\_\-lock}}
\index{CACHE_lock@{CACHE\_\-lock}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-lock]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-lock (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} {\em type}, void $\ast$ {\em address}, int {\em nbytes})}}
\label{CACHE_8h_a16}


Lock all or part of a specified cache. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]The cache type, i.e. one of {\em CACHE\_\-K\_\-DATA\/} or {\em CACHE\_\-K\_\-INSTRUCTION\/}. \item[{\em address}]The address to start locking at \item[{\em nbytes}]The number of bytes to lock \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status, OK, unless the cache type is invalid or not supported on the target architecture.\end{Desc}
Locks entries in the specified cache. Currently only the MCP750 supports cache locking.\hypertarget{CACHE_8h_a18}{
\index{CACHE.h@{CACHE.h}!CACHE_pipeFlush@{CACHE\_\-pipeFlush}}
\index{CACHE_pipeFlush@{CACHE\_\-pipeFlush}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-pipeFlush]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-pipe\-Flush (void)}}
\label{CACHE_8h_a18}


Flush the processor write buffers to memory. 

\begin{Desc}
\item[Returns:]Status, OK or ERROR if this operation is not supported. supported on the target architecture.\end{Desc}
Forces the output (write) buffers to write their contents to RAM. A cache flush may have forced the data into the write buffers, but then the buffers need to be flushed to RAM to maintain coherency.\hypertarget{CACHE_8h_a17}{
\index{CACHE.h@{CACHE.h}!CACHE_unlock@{CACHE\_\-unlock}}
\index{CACHE_unlock@{CACHE\_\-unlock}!CACHE.h@{CACHE.h}}
\subsubsection[CACHE\_\-unlock]{\setlength{\rightskip}{0pt plus 5cm}int CACHE\_\-unlock (\hyperlink{CACHE_8h_a7}{CACHE\_\-type} {\em type}, void $\ast$ {\em address}, int {\em nbytes})}}
\label{CACHE_8h_a17}


Unlock all or part of a specified cache. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]The cache type, i.e. one of {\em CACHE\_\-K\_\-DATA\/} or {\em CACHE\_\-K\_\-INSTRUCTION\/}. \item[{\em address}]The address to start locking at \item[{\em nbytes}]The number of bytes to lock \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status, OK, unless the cache type is invalid or not supported on the target architecture.\end{Desc}
Locks entries in the specified cache. Currently only the MCP750 supports cache locking.