\doxysection{pi2-\/\+CBPSK, pi4-\/\+CBPSK and pi4-\/\+CQPSK modulation}
\label{group__pi4cxpsk}\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ pi4cxpsk.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 pi2-\/\+CBPSK, pi4-\/\+CBPSK and pi4-\/\+CQPSK modulation support header. \end{DoxyCompactList}\item 
file \textbf{ pi4cxpsk.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom GMR-\/1 pi2-\/\+CBPSK, pi4-\/\+CBPSK and pi4-\/\+CQPSK modulation support implementation. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+symbol}
\begin{DoxyCompactList}\small\item\em pi4-\/\+Cx\+PSK symbol description \end{DoxyCompactList}\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation}
\begin{DoxyCompactList}\small\item\em pi4-\/\+Cx\+PSK modulation description \end{DoxyCompactList}\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+sync}
\begin{DoxyCompactList}\small\item\em pi4-\/\+Cx\+PSK Synchronization sequence segment description \end{DoxyCompactList}\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+data}
\begin{DoxyCompactList}\small\item\em pi4-\/\+Cx\+PSK Data segment description \end{DoxyCompactList}\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst}
\begin{DoxyCompactList}\small\item\em pi4-\/\+Cx\+PSK Burst format description \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__pi4cxpsk_ga3a551a9ff371809aa32f6bbeaf48fc62}} 
\#define {\bfseries GMR1\+\_\+\+MAX\+\_\+\+SYM\+\_\+\+EBITS}~2
\begin{DoxyCompactList}\small\item\em Max e bits in a symbol. \end{DoxyCompactList}\item 
\mbox{\label{group__pi4cxpsk_ga7078b941f0b0a04ff9ddf290452b93a9}} 
\#define {\bfseries GMR1\+\_\+\+MAX\+\_\+\+SYNC}~4
\begin{DoxyCompactList}\small\item\em Max diff. sync seqs ~\newline
 \end{DoxyCompactList}\item 
\mbox{\label{group__pi4cxpsk_gad1c5069c814820ccbc9abcc700fb6193}} 
\#define {\bfseries GMR1\+\_\+\+MAX\+\_\+\+SYNC\+\_\+\+SYMS}~32
\begin{DoxyCompactList}\small\item\em Max sym in a sync seq ~\newline
 \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+demod} (struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst} $\ast$burst\+\_\+type, struct \textbf{ osmo\+\_\+cxvec} $\ast$burst\+\_\+in, int sps, float freq\+\_\+shift, sbit\+\_\+t $\ast$ebits, int $\ast$sync\+\_\+id\+\_\+p, float $\ast$toa\+\_\+p, float $\ast$freq\+\_\+err\+\_\+p)
\begin{DoxyCompactList}\small\item\em All-\/in-\/one pi4-\/\+Cx\+PSK demodulation method. \end{DoxyCompactList}\item 
int \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+detect} (struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst} $\ast$$\ast$burst\+\_\+types, float e\+\_\+toa, struct \textbf{ osmo\+\_\+cxvec} $\ast$burst\+\_\+in, int sps, float freq\+\_\+shift, int $\ast$bt\+\_\+id\+\_\+p, int $\ast$sync\+\_\+id\+\_\+p, float $\ast$toa\+\_\+p)
\begin{DoxyCompactList}\small\item\em Try to identify burst type by matching training sequences. \end{DoxyCompactList}\item 
int \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+mod\+\_\+order} (struct \textbf{ osmo\+\_\+cxvec} $\ast$burst\+\_\+in, int sps, float freq\+\_\+shift)
\begin{DoxyCompactList}\small\item\em Estimates modulation order by comparing power of x$^\wedge$2 vs x$^\wedge$4. \end{DoxyCompactList}\item 
int \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+mod} (struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst} $\ast$burst\+\_\+type, ubit\+\_\+t $\ast$ebits, int sync\+\_\+id, struct \textbf{ osmo\+\_\+cxvec} $\ast$burst\+\_\+out)
\begin{DoxyCompactList}\small\item\em Modulates (currently at 1 sps) \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__pi4cxpsk_ga37214979bb79f5d23784ba1eda5fa384}} 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} {\bfseries gmr1\+\_\+pi2cbpsk}
\begin{DoxyCompactList}\small\item\em pi2-\/\+CBPSK modulation description \end{DoxyCompactList}\item 
\mbox{\label{group__pi4cxpsk_gaeae7cf33a9694b1911deefb535f5c1b8}} 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} {\bfseries gmr1\+\_\+pi4cbpsk}
\begin{DoxyCompactList}\small\item\em pi4-\/\+CBPSK modulation description \end{DoxyCompactList}\item 
\mbox{\label{group__pi4cxpsk_ga652dcdb5ad05ce39ebef8a5b97f6d516}} 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} {\bfseries gmr1\+\_\+pi4cqpsk}
\begin{DoxyCompactList}\small\item\em pi4-\/\+CQPSK modulation description \end{DoxyCompactList}\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} \textbf{ gmr1\+\_\+pi2cbpsk}
\begin{DoxyCompactList}\small\item\em pi2-\/\+CBPSK modulation description \end{DoxyCompactList}\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} \textbf{ gmr1\+\_\+pi4cbpsk}
\begin{DoxyCompactList}\small\item\em pi4-\/\+CBPSK modulation description \end{DoxyCompactList}\item 
struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} \textbf{ gmr1\+\_\+pi4cqpsk}
\begin{DoxyCompactList}\small\item\em pi4-\/\+CQPSK modulation description \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}


\doxysubsection{Function Documentation}
\mbox{\label{group__pi4cxpsk_ga39685a0ee6daeb04f7ca70bbd6d1fe29}} 
\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}!gmr1\_pi4cxpsk\_demod@{gmr1\_pi4cxpsk\_demod}}
\index{gmr1\_pi4cxpsk\_demod@{gmr1\_pi4cxpsk\_demod}!pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsubsection{gmr1\_pi4cxpsk\_demod()}
{\footnotesize\ttfamily int gmr1\+\_\+pi4cxpsk\+\_\+demod (\begin{DoxyParamCaption}\item[{struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst} $\ast$}]{burst\+\_\+type,  }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{burst\+\_\+in,  }\item[{int}]{sps,  }\item[{float}]{freq\+\_\+shift,  }\item[{sbit\+\_\+t $\ast$}]{ebits,  }\item[{int $\ast$}]{sync\+\_\+id\+\_\+p,  }\item[{float $\ast$}]{toa\+\_\+p,  }\item[{float $\ast$}]{freq\+\_\+err\+\_\+p }\end{DoxyParamCaption})}



All-\/in-\/one pi4-\/\+Cx\+PSK demodulation method. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em burst\+\_\+type} & Burst format description \\
\hline
\mbox{\texttt{ in}}  & {\em burst\+\_\+in} & Complex signal of the burst \\
\hline
\mbox{\texttt{ in}}  & {\em sps} & Oversampling used in the input complex signal \\
\hline
\mbox{\texttt{ in}}  & {\em freq\+\_\+shift} & Frequency shift to pre-\/apply to burst\+\_\+in (rad/sym) \\
\hline
\mbox{\texttt{ out}}  & {\em ebits} & Encoded soft bits return array \\
\hline
\mbox{\texttt{ out}}  & {\em sync\+\_\+id\+\_\+p} & Pointer to sync sequence id return variable \\
\hline
\mbox{\texttt{ out}}  & {\em toa\+\_\+p} & Pointer to TOA return variable \\
\hline
\mbox{\texttt{ out}}  & {\em freq\+\_\+err\+\_\+p} & Pointer to frequency error return variable (rad/sym) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success. -\/errno for errors
\end{DoxyReturn}
burst\+\_\+in is expected to be longer than necessary. Any extra length will be used as \textquotesingle{}search window\textquotesingle{} to find proper alignement. Good practice is to have a few samples too much in front and a few samples after the expected TOA. \mbox{\label{group__pi4cxpsk_ga1490fd560c08a9468c40ff69f2cae2bb}} 
\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}!gmr1\_pi4cxpsk\_detect@{gmr1\_pi4cxpsk\_detect}}
\index{gmr1\_pi4cxpsk\_detect@{gmr1\_pi4cxpsk\_detect}!pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsubsection{gmr1\_pi4cxpsk\_detect()}
{\footnotesize\ttfamily int gmr1\+\_\+pi4cxpsk\+\_\+detect (\begin{DoxyParamCaption}\item[{struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst} $\ast$$\ast$}]{burst\+\_\+types,  }\item[{float}]{e\+\_\+toa,  }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{burst\+\_\+in,  }\item[{int}]{sps,  }\item[{float}]{freq\+\_\+shift,  }\item[{int $\ast$}]{bt\+\_\+id\+\_\+p,  }\item[{int $\ast$}]{sync\+\_\+id\+\_\+p,  }\item[{float $\ast$}]{toa\+\_\+p }\end{DoxyParamCaption})}



Try to identify burst type by matching training sequences. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em burst\+\_\+types} & Array of burst types to test (NULL terminated) \\
\hline
\mbox{\texttt{ in}}  & {\em e\+\_\+toa} & Expected time of arrival \\
\hline
\mbox{\texttt{ in}}  & {\em burst\+\_\+in} & Complex signal of the burst \\
\hline
\mbox{\texttt{ in}}  & {\em sps} & Oversampling used in the input complex signal \\
\hline
\mbox{\texttt{ in}}  & {\em freq\+\_\+shift} & Frequency shift to pre-\/apply to burst\+\_\+in (rad/sym) \\
\hline
\mbox{\texttt{ out}}  & {\em bt\+\_\+id\+\_\+p} & Pointer to burst type ID return variable \\
\hline
\mbox{\texttt{ out}}  & {\em sync\+\_\+id\+\_\+p} & Pointer to sync sequence id return variable \\
\hline
\mbox{\texttt{ out}}  & {\em toa\+\_\+p} & Pointer to TOA return variable \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/errno for errors, 0 for success
\end{DoxyReturn}
The various burst types must be compatible in length and modulation ! 

References \textbf{ osmo\+\_\+cxvec\+\_\+sig\+\_\+normalize()}, and \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation\+::rotation}.

\mbox{\label{group__pi4cxpsk_ga554b1c56cd86f4e9c9cbdcc455212770}} 
\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}!gmr1\_pi4cxpsk\_mod@{gmr1\_pi4cxpsk\_mod}}
\index{gmr1\_pi4cxpsk\_mod@{gmr1\_pi4cxpsk\_mod}!pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsubsection{gmr1\_pi4cxpsk\_mod()}
{\footnotesize\ttfamily int gmr1\+\_\+pi4cxpsk\+\_\+mod (\begin{DoxyParamCaption}\item[{struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst} $\ast$}]{burst\+\_\+type,  }\item[{ubit\+\_\+t $\ast$}]{ebits,  }\item[{int}]{sync\+\_\+id,  }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{burst\+\_\+out }\end{DoxyParamCaption})}



Modulates (currently at 1 sps) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em burst\+\_\+type} & Burst format description \\
\hline
\mbox{\texttt{ in}}  & {\em ebits} & Encoded hard bits to pack in the burst \\
\hline
\mbox{\texttt{ in}}  & {\em sync\+\_\+id} & The sequence id to use (0 if burst\+\_\+type only has one) \\
\hline
\mbox{\texttt{ out}}  & {\em burst\+\_\+out} & Complex signal to fill with modulated symbols \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 for success. -\/errno for errors
\end{DoxyReturn}
burst\+\_\+out is expected to be long enough to contains the resulting symbols see the burst\+\_\+type structure for how long that is. 

References \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst\+::len}, \textbf{ osmo\+\_\+cxvec\+::max\+\_\+len}, and \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+burst\+::mod}.

\mbox{\label{group__pi4cxpsk_ga82887564b076046745f705f7c27c930e}} 
\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}!gmr1\_pi4cxpsk\_mod\_order@{gmr1\_pi4cxpsk\_mod\_order}}
\index{gmr1\_pi4cxpsk\_mod\_order@{gmr1\_pi4cxpsk\_mod\_order}!pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsubsection{gmr1\_pi4cxpsk\_mod\_order()}
{\footnotesize\ttfamily int gmr1\+\_\+pi4cxpsk\+\_\+mod\+\_\+order (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{burst\+\_\+in,  }\item[{int}]{sps,  }\item[{float}]{freq\+\_\+shift }\end{DoxyParamCaption})}



Estimates modulation order by comparing power of x$^\wedge$2 vs x$^\wedge$4. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em burst\+\_\+in} & Complex signal of the burst \\
\hline
\mbox{\texttt{ in}}  & {\em sps} & Oversampling used in the input complex signal \\
\hline
\mbox{\texttt{ in}}  & {\em freq\+\_\+shift} & Frequency shift to pre-\/apply to burst\+\_\+in (rad/sym) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
$<$0 for error. 2 for BPSK, 4 for QPSK.
\end{DoxyReturn}
Since x$^\wedge$4 only make sense for pi/4 variant, the pi/4 counter rotation is always applied. 

References \textbf{ M\+\_\+\+PIf}, and \textbf{ osmo\+\_\+cxvec\+\_\+sig\+\_\+normalize()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__pi4cxpsk_ga37214979bb79f5d23784ba1eda5fa384}} 
\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}!gmr1\_pi2cbpsk@{gmr1\_pi2cbpsk}}
\index{gmr1\_pi2cbpsk@{gmr1\_pi2cbpsk}!pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsubsection{gmr1\_pi2cbpsk}
{\footnotesize\ttfamily struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} gmr1\+\_\+pi2cbpsk}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        .rotation = M\_PIf/2,}
\DoxyCodeLine{        .nbits = 1,}
\DoxyCodeLine{        .syms = gmr1\_piNcbpsk\_syms\_bits,}
\DoxyCodeLine{        .bits = gmr1\_piNcbpsk\_syms\_bits,}
\DoxyCodeLine{\}}

\end{DoxyCode}


pi2-\/\+CBPSK modulation description 

\mbox{\label{group__pi4cxpsk_gaeae7cf33a9694b1911deefb535f5c1b8}} 
\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}!gmr1\_pi4cbpsk@{gmr1\_pi4cbpsk}}
\index{gmr1\_pi4cbpsk@{gmr1\_pi4cbpsk}!pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsubsection{gmr1\_pi4cbpsk}
{\footnotesize\ttfamily struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} gmr1\+\_\+pi4cbpsk}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        .rotation = M\_PIf/4,}
\DoxyCodeLine{        .nbits = 1,}
\DoxyCodeLine{        .syms = gmr1\_piNcbpsk\_syms\_bits,}
\DoxyCodeLine{        .bits = gmr1\_piNcbpsk\_syms\_bits,}
\DoxyCodeLine{\}}

\end{DoxyCode}


pi4-\/\+CBPSK modulation description 

\mbox{\label{group__pi4cxpsk_ga652dcdb5ad05ce39ebef8a5b97f6d516}} 
\index{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}!gmr1\_pi4cqpsk@{gmr1\_pi4cqpsk}}
\index{gmr1\_pi4cqpsk@{gmr1\_pi4cqpsk}!pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation@{pi2-\/CBPSK, pi4-\/CBPSK and pi4-\/CQPSK modulation}}
\doxysubsubsection{gmr1\_pi4cqpsk}
{\footnotesize\ttfamily struct \textbf{ gmr1\+\_\+pi4cxpsk\+\_\+modulation} gmr1\+\_\+pi4cqpsk}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        .rotation = M\_PIf/4,}
\DoxyCodeLine{        .nbits = 2,}
\DoxyCodeLine{        .syms = gmr1\_pi4cqpsk\_syms,}
\DoxyCodeLine{        .bits = gmr1\_pi4cqpsk\_bits,}
\DoxyCodeLine{\}}

\end{DoxyCode}


pi4-\/\+CQPSK modulation description 

