documentation/ethercat_doc.tex
branchstable-1.4
changeset 1665 c2dae2d88d31
parent 1664 0fd56b9fbd38
child 1666 50d6e13984b6
equal deleted inserted replaced
1664:0fd56b9fbd38 1665:c2dae2d88d31
   301 The EtherCAT master is integrated into the Linux 2.6 kernel. This was
   301 The EtherCAT master is integrated into the Linux 2.6 kernel. This was
   302 an early design decision, which has been made for several reasons:
   302 an early design decision, which has been made for several reasons:
   303 
   303 
   304 \begin{itemize}
   304 \begin{itemize}
   305 
   305 
   306 \item Kernel code has significantly better realtime characteristics,
   306 \item Kernel code has significantly better realtime characteristics, i.\,e.\
   307 i.\,e.~less latency than userspace code. It was foreseeable, that a fieldbus
   307 less latency than userspace code. It was foreseeable, that a fieldbus master
   308 master has a lot of cyclic work to do. Cyclic work is usually triggered by
   308 has a lot of cyclic work to do. Cyclic work is usually triggered by timer
   309 timer interrupts inside the kernel. The execution delay of a function that
   309 interrupts inside the kernel. The execution delay of a function that processes
   310 processes timer interrupts is less, when it resides in kernelspace, because
   310 timer interrupts is less, when it resides in kernelspace, because there is no
   311 there is no need of time-consuming context switches to a userspace process.
   311 need of time-consuming context switches to a userspace process.
   312 
   312 
   313 \item It was also foreseeable, that the master code has to directly
   313 \item It was also foreseeable, that the master code has to directly
   314 communicate with the Ethernet hardware. This has to be done in the kernel
   314 communicate with the Ethernet hardware. This has to be done in the kernel
   315 anyway (through network device drivers), which is one more reason for the
   315 anyway (through network device drivers), which is one more reason for the
   316 master code being in kernelspace.
   316 master code being in kernelspace.
   821 \item[\usebox\boxopen] This function is called when network communication has
   821 \item[\usebox\boxopen] This function is called when network communication has
   822 to be started, for example after a command \lstinline+ip link set ethX up+
   822 to be started, for example after a command \lstinline+ip link set ethX up+
   823 from userspace. Frame reception has to be enabled by the driver.
   823 from userspace. Frame reception has to be enabled by the driver.
   824 
   824 
   825 \item[\usebox\boxstop] The purpose of this callback is to ``close'' the
   825 \item[\usebox\boxstop] The purpose of this callback is to ``close'' the
   826 device, i.~e. make the hardware stop receiving frames.
   826 device, i.\,e.\ make the hardware stop receiving frames.
   827 
   827 
   828 \item[\usebox\boxxmit] This function is called for each frame that has to be
   828 \item[\usebox\boxxmit] This function is called for each frame that has to be
   829 transmitted. The network stack passes the frame as a pointer to an
   829 transmitted. The network stack passes the frame as a pointer to an
   830 \lstinline+sk_buff+ structure (``socket buffer''\index{Socket buffer}, see
   830 \lstinline+sk_buff+ structure (``socket buffer''\index{Socket buffer}, see
   831 below), which has to be freed after sending.
   831 below), which has to be freed after sending.
  1407 
  1407 
  1408 The below sections describe every state machine used in the EtherCAT master.
  1408 The below sections describe every state machine used in the EtherCAT master.
  1409 The textual descriptions of the state machines contain references to the
  1409 The textual descriptions of the state machines contain references to the
  1410 transitions in the corresponding state transition diagrams, that are marked
  1410 transitions in the corresponding state transition diagrams, that are marked
  1411 with an arrow followed by the name of the successive state. Transitions caused
  1411 with an arrow followed by the name of the successive state. Transitions caused
  1412 by trivial error cases (i.~e. no response from slave) are not described
  1412 by trivial error cases (i.\,e.\ no response from slave) are not described
  1413 explicitly. These transitions are drawn as dashed arrows in the diagrams.
  1413 explicitly. These transitions are drawn as dashed arrows in the diagrams.
  1414 
  1414 
  1415 %------------------------------------------------------------------------------
  1415 %------------------------------------------------------------------------------
  1416 
  1416 
  1417 \section{The Master State Machine}
  1417 \section{The Master State Machine}
  1532 
  1532 
  1533 \item[Pdo Sync Manager Configuration] If any Pdo sync managers exist, they are
  1533 \item[Pdo Sync Manager Configuration] If any Pdo sync managers exist, they are
  1534 configured.
  1534 configured.
  1535 
  1535 
  1536 \item[FMMU Configuration] If there are FMMUs configurations supplied by the
  1536 \item[FMMU Configuration] If there are FMMUs configurations supplied by the
  1537 application (i.~e. if the application registered Pdo entries), they are
  1537 application (i.\,e.\ if the application registered Pdo entries), they are
  1538 applied. 
  1538 applied. 
  1539 
  1539 
  1540 \item[SAFEOP] The state change FSM is used to bring the slave to SAFEOP state.
  1540 \item[SAFEOP] The state change FSM is used to bring the slave to SAFEOP state.
  1541 If this is the requested state, the state machine is finished.
  1541 If this is the requested state, the state machine is finished.
  1542 
  1542 
  1564 \end{figure}
  1564 \end{figure}
  1565 
  1565 
  1566 \begin{description}
  1566 \begin{description}
  1567 
  1567 
  1568 \item[Start] The new application-layer state is requested via the ``AL Control
  1568 \item[Start] The new application-layer state is requested via the ``AL Control
  1569 Request'' register (see ~\cite[sec. 5.3.1]{alspec}).
  1569 Request'' register (see~\cite[sec. 5.3.1]{alspec}).
  1570 
  1570 
  1571 \item[Check for Response] Some slave need some time to respond to an AL state
  1571 \item[Check for Response] Some slave need some time to respond to an AL state
  1572 change command, and do not respond for some time. For this case, the command
  1572 change command, and do not respond for some time. For this case, the command
  1573 is issued again, until it is acknowledged.
  1573 is issued again, until it is acknowledged.
  1574 
  1574 
  2152 copied (or better: linked) to the appropriate location (see
  2152 copied (or better: linked) to the appropriate location (see
  2153 sec.~\ref{sec:installation}), before the master can be inserted as a service.
  2153 sec.~\ref{sec:installation}), before the master can be inserted as a service.
  2154 Please note, that the init script depends on the sysconfig file described
  2154 Please note, that the init script depends on the sysconfig file described
  2155 below.
  2155 below.
  2156 
  2156 
  2157 To provide service dependencies (i.~e. which services have to be started before
  2157 To provide service dependencies (i.\,e.\ which services have to be started
  2158 others) inside the init script code, LSB defines a special comment block.
  2158 before others) inside the init script code, LSB defines a special comment
  2159 System tools can extract this information to insert the EtherCAT init script at
  2159 block. System tools can extract this information to insert the EtherCAT init
  2160 the correct place in the startup sequence:
  2160 script at the correct place in the startup sequence:
  2161 
  2161 
  2162 \lstinputlisting[firstline=38,lastline=48]
  2162 \lstinputlisting[firstline=38,lastline=48]
  2163     {../script/init.d/ethercat}
  2163     {../script/init.d/ethercat}
  2164 
  2164 
  2165 \subsection{Sysconfig File}
  2165 \subsection{Sysconfig File}
  2597 
  2597 
  2598 \bibitem{gpl} GNU General Public License, Version 2.
  2598 \bibitem{gpl} GNU General Public License, Version 2.
  2599 \url{http://www.gnu.org/licenses/gpl-2.0.html}. October~15, 2008.
  2599 \url{http://www.gnu.org/licenses/gpl-2.0.html}. October~15, 2008.
  2600 
  2600 
  2601 \bibitem{lsb} Linux Standard Base.
  2601 \bibitem{lsb} Linux Standard Base.
  2602 \url{http://www.linuxfoundation.org/en/LSB}.  August~9, 2006.
  2602 \url{http://www.linuxfoundation.org/en/LSB}. August~9, 2006.
  2603 
  2603 
  2604 \bibitem{wireshark} Wireshark. \url{http://www.wireshark.org}. 2008.
  2604 \bibitem{wireshark} Wireshark. \url{http://www.wireshark.org}. 2008.
  2605 
  2605 
  2606 \bibitem{automata} {\it Hopcroft, J.~E. / Ullman, J.~D.}: Introduction to
  2606 \bibitem{automata} {\it Hopcroft, J.\,E.\ / Ullman, J.\,D.}: Introduction to
  2607 Automata Theory, Languages and Computation. Adison-Wesley, Reading,
  2607 Automata Theory, Languages and Computation. Adison-Wesley, Reading,
  2608 Mass.~1979.
  2608 Mass.~1979.
  2609 
  2609 
  2610 \bibitem{fsmmis} {\it Wagner, F. / Wolstenholme, P.}: State machine
  2610 \bibitem{fsmmis} {\it Wagner, F.\ / Wolstenholme, P.}: State machine
  2611 misunderstandings. In: IEE journal ``Computing and Control Engineering'',
  2611 misunderstandings. In: IEE journal ``Computing and Control Engineering'',
  2612 2004.
  2612 2004.
  2613 
  2613 
  2614 \bibitem{rtai} RTAI. The RealTime Application Interface for Linux from DIAPM.
  2614 \bibitem{rtai} RTAI. The RealTime Application Interface for Linux from DIAPM.
  2615 \url{http://www.rtai.org}, 2006.
  2615 \url{http://www.rtai.org}, 2006.