\section{aversive\_\-10-03-12/modules/comm/mf2\_\-client/mf2\_\-client.c File Reference}
\label{mf2__client_8c}\index{aversive\_\-10-03-12/modules/comm/mf2\_\-client/mf2\_\-client.c@{aversive\_\-10-03-12/modules/comm/mf2\_\-client/mf2\_\-client.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$aversive.h$>$}\par
{\tt \#include $<$mf2\_\-client.h$>$}\par
{\tt \#include $<$mf2\_\-client\_\-config.h$>$}\par
{\tt \#include $<$aversive/wait.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf WATCHDOG\_\-TIMEOUT}~10000
\item 
\#define {\bf MF2\_\-CLIENT\_\-STATE\_\-IDLE}~0
\item 
\#define {\bf MF2\_\-CLIENT\_\-STATE\_\-RECV}~1
\item 
\#define {\bf MF2\_\-CLIENT\_\-STATE\_\-XMIT}~2
\item 
\#define {\bf MF2\_\-CLIENT\_\-STATE\_\-ACK}~3
\item 
\#define {\bf data\_\-Z}()~cbi(DDR(MF2\_\-CLIENT\_\-DATA\_\-PORT), MF2\_\-CLIENT\_\-DATA\_\-BIT)
\item 
\#define {\bf data\_\-0}()~sbi(DDR(MF2\_\-CLIENT\_\-DATA\_\-PORT), MF2\_\-CLIENT\_\-DATA\_\-BIT)
\item 
\#define {\bf clk\_\-Z}()~cbi(DDR(MF2\_\-CLIENT\_\-CLK\_\-PORT), MF2\_\-CLIENT\_\-CLK\_\-BIT)
\item 
\#define {\bf clk\_\-0}()~sbi(DDR(MF2\_\-CLIENT\_\-CLK\_\-PORT), MF2\_\-CLIENT\_\-CLK\_\-BIT)
\item 
\#define {\bf START\_\-BIT}~0x0001
\item 
\#define {\bf PARITY\_\-BIT}~0x0200
\item 
\#define {\bf STOP\_\-BIT}~0x0400
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef void( {\bf event} )(char)
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
{\bf SIGNAL} (MF2\_\-CLIENT\_\-INTERRUPT)
\item 
void {\bf mf2\_\-client\_\-init} (void)
\item 
{\bf s08} {\bf mf2\_\-client\_\-ready} (void)
\item 
{\bf s08} {\bf mf2\_\-client\_\-send} (char c)
\item 
void {\bf mf2\_\-client\_\-register\_\-tx\_\-event} (void($\ast$f)(char))
\item 
void {\bf mf2\_\-client\_\-register\_\-rx\_\-event} (void($\ast$f)(char))
\end{CompactItemize}


\subsection{Define Documentation}
\index{mf2\_\-client.c@{mf2\_\-client.c}!clk\_\-0@{clk\_\-0}}
\index{clk\_\-0@{clk\_\-0}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[clk\_\-0]{\setlength{\rightskip}{0pt plus 5cm}\#define clk\_\-0()~sbi(DDR(MF2\_\-CLIENT\_\-CLK\_\-PORT), MF2\_\-CLIENT\_\-CLK\_\-BIT)}\label{mf2__client_8c_69bfb1522cca8e1ae6de81e260819d18}




Definition at line 46 of file mf2\_\-client.c.

Referenced by mf2\_\-client\_\-send(), mf2\_\-server\_\-timer\_\-cb(), recv(), and SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!clk\_\-Z@{clk\_\-Z}}
\index{clk\_\-Z@{clk\_\-Z}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[clk\_\-Z]{\setlength{\rightskip}{0pt plus 5cm}\#define clk\_\-Z()~cbi(DDR(MF2\_\-CLIENT\_\-CLK\_\-PORT), MF2\_\-CLIENT\_\-CLK\_\-BIT)}\label{mf2__client_8c_3b657dbaf8a8cb4013c8a547e5689f8a}




Definition at line 45 of file mf2\_\-client.c.

Referenced by mf2\_\-client\_\-init(), mf2\_\-server\_\-init(), mf2\_\-server\_\-send(), mf2\_\-server\_\-timer\_\-cb(), recv(), and SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!data\_\-0@{data\_\-0}}
\index{data\_\-0@{data\_\-0}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[data\_\-0]{\setlength{\rightskip}{0pt plus 5cm}\#define data\_\-0()~sbi(DDR(MF2\_\-CLIENT\_\-DATA\_\-PORT), MF2\_\-CLIENT\_\-DATA\_\-BIT)}\label{mf2__client_8c_f4a0f0ad8f7c6c3a045da59788993dc2}




Definition at line 44 of file mf2\_\-client.c.

Referenced by mf2\_\-server\_\-timer\_\-cb(), recv(), and SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!data\_\-Z@{data\_\-Z}}
\index{data\_\-Z@{data\_\-Z}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[data\_\-Z]{\setlength{\rightskip}{0pt plus 5cm}\#define data\_\-Z()~cbi(DDR(MF2\_\-CLIENT\_\-DATA\_\-PORT), MF2\_\-CLIENT\_\-DATA\_\-BIT)}\label{mf2__client_8c_d0d516cba3150ec427bef2d53e29304b}




Definition at line 43 of file mf2\_\-client.c.

Referenced by mf2\_\-client\_\-init(), mf2\_\-server\_\-init(), mf2\_\-server\_\-send(), mf2\_\-server\_\-timer\_\-cb(), recv(), and SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!MF2\_\-CLIENT\_\-STATE\_\-ACK@{MF2\_\-CLIENT\_\-STATE\_\-ACK}}
\index{MF2\_\-CLIENT\_\-STATE\_\-ACK@{MF2\_\-CLIENT\_\-STATE\_\-ACK}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[MF2\_\-CLIENT\_\-STATE\_\-ACK]{\setlength{\rightskip}{0pt plus 5cm}\#define MF2\_\-CLIENT\_\-STATE\_\-ACK~3}\label{mf2__client_8c_49206afbac1abfc5c8f9b9a3a21c40d9}




Definition at line 41 of file mf2\_\-client.c.

Referenced by SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!MF2\_\-CLIENT\_\-STATE\_\-IDLE@{MF2\_\-CLIENT\_\-STATE\_\-IDLE}}
\index{MF2\_\-CLIENT\_\-STATE\_\-IDLE@{MF2\_\-CLIENT\_\-STATE\_\-IDLE}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[MF2\_\-CLIENT\_\-STATE\_\-IDLE]{\setlength{\rightskip}{0pt plus 5cm}\#define MF2\_\-CLIENT\_\-STATE\_\-IDLE~0}\label{mf2__client_8c_f6b6a826ee547cebf9daa7e1fdae87eb}




Definition at line 38 of file mf2\_\-client.c.

Referenced by mf2\_\-client\_\-init(), mf2\_\-client\_\-ready(), and SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!MF2\_\-CLIENT\_\-STATE\_\-RECV@{MF2\_\-CLIENT\_\-STATE\_\-RECV}}
\index{MF2\_\-CLIENT\_\-STATE\_\-RECV@{MF2\_\-CLIENT\_\-STATE\_\-RECV}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[MF2\_\-CLIENT\_\-STATE\_\-RECV]{\setlength{\rightskip}{0pt plus 5cm}\#define MF2\_\-CLIENT\_\-STATE\_\-RECV~1}\label{mf2__client_8c_0eb594b6ff9bb913a65d36bdd3809c38}




Definition at line 39 of file mf2\_\-client.c.

Referenced by SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!MF2\_\-CLIENT\_\-STATE\_\-XMIT@{MF2\_\-CLIENT\_\-STATE\_\-XMIT}}
\index{MF2\_\-CLIENT\_\-STATE\_\-XMIT@{MF2\_\-CLIENT\_\-STATE\_\-XMIT}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[MF2\_\-CLIENT\_\-STATE\_\-XMIT]{\setlength{\rightskip}{0pt plus 5cm}\#define MF2\_\-CLIENT\_\-STATE\_\-XMIT~2}\label{mf2__client_8c_a82f86d71196a47b3163440d59ce908b}




Definition at line 40 of file mf2\_\-client.c.

Referenced by mf2\_\-client\_\-send(), and SIGNAL().\index{mf2\_\-client.c@{mf2\_\-client.c}!PARITY\_\-BIT@{PARITY\_\-BIT}}
\index{PARITY\_\-BIT@{PARITY\_\-BIT}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[PARITY\_\-BIT]{\setlength{\rightskip}{0pt plus 5cm}\#define PARITY\_\-BIT~0x0200}\label{mf2__client_8c_3fe0dea7b30a55d84f5763338956eb44}




Definition at line 74 of file mf2\_\-client.c.

Referenced by mf2\_\-client\_\-send().\index{mf2\_\-client.c@{mf2\_\-client.c}!START\_\-BIT@{START\_\-BIT}}
\index{START\_\-BIT@{START\_\-BIT}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[START\_\-BIT]{\setlength{\rightskip}{0pt plus 5cm}\#define START\_\-BIT~0x0001}\label{mf2__client_8c_047737489bcc993e33016da6e77ce082}




Definition at line 73 of file mf2\_\-client.c.\index{mf2\_\-client.c@{mf2\_\-client.c}!STOP\_\-BIT@{STOP\_\-BIT}}
\index{STOP\_\-BIT@{STOP\_\-BIT}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[STOP\_\-BIT]{\setlength{\rightskip}{0pt plus 5cm}\#define STOP\_\-BIT~0x0400}\label{mf2__client_8c_d0c3743efc15a1320478871dc92998bd}




Definition at line 75 of file mf2\_\-client.c.\index{mf2\_\-client.c@{mf2\_\-client.c}!WATCHDOG\_\-TIMEOUT@{WATCHDOG\_\-TIMEOUT}}
\index{WATCHDOG\_\-TIMEOUT@{WATCHDOG\_\-TIMEOUT}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[WATCHDOG\_\-TIMEOUT]{\setlength{\rightskip}{0pt plus 5cm}\#define WATCHDOG\_\-TIMEOUT~10000}\label{mf2__client_8c_bf89628d486477bd0db5a5890cd38a05}




Definition at line 36 of file mf2\_\-client.c.

Referenced by SIGNAL().

\subsection{Typedef Documentation}
\index{mf2\_\-client.c@{mf2\_\-client.c}!event@{event}}
\index{event@{event}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[event]{\setlength{\rightskip}{0pt plus 5cm}typedef void( {\bf event})(char)}\label{mf2__client_8c_c002e5ef6b25541b21fa588f567903fa}




Definition at line 59 of file mf2\_\-client.c.

\subsection{Function Documentation}
\index{mf2\_\-client.c@{mf2\_\-client.c}!mf2\_\-client\_\-init@{mf2\_\-client\_\-init}}
\index{mf2\_\-client\_\-init@{mf2\_\-client\_\-init}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[mf2\_\-client\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void mf2\_\-client\_\-init (void)}\label{mf2__client_8c_adb253d9428f0450d1330256dcd2c2a8}




Definition at line 183 of file mf2\_\-client.c.

References cbi, clk\_\-Z, data\_\-Z, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and MF2\_\-CLIENT\_\-STATE\_\-IDLE.\index{mf2\_\-client.c@{mf2\_\-client.c}!mf2\_\-client\_\-ready@{mf2\_\-client\_\-ready}}
\index{mf2\_\-client\_\-ready@{mf2\_\-client\_\-ready}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[mf2\_\-client\_\-ready]{\setlength{\rightskip}{0pt plus 5cm}{\bf s08} mf2\_\-client\_\-ready (void)}\label{mf2__client_8c_b401d87b298c64fbc17b030ab7ca4bd0}




Definition at line 226 of file mf2\_\-client.c.

References MF2\_\-CLIENT\_\-STATE\_\-IDLE.

Referenced by mf2\_\-client\_\-send().\index{mf2\_\-client.c@{mf2\_\-client.c}!mf2\_\-client\_\-register\_\-rx\_\-event@{mf2\_\-client\_\-register\_\-rx\_\-event}}
\index{mf2\_\-client\_\-register\_\-rx\_\-event@{mf2\_\-client\_\-register\_\-rx\_\-event}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[mf2\_\-client\_\-register\_\-rx\_\-event]{\setlength{\rightskip}{0pt plus 5cm}void mf2\_\-client\_\-register\_\-rx\_\-event (void($\ast$)(char) {\em f})}\label{mf2__client_8c_a0893a4268a9856e2f1bea53d6eebb81}




Definition at line 314 of file mf2\_\-client.c.

References parse\_\-symbols::f, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and rx\_\-event.\index{mf2\_\-client.c@{mf2\_\-client.c}!mf2\_\-client\_\-register\_\-tx\_\-event@{mf2\_\-client\_\-register\_\-tx\_\-event}}
\index{mf2\_\-client\_\-register\_\-tx\_\-event@{mf2\_\-client\_\-register\_\-tx\_\-event}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[mf2\_\-client\_\-register\_\-tx\_\-event]{\setlength{\rightskip}{0pt plus 5cm}void mf2\_\-client\_\-register\_\-tx\_\-event (void($\ast$)(char) {\em f})}\label{mf2__client_8c_692b3aa18f9ed1e11ec2de5c2796a65c}




Definition at line 304 of file mf2\_\-client.c.

References parse\_\-symbols::f, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and tx\_\-event.\index{mf2\_\-client.c@{mf2\_\-client.c}!mf2\_\-client\_\-send@{mf2\_\-client\_\-send}}
\index{mf2\_\-client\_\-send@{mf2\_\-client\_\-send}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[mf2\_\-client\_\-send]{\setlength{\rightskip}{0pt plus 5cm}{\bf s08} mf2\_\-client\_\-send (char {\em c})}\label{mf2__client_8c_8072816c3243ec6c3d6e08a241029d41}




Definition at line 255 of file mf2\_\-client.c.

References clk\_\-0, IRQ\_\-LOCK, IRQ\_\-UNLOCK, mf2\_\-client\_\-ready(), MF2\_\-CLIENT\_\-STATE\_\-XMIT, PARITY\_\-BIT, and SCHEDULER\_\-UNIT.\index{mf2\_\-client.c@{mf2\_\-client.c}!SIGNAL@{SIGNAL}}
\index{SIGNAL@{SIGNAL}!mf2_client.c@{mf2\_\-client.c}}
\subsubsection[SIGNAL]{\setlength{\rightskip}{0pt plus 5cm}SIGNAL (MF2\_\-CLIENT\_\-INTERRUPT)}\label{mf2__client_8c_615324007a2c753f86a04047d7f6ba1c}




Definition at line 77 of file mf2\_\-client.c.

References clk\_\-0, clk\_\-Z, data\_\-0, data\_\-Z, MF2\_\-CLIENT\_\-STATE\_\-ACK, MF2\_\-CLIENT\_\-STATE\_\-IDLE, MF2\_\-CLIENT\_\-STATE\_\-RECV, MF2\_\-CLIENT\_\-STATE\_\-XMIT, PIN, rx\_\-event, scheduler\_\-del\_\-event(), SCHEDULER\_\-UNIT, tx\_\-event, and WATCHDOG\_\-TIMEOUT.