\doxysection{src/codec/ecu.c File Reference}
\label{ecu_8c}\index{src/codec/ecu.c@{src/codec/ecu.c}}
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/codec/ecu.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$ \textbf{ osmo\+\_\+ecu\+\_\+init} (void $\ast$ctx, enum \textbf{ osmo\+\_\+ecu\+\_\+codec} codec)
\begin{DoxyCompactList}\small\item\em initialize an ECU instance for given codec. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+ecu\+\_\+destroy} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st)
\begin{DoxyCompactList}\small\item\em destroy an ECU instance \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+ecu\+\_\+frame\+\_\+in} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st, bool bfi, const uint8\+\_\+t $\ast$frame, unsigned int frame\+\_\+bytes)
\begin{DoxyCompactList}\small\item\em process a received frame a substitute/erroneous frame. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+ecu\+\_\+frame\+\_\+out} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st, uint8\+\_\+t $\ast$frame\+\_\+out)
\begin{DoxyCompactList}\small\item\em generate output data for a substitute/erroneous frame. \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+ecu\+\_\+is\+\_\+dtx\+\_\+pause} (struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$st)
\begin{DoxyCompactList}\small\item\em check if the current state of this ECU is a DTX pause. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+ecu\+\_\+register} (const struct \textbf{ osmo\+\_\+ecu\+\_\+ops} $\ast$ops, enum \textbf{ osmo\+\_\+ecu\+\_\+codec} codec)
\begin{DoxyCompactList}\small\item\em register an ECU implementation for a given codec \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static const struct \textbf{ osmo\+\_\+ecu\+\_\+ops} $\ast$ \textbf{ g\+\_\+ecu\+\_\+ops} [\textbf{ \+\_\+\+NUM\+\_\+\+OSMO\+\_\+\+ECU\+\_\+\+CODECS}]
\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\mbox{\label{ecu_8c_aee251e8219d7922452d261a3c7d5329a}} 
\index{ecu.c@{ecu.c}!osmo\_ecu\_destroy@{osmo\_ecu\_destroy}}
\index{osmo\_ecu\_destroy@{osmo\_ecu\_destroy}!ecu.c@{ecu.c}}
\doxysubsubsection{osmo\_ecu\_destroy()}
{\footnotesize\ttfamily void osmo\+\_\+ecu\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st }\end{DoxyParamCaption})}



destroy an ECU instance 



References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ osmo\+\_\+ecu\+\_\+ops\+::destroy}, and \textbf{ g\+\_\+ecu\+\_\+ops}.

\mbox{\label{ecu_8c_a111ce1d991c8bc5f175521cb9d16ea1b}} 
\index{ecu.c@{ecu.c}!osmo\_ecu\_frame\_in@{osmo\_ecu\_frame\_in}}
\index{osmo\_ecu\_frame\_in@{osmo\_ecu\_frame\_in}!ecu.c@{ecu.c}}
\doxysubsubsection{osmo\_ecu\_frame\_in()}
{\footnotesize\ttfamily int osmo\+\_\+ecu\+\_\+frame\+\_\+in (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st,  }\item[{bool}]{bfi,  }\item[{const uint8\+\_\+t $\ast$}]{frame,  }\item[{unsigned int}]{frame\+\_\+bytes }\end{DoxyParamCaption})}



process a received frame a substitute/erroneous frame. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em st} & ECU state/instance on which to operate \\
\hline
\mbox{\texttt{ in}}  & {\em bfi} & Bad Frame Indication \\
\hline
\mbox{\texttt{ in}}  & {\em frame} & received codec frame to be processed \\
\hline
\mbox{\texttt{ in}}  & {\em frame\+\_\+bytes} & number of bytes available in frame \\
\hline
\end{DoxyParams}


References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ osmo\+\_\+ecu\+\_\+ops\+::frame\+\_\+in}, and \textbf{ g\+\_\+ecu\+\_\+ops}.

\mbox{\label{ecu_8c_a7ca732e6dd9ed449697ba24847609d79}} 
\index{ecu.c@{ecu.c}!osmo\_ecu\_frame\_out@{osmo\_ecu\_frame\_out}}
\index{osmo\_ecu\_frame\_out@{osmo\_ecu\_frame\_out}!ecu.c@{ecu.c}}
\doxysubsubsection{osmo\_ecu\_frame\_out()}
{\footnotesize\ttfamily int osmo\+\_\+ecu\+\_\+frame\+\_\+out (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st,  }\item[{uint8\+\_\+t $\ast$}]{frame\+\_\+out }\end{DoxyParamCaption})}



generate output data for a substitute/erroneous frame. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em st} & ECU state/instance on which to operate \\
\hline
\mbox{\texttt{ out}}  & {\em frame\+\_\+out} & buffer for generated output frame \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes written to frame\+\_\+out; negative on error 
\end{DoxyReturn}


References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ osmo\+\_\+ecu\+\_\+ops\+::frame\+\_\+out}, and \textbf{ g\+\_\+ecu\+\_\+ops}.

\mbox{\label{ecu_8c_a9b62d65c3a20761dd0430df7fc090adf}} 
\index{ecu.c@{ecu.c}!osmo\_ecu\_init@{osmo\_ecu\_init}}
\index{osmo\_ecu\_init@{osmo\_ecu\_init}!ecu.c@{ecu.c}}
\doxysubsubsection{osmo\_ecu\_init()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$ osmo\+\_\+ecu\+\_\+init (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{enum \textbf{ osmo\+\_\+ecu\+\_\+codec}}]{codec }\end{DoxyParamCaption})}



initialize an ECU instance for given codec. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate \\
\hline
\mbox{\texttt{ in}}  & {\em codec} & codec for which to initialize/create ECU \\
\hline
\end{DoxyParams}


References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ g\+\_\+ecu\+\_\+ops}, and \textbf{ osmo\+\_\+ecu\+\_\+ops\+::init}.

\mbox{\label{ecu_8c_a8edd060507313dcfd4293c51ef270691}} 
\index{ecu.c@{ecu.c}!osmo\_ecu\_is\_dtx\_pause@{osmo\_ecu\_is\_dtx\_pause}}
\index{osmo\_ecu\_is\_dtx\_pause@{osmo\_ecu\_is\_dtx\_pause}!ecu.c@{ecu.c}}
\doxysubsubsection{osmo\_ecu\_is\_dtx\_pause()}
{\footnotesize\ttfamily bool osmo\+\_\+ecu\+\_\+is\+\_\+dtx\+\_\+pause (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ecu\+\_\+state} $\ast$}]{st }\end{DoxyParamCaption})}



check if the current state of this ECU is a DTX pause. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em st} & ECU state/instance on which to operate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if DTX pause, false otherwise 
\end{DoxyReturn}


References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, \textbf{ g\+\_\+ecu\+\_\+ops}, and \textbf{ osmo\+\_\+ecu\+\_\+ops\+::is\+\_\+dtx\+\_\+pause}.

\mbox{\label{ecu_8c_adae3370086c32ba775ce711bf5a5162c}} 
\index{ecu.c@{ecu.c}!osmo\_ecu\_register@{osmo\_ecu\_register}}
\index{osmo\_ecu\_register@{osmo\_ecu\_register}!ecu.c@{ecu.c}}
\doxysubsubsection{osmo\_ecu\_register()}
{\footnotesize\ttfamily int osmo\+\_\+ecu\+\_\+register (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+ecu\+\_\+ops} $\ast$}]{ops,  }\item[{enum \textbf{ osmo\+\_\+ecu\+\_\+codec}}]{codec }\end{DoxyParamCaption})}



register an ECU implementation for a given codec 



References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ecu\+\_\+state\+::codec}, and \textbf{ g\+\_\+ecu\+\_\+ops}.



Referenced by \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+()}.



\doxysubsection{Variable Documentation}
\mbox{\label{ecu_8c_a6231f4ffaa417cfecc8e48daa66ca579}} 
\index{ecu.c@{ecu.c}!g\_ecu\_ops@{g\_ecu\_ops}}
\index{g\_ecu\_ops@{g\_ecu\_ops}!ecu.c@{ecu.c}}
\doxysubsubsection{g\_ecu\_ops}
{\footnotesize\ttfamily const struct \textbf{ osmo\+\_\+ecu\+\_\+ops}$\ast$ g\+\_\+ecu\+\_\+ops[\textbf{ \+\_\+\+NUM\+\_\+\+OSMO\+\_\+\+ECU\+\_\+\+CODECS}]\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ osmo\+\_\+ecu\+\_\+destroy()}, \textbf{ osmo\+\_\+ecu\+\_\+frame\+\_\+in()}, \textbf{ osmo\+\_\+ecu\+\_\+frame\+\_\+out()}, \textbf{ osmo\+\_\+ecu\+\_\+init()}, \textbf{ osmo\+\_\+ecu\+\_\+is\+\_\+dtx\+\_\+pause()}, and \textbf{ osmo\+\_\+ecu\+\_\+register()}.

