\hypertarget{cue_8c}{
\section{cue.c File Reference}
\label{cue_8c}\index{cue.c@{cue.c}}
}
Routines that act upon the cue structure. 

{\tt \#include \char`\"{}LCI/LCI\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}cue\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}LEM/msg\_\-macros.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/MBA.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/WUT.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/SEM.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par


Include dependency graph for cue.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=176pt]{cue_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static WUT\_\-cb\_\-status \hyperlink{cue_8c_a0}{cue\_\-wut\_\-cb} (void $\ast$prm, WUT\_\-tmr $\ast$wut)
\begin{CompactList}\small\item\em Timer callback. \item\end{CompactList}\item 
\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$ \hyperlink{cue_8c_a1}{LCI\_\-new\-Cue} (void)
\begin{CompactList}\small\item\em Create a new cue. \item\end{CompactList}\item 
unsigned \hyperlink{cue_8c_a2}{LCI\_\-delete\-Cue} (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$cue)
\begin{CompactList}\small\item\em Delete a cue. \item\end{CompactList}\item 
void \hyperlink{cue_8c_a3}{LCI\_\-clear\-Cue} (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$cue)
\begin{CompactList}\small\item\em Clear a cue. \item\end{CompactList}\item 
unsigned \hyperlink{cue_8c_a4}{LCI\_\-wait\-Cue} (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$cue, unsigned timeout)
\begin{CompactList}\small\item\em Wait for a cue to complete or time out. \item\end{CompactList}\item 
void \hyperlink{cue_8c_a5}{LCI\_\-signal\-Cue} (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$cue)
\begin{CompactList}\small\item\em Signal cue completion. \item\end{CompactList}\item 
void \hyperlink{cue_8c_a6}{LCI\_\-clear\-Cue\-Counts} (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$cue)
\begin{CompactList}\small\item\em Clear cue counters. \item\end{CompactList}\item 
void \hyperlink{cue_8c_a7}{LCI\_\-get\-Cue\-Counts} (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$cue, unsigned int $\ast$n\-Wait, unsigned int $\ast$n\-Signal, unsigned int $\ast$n\-Timeout)
\begin{CompactList}\small\item\em Get cue counters. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Routines that act upon the cue structure. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
The order of calling the functions presented here should be LCI\_\-new\-Cue LCI\_\-clear\-Cue --$>$ LCI\_\-wait\-Cue --$>$ In another task --$>$ LCI\_\-signal\-Cue : Repeat as necessary : LCI\_\-delete\-Cue

\begin{Desc}
\item[Id]\hyperlink{cue_8c}{cue.c},v 1.3 2007/04/17 22:57:54 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{cue_8c_a0}{
\index{cue.c@{cue.c}!cue_wut_cb@{cue\_\-wut\_\-cb}}
\index{cue_wut_cb@{cue\_\-wut\_\-cb}!cue.c@{cue.c}}
\subsubsection[cue\_\-wut\_\-cb]{\setlength{\rightskip}{0pt plus 5cm}WUT\_\-cb\_\-status cue\_\-wut\_\-cb (void $\ast$ {\em prm}, WUT\_\-tmr $\ast$ {\em wut})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{cue_8c_a0}


Timer callback. 

This routine is called back when the wake-up timer goes off. It sets the end state to LCI\_\-CUE\_\-TIMEDOUT and gives the semaphore

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]Pointer to the LCI\_\-cue structure\item[{\em wut}]Pointer to the wake-up timer\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em WUT\_\-K\_\-STATE\_\-CHANGE\_\-YES}]\end{description}
\end{Desc}
\hypertarget{cue_8c_a3}{
\index{cue.c@{cue.c}!LCI_clearCue@{LCI\_\-clearCue}}
\index{LCI_clearCue@{LCI\_\-clearCue}!cue.c@{cue.c}}
\subsubsection[LCI\_\-clearCue]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-clear\-Cue (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$ {\em cue})}}
\label{cue_8c_a3}


Clear a cue. 

This routine puts the cue into a known cleared state, ready for the next wait.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cue}]Pointer to an allocated, initialised cue structure (from LCI\_\-new\-Cue)\end{description}
\end{Desc}
\hypertarget{cue_8c_a6}{
\index{cue.c@{cue.c}!LCI_clearCueCounts@{LCI\_\-clearCueCounts}}
\index{LCI_clearCueCounts@{LCI\_\-clearCueCounts}!cue.c@{cue.c}}
\subsubsection[LCI\_\-clearCueCounts]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-clear\-Cue\-Counts (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$ {\em cue})}}
\label{cue_8c_a6}


Clear cue counters. 

This routine zeroes the counts of waits, signals and timeouts.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cue}]Pointer to a cue being used.\end{description}
\end{Desc}
\hypertarget{cue_8c_a2}{
\index{cue.c@{cue.c}!LCI_deleteCue@{LCI\_\-deleteCue}}
\index{LCI_deleteCue@{LCI\_\-deleteCue}!cue.c@{cue.c}}
\subsubsection[LCI\_\-deleteCue]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-delete\-Cue (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$ {\em cue})}}
\label{cue_8c_a2}


Delete a cue. 

This routine destroys the semaphore and wake-up timer and then frees the memory associated with the cue structure

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cue}]Pointer to an initialised cue structure (make sure that it is not currently running!)\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]if all goes well \item[{\em LCI\_\-WUTDFAIL}]if the wake-up timer could not be destroyed, because it was in a bad state\end{description}
\end{Desc}
\hypertarget{cue_8c_a7}{
\index{cue.c@{cue.c}!LCI_getCueCounts@{LCI\_\-getCueCounts}}
\index{LCI_getCueCounts@{LCI\_\-getCueCounts}!cue.c@{cue.c}}
\subsubsection[LCI\_\-getCueCounts]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-get\-Cue\-Counts (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$ {\em cue}, unsigned int $\ast$ {\em n\-Wait}, unsigned int $\ast$ {\em n\-Signal}, unsigned int $\ast$ {\em n\-Timeout})}}
\label{cue_8c_a7}


Get cue counters. 

This routine obtains the counts of waits, signals and timeouts since the last time the cue was cleared.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cue}]Pointer to a cue being used.\item[{\em n\-Wait}]Address of an integer to receive the number of wait calls, or NULL if not needed.\item[{\em n\-Signal}]Address of an integer to receive the number of signal calls, or NULL if not needed.\item[{\em n\-Timeout}]Address of an integer to receive the number of timeouts, or NULL if not needed.\end{description}
\end{Desc}
\hypertarget{cue_8c_a1}{
\index{cue.c@{cue.c}!LCI_newCue@{LCI\_\-newCue}}
\index{LCI_newCue@{LCI\_\-newCue}!cue.c@{cue.c}}
\subsubsection[LCI\_\-newCue]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__LCI__cue}{LCI\_\-cue}$\ast$ LCI\_\-new\-Cue (void)}}
\label{cue_8c_a1}


Create a new cue. 

This routine allocates memory for the cue structure then creates the timer and semaphore to be held by the structure

\begin{Desc}
\item[Returns:]Pointer to an allocated and initialised cue structure, or NULL if there is an error.\end{Desc}
\hypertarget{cue_8c_a5}{
\index{cue.c@{cue.c}!LCI_signalCue@{LCI\_\-signalCue}}
\index{LCI_signalCue@{LCI\_\-signalCue}!cue.c@{cue.c}}
\subsubsection[LCI\_\-signalCue]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-signal\-Cue (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$ {\em cue})}}
\label{cue_8c_a5}


Signal cue completion. 

This routine signals completion by setting the end state to LCI\_\-CUE\_\-SIGNALED and giving the semaphore

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cue}]Pointer to a cue that is being waited upon\end{description}
\end{Desc}
\hypertarget{cue_8c_a4}{
\index{cue.c@{cue.c}!LCI_waitCue@{LCI\_\-waitCue}}
\index{LCI_waitCue@{LCI\_\-waitCue}!cue.c@{cue.c}}
\subsubsection[LCI\_\-waitCue]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-wait\-Cue (\hyperlink{struct__LCI__cue}{LCI\_\-cue} $\ast$ {\em cue}, unsigned {\em timeout})}}
\label{cue_8c_a4}


Wait for a cue to complete or time out. 

This routine starts the wake-up timer and takes the semaphore

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cue}]Pointer to an allocated, initialised cue structure (from LCI\_\-new\-Cue)\item[{\em timeout}]Time, in microseconds, until the call times out.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-CUE\_\-SIGNALED}]Another task called signal \item[{\em LCI\_\-CUE\_\-TIMEDOUT}]If the timer expired before the cue was signalled. \item[{\em LCI\_\-CUE\_\-FAILED}]Timer failed to start (because of incorrect state)\end{description}
\end{Desc}
