\doxysection{Osmocom CRC routines}
\label{group__crc}\index{Osmocom CRC routines@{Osmocom CRC routines}}


Osmocom generic CRC routines (for max 16 bits poly).  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ crc16.\+h}
\begin{DoxyCompactList}\small\item\em This was copied from the linux kernel and adjusted for our types. \end{DoxyCompactList}\item 
file \textbf{ crcgen.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom generic CRC routines global header. \end{DoxyCompactList}\item 
file \textbf{ crc16.\+c}
\begin{DoxyCompactList}\small\item\em This was copied from the linux kernel and adjusted for our types. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+crc16gen\+\_\+code}
\begin{DoxyCompactList}\small\item\em structure describing a given CRC code of max 16 bits \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+crc32gen\+\_\+code}
\begin{DoxyCompactList}\small\item\em structure describing a given CRC code of max 32 bits \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+crc64gen\+\_\+code}
\begin{DoxyCompactList}\small\item\em structure describing a given CRC code of max 64 bits \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+crc8gen\+\_\+code}
\begin{DoxyCompactList}\small\item\em structure describing a given CRC code of max 8 bits \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
uint16\+\_\+t \textbf{ osmo\+\_\+crc16} (uint16\+\_\+t crc, uint8\+\_\+t const $\ast$\textbf{ buffer}, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em Compute 16bit CCITT polynome 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) over given buffer. \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ osmo\+\_\+crc16\+\_\+byte} (uint16\+\_\+t crc, const uint8\+\_\+t \textbf{ data})
\begin{DoxyCompactList}\small\item\em CRC-\/16 polynome 0x8005 (x$^\wedge$16 + x$^\wedge$15 + x$^\wedge$2 + 1) \end{DoxyCompactList}\item 
uint16\+\_\+t \textbf{ osmo\+\_\+crc16\+\_\+ccitt} (uint16\+\_\+t crc, uint8\+\_\+t const $\ast$\textbf{ buffer}, size\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em Compute 16bit CCITT polynome 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) over given buffer. \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ osmo\+\_\+crc16\+\_\+ccitt\+\_\+byte} (uint16\+\_\+t crc, const uint8\+\_\+t \textbf{ data})
\begin{DoxyCompactList}\small\item\em CCITT polynome 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) \end{DoxyCompactList}\item 
uint16\+\_\+t \textbf{ osmo\+\_\+crc16gen\+\_\+compute\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc16gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len})
\begin{DoxyCompactList}\small\item\em Compute the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+crc16gen\+\_\+check\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc16gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, const \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Checks the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+crc16gen\+\_\+set\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc16gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Computes and writes the CRC value of a given array of bits. \end{DoxyCompactList}\item 
uint32\+\_\+t \textbf{ osmo\+\_\+crc32gen\+\_\+compute\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc32gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len})
\begin{DoxyCompactList}\small\item\em Compute the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+crc32gen\+\_\+check\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc32gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, const \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Checks the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+crc32gen\+\_\+set\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc32gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Computes and writes the CRC value of a given array of bits. \end{DoxyCompactList}\item 
uint64\+\_\+t \textbf{ osmo\+\_\+crc64gen\+\_\+compute\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc64gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len})
\begin{DoxyCompactList}\small\item\em Compute the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+crc64gen\+\_\+check\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc64gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, const \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Checks the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+crc64gen\+\_\+set\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc64gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Computes and writes the CRC value of a given array of bits. \end{DoxyCompactList}\item 
uint8\+\_\+t \textbf{ osmo\+\_\+crc8gen\+\_\+compute\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc8gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len})
\begin{DoxyCompactList}\small\item\em Compute the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+crc8gen\+\_\+check\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc8gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, const \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Checks the CRC value of a given array of hard-\/bits. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+crc8gen\+\_\+set\+\_\+bits} (const struct \textbf{ osmo\+\_\+crc8gen\+\_\+code} $\ast$code, const \textbf{ ubit\+\_\+t} $\ast$in, int \textbf{ len}, \textbf{ ubit\+\_\+t} $\ast$crc\+\_\+bits)
\begin{DoxyCompactList}\small\item\em Computes and writes the CRC value of a given array of bits. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
uint16\+\_\+t const \textbf{ osmo\+\_\+crc16\+\_\+table} [256]
\begin{DoxyCompactList}\small\item\em CRC table for the CRC-\/16. \end{DoxyCompactList}\item 
uint16\+\_\+t const \textbf{ osmo\+\_\+crc16\+\_\+ccitt\+\_\+table} [256]
\begin{DoxyCompactList}\small\item\em CRC table for the CCITT CRC-\/6. \end{DoxyCompactList}\item 
uint16\+\_\+t const \textbf{ osmo\+\_\+crc16\+\_\+table} [256]
\begin{DoxyCompactList}\small\item\em CRC table for the CRC-\/16. \end{DoxyCompactList}\item 
uint16\+\_\+t const \textbf{ osmo\+\_\+crc16\+\_\+ccitt\+\_\+table} [256]
\begin{DoxyCompactList}\small\item\em CRC table for the CCITT CRC-\/6. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Osmocom generic CRC routines (for max 16 bits poly). 

Osmocom generic CRC routines (for max 8 bits poly).

Osmocom generic CRC routines (for max 64 bits poly).

Osmocom generic CRC routines (for max 32 bits poly).

\doxysubsection{Function Documentation}
\mbox{\label{group__crc_ga58cd4fba87bbaf0f343bd33180eebe42}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16@{osmo\_crc16}}
\index{osmo\_crc16@{osmo\_crc16}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16()}
{\footnotesize\ttfamily uint16\+\_\+t osmo\+\_\+crc16 (\begin{DoxyParamCaption}\item[{uint16\+\_\+t}]{crc,  }\item[{uint8\+\_\+t const $\ast$}]{buffer,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



Compute 16bit CCITT polynome 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) over given buffer. 


\begin{DoxyParams}{Parameters}
{\em crc\mbox{[}in\mbox{]}} & previous CRC value \\
\hline
{\em buffer\mbox{[}in\mbox{]}} & data pointer \\
\hline
{\em len\mbox{[}in\mbox{]}} & number of bytes in input \textbf{ buffer} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
updated CRC value 
\end{DoxyReturn}


References \textbf{ len()}, and \textbf{ osmo\+\_\+crc16\+\_\+byte()}.

\mbox{\label{group__crc_ga4e06f5f025021925caffc89c203ca63c}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16\_byte@{osmo\_crc16\_byte}}
\index{osmo\_crc16\_byte@{osmo\_crc16\_byte}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16\_byte()}
{\footnotesize\ttfamily static uint16\+\_\+t osmo\+\_\+crc16\+\_\+byte (\begin{DoxyParamCaption}\item[{uint16\+\_\+t}]{crc,  }\item[{const uint8\+\_\+t}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



CRC-\/16 polynome 0x8005 (x$^\wedge$16 + x$^\wedge$15 + x$^\wedge$2 + 1) 



References \textbf{ data}, and \textbf{ osmo\+\_\+crc16\+\_\+table}.



Referenced by \textbf{ osmo\+\_\+crc16()}.

\mbox{\label{group__crc_gaad60da91cb9972f08402e66fe456faa3}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16\_ccitt@{osmo\_crc16\_ccitt}}
\index{osmo\_crc16\_ccitt@{osmo\_crc16\_ccitt}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16\_ccitt()}
{\footnotesize\ttfamily uint16\+\_\+t osmo\+\_\+crc16\+\_\+ccitt (\begin{DoxyParamCaption}\item[{uint16\+\_\+t}]{crc,  }\item[{uint8\+\_\+t const $\ast$}]{buffer,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



Compute 16bit CCITT polynome 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) over given buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em crc} & initial value of CRC \\
\hline
\mbox{\texttt{ in}}  & {\em buffer} & pointer to buffer of input data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of {\itshape buffer} in bytes \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
16bit CRC 
\end{DoxyReturn}


References \textbf{ len()}, and \textbf{ osmo\+\_\+crc16\+\_\+ccitt\+\_\+byte()}.

\mbox{\label{group__crc_gae9bbf080cb79448668ff0421a8923876}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16\_ccitt\_byte@{osmo\_crc16\_ccitt\_byte}}
\index{osmo\_crc16\_ccitt\_byte@{osmo\_crc16\_ccitt\_byte}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16\_ccitt\_byte()}
{\footnotesize\ttfamily static uint16\+\_\+t osmo\+\_\+crc16\+\_\+ccitt\+\_\+byte (\begin{DoxyParamCaption}\item[{uint16\+\_\+t}]{crc,  }\item[{const uint8\+\_\+t}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



CCITT polynome 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) 



References \textbf{ data}, and \textbf{ osmo\+\_\+crc16\+\_\+ccitt\+\_\+table}.



Referenced by \textbf{ osmo\+\_\+crc16\+\_\+ccitt()}.

\mbox{\label{group__crc_ga9a00e7f03b13fafc300c472041232a13}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16gen\_check\_bits@{osmo\_crc16gen\_check\_bits}}
\index{osmo\_crc16gen\_check\_bits@{osmo\_crc16gen\_check\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16gen\_check\_bits()}
{\footnotesize\ttfamily int osmo\+\_\+crc16gen\+\_\+check\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc16gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Checks the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits with the alleged CRC \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if CRC matches. 1 in case of error.
\end{DoxyReturn}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc16gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc16gen\+\_\+compute\+\_\+bits()}.

\mbox{\label{group__crc_ga5f2be129743f4ef86a0dc8254e7ef2db}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16gen\_compute\_bits@{osmo\_crc16gen\_compute\_bits}}
\index{osmo\_crc16gen\_compute\_bits@{osmo\_crc16gen\_compute\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16gen\_compute\_bits()}
{\footnotesize\ttfamily uint16\+\_\+t osmo\+\_\+crc16gen\+\_\+compute\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc16gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len }\end{DoxyParamCaption})}



Compute the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The CRC value 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+crc16gen\+\_\+code\+::bits}, \textbf{ osmo\+\_\+crc16gen\+\_\+code\+::init}, \textbf{ len()}, \textbf{ n}, \textbf{ osmo\+\_\+crc16gen\+\_\+code\+::poly}, and \textbf{ osmo\+\_\+crc16gen\+\_\+code\+::remainder}.



Referenced by \textbf{ osmo\+\_\+crc16gen\+\_\+check\+\_\+bits()}, and \textbf{ osmo\+\_\+crc16gen\+\_\+set\+\_\+bits()}.

\mbox{\label{group__crc_ga78c47159065aced37cb21d78dc5f7a66}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16gen\_set\_bits@{osmo\_crc16gen\_set\_bits}}
\index{osmo\_crc16gen\_set\_bits@{osmo\_crc16gen\_set\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16gen\_set\_bits()}
{\footnotesize\ttfamily void osmo\+\_\+crc16gen\+\_\+set\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc16gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{\textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Computes and writes the CRC value of a given array of bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits to write the computed CRC to\\
\hline
\end{DoxyParams}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc16gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc16gen\+\_\+compute\+\_\+bits()}.

\mbox{\label{group__crc_gacd9e567dca7fe9704c4a3091fb73f731}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc32gen\_check\_bits@{osmo\_crc32gen\_check\_bits}}
\index{osmo\_crc32gen\_check\_bits@{osmo\_crc32gen\_check\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc32gen\_check\_bits()}
{\footnotesize\ttfamily int osmo\+\_\+crc32gen\+\_\+check\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc32gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Checks the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits with the alleged CRC \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if CRC matches. 1 in case of error.
\end{DoxyReturn}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc32gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc32gen\+\_\+compute\+\_\+bits()}.

\mbox{\label{group__crc_ga38fd8d69d0e56e7ac9c424d9c1201da3}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc32gen\_compute\_bits@{osmo\_crc32gen\_compute\_bits}}
\index{osmo\_crc32gen\_compute\_bits@{osmo\_crc32gen\_compute\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc32gen\_compute\_bits()}
{\footnotesize\ttfamily uint32\+\_\+t osmo\+\_\+crc32gen\+\_\+compute\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc32gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len }\end{DoxyParamCaption})}



Compute the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The CRC value 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+crc32gen\+\_\+code\+::bits}, \textbf{ osmo\+\_\+crc32gen\+\_\+code\+::init}, \textbf{ len()}, \textbf{ n}, \textbf{ osmo\+\_\+crc32gen\+\_\+code\+::poly}, and \textbf{ osmo\+\_\+crc32gen\+\_\+code\+::remainder}.



Referenced by \textbf{ osmo\+\_\+crc32gen\+\_\+check\+\_\+bits()}, and \textbf{ osmo\+\_\+crc32gen\+\_\+set\+\_\+bits()}.

\mbox{\label{group__crc_gafd51fe33e5139ac2ac74b235864bc5f6}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc32gen\_set\_bits@{osmo\_crc32gen\_set\_bits}}
\index{osmo\_crc32gen\_set\_bits@{osmo\_crc32gen\_set\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc32gen\_set\_bits()}
{\footnotesize\ttfamily void osmo\+\_\+crc32gen\+\_\+set\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc32gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{\textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Computes and writes the CRC value of a given array of bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits to write the computed CRC to\\
\hline
\end{DoxyParams}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc32gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc32gen\+\_\+compute\+\_\+bits()}.

\mbox{\label{group__crc_gae8e3f4375b32508b040ce49e948b06d5}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc64gen\_check\_bits@{osmo\_crc64gen\_check\_bits}}
\index{osmo\_crc64gen\_check\_bits@{osmo\_crc64gen\_check\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc64gen\_check\_bits()}
{\footnotesize\ttfamily int osmo\+\_\+crc64gen\+\_\+check\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc64gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Checks the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits with the alleged CRC \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if CRC matches. 1 in case of error.
\end{DoxyReturn}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc64gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc64gen\+\_\+compute\+\_\+bits()}.

\mbox{\label{group__crc_gaea21afc395bb6817b77ff5bd7a66e1b6}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc64gen\_compute\_bits@{osmo\_crc64gen\_compute\_bits}}
\index{osmo\_crc64gen\_compute\_bits@{osmo\_crc64gen\_compute\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc64gen\_compute\_bits()}
{\footnotesize\ttfamily uint64\+\_\+t osmo\+\_\+crc64gen\+\_\+compute\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc64gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len }\end{DoxyParamCaption})}



Compute the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The CRC value 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+crc64gen\+\_\+code\+::bits}, \textbf{ osmo\+\_\+crc64gen\+\_\+code\+::init}, \textbf{ len()}, \textbf{ n}, \textbf{ osmo\+\_\+crc64gen\+\_\+code\+::poly}, and \textbf{ osmo\+\_\+crc64gen\+\_\+code\+::remainder}.



Referenced by \textbf{ osmo\+\_\+crc64gen\+\_\+check\+\_\+bits()}, and \textbf{ osmo\+\_\+crc64gen\+\_\+set\+\_\+bits()}.

\mbox{\label{group__crc_gaa78449595b3ce3ff202d3f898a85f995}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc64gen\_set\_bits@{osmo\_crc64gen\_set\_bits}}
\index{osmo\_crc64gen\_set\_bits@{osmo\_crc64gen\_set\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc64gen\_set\_bits()}
{\footnotesize\ttfamily void osmo\+\_\+crc64gen\+\_\+set\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc64gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{\textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Computes and writes the CRC value of a given array of bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits to write the computed CRC to\\
\hline
\end{DoxyParams}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc64gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc64gen\+\_\+compute\+\_\+bits()}.

\mbox{\label{group__crc_ga66f9c6afefc4dfe9baacdaf75ac1d95a}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc8gen\_check\_bits@{osmo\_crc8gen\_check\_bits}}
\index{osmo\_crc8gen\_check\_bits@{osmo\_crc8gen\_check\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc8gen\_check\_bits()}
{\footnotesize\ttfamily int osmo\+\_\+crc8gen\+\_\+check\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc8gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Checks the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits with the alleged CRC \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if CRC matches. 1 in case of error.
\end{DoxyReturn}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc8gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc8gen\+\_\+compute\+\_\+bits()}.

\mbox{\label{group__crc_ga1549c35fe5c50ec456a7bcbe65573e62}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc8gen\_compute\_bits@{osmo\_crc8gen\_compute\_bits}}
\index{osmo\_crc8gen\_compute\_bits@{osmo\_crc8gen\_compute\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc8gen\_compute\_bits()}
{\footnotesize\ttfamily uint8\+\_\+t osmo\+\_\+crc8gen\+\_\+compute\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc8gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len }\end{DoxyParamCaption})}



Compute the CRC value of a given array of hard-\/bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The CRC value 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+crc8gen\+\_\+code\+::bits}, \textbf{ osmo\+\_\+crc8gen\+\_\+code\+::init}, \textbf{ len()}, \textbf{ n}, \textbf{ osmo\+\_\+crc8gen\+\_\+code\+::poly}, and \textbf{ osmo\+\_\+crc8gen\+\_\+code\+::remainder}.



Referenced by \textbf{ osmo\+\_\+crc8gen\+\_\+check\+\_\+bits()}, and \textbf{ osmo\+\_\+crc8gen\+\_\+set\+\_\+bits()}.

\mbox{\label{group__crc_gac88fe09d8beb2a70f1ec43f87920ee73}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc8gen\_set\_bits@{osmo\_crc8gen\_set\_bits}}
\index{osmo\_crc8gen\_set\_bits@{osmo\_crc8gen\_set\_bits}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc8gen\_set\_bits()}
{\footnotesize\ttfamily void osmo\+\_\+crc8gen\+\_\+set\+\_\+bits (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+crc8gen\+\_\+code} $\ast$}]{code,  }\item[{const \textbf{ ubit\+\_\+t} $\ast$}]{in,  }\item[{int}]{len,  }\item[{\textbf{ ubit\+\_\+t} $\ast$}]{crc\+\_\+bits }\end{DoxyParamCaption})}



Computes and writes the CRC value of a given array of bits. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em code} & The CRC code description to apply \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the array of hard bits \\
\hline
\mbox{\texttt{ in}}  & {\em crc\+\_\+bits} & Array of hard bits to write the computed CRC to\\
\hline
\end{DoxyParams}
The crc\+\_\+bits array must have a length of code-\/$>$len 

References \textbf{ osmo\+\_\+crc8gen\+\_\+code\+::bits}, \textbf{ len()}, and \textbf{ osmo\+\_\+crc8gen\+\_\+compute\+\_\+bits()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__crc_gabc80ae8a51f5ed975c980dee63129818}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16\_ccitt\_table@{osmo\_crc16\_ccitt\_table}}
\index{osmo\_crc16\_ccitt\_table@{osmo\_crc16\_ccitt\_table}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16\_ccitt\_table\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily uint16\+\_\+t const osmo\+\_\+crc16\+\_\+ccitt\+\_\+table[256]\hspace{0.3cm}{\ttfamily [extern]}}



CRC table for the CCITT CRC-\/6. 

The poly is 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) 

Referenced by \textbf{ osmo\+\_\+crc16\+\_\+ccitt\+\_\+byte()}.

\mbox{\label{group__crc_gabc80ae8a51f5ed975c980dee63129818}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16\_ccitt\_table@{osmo\_crc16\_ccitt\_table}}
\index{osmo\_crc16\_ccitt\_table@{osmo\_crc16\_ccitt\_table}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16\_ccitt\_table\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily uint16\+\_\+t const osmo\+\_\+crc16\+\_\+ccitt\+\_\+table[256]}



CRC table for the CCITT CRC-\/6. 

The poly is 0x8408 (x$^\wedge$0 + x$^\wedge$5 + x$^\wedge$12) 

Referenced by \textbf{ osmo\+\_\+crc16\+\_\+ccitt\+\_\+byte()}.

\mbox{\label{group__crc_ga539c9a3a9def4b974c3957a9d843fc03}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16\_table@{osmo\_crc16\_table}}
\index{osmo\_crc16\_table@{osmo\_crc16\_table}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16\_table\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily uint16\+\_\+t const osmo\+\_\+crc16\+\_\+table[256]\hspace{0.3cm}{\ttfamily [extern]}}



CRC table for the CRC-\/16. 

The poly is 0x8005 (x$^\wedge$16 + x$^\wedge$15 + x$^\wedge$2 + 1) 

Referenced by \textbf{ osmo\+\_\+crc16\+\_\+byte()}.

\mbox{\label{group__crc_ga539c9a3a9def4b974c3957a9d843fc03}} 
\index{Osmocom CRC routines@{Osmocom CRC routines}!osmo\_crc16\_table@{osmo\_crc16\_table}}
\index{osmo\_crc16\_table@{osmo\_crc16\_table}!Osmocom CRC routines@{Osmocom CRC routines}}
\doxysubsubsection{osmo\_crc16\_table\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily uint16\+\_\+t const osmo\+\_\+crc16\+\_\+table[256]}



CRC table for the CRC-\/16. 

The poly is 0x8005 (x$^\wedge$16 + x$^\wedge$15 + x$^\wedge$2 + 1) 

Referenced by \textbf{ osmo\+\_\+crc16\+\_\+byte()}.

