\doxysection{sercomm.\+h}
\label{sercomm_8h_source}\index{include/osmocom/core/sercomm.h@{include/osmocom/core/sercomm.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{5 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{6 }
\DoxyCodeLine{7 \textcolor{preprocessor}{\#include <osmocom/core/msgb.h>}}
\DoxyCodeLine{8 }
\DoxyCodeLine{14 \textcolor{keyword}{enum} sercomm\_dlci \{}
\DoxyCodeLine{15         SC\_DLCI\_HIGHEST = 0,}
\DoxyCodeLine{16         SC\_DLCI\_DEBUG   = 4,}
\DoxyCodeLine{17         SC\_DLCI\_L1A\_L23 = 5,}
\DoxyCodeLine{18         SC\_DLCI\_LOADER  = 9,}
\DoxyCodeLine{19         SC\_DLCI\_CONSOLE = 10,}
\DoxyCodeLine{20         SC\_DLCI\_ECHO    = 128,}
\DoxyCodeLine{21         \_SC\_DLCI\_MAX}
\DoxyCodeLine{22 \};}
\DoxyCodeLine{23 }
\DoxyCodeLine{24 \textcolor{keyword}{struct }osmo\_sercomm\_inst;}
\DoxyCodeLine{29 \textcolor{keyword}{typedef} void (*dlci\_cb\_t)(\textcolor{keyword}{struct }osmo\_sercomm\_inst *sercomm, uint8\_t dlci, \textcolor{keyword}{struct }msgb *msg);}
\DoxyCodeLine{30 }
\DoxyCodeLine{32 \textcolor{keyword}{struct }osmo\_sercomm\_inst \{}
\DoxyCodeLine{34         \textcolor{keywordtype}{int} initialized;}
\DoxyCodeLine{36         \textcolor{keywordtype}{int} uart\_id;}
\DoxyCodeLine{37 }
\DoxyCodeLine{39         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{41                 \textcolor{keyword}{struct }llist\_head dlci\_queues[\_SC\_DLCI\_MAX];}
\DoxyCodeLine{43                 \textcolor{keyword}{struct }msgb *msg;}
\DoxyCodeLine{45                 \textcolor{keywordtype}{int} state;}
\DoxyCodeLine{47                 uint8\_t *next\_char;}
\DoxyCodeLine{48         \} tx;}
\DoxyCodeLine{49 }
\DoxyCodeLine{51         \textcolor{keyword}{struct }\{}
\DoxyCodeLine{53                 dlci\_cb\_t dlci\_handler[\_SC\_DLCI\_MAX];}
\DoxyCodeLine{55                 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} msg\_size;}
\DoxyCodeLine{57                 \textcolor{keyword}{struct }msgb *msg;}
\DoxyCodeLine{59                 \textcolor{keywordtype}{int} state;}
\DoxyCodeLine{61                 uint8\_t dlci;}
\DoxyCodeLine{63                 uint8\_t ctrl;}
\DoxyCodeLine{64         \} rx;}
\DoxyCodeLine{65 \};}
\DoxyCodeLine{66 }
\DoxyCodeLine{67 }
\DoxyCodeLine{68 \textcolor{keywordtype}{void} osmo\_sercomm\_init(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm);}
\DoxyCodeLine{69 \textcolor{keywordtype}{int} osmo\_sercomm\_initialized(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm);}
\DoxyCodeLine{70 }
\DoxyCodeLine{71 \textcolor{comment}{/* User Interface: Tx */}}
\DoxyCodeLine{72 \textcolor{keywordtype}{void} osmo\_sercomm\_sendmsg(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm, uint8\_t dlci, \textcolor{keyword}{struct} msgb *msg);}
\DoxyCodeLine{73 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} osmo\_sercomm\_tx\_queue\_depth(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm, uint8\_t dlci);}
\DoxyCodeLine{74 }
\DoxyCodeLine{75 \textcolor{comment}{/* User Interface: Rx */}}
\DoxyCodeLine{76 \textcolor{keywordtype}{int} osmo\_sercomm\_register\_rx\_cb(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm, uint8\_t dlci, dlci\_cb\_t cb);}
\DoxyCodeLine{77 }
\DoxyCodeLine{78 \textcolor{keywordtype}{int} osmo\_sercomm\_change\_speed(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm, uint32\_t bdrt);}
\DoxyCodeLine{79 }
\DoxyCodeLine{80 \textcolor{comment}{/* Driver Interface */}}
\DoxyCodeLine{81 }
\DoxyCodeLine{82 \textcolor{keywordtype}{int} osmo\_sercomm\_drv\_pull(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm, uint8\_t *ch);}
\DoxyCodeLine{83 \textcolor{keywordtype}{int} osmo\_sercomm\_drv\_rx\_char(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm, uint8\_t ch);}
\DoxyCodeLine{84 }
\DoxyCodeLine{85 \textcolor{keyword}{extern} \textcolor{keywordtype}{void} sercomm\_drv\_lock(\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} *flags);}
\DoxyCodeLine{86 \textcolor{keyword}{extern} \textcolor{keywordtype}{void} sercomm\_drv\_unlock(\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} *flags);}
\DoxyCodeLine{87 }
\DoxyCodeLine{96 \textcolor{keyword}{extern} \textcolor{keywordtype}{void} sercomm\_drv\_start\_tx(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm);}
\DoxyCodeLine{97 }
\DoxyCodeLine{103 \textcolor{keyword}{extern} \textcolor{keywordtype}{int} sercomm\_drv\_baudrate\_chg(\textcolor{keyword}{struct} osmo\_sercomm\_inst *sercomm, uint32\_t bdrt);}
\DoxyCodeLine{104 }
\DoxyCodeLine{106 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keyword}{struct }msgb *osmo\_sercomm\_alloc\_msgb(\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} len)}
\DoxyCodeLine{107 \{}
\DoxyCodeLine{108         \textcolor{keywordflow}{return} msgb\_alloc\_headroom(len+4, 4, \textcolor{stringliteral}{"{}sercomm\_tx"{}});}
\DoxyCodeLine{109 \}}
\DoxyCodeLine{110 }

\end{DoxyCode}
