\doxysection{include/osmocom/core/sercomm.h File Reference}
\label{sercomm_8h}\index{include/osmocom/core/sercomm.h@{include/osmocom/core/sercomm.h}}


Osmocom Sercomm HDLC (de)multiplex.  


{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+sercomm\+\_\+inst}
\begin{DoxyCompactList}\small\item\em one instance of a sercomm multiplex/demultiplex \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef void($\ast$ \textbf{ dlci\+\_\+cb\+\_\+t}) (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint8\+\_\+t dlci, struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em call-\/back function for per-\/\+DLC receive handler \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ sercomm\+\_\+dlci} \{ \newline
\textbf{ SC\+\_\+\+DLCI\+\_\+\+HIGHEST} = 0
, \newline
\textbf{ SC\+\_\+\+DLCI\+\_\+\+DEBUG} = 4
, \newline
\textbf{ SC\+\_\+\+DLCI\+\_\+\+L1\+A\+\_\+\+L23} = 5
, \newline
\textbf{ SC\+\_\+\+DLCI\+\_\+\+LOADER} = 9
, \newline
\textbf{ SC\+\_\+\+DLCI\+\_\+\+CONSOLE} = 10
, \newline
\textbf{ SC\+\_\+\+DLCI\+\_\+\+ECHO} = 128
, \newline
\textbf{ \+\_\+\+SC\+\_\+\+DLCI\+\_\+\+MAX}
 \}
\begin{DoxyCompactList}\small\item\em A low sercomm\+\_\+dlci means high priority. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ osmo\+\_\+sercomm\+\_\+init} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm)
\begin{DoxyCompactList}\small\item\em Initialize an Osmocom sercomm instance. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+sercomm\+\_\+initialized} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm)
\begin{DoxyCompactList}\small\item\em Determine if a given Osmocom sercomm instance has been initialized. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+sercomm\+\_\+sendmsg} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint8\+\_\+t dlci, struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em User interface for transmitting messages for a given DLCI. \end{DoxyCompactList}\item 
unsigned int \textbf{ osmo\+\_\+sercomm\+\_\+tx\+\_\+queue\+\_\+depth} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint8\+\_\+t dlci)
\begin{DoxyCompactList}\small\item\em How deep is the Tx queue for a given DLCI? \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+sercomm\+\_\+register\+\_\+rx\+\_\+cb} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint8\+\_\+t dlci, \textbf{ dlci\+\_\+cb\+\_\+t} cb)
\begin{DoxyCompactList}\small\item\em Register a handler for a given DLCI. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+sercomm\+\_\+change\+\_\+speed} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint32\+\_\+t bdrt)
\begin{DoxyCompactList}\small\item\em wait until everything has been transmitted, then grab the lock and change the baud rate as requested \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+sercomm\+\_\+drv\+\_\+pull} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint8\+\_\+t $\ast$ch)
\begin{DoxyCompactList}\small\item\em fetch one octet of to-\/be-\/transmitted serial data \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+sercomm\+\_\+drv\+\_\+rx\+\_\+char} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint8\+\_\+t ch)
\begin{DoxyCompactList}\small\item\em the driver has received one byte, pass it into sercomm layer \end{DoxyCompactList}\item 
void \textbf{ sercomm\+\_\+drv\+\_\+lock} (unsigned long $\ast$\textbf{ flags})
\item 
void \textbf{ sercomm\+\_\+drv\+\_\+unlock} (unsigned long $\ast$\textbf{ flags})
\item 
void \textbf{ sercomm\+\_\+drv\+\_\+start\+\_\+tx} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm)
\begin{DoxyCompactList}\small\item\em low-\/level driver routine to request start of transmission The Sercomm code calls this function to inform the low-\/level driver that some data is pending for transmission, and the low-\/level driver should (if not active already) start enabling tx\+\_\+empty interrupts and pull drivers out of sercomm using \doxyref{osmo\+\_\+sercomm\+\_\+drv\+\_\+pull()}{p.}{group__sercomm_ga0b371b3a27149b137f7589b194ee26c6} until the latter returns 0. \end{DoxyCompactList}\item 
int \textbf{ sercomm\+\_\+drv\+\_\+baudrate\+\_\+chg} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint32\+\_\+t bdrt)
\begin{DoxyCompactList}\small\item\em low-\/level driver routine to execute baud-\/rate change \end{DoxyCompactList}\item 
static struct \textbf{ msgb} $\ast$ \textbf{ osmo\+\_\+sercomm\+\_\+alloc\+\_\+msgb} (unsigned int \textbf{ len})
\begin{DoxyCompactList}\small\item\em Sercomm msgb allocator function. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Osmocom Sercomm HDLC (de)multiplex. 

