\hypertarget{timers__unix_8c}{
\section{/home/epimerde/documents/tc11/Can\-Festival-3/drivers/timers\_\-unix/timers\_\-unix.c File Reference}
\label{timers__unix_8c}\index{/home/epimerde/documents/tc11/CanFestival-3/drivers/timers_unix/timers_unix.c@{/home/epimerde/documents/tc11/CanFestival-3/drivers/timers\_\-unix/timers\_\-unix.c}}
}
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$sys/time.h$>$}\par
{\tt \#include $<$pthread.h$>$}\par
{\tt \#include $<$signal.h$>$}\par
{\tt \#include \char`\"{}applicfg.h\char`\"{}}\par
{\tt \#include \char`\"{}timer.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{timers__unix_8c_016587a4d6fc754357c47c9df9f0bde4}{maxval}(a, b)~((a$>$b)?a:b)
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{timers__unix_8c_d7fee43b8a44cf8b7036853593044037}{Enter\-Mutex} (void)
\item 
void \hyperlink{timers__unix_8c_73d9a4eb941fb20cf6b597840510394b}{Leave\-Mutex} (void)
\item 
void \hyperlink{timers__unix_8c_4cd19302f57b08fc0403a05017332735}{timer\_\-notify} (sigval\_\-t val)
\item 
void \hyperlink{timers__unix_8c_02922529b60419a94afe8f369dda070b}{init\-Timer} (void)
\item 
void \hyperlink{timers__unix_8c_8758484f3cebb0cd44bb247c3f23d5e3}{Stop\-Timer\-Loop} (void)
\item 
void \hyperlink{timers__unix_8c_c9e1731843825eb55e7a94894e6a8ec5}{Start\-Timer\-Loop} (\hyperlink{timer_8h_f7d102e060339d3730ceae5fea03691b}{Timer\-Callback\_\-t} init\_\-callback)
\item 
void \hyperlink{timers__unix_8c_a3a7df911baa20b01c4374a9677a154a}{Create\-Receive\-Task} (\hyperlink{win32_2applicfg_8h_7ef59f941603c6680e74fc335523f17e}{CAN\_\-PORT} port, TASK\_\-HANDLE $\ast$Thread, void $\ast$Receive\-Loop\-Ptr)
\item 
void \hyperlink{timers__unix_8c_4b2486891ee01e06e2deead4cf963727}{Wait\-Receive\-Task\-End} (TASK\_\-HANDLE Thread)
\item 
void \hyperlink{timers__unix_8c_b8d05dee70f04b5c5190ab00e84da106}{set\-Timer} (TIMEVAL value)
\item 
TIMEVAL \hyperlink{timers__unix_8c_4dccc204d52176bd547ab34d6858f5ba}{get\-Elapsed\-Time} (void)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
pthread\_\-mutex\_\-t \hyperlink{timers__unix_8c_93ad8a5a5e353192bfa45ae850df337f}{Can\-Festival\_\-mutex} = PTHREAD\_\-MUTEX\_\-INITIALIZER
\item 
TASK\_\-HANDLE \hyperlink{timers__unix_8c_ef197e4f64855d2ac4ccbc40595d6bdd}{Timer\-Loop\-Thread}
\item 
TIMEVAL \hyperlink{timers__unix_8c_9b886230a6b35bdd1532a27ee7400d10}{last\_\-time\_\-set} = TIMEVAL\_\-MAX
\item 
timeval \hyperlink{timers__unix_8c_bcf9307062fc6f0a7906547a892e38df}{last\_\-sig}
\item 
timer\_\-t \hyperlink{timers__unix_8c_1a1e2de3a80567484c9b4d4f20d5a3d0}{timer}
\end{CompactItemize}


\subsection{Define Documentation}
\hypertarget{timers__unix_8c_016587a4d6fc754357c47c9df9f0bde4}{
\index{timers_unix.c@{timers\_\-unix.c}!maxval@{maxval}}
\index{maxval@{maxval}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[maxval]{\setlength{\rightskip}{0pt plus 5cm}\#define maxval(a, b)~((a$>$b)?a:b)}}
\label{timers__unix_8c_016587a4d6fc754357c47c9df9f0bde4}




Definition at line 82 of file timers\_\-unix.c.

\subsection{Function Documentation}
\hypertarget{timers__unix_8c_a3a7df911baa20b01c4374a9677a154a}{
\index{timers_unix.c@{timers\_\-unix.c}!CreateReceiveTask@{CreateReceiveTask}}
\index{CreateReceiveTask@{CreateReceiveTask}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[CreateReceiveTask]{\setlength{\rightskip}{0pt plus 5cm}void Create\-Receive\-Task (\hyperlink{win32_2applicfg_8h_7ef59f941603c6680e74fc335523f17e}{CAN\_\-PORT} {\em port}, TASK\_\-HANDLE $\ast$ {\em Thread}, void $\ast$ {\em Receive\-Loop\-Ptr})}}
\label{timers__unix_8c_a3a7df911baa20b01c4374a9677a154a}




Definition at line 71 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_d7fee43b8a44cf8b7036853593044037}{
\index{timers_unix.c@{timers\_\-unix.c}!EnterMutex@{EnterMutex}}
\index{EnterMutex@{EnterMutex}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[EnterMutex]{\setlength{\rightskip}{0pt plus 5cm}void Enter\-Mutex (void)}}
\label{timers__unix_8c_d7fee43b8a44cf8b7036853593044037}




Definition at line 20 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_4dccc204d52176bd547ab34d6858f5ba}{
\index{timers_unix.c@{timers\_\-unix.c}!getElapsedTime@{getElapsedTime}}
\index{getElapsedTime@{getElapsedTime}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[getElapsedTime]{\setlength{\rightskip}{0pt plus 5cm}TIMEVAL get\-Elapsed\-Time (void)}}
\label{timers__unix_8c_4dccc204d52176bd547ab34d6858f5ba}




Definition at line 98 of file timers\_\-unix.c.

References last\_\-sig.\hypertarget{timers__unix_8c_02922529b60419a94afe8f369dda070b}{
\index{timers_unix.c@{timers\_\-unix.c}!initTimer@{initTimer}}
\index{initTimer@{initTimer}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[initTimer]{\setlength{\rightskip}{0pt plus 5cm}void init\-Timer (void)}}
\label{timers__unix_8c_02922529b60419a94afe8f369dda070b}




Definition at line 39 of file timers\_\-unix.c.

References IO\_\-PORTS\_\-8, last\_\-sig, lock(), TCTL1, TIE, timer, timer\_\-notify(), TIOS, TSCR1, TSCR2, and unlock().\hypertarget{timers__unix_8c_73d9a4eb941fb20cf6b597840510394b}{
\index{timers_unix.c@{timers\_\-unix.c}!LeaveMutex@{LeaveMutex}}
\index{LeaveMutex@{LeaveMutex}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[LeaveMutex]{\setlength{\rightskip}{0pt plus 5cm}void Leave\-Mutex (void)}}
\label{timers__unix_8c_73d9a4eb941fb20cf6b597840510394b}




Definition at line 25 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_b8d05dee70f04b5c5190ab00e84da106}{
\index{timers_unix.c@{timers\_\-unix.c}!setTimer@{setTimer}}
\index{setTimer@{setTimer}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[setTimer]{\setlength{\rightskip}{0pt plus 5cm}void set\-Timer (TIMEVAL {\em value})}}
\label{timers__unix_8c_b8d05dee70f04b5c5190ab00e84da106}




Definition at line 83 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_c9e1731843825eb55e7a94894e6a8ec5}{
\index{timers_unix.c@{timers\_\-unix.c}!StartTimerLoop@{StartTimerLoop}}
\index{StartTimerLoop@{StartTimerLoop}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[StartTimerLoop]{\setlength{\rightskip}{0pt plus 5cm}void Start\-Timer\-Loop (\hyperlink{timer_8h_f7d102e060339d3730ceae5fea03691b}{Timer\-Callback\_\-t} {\em init\_\-callback})}}
\label{timers__unix_8c_c9e1731843825eb55e7a94894e6a8ec5}




Definition at line 62 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_8758484f3cebb0cd44bb247c3f23d5e3}{
\index{timers_unix.c@{timers\_\-unix.c}!StopTimerLoop@{StopTimerLoop}}
\index{StopTimerLoop@{StopTimerLoop}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[StopTimerLoop]{\setlength{\rightskip}{0pt plus 5cm}void Stop\-Timer\-Loop (void)}}
\label{timers__unix_8c_8758484f3cebb0cd44bb247c3f23d5e3}




Definition at line 55 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_4cd19302f57b08fc0403a05017332735}{
\index{timers_unix.c@{timers\_\-unix.c}!timer_notify@{timer\_\-notify}}
\index{timer_notify@{timer\_\-notify}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[timer\_\-notify]{\setlength{\rightskip}{0pt plus 5cm}void timer\_\-notify (sigval\_\-t {\em val})}}
\label{timers__unix_8c_4cd19302f57b08fc0403a05017332735}




Definition at line 30 of file timers\_\-unix.c.

References Enter\-Mutex(), last\_\-sig, Leave\-Mutex(), and Time\-Dispatch().\hypertarget{timers__unix_8c_4b2486891ee01e06e2deead4cf963727}{
\index{timers_unix.c@{timers\_\-unix.c}!WaitReceiveTaskEnd@{WaitReceiveTaskEnd}}
\index{WaitReceiveTaskEnd@{WaitReceiveTaskEnd}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[WaitReceiveTaskEnd]{\setlength{\rightskip}{0pt plus 5cm}void Wait\-Receive\-Task\-End (TASK\_\-HANDLE {\em Thread})}}
\label{timers__unix_8c_4b2486891ee01e06e2deead4cf963727}




Definition at line 76 of file timers\_\-unix.c.

\subsection{Variable Documentation}
\hypertarget{timers__unix_8c_93ad8a5a5e353192bfa45ae850df337f}{
\index{timers_unix.c@{timers\_\-unix.c}!CanFestival_mutex@{CanFestival\_\-mutex}}
\index{CanFestival_mutex@{CanFestival\_\-mutex}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[CanFestival\_\-mutex]{\setlength{\rightskip}{0pt plus 5cm}pthread\_\-mutex\_\-t \hyperlink{timers__xeno_8c_b6ebfe5bfc980bae026866758af3a7ff}{Can\-Festival\_\-mutex} = PTHREAD\_\-MUTEX\_\-INITIALIZER}}
\label{timers__unix_8c_93ad8a5a5e353192bfa45ae850df337f}




Definition at line 10 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_bcf9307062fc6f0a7906547a892e38df}{
\index{timers_unix.c@{timers\_\-unix.c}!last_sig@{last\_\-sig}}
\index{last_sig@{last\_\-sig}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[last\_\-sig]{\setlength{\rightskip}{0pt plus 5cm}struct timeval \hyperlink{timers__unix_8c_bcf9307062fc6f0a7906547a892e38df}{last\_\-sig}}}
\label{timers__unix_8c_bcf9307062fc6f0a7906547a892e38df}




Definition at line 16 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_9b886230a6b35bdd1532a27ee7400d10}{
\index{timers_unix.c@{timers\_\-unix.c}!last_time_set@{last\_\-time\_\-set}}
\index{last_time_set@{last\_\-time\_\-set}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[last\_\-time\_\-set]{\setlength{\rightskip}{0pt plus 5cm}TIMEVAL \hyperlink{timers__unix_8c_9b886230a6b35bdd1532a27ee7400d10}{last\_\-time\_\-set} = TIMEVAL\_\-MAX}}
\label{timers__unix_8c_9b886230a6b35bdd1532a27ee7400d10}




Definition at line 14 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_1a1e2de3a80567484c9b4d4f20d5a3d0}{
\index{timers_unix.c@{timers\_\-unix.c}!timer@{timer}}
\index{timer@{timer}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[timer]{\setlength{\rightskip}{0pt plus 5cm}timer\_\-t \hyperlink{timers__unix_8c_1a1e2de3a80567484c9b4d4f20d5a3d0}{timer}}}
\label{timers__unix_8c_1a1e2de3a80567484c9b4d4f20d5a3d0}




Definition at line 18 of file timers\_\-unix.c.\hypertarget{timers__unix_8c_ef197e4f64855d2ac4ccbc40595d6bdd}{
\index{timers_unix.c@{timers\_\-unix.c}!TimerLoopThread@{TimerLoopThread}}
\index{TimerLoopThread@{TimerLoopThread}!timers_unix.c@{timers\_\-unix.c}}
\subsubsection[TimerLoopThread]{\setlength{\rightskip}{0pt plus 5cm}TASK\_\-HANDLE \hyperlink{timers__unix_8c_ef197e4f64855d2ac4ccbc40595d6bdd}{Timer\-Loop\-Thread}}}
\label{timers__unix_8c_ef197e4f64855d2ac4ccbc40595d6bdd}




Definition at line 12 of file timers\_\-unix.c.