\doxysection{include/osmocom/gsm/gsm0502.h File Reference}
\label{gsm0502_8h}\index{include/osmocom/gsm/gsm0502.h@{include/osmocom/gsm/gsm0502.h}}
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/gsm\+\_\+04\+\_\+08.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/gsm\+\_\+08\+\_\+58.\+h$>$}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+DURATION\+\_\+nS}~4615384  /$\ast$ in 1e−9 seconds (approx) $\ast$/
\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+DURATION\+\_\+uS}~4615  /$\ast$ in 1e-\/6 seconds (approx) $\ast$/
\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+SUPERFRAME}~(26 $\ast$ 51)
\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+HYPERFRAME}~(2048 $\ast$ \textbf{ GSM\+\_\+\+TDMA\+\_\+\+SUPERFRAME})
\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+SUM}(a,  b)~ (((a) + (b)) \% \textbf{ GSM\+\_\+\+TDMA\+\_\+\+HYPERFRAME})
\begin{DoxyCompactList}\small\item\em Return the sum of two specified TDMA frame numbers (summation) \end{DoxyCompactList}\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+SUB}(a,  b)~ (((a) + \textbf{ GSM\+\_\+\+TDMA\+\_\+\+HYPERFRAME} -\/ (b)) \% \textbf{ GSM\+\_\+\+TDMA\+\_\+\+HYPERFRAME})
\begin{DoxyCompactList}\small\item\em Return the difference of two specified TDMA frame numbers (subtraction) \end{DoxyCompactList}\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+DIFF}(a,  b)~ \textbf{ OSMO\+\_\+\+MIN}(\textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+SUB}(a, b), \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+SUB}(b, a))
\begin{DoxyCompactList}\small\item\em Return the {\itshape minimum} difference of two specified TDMA frame numbers (distance) \end{DoxyCompactList}\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+INC}(fn)~ ((fn) = \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+SUM}((fn), 1))
\begin{DoxyCompactList}\small\item\em Increment the given TDMA frame number by 1 and return the result (like ++fn) \end{DoxyCompactList}\item 
\#define \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+DEC}(fn)~ ((fn) = \textbf{ GSM\+\_\+\+TDMA\+\_\+\+FN\+\_\+\+SUB}((fn), 1))
\begin{DoxyCompactList}\small\item\em Decrement the given TDMA frame number by 1 and return the result (like --fn) \end{DoxyCompactList}\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+TAIL}~3
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+PAYLOAD}~(2 $\ast$ 58)
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+TRAIN\+\_\+\+SEQ}~26
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+BURST}~148  /$\ast$ without guard period $\ast$/
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+8\+PSK\+\_\+\+TAIL}~(\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+TAIL} $\ast$ 3)
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+8\+PSK\+\_\+\+PAYLOAD}~(\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+PAYLOAD} $\ast$ 3)
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+8\+PSK\+\_\+\+TRAIN\+\_\+\+SEQ}~(\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+TRAIN\+\_\+\+SEQ} $\ast$ 3)
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+8\+PSK\+\_\+\+BURST}~(\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+BURST} $\ast$ 3)
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+SB\+\_\+\+GMSK\+\_\+\+TAIL}~\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+TAIL}
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+SB\+\_\+\+GMSK\+\_\+\+PAYLOAD}~(2 $\ast$ 39)
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+SB\+\_\+\+GMSK\+\_\+\+ETRAIN\+\_\+\+SEQ}~64
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+SB\+\_\+\+GMSK\+\_\+\+BURST}~\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+BURST}
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+DB\+\_\+\+GMSK\+\_\+\+TAIL}~\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+TAIL}
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+DB\+\_\+\+GMSK\+\_\+\+MIXED}~142
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+DB\+\_\+\+GMSK\+\_\+\+BURST}~\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+BURST}
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+AB\+\_\+\+GMSK\+\_\+\+ETAIL}~8
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+AB\+\_\+\+GMSK\+\_\+\+SYNCH\+\_\+\+SEQ}~41
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+AB\+\_\+\+GMSK\+\_\+\+PAYLOAD}~36
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+AB\+\_\+\+GMSK\+\_\+\+TAIL}~\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+TAIL}
\item 
\#define \textbf{ GSM\+\_\+\+NBITS\+\_\+\+AB\+\_\+\+GMSK\+\_\+\+BURST}~\textbf{ GSM\+\_\+\+NBITS\+\_\+\+NB\+\_\+\+GMSK\+\_\+\+BURST}
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ gsm0502\+\_\+fn\+\_\+remap\+\_\+channel} \{ \newline
\textbf{ FN\+\_\+\+REMAP\+\_\+\+TCH\+\_\+F}
, \newline
\textbf{ FN\+\_\+\+REMAP\+\_\+\+TCH\+\_\+\+H0}
, \newline
\textbf{ FN\+\_\+\+REMAP\+\_\+\+TCH\+\_\+\+H1}
, \newline
\textbf{ FN\+\_\+\+REMAP\+\_\+\+FACCH\+\_\+F}
, \newline
\textbf{ FN\+\_\+\+REMAP\+\_\+\+FACCH\+\_\+\+H0}
, \newline
\textbf{ FN\+\_\+\+REMAP\+\_\+\+FACCH\+\_\+\+H1}
, \newline
\textbf{ FN\+\_\+\+REMAP\+\_\+\+MAX}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static int \textbf{ gsm0502\+\_\+fncmp} (uint32\+\_\+t fn1, uint32\+\_\+t fn2)
\begin{DoxyCompactList}\small\item\em Compare the given TDMA FNs, taking the wrapping into account. \end{DoxyCompactList}\item 
static unsigned int \textbf{ gsm0502\+\_\+get\+\_\+n\+\_\+pag\+\_\+blocks} (const struct \textbf{ gsm48\+\_\+control\+\_\+channel\+\_\+descr} $\ast$\textbf{ chan\+\_\+desc})
\item 
static unsigned int \textbf{ gsm0502\+\_\+get\+\_\+ccch\+\_\+group} (uint64\+\_\+t imsi, unsigned int bs\+\_\+cc\+\_\+chans, unsigned int n\+\_\+pag\+\_\+blocks)
\item 
static unsigned int \textbf{ gsm0502\+\_\+get\+\_\+paging\+\_\+group} (uint64\+\_\+t imsi, unsigned int bs\+\_\+cc\+\_\+chans, int n\+\_\+pag\+\_\+blocks)
\item 
unsigned int \textbf{ gsm0502\+\_\+calc\+\_\+paging\+\_\+group} (const struct \textbf{ gsm48\+\_\+control\+\_\+channel\+\_\+descr} $\ast$\textbf{ chan\+\_\+desc}, uint64\+\_\+t imsi)
\item 
uint32\+\_\+t \textbf{ gsm0502\+\_\+fn\+\_\+remap} (uint32\+\_\+t fn, enum \textbf{ gsm0502\+\_\+fn\+\_\+remap\+\_\+channel} channel)
\begin{DoxyCompactList}\small\item\em Calculate the frame number of the beginning of a block. \end{DoxyCompactList}\item 
uint16\+\_\+t \textbf{ gsm0502\+\_\+hop\+\_\+seq\+\_\+gen} (const struct \textbf{ gsm\+\_\+time} $\ast$t, uint8\+\_\+t hsn, uint8\+\_\+t maio, size\+\_\+t \textbf{ n}, const uint16\+\_\+t $\ast$ma)
\begin{DoxyCompactList}\small\item\em Hopping sequence generation as per 3GPP TS 45.\+002, section 6.\+2.\+3. \end{DoxyCompactList}\item 
int \textbf{ gsm0502\+\_\+fn2ccch\+\_\+block} (uint32\+\_\+t fn)
\begin{DoxyCompactList}\small\item\em Calculate CCCH block number from the given TDMA frame number. \end{DoxyCompactList}\end{DoxyCompactItemize}
