\section{Shutter}\label{ch:shutter}

An optional ``shutter'' can be enabled. When the shutter is ``closed'' triggers are vetoed and no triggers are sent. When the shutter is ``open'' triggers can be generated and sent to active DUTs.\\
The shutter cycle can either be started by an external signal or synchronized by a counter clocked by the system clock.\\
The external signal, if used, must be connected to one of the trigger inputs (i.e. of the the six the LEMO inputs).\\
\begin{alertinfo}{If the external signal is used, an appropriate threshold should be set to the corresponding input. The input used for synchronizing the shutter should not be used in the trigger mask.}  
\end{alertinfo} 
Figure~\ref{fig:shutter_timing} illustrates the timing of the shutter.\\
Behaviour of the shutter is controlled by the IPBus registers that can be configured using the configuration parameters described in table~\ref{tab:shutter_registers}.
\begin{figure}
  \centering
  \includegraphics[width=.95\textwidth]{./Images/aida-tlu-sitra-shutter-timing_02.pdf}
  \caption{Shutter Timing}
  \label{fig:shutter_timing}
\end{figure}
%\begin{table}
%	\begin{tabular}{lp{\0.6\linewidth}}
%	Register Name & Function \\ \hline
%	ControlRW & Bit-0 controls if shutter pulses are active. 1 = active. Bit-1 selects external synchronization (bit-1 = 0) or internal sequence (bit-1 = 1) \\
%	ShutterSelectRW & Selects which input is used to trigger shutter sequence.range = 0-5)\\
%	InternalShutterPeriodRW & Internal sequence period (when using internal sequence). Units of clock cycles.\\
%	ShutterOnTimeRW & Time between start of sequence and shutter asserted( t1) \\
%	ShutterVetoOffTimeRW & time between start of sequence and veto being de-asserted (t2)\\
%	ShutterOffTimeRW &  Time between start of sequence and time at which shutter de-asserted and veto reasserted(t3)\\
%	\end{tabular}
%	\caption{IPBus registers controlling behaviour of shutter.}
%	\label{tab:shutter_registers}
%\end{table}

\begin{landscape}
\begin{table}[]
\begin{tabular}{llll}
\textbf{\begin{tabular}[c]{@{}l@{}}CONFIGURATION\\ PARAMETER\end{tabular}} & \textbf{FUNCTION}                                                                                                                               & \multicolumn{1}{c}{\textbf{NOTE}}                                                   & \textbf{\begin{tabular}[c]{@{}l@{}}REGISTER \\ NAME\end{tabular}} \\ \hline
EnableShutterMode                                                          & \begin{tabular}[c]{@{}l@{}}If 1, shutter mode is enabled.\\ If 0, shutter mode is disabled.\end{tabular}                                        &                                                                                     & ControlRW                                                         \\ \hline
ShutterSource                                                              & Selects which input is used to trigger shutter sequence.                                                                                        & Range 0:5                                                                           & ShutterSelectRW                                                   \\ \hline
InternalShutterInterval                                                    & \begin{tabular}[c]{@{}l@{}}Internal shutter period when using internal sequence.\\ Set to 0 to not use internal shutter generator.\end{tabular} & \begin{tabular}[c]{@{}l@{}}32-bit vale.\\ Units of 25 ns clock cycles.\end{tabular} & InternalShutterPeriodRW                                           \\ \hline
ShutterOnTime                                                              & Time between start of sequence and shutter asserted (t$_{1}$)                                                                                   & \begin{tabular}[c]{@{}l@{}}32-bit vale.\\ Units of 25 ns clock cycles.\end{tabular} & ShutterOnTimeRW                                                   \\ \hline
ShutterVetoOffTime                                                         & Time between start of sequence and veto being de-asserted (t$_{2}$)                                                                             & \begin{tabular}[c]{@{}l@{}}32-bit vale.\\ Units of 25 ns clock cycles.\end{tabular} & ShutterVetoOffTimeRW                                              \\ \hline
ShutterOffTime                                                             & \begin{tabular}[c]{@{}l@{}}Time between start of sequence and time at which\\ shutter de-asserted and veto reasserted (t$_{3}$)\end{tabular}    & \begin{tabular}[c]{@{}l@{}}32-bit vale.\\ Units of 25 ns clock cycles.\end{tabular} & ShutterOffTimeRW                                                  \\ \hline
\end{tabular}
\caption{Configuration parameters and corresponding IPBus registers controlling behaviour of shutter.}
\label{tab:shutter_registers}
\end{table}
\end{landscape}



