\doxysection{src/isdn/i460\+\_\+mux.c File Reference}
\label{i460__mux_8c}\index{src/isdn/i460\_mux.c@{src/isdn/i460\_mux.c}}


ITU-\/T I.\+460 sub-\/channel multiplexer + demultiplexer.  


{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/bits.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/isdn/i460\+\_\+mux.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+count} (struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts})
\begin{DoxyCompactList}\small\item\em count the number of sub-\/channels in this I.\+460 slot. \end{DoxyCompactList}\item 
static bool \textbf{ osmo\+\_\+i460\+\_\+has\+\_\+single\+\_\+64k\+\_\+schan} (struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts})
\item 
static void \textbf{ demux\+\_\+subchan\+\_\+append\+\_\+bit} (struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan, uint8\+\_\+t bit)
\item 
static void \textbf{ demux\+\_\+subchan\+\_\+extract\+\_\+bits} (struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan, const uint8\+\_\+t $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len)
\item 
void \textbf{ osmo\+\_\+i460\+\_\+demux\+\_\+in} (struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts}, const uint8\+\_\+t $\ast$\textbf{ data}, size\+\_\+t data\+\_\+len)
\begin{DoxyCompactList}\small\item\em Feed multiplexed data (from an E1 timeslot) into de-\/multiplexer. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+i460\+\_\+mux\+\_\+enqueue} (struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan, struct \textbf{ msgb} $\ast$msg)
\begin{DoxyCompactList}\small\item\em enqueue a to-\/be-\/transmitted message buffer containing unpacked bits \end{DoxyCompactList}\item 
static \textbf{ ubit\+\_\+t} \textbf{ mux\+\_\+schan\+\_\+provide\+\_\+bit} (struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan)
\item 
static uint8\+\_\+t \textbf{ mux\+\_\+subchan\+\_\+provide\+\_\+bits} (struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan, uint8\+\_\+t $\ast$mask)
\begin{DoxyCompactList}\small\item\em provide one byte with the subchan-\/specific bits of given sub-\/channel. \end{DoxyCompactList}\item 
static uint8\+\_\+t \textbf{ mux\+\_\+timeslot\+\_\+provide\+\_\+bits} (struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts})
\item 
int \textbf{ osmo\+\_\+i460\+\_\+mux\+\_\+out} (struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts}, uint8\+\_\+t $\ast$out, size\+\_\+t out\+\_\+len)
\begin{DoxyCompactList}\small\item\em Get multiplexed data from de-\/multiplexer (for feeding it into an E1 timeslot). \end{DoxyCompactList}\item 
static int \textbf{ alloc\+\_\+bitbuf} (void $\ast$ctx, struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan, size\+\_\+t num\+\_\+bits)
\item 
static int \textbf{ find\+\_\+unused\+\_\+subchan\+\_\+idx} (const struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts})
\item 
static void \textbf{ subchan\+\_\+reset} (struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan, bool first\+\_\+time)
\item 
void \textbf{ osmo\+\_\+i460\+\_\+ts\+\_\+init} (struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts})
\begin{DoxyCompactList}\small\item\em initialize an I.\+460 timeslot \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$ \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+add} (void $\ast$ctx, struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$\textbf{ ts}, const struct \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc} $\ast$chd)
\begin{DoxyCompactList}\small\item\em add a new sub-\/channel to the given timeslot \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+del} (struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$schan)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
ITU-\/T I.\+460 sub-\/channel multiplexer + demultiplexer. 



\doxysubsection{Function Documentation}
\mbox{\label{i460__mux_8c_abc884873cd612b7bf77b45d7255d7ff2}} 
\index{i460\_mux.c@{i460\_mux.c}!alloc\_bitbuf@{alloc\_bitbuf}}
\index{alloc\_bitbuf@{alloc\_bitbuf}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{alloc\_bitbuf()}
{\footnotesize\ttfamily static int alloc\+\_\+bitbuf (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan,  }\item[{size\+\_\+t}]{num\+\_\+bits }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+i460\+\_\+subchan\+::demux}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+bitbuf}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+bitbuf\+\_\+size}.



Referenced by \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+add()}.

\mbox{\label{i460__mux_8c_ad5f103802b76d09f1a3b8270539ad790}} 
\index{i460\_mux.c@{i460\_mux.c}!demux\_subchan\_append\_bit@{demux\_subchan\_append\_bit}}
\index{demux\_subchan\_append\_bit@{demux\_subchan\_append\_bit}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{demux\_subchan\_append\_bit()}
{\footnotesize\ttfamily static void demux\+\_\+subchan\+\_\+append\+\_\+bit (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan,  }\item[{uint8\+\_\+t}]{bit }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+i460\+\_\+subchan\+::demux}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ osmo\+\_\+ubit2pbit()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+bitbuf}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+bitbuf\+\_\+size}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+cb\+\_\+bits}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+cb\+\_\+bytes}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+idx}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::user\+\_\+data}.



Referenced by \textbf{ demux\+\_\+subchan\+\_\+extract\+\_\+bits()}.

\mbox{\label{i460__mux_8c_a364c9042b49ae3cc893593f0fc1118a8}} 
\index{i460\_mux.c@{i460\_mux.c}!demux\_subchan\_extract\_bits@{demux\_subchan\_extract\_bits}}
\index{demux\_subchan\_extract\_bits@{demux\_subchan\_extract\_bits}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{demux\_subchan\_extract\_bits()}
{\footnotesize\ttfamily static void demux\+\_\+subchan\+\_\+extract\+\_\+bits (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan,  }\item[{const uint8\+\_\+t $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+i460\+\_\+subchan\+::bit\+\_\+offset}, \textbf{ data}, \textbf{ demux\+\_\+subchan\+\_\+append\+\_\+bit()}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+16k}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+32k}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+64k}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+8k}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+::rate}.



Referenced by \textbf{ osmo\+\_\+i460\+\_\+demux\+\_\+in()}.

\mbox{\label{i460__mux_8c_a877271b1dcea5dba35d13e0f85044359}} 
\index{i460\_mux.c@{i460\_mux.c}!find\_unused\_subchan\_idx@{find\_unused\_subchan\_idx}}
\index{find\_unused\_subchan\_idx@{find\_unused\_subchan\_idx}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{find\_unused\_subchan\_idx()}
{\footnotesize\ttfamily static int find\+\_\+unused\+\_\+subchan\+\_\+idx (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+\+NONE}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::rate}, \textbf{ osmo\+\_\+i460\+\_\+timeslot\+::schan}, \textbf{ ts}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+::ts}.



Referenced by \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+add()}.

\mbox{\label{i460__mux_8c_a132957aec38d6f67fcaf2ed3e3c864f7}} 
\index{i460\_mux.c@{i460\_mux.c}!mux\_schan\_provide\_bit@{mux\_schan\_provide\_bit}}
\index{mux\_schan\_provide\_bit@{mux\_schan\_provide\_bit}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{mux\_schan\_provide\_bit()}
{\footnotesize\ttfamily static \textbf{ ubit\+\_\+t} mux\+\_\+schan\+\_\+provide\+\_\+bit (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+mux\+::in\+\_\+cb\+\_\+queue\+\_\+empty}, \textbf{ msgb\+::list}, \textbf{ llist\+\_\+del()}, \textbf{ llist\+\_\+empty()}, \textbf{ llist\+\_\+entry}, \textbf{ msgb\+\_\+length()}, \textbf{ msgb\+\_\+pull\+\_\+u8()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::mux}, \textbf{ llist\+\_\+head\+::next}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+mux\+::tx\+\_\+queue}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+mux\+::user\+\_\+data}.



Referenced by \textbf{ mux\+\_\+subchan\+\_\+provide\+\_\+bits()}.

\mbox{\label{i460__mux_8c_a04b906513967f1c5c687f0a04a987fe4}} 
\index{i460\_mux.c@{i460\_mux.c}!mux\_subchan\_provide\_bits@{mux\_subchan\_provide\_bits}}
\index{mux\_subchan\_provide\_bits@{mux\_subchan\_provide\_bits}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{mux\_subchan\_provide\_bits()}
{\footnotesize\ttfamily static uint8\+\_\+t mux\+\_\+subchan\+\_\+provide\+\_\+bits (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan,  }\item[{uint8\+\_\+t $\ast$}]{mask }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



provide one byte with the subchan-\/specific bits of given sub-\/channel. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em schan} & sub-\/channel that is to provide bits \\
\hline
\mbox{\texttt{ out}}  & {\em mask} & bitmask of those bits filled in \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bits of given sub-\/channel 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+i460\+\_\+subchan\+::bit\+\_\+offset}, \textbf{ mux\+\_\+schan\+\_\+provide\+\_\+bit()}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+16k}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+32k}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+64k}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+8k}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+::rate}.



Referenced by \textbf{ mux\+\_\+timeslot\+\_\+provide\+\_\+bits()}.

\mbox{\label{i460__mux_8c_a048bdb71db6c4cf2b5841aec2607d637}} 
\index{i460\_mux.c@{i460\_mux.c}!mux\_timeslot\_provide\_bits@{mux\_timeslot\_provide\_bits}}
\index{mux\_timeslot\_provide\_bits@{mux\_timeslot\_provide\_bits}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{mux\_timeslot\_provide\_bits()}
{\footnotesize\ttfamily static uint8\+\_\+t mux\+\_\+timeslot\+\_\+provide\+\_\+bits (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ mux\+\_\+subchan\+\_\+provide\+\_\+bits()}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+\+NONE}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::rate}, \textbf{ osmo\+\_\+i460\+\_\+timeslot\+::schan}, \textbf{ ts}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+::ts}.



Referenced by \textbf{ osmo\+\_\+i460\+\_\+mux\+\_\+out()}.

\mbox{\label{i460__mux_8c_a63ea0e20ed072142f8bb3e555d873973}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_demux\_in@{osmo\_i460\_demux\_in}}
\index{osmo\_i460\_demux\_in@{osmo\_i460\_demux\_in}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_demux\_in()}
{\footnotesize\ttfamily void osmo\+\_\+i460\+\_\+demux\+\_\+in (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts,  }\item[{const uint8\+\_\+t $\ast$}]{data,  }\item[{size\+\_\+t}]{data\+\_\+len }\end{DoxyParamCaption})}



Feed multiplexed data (from an E1 timeslot) into de-\/multiplexer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ts} & timeslot state. \\
\hline
\mbox{\texttt{ in}}  & {\em data} & input data bytes as received from E1/\+T1. \\
\hline
\mbox{\texttt{ in}}  & {\em data\+\_\+len} & length of data in bytes. \\
\hline
\end{DoxyParams}


References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ data}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::demux}, \textbf{ demux\+\_\+subchan\+\_\+extract\+\_\+bits()}, \textbf{ osmo\+\_\+i460\+\_\+has\+\_\+single\+\_\+64k\+\_\+schan()}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+\+NONE}, \textbf{ osmo\+\_\+pbit2ubit()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+cb\+\_\+bits}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+cb\+\_\+bytes}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::rate}, \textbf{ ts}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::user\+\_\+data}.

\mbox{\label{i460__mux_8c_a9c8cf428409d022811e32675e2b5514c}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_has\_single\_64k\_schan@{osmo\_i460\_has\_single\_64k\_schan}}
\index{osmo\_i460\_has\_single\_64k\_schan@{osmo\_i460\_has\_single\_64k\_schan}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_has\_single\_64k\_schan()}
{\footnotesize\ttfamily static bool osmo\+\_\+i460\+\_\+has\+\_\+single\+\_\+64k\+\_\+schan (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+64k}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+count()}, and \textbf{ ts}.



Referenced by \textbf{ osmo\+\_\+i460\+\_\+demux\+\_\+in()}.

\mbox{\label{i460__mux_8c_aaec9106d232081b9451bb41573f0658b}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_mux\_enqueue@{osmo\_i460\_mux\_enqueue}}
\index{osmo\_i460\_mux\_enqueue@{osmo\_i460\_mux\_enqueue}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_mux\_enqueue()}
{\footnotesize\ttfamily void osmo\+\_\+i460\+\_\+mux\+\_\+enqueue (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan,  }\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



enqueue a to-\/be-\/transmitted message buffer containing unpacked bits 



References \textbf{ msgb\+\_\+enqueue()}, \textbf{ msgb\+\_\+length()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::mux}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+mux\+::tx\+\_\+queue}.

\mbox{\label{i460__mux_8c_a202639ded7762dfe9963bc4e4fa334e1}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_mux\_out@{osmo\_i460\_mux\_out}}
\index{osmo\_i460\_mux\_out@{osmo\_i460\_mux\_out}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_mux\_out()}
{\footnotesize\ttfamily int osmo\+\_\+i460\+\_\+mux\+\_\+out (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts,  }\item[{uint8\+\_\+t $\ast$}]{out,  }\item[{size\+\_\+t}]{out\+\_\+len }\end{DoxyParamCaption})}



Get multiplexed data from de-\/multiplexer (for feeding it into an E1 timeslot). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ts} & timeslot state. \\
\hline
\mbox{\texttt{ out}}  & {\em out} & caller-\/provided buffer where to store generated output bytes. \\
\hline
\mbox{\texttt{ in}}  & {\em out\+\_\+len} & number of bytes to be stored at out. \\
\hline
\end{DoxyParams}


References \textbf{ mux\+\_\+timeslot\+\_\+provide\+\_\+bits()}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+::ts}.

\mbox{\label{i460__mux_8c_ac1e5f8d00d61e586ad07f8528e0ce134}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_subchan\_add@{osmo\_i460\_subchan\_add}}
\index{osmo\_i460\_subchan\_add@{osmo\_i460\_subchan\_add}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_subchan\_add()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$ osmo\+\_\+i460\+\_\+subchan\+\_\+add (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts,  }\item[{const struct \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc} $\ast$}]{chd }\end{DoxyParamCaption})}



add a new sub-\/channel to the given timeslot 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from where to allocate the internal buffer \\
\hline
\mbox{\texttt{ in}}  & {\em ts} & timeslot to which to add a sub-\/channel \\
\hline
\mbox{\texttt{ in}}  & {\em chd} & description of the sub-\/channel to be added \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to sub-\/channel on success, NULL on error 
\end{DoxyReturn}


References \textbf{ alloc\+\_\+bitbuf()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::bit\+\_\+offset}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::bit\+\_\+offset}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::demux}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::demux}, \textbf{ find\+\_\+unused\+\_\+subchan\+\_\+idx()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+mux\+::in\+\_\+cb\+\_\+queue\+\_\+empty}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::in\+\_\+cb\+\_\+queue\+\_\+empty}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::mux}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::mux}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::num\+\_\+bits}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+cb\+\_\+bits}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::out\+\_\+cb\+\_\+bits}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+cb\+\_\+bytes}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::out\+\_\+cb\+\_\+bytes}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::rate}, \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::rate}, \textbf{ osmo\+\_\+i460\+\_\+timeslot\+::schan}, \textbf{ subchan\+\_\+reset()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::ts}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::user\+\_\+data}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+mux\+::user\+\_\+data}, and \textbf{ osmo\+\_\+i460\+\_\+schan\+\_\+desc\+::user\+\_\+data}.

\mbox{\label{i460__mux_8c_adbeaac50546caedabd973fa5a294d624}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_subchan\_count@{osmo\_i460\_subchan\_count}}
\index{osmo\_i460\_subchan\_count@{osmo\_i460\_subchan\_count}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_subchan\_count()}
{\footnotesize\ttfamily int osmo\+\_\+i460\+\_\+subchan\+\_\+count (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts }\end{DoxyParamCaption})}



count the number of sub-\/channels in this I.\+460 slot. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ts} & timeslot that holds the I.\+460 subchannels. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of subchannels. ~\newline
 
\end{DoxyReturn}


References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+\+NONE}, and \textbf{ ts}.



Referenced by \textbf{ osmo\+\_\+i460\+\_\+has\+\_\+single\+\_\+64k\+\_\+schan()}.

\mbox{\label{i460__mux_8c_a275016759936cb7aeaf530d828d156cc}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_subchan\_del@{osmo\_i460\_subchan\_del}}
\index{osmo\_i460\_subchan\_del@{osmo\_i460\_subchan\_del}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_subchan\_del()}
{\footnotesize\ttfamily void osmo\+\_\+i460\+\_\+subchan\+\_\+del (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan }\end{DoxyParamCaption})}



References \textbf{ subchan\+\_\+reset()}.

\mbox{\label{i460__mux_8c_a9016834233de0070cc5723eaa8309f96}} 
\index{i460\_mux.c@{i460\_mux.c}!osmo\_i460\_ts\_init@{osmo\_i460\_ts\_init}}
\index{osmo\_i460\_ts\_init@{osmo\_i460\_ts\_init}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{osmo\_i460\_ts\_init()}
{\footnotesize\ttfamily void osmo\+\_\+i460\+\_\+ts\+\_\+init (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+timeslot} $\ast$}]{ts }\end{DoxyParamCaption})}



initialize an I.\+460 timeslot 



References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ osmo\+\_\+i460\+\_\+timeslot\+::schan}, \textbf{ subchan\+\_\+reset()}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+::ts}.

\mbox{\label{i460__mux_8c_a6a7c1ec5adb3dd80fd45cae247c4808e}} 
\index{i460\_mux.c@{i460\_mux.c}!subchan\_reset@{subchan\_reset}}
\index{subchan\_reset@{subchan\_reset}!i460\_mux.c@{i460\_mux.c}}
\doxysubsubsection{subchan\_reset()}
{\footnotesize\ttfamily static void subchan\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+i460\+\_\+subchan} $\ast$}]{schan,  }\item[{bool}]{first\+\_\+time }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+i460\+\_\+subchan\+::demux}, \textbf{ INIT\+\_\+\+LLIST\+\_\+\+HEAD}, \textbf{ msgb\+\_\+queue\+\_\+free()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::mux}, \textbf{ OSMO\+\_\+\+I460\+\_\+\+RATE\+\_\+\+NONE}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+demux\+::out\+\_\+bitbuf}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+::rate}, and \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+mux\+::tx\+\_\+queue}.



Referenced by \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+add()}, \textbf{ osmo\+\_\+i460\+\_\+subchan\+\_\+del()}, and \textbf{ osmo\+\_\+i460\+\_\+ts\+\_\+init()}.

