\doxysection{src/core/sercomm.c File Reference}
\label{sercomm_8c}\index{src/core/sercomm.c@{src/core/sercomm.c}}
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/sercomm.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ DEFAULT\+\_\+\+RX\+\_\+\+MSG\+\_\+\+SIZE}~2048
\item 
\#define \textbf{ HDLC\+\_\+\+FLAG}~0x7E
\item 
\#define \textbf{ HDLC\+\_\+\+ESCAPE}~0x7D
\item 
\#define \textbf{ HDLC\+\_\+\+C\+\_\+\+UI}~0x03
\item 
\#define \textbf{ HDLC\+\_\+\+C\+\_\+\+P\+\_\+\+BIT}~(1 $<$$<$ 4)
\item 
\#define \textbf{ HDLC\+\_\+\+C\+\_\+\+F\+\_\+\+BIT}~(1 $<$$<$ 4)
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ rx\+\_\+state} \{ \newline
\textbf{ RX\+\_\+\+ST\+\_\+\+WAIT\+\_\+\+START}
, \newline
\textbf{ RX\+\_\+\+ST\+\_\+\+ADDR}
, \newline
\textbf{ RX\+\_\+\+ST\+\_\+\+CTRL}
, \newline
\textbf{ RX\+\_\+\+ST\+\_\+\+DATA}
, \newline
\textbf{ RX\+\_\+\+ST\+\_\+\+ESCAPE}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ sercomm\+\_\+drv\+\_\+lock} (unsigned long \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+}((unused)) $\ast$\textbf{ flags})
\begin{DoxyCompactList}\small\item\em Protect against IRQ context. \end{DoxyCompactList}\item 
void \textbf{ sercomm\+\_\+drv\+\_\+unlock} (unsigned long \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+}((unused)) $\ast$\textbf{ flags})
\begin{DoxyCompactList}\small\item\em Release protection against IRQ context. \end{DoxyCompactList}\item 
\textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+} ((weak))
\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\+\_\+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\+\_\+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 
static void \textbf{ dispatch\+\_\+rx\+\_\+msg} (struct \textbf{ osmo\+\_\+sercomm\+\_\+inst} $\ast$sercomm, uint8\+\_\+t dlci, struct \textbf{ msgb} $\ast$\textbf{ msg})
\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}\end{DoxyCompactItemize}
