\hypertarget{TBD_8ih}{
\section{TBD.ih File Reference}
\label{TBD_8ih}\index{TBD.ih@{TBD.ih}}
}
Task Block of Data manager, inline function prototypes.  


{\tt \#include $<$PBI/Inline.h$>$}\par
{\tt \#include $<$PBI/Attribute.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
TBD\_\-\_\-EXP\_\-PROTO void $\ast$$\ast$ \hyperlink{TBD_8ih_b8d4b0ff3959b1595a4950e9781ce7e3}{TBD\_\-\_\-locate} (void) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Locates the block of task data. \item\end{CompactList}\item 
TBD\_\-\_\-EXP\_\-PROTO void $\ast$$\ast$ \hyperlink{TBD_8ih_5ff5eebf5df8e5d910eef5112b7d08c9}{TBD\_\-\_\-glocate} (void) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Locates the block of task data. \item\end{CompactList}\item 
TBD\_\-\_\-EXP\_\-PROTO void $\ast$ \hyperlink{TBD_8ih_2d16a9733766ab2e2cbd254c65008877}{TBD\_\-\_\-get} (void $\ast$$\ast$tbd, int index) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Returns the value task global data at the specified index. \item\end{CompactList}\item 
TBD\_\-\_\-EXP\_\-PROTO void \hyperlink{TBD_8ih_404b2fbff093c0086c6ccb1237135dc5}{TBD\_\-\_\-put} (void $\ast$$\ast$tbd, int index, void $\ast$value) ATTR\_\-UNUSED\_\-OK
\begin{CompactList}\small\item\em Puts the data value into the task global data at the specified index. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Task Block of Data manager, inline function prototypes. 

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


\footnotesize\begin{verbatim}

    CVS $Id: TBD.ih,v 1.2 2011/03/25 21:15:03 saxton Exp $
\end{verbatim}
\normalsize
 

\subsection{Function Documentation}
\hypertarget{TBD_8ih_2d16a9733766ab2e2cbd254c65008877}{
\index{TBD.ih@{TBD.ih}!TBD\_\-\_\-get@{TBD\_\-\_\-get}}
\index{TBD\_\-\_\-get@{TBD\_\-\_\-get}!TBD.ih@{TBD.ih}}
\subsubsection[{TBD\_\-\_\-get}]{\setlength{\rightskip}{0pt plus 5cm}void $\ast$$\ast$ TBD\_\-\_\-get (void $\ast$$\ast$ {\em tbd}, \/  int {\em index})}}
\label{TBD_8ih_2d16a9733766ab2e2cbd254c65008877}


Returns the value task global data at the specified index. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em tbd}]The table location, from a call to {\em \hyperlink{TBD_8h_d81b7bc3e8c0b5fef07c2bcbe025520b}{TBD\_\-locate()}\/} or one of its cousins. \item[{\em index}]The index of the requested data value. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The data value at the specified index.\end{Desc}
The implementation of this function is very efficient of the VXWORKS platform, requiring approximately 3 instructions. It is highly recommended that the inline form of this function be used. The function call is provided only to make the code portable across all platforms.

\begin{Desc}
\item[Warning:]If you have any doubt the TBD facility has not been initialized for the task you a making the call in, make sure to check the value returned from {\em \hyperlink{TBD_8h_d81b7bc3e8c0b5fef07c2bcbe025520b}{TBD\_\-locate()}\/} or one of its cousins for NULL before calling \hyperlink{TBD_8h_578bcb95eb44c919641a5673c2124112}{TBD\_\-get()}. \end{Desc}


Referenced by TASK\_\-\_\-self().\hypertarget{TBD_8ih_5ff5eebf5df8e5d910eef5112b7d08c9}{
\index{TBD.ih@{TBD.ih}!TBD\_\-\_\-glocate@{TBD\_\-\_\-glocate}}
\index{TBD\_\-\_\-glocate@{TBD\_\-\_\-glocate}!TBD.ih@{TBD.ih}}
\subsubsection[{TBD\_\-\_\-glocate}]{\setlength{\rightskip}{0pt plus 5cm}void $\ast$$\ast$ TBD\_\-\_\-glocate (void)}}
\label{TBD_8ih_5ff5eebf5df8e5d910eef5112b7d08c9}


Locates the block of task data. 

\begin{Desc}
\item[Returns:]Handle of the managed data area or NULL if called from a task that did not establish a managed data area.\end{Desc}
This call is similar to {\em \hyperlink{TBD_8ih_b8d4b0ff3959b1595a4950e9781ce7e3}{TBD\_\-\_\-locate()}\/}, but, if called in ISR context, returns a handle to the ISR specfic managed data area. Because the implementation of this function on VxWork's platforms is only in the 6-8 instruction area, the user is encouraged to use the inline version of this routine.

\begin{Desc}
\item[Warning:]While this function will return non-NULL in an ISR context, it still may return a NULL handle if called from a task that has not established a task specific managed data area.\end{Desc}
If you have any doubts about whether the calling context has a managed area associated with it, make sure to check this handle being non-NULL before using it. If the caller knows that the calling context is always at task level, the TBD\_\-\_\-locate is more efficient.

See {\em \hyperlink{TBD_8ih_b8d4b0ff3959b1595a4950e9781ce7e3}{TBD\_\-\_\-locate()}\/} for a usage example. \hypertarget{TBD_8ih_b8d4b0ff3959b1595a4950e9781ce7e3}{
\index{TBD.ih@{TBD.ih}!TBD\_\-\_\-locate@{TBD\_\-\_\-locate}}
\index{TBD\_\-\_\-locate@{TBD\_\-\_\-locate}!TBD.ih@{TBD.ih}}
\subsubsection[{TBD\_\-\_\-locate}]{\setlength{\rightskip}{0pt plus 5cm}void $\ast$$\ast$ TBD\_\-\_\-locate (void)}}
\label{TBD_8ih_b8d4b0ff3959b1595a4950e9781ce7e3}


Locates the block of task data. 

\begin{Desc}
\item[Returns:]Handle of the managed data area or NULL if called from a task that did not establish a managed data area or if called from an ISR (interrupt level).\end{Desc}
This function returns a handle to the managed area for the current task. This handle is passed to {\em \hyperlink{TBD_8h_96b8eaab36c0f07bfd911a1d21edc804}{TBD\_\-put()}\/} and {\em \hyperlink{TBD_8h_578bcb95eb44c919641a5673c2124112}{TBD\_\-get()}\/} to perform reads and writes to selected locations.

The implementation of this function is very efficient of the VXWORKS platform, requiring approximately 2 instructions. It is highly recommended that the inline form of this function be used.

\begin{Desc}
\item[Warning:]There are two limitations to this routine on VXWORKs platforms.\end{Desc}
\begin{enumerate}
\item Calling from a task with no established managed area\item Calling at ISR level\end{enumerate}


\begin{Desc}
\item[]In the first case of calling from a task with established area will yield NULL as its returned pointer. Provided one checks for NULL, this routine's behaviour is well-defined.\end{Desc}
\begin{Desc}
\item[]In the second case of calling from a ISR level, the result is undefined. (Actually it is defined, the pointer is that of the interrupted task.) If you have any doubts about whether the calling context maybe ISR, the use the more general, but less efficient \hyperlink{TBD_8ih_5ff5eebf5df8e5d910eef5112b7d08c9}{TBD\_\-\_\-glocate()}.\end{Desc}
{\bf EXAMPLE} \par
 {\bf -------} \par
 

\begin{Code}\begin{verbatim}   void   **tbd = TBD__locate ();

   / * Check for NULL * /
   if (tbd != NULL)
   {
       int   org_1 = TBD__get (tbd, DATA_IDX_1);
       int   org_2 = TBD__get (tbd, DATA_IDX_2];
   
       TBD__put (tbd, DATA_IDX_1, 0xdeadbeef);
       TBD__put (tbd, DATA_IDX_2, 0xabadcafe);
   } 
\end{verbatim}
\end{Code}

 

Referenced by TASK\_\-\_\-self().\hypertarget{TBD_8ih_404b2fbff093c0086c6ccb1237135dc5}{
\index{TBD.ih@{TBD.ih}!TBD\_\-\_\-put@{TBD\_\-\_\-put}}
\index{TBD\_\-\_\-put@{TBD\_\-\_\-put}!TBD.ih@{TBD.ih}}
\subsubsection[{TBD\_\-\_\-put}]{\setlength{\rightskip}{0pt plus 5cm}void TBD\_\-\_\-put (void $\ast$$\ast$ {\em tbd}, \/  int {\em index}, \/  void $\ast$ {\em value})}}
\label{TBD_8ih_404b2fbff093c0086c6ccb1237135dc5}


Puts the data value into the task global data at the specified index. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em tbd}]The table location, from a call to {\em \hyperlink{TBD_8ih_b8d4b0ff3959b1595a4950e9781ce7e3}{TBD\_\-\_\-locate()}\/} or one of its cousins. \item[{\em index}]The index of the target data word \item[{\em value}]The value to put into the target data word\end{description}
\end{Desc}
The implementation of this function is very efficient of the VXWORKS platform, requiring approximately 3 instructions. It is highly recommended that the inline form of this function be used. 