author | Florian Pose <fp@igh-essen.com> |
Tue, 13 Feb 2007 14:15:13 +0000 | |
branch | stable-1.2 |
changeset 1741 | 5eb7bed96194 |
parent 1732 | 1cc865ba17c2 |
permissions | -rw-r--r-- |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
% |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
% IgH EtherCAT Master Documentation |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
% |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
% $Id$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
% |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
\documentclass[a4paper,12pt,BCOR6mm,bibtotoc,idxtotoc]{scrbook} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
\usepackage[latin1]{inputenc} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
\usepackage[automark,headsepline]{scrpage2} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
\usepackage{graphicx} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
\usepackage{makeidx} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
\usepackage[refpage]{nomencl} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
\usepackage{listings} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
\usepackage{svn} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
\usepackage{textcomp} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
\usepackage{url} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
\usepackage[pdfpagelabels,plainpages=false]{hyperref} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
\setlength{\parskip}{0.8ex plus 0.8ex minus 0.5ex} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
\setlength{\parindent}{0mm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
\setcounter{secnumdepth}{\subsubsectionlevel} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
\DeclareFontShape{OT1}{cmtt}{bx}{n} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
<5><6><7><8><9><10><10.95><12><14.4><17.28><20.74><24.88>cmttb10 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
}{} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
\lstset{basicstyle=\ttfamily\small,numberstyle=\tiny,aboveskip=4mm, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
belowskip=2mm,gobble=2,escapechar=`} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
\renewcommand\lstlistlistingname{List of Listings} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
\renewcommand\nomname{Glossary} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
\newcommand{\IgH}{\raisebox{-0.7667ex} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
{\includegraphics[height=2.2ex]{images/ighsign}}} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
\SVN $Date$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
\SVN $Revision$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
|
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
44 |
\newcommand{\masterversion}{1.1.1} |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
45 |
|
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
\makeindex |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
\makeglossary |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
\begin{document} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
\pagenumbering{roman} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
\pagestyle{empty} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
\begin{titlepage} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
\begin{center} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
\rule{\textwidth}{1.5mm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
{\Huge\bf IgH \includegraphics[height=2.4ex]{images/ethercat} |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
61 |
Master \masterversion\\[1ex] |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
Documentation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
\vspace{1ex} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
\rule{\textwidth}{1.5mm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
\vspace{\fill} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
{\Large Florian Pose, \url{fp@igh-essen.com}\\[1ex] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
Ingenieurgemeinschaft \IgH} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
\vspace{\fill} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
{\Large Essen, \SVNDate\\[1ex] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
Revision \SVNRevision} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
\end{center} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
\end{titlepage} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
\tableofcontents |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
\listoftables |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
\listoffigures |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
\lstlistoflistings |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
\newpage |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
\pagestyle{scrheadings} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
\section*{Conventions} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
\addcontentsline{toc}{section}{Conventions} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
\markleft{Conventions} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
The following typographic conventions are used: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
\item \textit{Italic face} is used for newly introduced terms, file |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
names, parameter names and in-text source code elements. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
\item \texttt{Typewriter face} is used for code examples and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
command line output. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
\item \texttt{\textbf{Bold typewriter face}} is used for user input in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
command lines. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
Data values and addresses are specified as hexadecimal values with the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
prefix 0x. Example: 0x88A4. Unless otherwise noted, address values are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
specified as byte addresses. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
Concerning bit operations, the phrase ``setting a bit'', stands for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
setting the bit to $1$, ``clearing a bit'' means setting it to $0$, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
respectively. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
Function names are always printed with parentheses, but without |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
parameters. So, if a function \textit{ecrt\_request\_master()} has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
empty parentheses, this does not mean, that it has no parameters. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
If shell commands have to be entered, this is marked by a prompt: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
\begin{lstlisting}[gobble=2] |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
119 |
`\$` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
Further, if a shell command has to be entered as the superuser, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
prompt ends with a mesh: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
\begin{lstlisting}[gobble=2] |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
126 |
# |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
\chapter{The IgH EtherCAT Master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
\label{chapter:master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
\pagenumbering{arabic} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
This section will first introduce the master's general features and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
the concepts used for master development and will then explain the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
master's general architecture and offer details of the different |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
modules. In addition, it will cover state machine definitions, mailbox |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
protocol implementation and the user space interface. The last section |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
will deal with timing aspects. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
\section{Feature Summary} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
\label{sec:summary} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
\index{Master!Features} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
The list below gives a short summary of the features of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
implemented EtherCAT master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
\item The master runs as a kernel module for Linux 2.6. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
\item It comes with EtherCAT-capable network driver for RealTek |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
RTL8139 (and compatible) network interface cards. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
\item The Ethernet hardware is operated without interrupts. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
\item Drivers for additional Ethernet hardware can easily be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
implemented due to a common device interface provided by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
\item The master module supports multiple EtherCAT masters on one |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
machine. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
\item The master code supports any Linux realtime extension through |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
its independent architecture. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
\item RTAI\nomenclature{RTAI}{RealTime Application Interface}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
ADEOS\nomenclature{ADEOS}{Adaptive Domain Environment for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
Operating Systems}, etc. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
\item It runs well even without realtime extensions. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
\item Common ``realtime interface'' for modules, that want to use |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
EtherCAT functionality. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
\item Synchronous and asynchronous sending and receiving of frames |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
is supported. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
\item Avoidance of unnecessary copy operations for process data. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
\item \textit{Domains} are introduced, to allow grouping of process |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
data objects. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
\item Handling of multiple domains with different sampling rates. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
\item Automatic calculation of process data mapping, FMMU and sync manager |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
configuration within each domain. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
\item Communication through serveral finite state machines. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
\item Bus monitoring possible during realtime operation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
\item Automatic reconfiguration of slaves on bus power failure |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
during realtime operation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
\item Controlling of single slaves during realtime operation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
\item Master idle mode. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
\item Automatic scanning of slaves upon topology changes. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
\item Bus visualisation and EoE processing without a realtime module |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
connected. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
\item Implementation of the CANopen-over-EtherCAT (CoE) protocol. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
\item Configuration of CoE-capable slaves via SDO interface. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
\item Implementation of the Ethernet-over-EtherCAT (EoE) protocol. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
\item Each master creates virtual network devices that are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
automatically coupled to EoE-cap\-able slaves found. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
\item This implementation natively supports either a switched or a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
routed EoE network architecture. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
\item User space interface via the System Filesystem |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
(Sysfs)\nomenclature{Sysfs}{System Filesystem}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
\item User space tool for bus visualisation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
\item Slave E$^2$PROM image reading and writing. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
\item Seamless system integration though LSB\nomenclature{LSB}{Linux |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
Standard Base} compliance. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
\item Master and network device configuration via Sysconfig files. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
\item Linux Standard Base compatible init script for master control. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
\item Virtual read-only network interface for monitoring and debugging |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
purposes. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
\section{License} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
\label{sec:license} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
The master code is released under the terms and conditions of the GNU |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
General Public License\index{GPL} \cite{gpl} (version 2). Other |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
developers, that want to use EtherCAT with Linux systems, are invited |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
to use the master code or even participate on development. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
\section{General Master Architecture} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
\label{sec:masterarch} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
\index{Master!Architecture} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
The EtherCAT master is integrated into the Linux 2.6 kernel. This was |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
an early design decision, which has been made for serveral reasons: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
\item Kernel code has significantly better realtime characteristics, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
i.~e. less jitter than user space code. It was foreseeable, that a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
fieldbus master has a lot of cyclic work to do. Cyclic work is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
usually triggered by timer interrupts inside the kernel. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
execution delay of a function that processes timer interrupts is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
less, when it resides in kernel space, because there is no need of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
time-consuming context switches to a user space process. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
\item It was also foreseeable, that the master code has to directly |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
communicate with the Ethernet hardware. This has to be done in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
kernel anyway (through network device drivers), which is one more |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
reason for the master code being in kernel space. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
A general overview of the master architecture can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
figure~\ref{fig:masterarch}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
\includegraphics[width=.9\textwidth]{images/masterarch} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
\caption{Master architecture} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
\label{fig:masterarch} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
\paragraph{Master Module} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
\index{Master module} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
The EtherCAT master mainly consists of the master module, containing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
one or more EtherCAT masters (section~\ref{sec:mastermod}), the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
``Device Interface'' (section~\ref{sec:ecdev}) and the ``Realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
Interface'' (section~\ref{sec:ecrt}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
\paragraph{Device Modules} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
\index{Device modules} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
Furthermore there are EtherCAT-capable network device driver |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
modules\index{Device modules}, that connect to the EtherCAT master via |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
the device interface. These modified network drivers can handle both |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
network devices used for EtherCAT operation and ``normal'' Ethernet |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
devices. The common case is, that the master module offers a single |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
EtherCAT master: An EtherCAT-capable network device driver module |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
connects one network device to this master, that is now able to send |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
and receive EtherCAT frames, while all other network devices handled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
by the network driver get connected to the kernel's network stack as |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
usual. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
\paragraph{Realtime Modules} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
A ``realtime module''\index{Realtime module} is a kernel module, that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
uses the EtherCAT master for cyclic exchange of process data with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
EtherCAT slaves. Realtime modules are not part of the EtherCAT master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
code\footnote{Although there are serveral examples provided in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
\textit{examples} directory, see chapter~\ref{chapter:usage} for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
more information}, so anybody wanting to use the master has to write |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
one. A realtime module can ``request'' a master through the realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
interface. If this succeeds, the module has the control over the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
master. It can now configure slaves and set up a process data image |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
(see section~\ref{sec:processdata}) for cyclic exchange. This cyclic |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
code has to be provided by the realtime module, so it is in hands of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
the developer, which mechanism to use for this. Moreover he has to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
decide, whether or not using a Linux realtime extension. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
\paragraph{Why ``Realtime'' Module?} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
The name shall not imply, that a linux realtime extension is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
mandatory: The master runs well even without realtime extensions, as |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
section~\ref{sec:mini} shows. However, the code using the master is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
time-critical, because process data IO has to be done in cyclic work. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
Some EtherCAT slaves support watchdog units, that stop driving the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
outputs when process data was not exchanged for some time. So the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
names ``realtime interface'' and ``realtime module'' are quite |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
appropriate. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
\subsection{Handling of Process Data} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
\label{sec:processdata} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
\paragraph{Process Data Image} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
\index{Process data} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
The slaves offer their inputs and outputs by presenting the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
so-called ``Process Data Objects'' (PDOs\index{PDO}). The available |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
PDOs can be determined by reading out the slave's TXPDO and RXPDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
E$^2$PROM categories. The realtime module can register the PDOs for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
data exchange during cyclic operation. The sum of all registered PDOs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
defines the ``process data image'', which is exchanged via the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
``Logical ReadWrite'' datagrams introduced |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
in~\cite[section~5.4.2.4]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
\paragraph{Process Data Domains} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
\index{Domain} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
The process data image can be easily managed by creating co-called |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
``domains'', which group PDOs and allocate the datagrams needed to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
exchange them. Domains are mandatory for process data exchange, so |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
there has to be at least one. They were introduced for the following |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
reasons: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
\item The maximum size of a ``Logical ReadWrite'' datagram is limited |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
due to the limited size of an Ethernet frame: The maximum data size |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
is the Ethernet data field size minus the EtherCAT frame header, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
EtherCAT datagram header and EtherCAT datagram footer: $1500 - 2 - |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
12 - 2 = 1484$ octets. If the size of the process data image exceeds |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
this limit, multiple frames have to be sent, and the image has to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
partitioned for the use of multiple datagrams. A domain manages this |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
automatically. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
\item Not every PDO has to be exchanged with the same frequency: The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
values of PDOs can vary slowly over time (for example temperature |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
values), so exchanging them with a high frequency would just waste |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
bus bandwidth. For this reason, multiple domains can be created, to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
group different PDOs and so allow separate exchange. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
There is no upper limit for the number of domains, but each domain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
occupies one FMMU in each slave involved, so the maximum number of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
domains is also limited by the slaves' capabilities. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
\paragraph{FMMU Configuration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
\index{FMMU!Configuration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
A realtime module can register PDOs for process data exchange. Every |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
PDO is part of a memory area in the slave's physical memory, that is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
protected by a sync manager \cite[section~6.7]{dlspec} for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
synchronized access. In order to make a sync manager react on a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
datagram accessing its memory, it is necessary to access the last byte |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
covered by the sync manager. Otherwise the sync manager will not react |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
on the datagram and no data will be exchanged. That is why the whole |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
synchronized memory area has to be included into the process data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
image: For example, if a certain PDO of a slave is registered for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
exchange with a certain domain, one FMMU will be configured to map the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
complete sync-manager-protected memory, the PDO resides in. If a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
second PDO of the same slave is registered for process data exchange |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
within the same domain, and this PDO resides in the same |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
sync-manager-protected memory as the first PDO, the FMMU configuration |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
is not touched, because the appropriate memory is already part of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
domain's process data image. If the second PDO belongs to another |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
sync-manager-protected area, this complete area is also included into |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
the domains process data image. See figure~\ref{fig:fmmus} for an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
overview, how FMMU's are configured to map physical memory to logical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
process data images. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
\includegraphics[width=\textwidth]{images/fmmus} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
\caption{FMMU configuration for serveral domains} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
\label{fig:fmmus} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
\paragraph{Process Data Pointers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
The figure also demonstrates the way, the realtime module can access the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
exchanged process data: At PDO registration, the realtime module has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
to provide the address of a process data pointer. Upon calculation of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
the domain image and allocation of process data memory, this pointer |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
is redirected to the appropriate location inside the domain's process |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
data memory and can later be easily dereferenced by the module code. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
\subsection{Operation Modes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
\index{Master modes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
The EtherCAT master has serveral modes of operation: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
\item[Orphaned Mode] This mode takes effect, when the master has no |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
EtherCAT-capable network device connected. No bus communication is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
possible, so this mode is not of further interest. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
\item[Idle Mode]\index{Idle mode} takes effect when the master is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
unused (i.~e. there is no realtime module, that reserved the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
master). In this case, the master has the ability to scan the bus by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
itsself and generously allow bus access from user space. This mode |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
is meant for maintenance and visualisation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
\item[Operation Mode]\index{Operation mode} The master is reserved for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
exclusive access by a realtime module. In this mode, the master is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
adjusted for availability and monitoring. Access from user space is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
very restrictive and mostly limited to reading direction. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
Figure~\ref{fig:modes} shows the three modes and the possible mode |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
transitions. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
\includegraphics[width=.9\textwidth]{images/modes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
\caption{Master modes and transitions} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
\label{fig:modes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
\subsubsection{Idle Mode} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
\index{Idle mode} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
The master enters idle mode upon connection of a device module (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
section~\ref{sec:device}) or releasing by a realtime module. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
master owns a kernel workqueue and a suitable work structure, which is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
used to cyclically process the ``Idle state machine'' (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
section~\ref{sec:fsm-idle}). This state machine automatically scans |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
the bus for slaves (and re-scans upon topology changes), configures |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
slaves for idle operation and executes pending operations from the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
user space interface (for example E$^2$PROM writing). On device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
disconnection or realtime request, the idle mode is stopped by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
cancelling the work and flushing the workqueue. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
\subsubsection{Operation Mode} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
\index{Operation mode} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
Operation mode is entered when a realtime module requests the master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
The idle mode is stopped and the bus is scanned by getting the number |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
of slaves and executing the ``Slave scan state machine'' (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
section~\ref{sec:fsm-scan}) for each slave. The master is now ready to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
create domains and accept PDO registrations and slave configurations. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
After that, cyclic communication can be done by the realtime module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
\paragraph{Master Phases} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
Every realtime module should use the master in three phases: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
\begin{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
\item \textit{Startup} - The master is requested and the bus is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
validated. Domains are created and PDOs are registered. Slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
configurations are applied. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
\item \textit{Operation} - Cyclic code is run, process data is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
exchanged and the master state machine is executed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
\item \textit{Shutdown} - Cyclic code is stopped and the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
is released. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
\end{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
\section{Device Modules} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
\label{sec:device} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
\index{Device modules} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
Device modules are network device driver modules that handle Ethernet |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
devices, which the master can use to connect to an EtherCAT bus. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
Section~\ref{sec:networkdrivers} offers an overview of general Linux |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
network driver modules, while section~\ref{sec:requirements} will show |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
the requirements to an EtherCAT-enabled network driver. Finally, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
sections~\ref{sec:seldev} to~\ref{sec:patching} show how to fulfill |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
these requirements and implement such a driver module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
\subsection{Network Driver Basics} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
\label{sec:networkdrivers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
\index{Network drivers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
EtherCAT relies on Ethernet hardware and the master needs a physical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
Ethernet device to communicate with the bus. Therefore it is necessary |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
to understand how Linux handles network devices and their drivers, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
respectively. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
\paragraph{Tasks of a Network Driver} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
Network device drivers handle the lower two layers of the OSI model, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
that is the physical layer and the data-link layer. A network device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
itself natively handles the physical layer issues: It represents the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
hardware to connect to the medium and to send and receive data in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
way, the physical layer protocol describes. The network device driver |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
is responsible for getting data from the kernel's networking stack and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
forwarding it to the hardware, that does the physical transmission. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
If data is received by the hardware respectively, the driver is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
notified (usually by means of an interrupt) and has to read the data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
from the hardware memory and forward it to the network stack. There |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
are a few more tasks, a network device driver has to handle, including |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
queue control, statistics and device dependent features. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
\paragraph{Driver Startup} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
Usually, a driver searches for compatible devices on module loading. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
For PCI drivers, this is done by scanning the PCI bus and checking for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
known device IDs. If a device is found, data structures are allocated |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
and the device is taken into operation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
\paragraph{Interrupt Operation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
\index{Interrupt} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
A network device usually provides a hardware interrupt that is used to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
notify the driver of received frames and success of transmittion, or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
errors, respectively. The driver has to register an interrupt service |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
routine (ISR\index{ISR}\nomenclature{ISR}{Interrupt Service Routine}), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
that is executed each time, the hardware signals such an event. If the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
interrupt was thrown by the own device (multiple devices can share one |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
hardware interrupt), the reason for the interrupt has to be determined |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
by reading the device's interrupt register. For example, if the flag |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
for received frames is set, frame data has to be copied from hardware |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
to kernel memory and passed to the network stack. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
\paragraph{The net\_device structure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
\index{net\_device} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
The driver registers a \textit{net\_device} structure for each device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
to communicate with the network stack and to create a ``network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
interface''. In case of an Ethernet driver, this interface appears as |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
\textit{ethX}, where X is a number assigned by the kernel on |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
registration. The \textit{net\_device} structure receives events |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
(either from user space or from the network stack) via serveral |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
callbacks, which have to be set before registration. Not every |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
callback is mandatory, but for reasonable operation the ones below are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
needed in any case: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
\item[int (*open)(struct net\_device *)] This function is called when |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
network communication has to be started, for example after a command |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
\textit{ifconfig ethX up} from user space. Frame reception has to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
enabled by the driver. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
\item[int (*stop)(struct net\_device *)] The purpose of this callback |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
is to ``close'' the device, i.~e. make the hardware stop receiving |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
frames. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
\item[int (*hard\_start\_xmit)(struct sk\_buff *, struct net\_device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
*)] This function is cal\-led for each frame that has to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
transmitted. The network stack passes the frame as a pointer to an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
\textit{sk\_buff} structure (``socket buffer''\index{Socket buffer}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
see below), which has to be freed after sending. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
\item[struct net\_device\_stats *(*get\_stats)(struct net\_device *)] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
This call has to return a pointer to the device's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
\textit{net\_device\_stats} structure, which permanently has to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
filled with frame statistics. This means, that everytime a frame is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
received, sent, or an error happened, the appropriate counter in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
this structure has to be increased. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
The actual registration is done with the \textit{register\_netdev()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
call, unregistering is done with \textit{unregister\_netdev()}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
\paragraph{The netif Interface} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
\index{netif} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
All other communication in the direction interface $\to$ network stack |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
is done via the \textit{netif\_*} calls. For example, on successful |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
device opening, the network stack has to be notified, that it can now |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
pass frames to the interface. This is done by calling |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
\textit{netif\_start\_queue()}. After this call, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
\textit{hard\_start\_xmit()} callback can be called by the network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
stack. Furthermore a network driver usually manages a frame |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
transmission queue. If this gets filled up, the network stack has to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
be told to stop passing further frames for a while. This happens with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
a call to \textit{netif\_stop\_queue()}. If some frames have been |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
sent, and there is enough space again to queue new frames, this can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
notified with \textit{netif\_wake\_queue()}. Another important call is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
\textit{netif\_receive\_skb()}\footnote{This function is part of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
NAPI (``New API''), that replaces the ``old'' kernel 2.4 technique |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
for interfacing to the network stack (with \textit{netif\_rx()}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
NAPI is a technique to improve network performance on Linux. Read |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
more in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
http://www.cyberus.ca/\textasciitilde{}hadi/usenix-paper.tgz}: It |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
passes a frame to the network stack, that was just received by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
device. Frame data has to be packed into a so-called ``socket |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
buffer'' for that (see below). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
\paragraph{Socket Buffers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
\index{Socket buffer} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
Socket buffers are the basic data type for the whole network stack. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
They serve as containers for network data and are able to quickly add |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
data headers and footers, or strip them off again. Therefore a socket |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
buffer consists of an allocated buffer and serveral pointers that mark |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
beginning of the buffer (\textit{head}), beginning of data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
(\textit{data}), end of data (\textit{tail}) and end of buffer |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
(\textit{end}). In addition, a socket buffer holds network header |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
information and (in case of received data) a pointer to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
\textit{net\_device}, it was received on. There exist functions that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
create a socket buffer (\textit{dev\_alloc\_skb()}), add data either |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
from front (\textit{skb\_push()}) or back (\textit{skb\_put()}), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
remove data from front (\textit{skb\_pull()}) or back |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
(\textit{skb\_trim()}), or delete the buffer (\textit{kfree\_skb()}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
A socket buffer is passed from layer to layer, and is freed by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
layer that uses it the last time. In case of sending, freeing has to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
be done by the network driver. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
\subsection{EtherCAT Network Drivers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
\label{sec:requirements} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
There are a few requirements for Ethernet network devices to function |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
as EtherCAT devices, when connected to an EtherCAT bus. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
\paragraph{Dedicated Interfaces} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
For performance and realtime purposes, the EtherCAT master needs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
direct and exclusive access to the Ethernet hardware. This implies |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
that the network device must not be connected to the kernel's network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
stack as usual, because the kernel would try to use it as an ordinary |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
Ethernet device. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
\paragraph{Interrupt-less Operation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
\index{Interrupt} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
EtherCAT frames travel through the logical EtherCAT ring and are then |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
sent back to the master. Communication is highly deterministic: A |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
frame is sent and will be received again after a constant time. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
Therefore, there is no need to notify the driver about frame |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
reception: The master can instead query the hardware for received |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
frames. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
Figure~\ref{fig:interrupt} shows two workflows for cyclic frame |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
transmittion and reception with and without interrupts. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
\includegraphics[width=.8\textwidth]{images/interrupt} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
\caption{Interrupt Operation versus Interrupt-less Operation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
\label{fig:interrupt} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
In the left workflow ``Interrupt Operation'', the data from the last |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
cycle is first processed and a new frame is assembled with new |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
datagrams, which is then sent. The cyclic work is done for now. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
Later, when the frame is received again by the hardware, an interrupt |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
is triggered and the ISR is executed. The ISR will fetch the frame |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
data from the hardware and initiate the frame dissection: The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
datagrams will be processed, so that the data is ready for processing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
in the next cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
In the right workflow ``Interrupt-less Operation'', there is no |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
hardware interrupt enabled. Instead, the hardware will be polled by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
the master by executing the ISR. If the frame has been received in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
meantime, it will be dissected. The situation is now the same as at |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
the beginning of the left workflow: The received data is processed and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
a new frame is assembled and sent. There is nothing to do for the rest |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
of the cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
The interrupt-less operation is desirable, because there is simply no |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
need for an interrupt. Moreover hardware interrupts are not conducive |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
in improving the driver's realtime behaviour: Their undeterministic |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
incidences contribute to increasing the jitter. Besides, if a realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
extension (like RTAI) is used, some additional effort would have to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
made to priorize interrupts. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
\paragraph{Ethernet and EtherCAT Devices} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
Another issue lies in the way Linux handles devices of the same type. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
For example, a PCI\nomenclature{PCI}{Peripheral Component |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
Interconnect, Computer Bus} driver scans the PCI bus for devices it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
can handle. Then it registers itself as the responsible driver for all |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
of the devices found. The problem is, that an unmodified driver can |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
not be told to ignore a device because it will be used for EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
later. There must be a way to handle multiple devices of the same |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
type, where one is reserved for EtherCAT, while the other is treated |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
as an ordinary Ethernet device. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
For all this reasons, the author has decided that the only acceptable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
solution is to modify standard Ethernet drivers in a way that they |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
keep their normal functionality, but gain the ability to treat one or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
more of the devices as EtherCAT-capable. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
Below are the advantages of this solution: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
\item No need to tell the standard drivers to ignore certain devices. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
\item One networking driver for EtherCAT and non-EtherCAT devices. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
\item No need to implement a network driver from scratch and running |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
into issues, the former developers already solved. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
The chosen approach has the following disadvantages: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
\item The modified driver gets more complicated, as it must handle |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
EtherCAT and non-EtherCAT devices. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
\item Many additional case differentiations in the driver code. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
\item Changes and bugfixes on the standard drivers have to be ported |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
to the Ether\-CAT-capable versions from time to time. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
\subsection{Device Selection} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
\label{sec:seldev} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
After loading the master module, at least one EtherCAT-capable network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
driver module has to be loaded, that connects one of its devices to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
the master. To specify an EtherCAT device and the master to connect |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
to, all EtherCAT-capable network driver modules should provide two |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
module parameters: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
\item[ec\_device\_index] PCI device index of the device that is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
connected to the EtherCAT bus. If this parameter is left away, all |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
devices found are treated as ordinary Ethernet devices. Default: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
$-1$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
\item[ec\_master\_index] Index of the master to connect to. Default: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
$0$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
The following command loads the EtherCAT-capable RTL8139 device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
driver, telling it to handle the second device as an EtherCAT device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
and connecting it to the first master: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
739 |
# `\textbf{modprobe ec\_8139too ec\_device\_index=1}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
Usually, this command does not have to be entered manually, but is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
called by the EtherCAT init script. See section~\ref{sec:init} for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
more information. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
\subsection{The Device Interface} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
\label{sec:ecdev} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
\index{Device interface} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
An anticipation to the section about the master module |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
(section~\ref{sec:mastermod}) has to be made in order to understand |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
the way, a network device driver module can connect a device to a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
specific EtherCAT master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
The master module provides a ``device interface'' for network device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
drivers. To use this interface, a network device driver module must |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
include the header |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
\textit{devices/ecdev.h}\nomenclature{ecdev}{EtherCAT Device}, coming |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
with the EtherCAT master code. This header offers a function interface |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
for EtherCAT devices which is explained below. All functions of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
device interface are named with the prefix \textit{ecdev}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
\paragraph{Device Registration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
A network device driver can connect a physical device to an EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
master with the \textit{ecdev\_register()} function. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
ec_device_t *ecdev_register(unsigned int master_index, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
struct net_device *net_dev, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
ec_isr_t isr, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
struct module *module); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
The first parameter \textit{master\_index} must be the index of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
EtherCAT master to connect to (see section~\ref{sec:mastermod}), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
followed by \textit{net\_dev}, the pointer to the corresponding |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
net\_device structure, which represents the network device to connect. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
The third parameter \textit{isr} must be a pointer to the interrupt |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
service routine (ISR\index{ISR}) handling the device. The master will |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
later execute the ISR in order to receive frames and to update the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
device status. The last parameter \textit{module} must be the pointer |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
to the device driver module, which is usually accessible via the macro |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
\textit{THIS\_MODULE} (see next paragraph). On success, the function |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
returns a pointer to an \textit{ec\_device\_t} object, which has to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
specified when calling further functions of the device interface. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
Therefore the device module has to store this pointer for future use. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
In error case, the \textit{ecdev\_register()} returns \textit{NULL}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
which means that the device could not be registered. The reason for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
this is printed to \textit{syslog}\index{syslog}. In this case, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
device module is supposed to abort the module initialisation and let |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
the \textit{insmod} command fail. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
\paragraph{Implicit Dependencies} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
The reason for the module pointer has to be specified at device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
registration is a non-trivial one: The master has to know about the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
module, because there will be an implicit dependency between the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
device module and a later connected realtime module: When a realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
module connects to the master, the use count of the master module will |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
be increased, so that the master module can not be unloaded for the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
time of the connection. This is reasonable, and so automatically done |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
by the kernel. The kernel knows about this dependency, because the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
realtime module uses kernel symbols provided by the master module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
Moreover it is mandatory, that the device module can be unloaded |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
neither, because it is implicitely used by the realtime module, too. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
Unloading it would lead to a fatal situation, because the master would |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
have no device to send and receive frames for the realtime module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
This dependency can not be detected automatically, because the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
realtime module does not use any symbols of the device module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
Therefore the master explicitly increments the use counter of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
connected device module upon connection of a realtime module and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
decrements it, if the realtime module disconnects. In this manner, it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
is impossible to unload a device module while the master is in use. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
This is done with the kernel function pair \textit{try\_module\_get()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
\index{try\_module\_get@\textit{try\_module\_get()}} and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
\textit{module\_put()} \index{module\_put@\textit{module\_put()}}. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
first one increases the use count of a module and only fails, if the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
module is currenly being unloaded. The last one decreases the use |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
count again and never fails. Both functions take a pointer to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
module as their argument, which the device module therefore has to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
specify upon device registration. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
\paragraph{Device Unregistering} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
The unregistration of a device is usually done in the device module's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
cleanup function, by calling the \textit{ecdev\_unregister()} function |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
and specifying the master index and a pointer to the device object |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
again. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
void ecdev_unregister(unsigned int master_index, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
ec_device_t *device); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
This function can fail too (if the master index is invalid, or the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
given device was not registered), but due to the fact, that this |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
failure can not be dealt with appropriately, because the device module |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
is unloading anyway, the failure code would not be of any interest. So |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
the function has a void return value. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
\paragraph{Starting the Master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
When a device has been initialized completely and is ready to send and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
receive frames, the master has to be notified about this by calling |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
the \textit{ecdev\_start()} function. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
int ecdev_start(unsigned int master_index); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
The master will then enter ``Idle Mode'' and start scanning the bus |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
(and possibly handling EoE slaves). Moreover it will make the bus |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
accessible via Sysfs interface and react to user interactions. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
function takes one parameter \textit{master\_index}, which has to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
the same as at the call to \textit{ecdev\_register()}. The return |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
value will be non-zero if the starting process failed. In this case |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
the device module is supposed to abort the init sequence and make the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
init function return an error code. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
\paragraph{Stopping the Master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
Before a device can be unregistered, the master has to be stopped by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
calling the \textit{ecdev\_stop()} function. It will stop processing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
messages of EoE slaves and leave ``Idle Mode''. The only parameter is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
\textit{master\_index}. This function can not fail. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
void ecdev_stop(unsigned int master_index); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
A subsequent call to \textit{ecdev\_unregister()} will now unregister |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
the device savely. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
\paragraph{Receiving Frames} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
The interrupt service routine handling device events usually has a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
section where new frames are fetched from the hardware and forwarded |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
to the kernel network stack via \textit{netif\_receive\_skb()}. For an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
EtherCAT-capable device, this has to be replaced by calling the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
\textit{ecdev\_receive()} function to forward the received data to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
connected EtherCAT master instead. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
void ecdev_receive(ec_device_t *device, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
const void *data, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
size_t size); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
This function takes 3 arguments, a pointer to the device object |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
(\textit{device}), a pointer to the received data, and the size of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
received data. The data range has to include the Ethernet headers |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
starting with the destination address and reach up to the last octet |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
of EtherCAT data, excluding the FCS. Most network devices handle the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
FCS in hardware, so it is not seen by the driver code and therefore |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
doesn't have to be cut off manually. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
\paragraph{Handling the Link Status} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
Information about the link status (i.~e. if there is a carrier signal |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
detected on the physical port) is also important to the master. This |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
information is usually gathered by the ISR and should be forwarded to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
the master by calling the \textit{ecdev\_link\_state()} function. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
master then can react on this and warn the realtime module of a lost |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
link. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
void ecdev_link_state(ec_device_t *device, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
uint8_t new_state); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
The parameter \textit{device} has to be a pointer to the device object |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
returned by \textit{ecdev\_\-register()}. With the second parameter |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
\textit{new\_state}, the new link state is passed: 1, if the link went |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
up, and 0, if it went down. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
\subsection{Patching Network Drivers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
\label{sec:patching} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
\index{Network drivers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
This section will demonstrate, how to make a standard Ethernet driver |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
EtherCAT-capable. The below code examples are taken out of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
modified RealTek RTL8139 driver coming with the EtherCAT master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
(\textit{devices/8139too.c}). The driver was originally developed by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
Donald Becker, and is currently maintained by Jeff Garzik. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
Unfortunately, there is no standard procedure to enable an Ethernet |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
driver for use with the EtherCAT master, but there are a few common |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
techniques, that are described in this section. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
\begin{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
\item A first simple rule is, that \textit{netif\_*()}-calls must be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
strictly avoided for all EtherCAT devices. As mentioned before, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
EtherCAT devices have no connection to the network stack, and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
therefore must not call its interface functions. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
\item Another important thing is, that EtherCAT devices should be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
operated without interrupts. So any calls of registering interrupt |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
handlers and enabling interrupts at hardware level must be avoided, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
too. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
\item The master does not use a new socket buffer for each send |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
operation: Instead there is a fix one allocated on master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
initialization. This socket buffer is filled with an EtherCAT frame |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
with every send operation and passed to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
\textit{hard\_start\_xmit()} callback. For that it is necessary, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
that the socket buffer is not be freed by the network driver as |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
usual. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
\end{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
As mentioned before, the driver will handle both EtherCAT and ordinary |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
Ethernet devices. This implies, that for each device-dependent |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
operation, it has to be checked if an EtherCAT device is involved, or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
just an Ethernet device. For means of simplicity, this example driver |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
will only handle one EtherCAT device. This makes the case |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
differentiations easier. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
\paragraph{Global Variables} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
First of all, there have to be additional global variables declared, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
as shown in the listing: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
static int ec_device_index = -1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
static int ec_device_master_index = 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
static ec_device_t *rtl_ec_dev; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
struct net_device *rtl_ec_net_dev = NULL; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
\item[\normalfont\textcircled{\tiny 1} -- \textcircled{\tiny 2}] To |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
comply to the requirements for parameters of EtherCAT device modules |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
described in section~\ref{sec:seldev}, there have to be additional |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
parameter variables: \textit{ec\_\-device\_\-index} holds the index |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
of the EtherCAT device and defaults to $-1$ (no EtherCAT device), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
while \textit{ec\_device\_master\_index} stores index of the master, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
the single device will be connected to. Default: $0$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
\item[\normalfont\textcircled{\tiny 3}] \textit{rtl\_ec\_dev} will be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
the pointer to the later registered RealTek EtherCAT device, which |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
can be used as a parameter for device methods. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
\item[\normalfont\textcircled{\tiny 4}] \textit{rtl\_ec\_net\_dev} is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
a pointer to the \textit{net\_device} structure of the dedicated |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
device and is set while scanning the PCI bus and finding the device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
with the specified index. This is done inside the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
\textit{pci\_module\_init()} function executed as the first thing on |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
module loading. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
\paragraph{Module Initialization} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
Below is the (shortened) coding of the device driver's module init |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
function: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
static int __init rtl8139_init_module(void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
if (pci_module_init(&rtl8139_pci_driver) < 0) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
printk(KERN_ERR "Failed to init PCI mod.\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
goto out_return; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
if (rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
printk(KERN_INFO "Registering" |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
" EtherCAT device...\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
if (!(rtl_ec_dev = |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
ecdev_register(ec_device_master_index, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
rtl_ec_net_dev, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
rtl8139_interrupt, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
THIS_MODULE))) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
printk(KERN_ERR "Failed to reg." |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
" EtherCAT device!\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
goto out_unreg_pci; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
printk(KERN_INFO "Starting EtherCAT" |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
" device...\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
if (ecdev_start(ec_device_master_index)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
printk(KERN_ERR "Failed to start" |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
" EtherCAT device!\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
goto out_unreg_ec; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
} else { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
printk(KERN_WARNING "No EtherCAT device" |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
" registered!\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
return 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
out_unreg_ec: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
ecdev_unregister(ec_device_master_index, rtl_ec_dev); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
out_unreg_pci: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
pci_unregister_driver(&rtl8139_pci_driver); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
out_return: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
return -1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
\item[\normalfont\textcircled{\tiny 3}] This call initializes all |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
RTL8139-compatible devices found on the pci bus. If a device with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
index \textit{ec\_device\_index} is found, a pointer to its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
\textit{net\_device} structure is stored in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
\textit{rtl\_ec\_net\_dev} for later use (see next listings). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
\item[\normalfont\textcircled{\tiny 8}] If the specified device was |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
found, \textit{rtl\_ec\_net\_dev} is non-zero. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
\item[\normalfont\textcircled{\tiny 11}] The device is connected to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
the specified master with a call to \textit{ecdev\_register()}. If |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
this fails, module loading is aborted. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
\item[\normalfont\textcircled{\tiny 23}] The device registration was |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
successful and the master is started. This can fail, which aborts |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
module loading. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
\item[\normalfont\textcircled{\tiny 29}] If no EtherCAT device was |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
found, a warning is output. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
\paragraph{Device Searching} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
During the PCI initialization phase, a variable \textit{board\_idx} is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
increased for each RTL8139-compatible device found. The code below is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
executed for each device: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
if (board_idx == ec_device_index) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
rtl_ec_net_dev = dev; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
strcpy(dev->name, "ec0"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
\item[\normalfont\textcircled{\tiny 1}] The device with the specified |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
index will be the EtherCAT device. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
\paragraph{Avoiding Device Registration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
Later in the PCI initialization phase, the net\_devices get |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
registered. This has to be avoided for EtherCAT devices and so this is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
a typical example for an EtherCAT case differentiation: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
if (dev != rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
i = register_netdev(dev); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
if (i) goto err_out; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
\item[\normalfont\textcircled{\tiny 1}] If the current net\_device is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
not the EtherCAT device, it is registered at the network stack. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
\paragraph{Avoiding Interrupt Registration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
In the next two listings, there is an interrupt requested and the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
device's interrupts are enabled. This also has to be encapsulated by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
if-clauses, because interrupt operation is not wanted for EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
devices. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
if (dev != rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
retval = request_irq(dev->irq, rtl8139_interrupt, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
SA_SHIRQ, dev->name, dev); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
if (retval) return retval; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
if (dev != rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
/* Enable all known interrupts by setting |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
the interrupt mask. */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
RTL_W16(IntrMask, rtl8139_intr_mask); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
\paragraph{Frame Sending} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
The listing below shows an exerpt of the function representing the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
\textit{hard\_start\_xmit()} callback of the net\_device. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
/* Note: the chip doesn't have auto-pad! */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
if (likely(len < TX_BUF_SIZE)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
if (len < ETH_ZLEN) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
memset(tp->tx_buf[entry], 0, ETH_ZLEN); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
if (dev != rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
dev_kfree_skb(skb); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
} else { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
if (dev != rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
dev_kfree_skb(skb); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
tp->stats.tx_dropped++; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
return 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
\item[\normalfont\textcircled{\tiny 6} + \textcircled{\tiny 10}] The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
master uses a fixed socket buffer for transmission, which is reused |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
and may not be freed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
\paragraph{Frame Receiving} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
During ordinary frame reception, a socket buffer is created and filled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
with the received data. This is not necessary for an EtherCAT device: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
if (dev != rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
/* Malloc up new buffer, compatible with net-2e. */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
/* Omit the four octet CRC from the length. */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
skb = dev_alloc_skb (pkt_size + 2); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
if (likely(skb)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
skb->dev = dev; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
skb_reserve(skb, 2); /* 16 byte align |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
the IP fields. */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
eth_copy_and_sum(skb, &rx_ring[ring_off + 4], |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
pkt_size, 0); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
skb_put(skb, pkt_size); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
skb->protocol = eth_type_trans(skb, dev); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
dev->last_rx = jiffies; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
tp->stats.rx_bytes += pkt_size; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
tp->stats.rx_packets++; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
netif_receive_skb (skb); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
} else { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
if (net_ratelimit()) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
printk(KERN_WARNING |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
"%s: Memory squeeze, dropping" |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
" packet.\n", dev->name); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
tp->stats.rx_dropped++; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
} else { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
ecdev_receive(rtl_ec_dev, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
&rx_ring[ring_offset + 4], pkt_size); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
dev->last_rx = jiffies; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
tp->stats.rx_bytes += pkt_size; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
tp->stats.rx_packets++; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
\item[\normalfont\textcircled{\tiny 28}] If the device is an EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
device, no socket buffer is allocated. Instead a pointer to the data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
(which is still in the device's receive ring) is passed to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
EtherCAT master. Unnecessary copy operations are avoided. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
\item[\normalfont\textcircled{\tiny 30} -- \textcircled{\tiny 32}] The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
device's statistics are updated as usual. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
\paragraph{Link State} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
The link state (i.~e. if there is a carrier signal detected on the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
receive port) is determined during execution of the ISR. The listing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
below shows the different processing for Ethernet and EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
devices: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
if (dev != rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
if (tp->phys[0] >= 0) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
mii_check_media(&tp->mii, netif_msg_link(tp), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
init_media); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
} else { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
void __iomem *ioaddr = tp->mmio_addr; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
uint16_t link = RTL_R16(BasicModeStatus) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
& BMSR_LSTATUS; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
ecdev_link_state(rtl_ec_dev, link ? 1 : 0); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
\item[\normalfont\textcircled{\tiny 3}] The ``media check'' is done |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
via the media independent interface (MII\nomenclature{MII}{Media |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
Independent Interface}), a standard interface for Fast Ethernet |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
devices. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
\item[\normalfont\textcircled{\tiny 7} -- \textcircled{\tiny 10}] For |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
EtherCAT devices, the link state is fetched manually from the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
appropriate device register, and passed to the EtherCAT master by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
calling \textit{ecdev\_\-link\_\-state()}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
\paragraph{Module Cleanup} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
Below is the module's cleanup function: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
static void __exit rtl8139_cleanup_module (void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
printk(KERN_INFO "Cleaning up RTL8139-EtherCAT" |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
" module...\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
if (rtl_ec_net_dev) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
printk(KERN_INFO "Stopping device...\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
ecdev_stop(ec_device_master_index); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
printk(KERN_INFO "Unregistering device...\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
ecdev_unregister(ec_device_master_index, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
rtl_ec_dev); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
rtl_ec_dev = NULL; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
pci_unregister_driver(&rtl8139_pci_driver); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
printk(KERN_INFO "RTL8139-EtherCAT module" |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
" cleaned up.\n"); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
\item[\normalfont\textcircled{\tiny 6}] Stopping and unregistration is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
only done, if a device was registered before. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
\item[\normalfont\textcircled{\tiny 8}] The master is first stopped, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
so it does not access the device any more. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
\item[\normalfont\textcircled{\tiny 10}] After this, the device is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
unregistered. The master is now ``ophaned''. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
\section{The Master Module} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
\label{sec:mastermod} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
\index{Master module} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
The EtherCAT master is designed to run as a kernel module. Moreover |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
the master kernel module \textit{ec\_master} can handle multiple |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
masters at the same time: The number of masters has to be passed to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
the module with the parameter \textit{ec\_master\_count}, that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
defaults to $1$. A certain master can later be addressed by its index. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
For example, if the master module has been loaded with the command |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
1277 |
# `\textbf{modprobe ec\_master ec\_master\_count=2}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
the two masters can be addressed by their indices 0 and 1 respectively |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
(see figure~\ref{fig:masters}). This master index mandatory for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
certain functions of the master interfaces. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
\includegraphics[width=.5\textwidth]{images/masters} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
\caption{Multiple masters in one module} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
\label{fig:masters} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
\paragraph{Master Log Messages} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
The master module gives information about it's state and events via |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
the syslog interface. The module loading command above should result |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
1295 |
in the syslog messages below (or similar): |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
\begin{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
EtherCAT: Master driver, 1.1 (stable) - rev. 513, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
compiled by fp at Aug 09 2006 09:43:50 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
EtherCAT: Initializing 2 EtherCAT master(s)... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
EtherCAT: Initializing master 0. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
EtherCAT: Initializing master 1. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
EtherCAT: Master driver initialized. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
The master provides information about it's version number, subversion |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
revision number and compile information, like the date of compilation |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
and the user, who compiled. All messages are prefixed either with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
\texttt{EtherCAT:}, \texttt{EtherCAT WARNING:} or \texttt{EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
ERROR:}, which makes searching the logs easier. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
\subsection{Class Reference} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
\label{sec:classes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
This section is not intended to be a complete reference of master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
classes and functions\footnote{The comprehensive master reference can |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
be obtained at http://etherlab.org/download/download-en.html}, but |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
will give a general survey of the master's classes, and how they |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
interact. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
Figure~\ref{fig:uml-all} shows an UML class diagram of the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
classes. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
\includegraphics[width=\textwidth]{images/uml-all} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
\caption{UML class diagram with associations} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
\label{fig:uml-all} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
The following subsections introduce serveral classes with their |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
attributes and methods. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
\subsubsection{The Master Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
\label{sec:class-master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
\index{Master!Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
Figure~\ref{fig:uml-master} shows an UML class diagram of the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
class. There is a short explanation of the attributes and methods |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
below. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
\includegraphics[width=.8\textwidth]{images/uml-master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
\caption{Master UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
\label{fig:uml-master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
\paragraph{Master Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
\item[list] is a listhead structure that is needed to manage the list |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
of masters in the master module (see section~\ref{sec:mastermod}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
\item[reserved] is a flag, that marks the master as reserved for a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
realtime module, so that a call to \textit{ecrt\_request\_master()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
fails, if another module is already using the master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
\item[index] contains the number of the master. The first master will |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
get index 0, the second index 1, and so on. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
\item[kobj] In order to make the master object available via Sysfs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
(see section~\ref{sec:sysfs}), this structure is needed inside the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
master object (see section~\ref{sec:sysfs}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
\item[slaves] is the list of slaves. It consists of objects of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
\textit{ec\_slave\_t} class (see section~\ref{sec:class-slave}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
\item[slave\_count] is the number of slaves in the list. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
\item[device] points to the network device that is used by the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
to send and receive frames (see section~\ref{sec:class-device}). It |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
is \textit{NULL}, if no device is connected. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
\item[datagram\_queue] is a list of datagrams (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
section~\ref{sec:class-datagram}) that have to be sent by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
master, or have already been sent and wait to be received again. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
Upon reception or error, the datagrams are dequeued. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
\item[datagram\_index] contains the index value for the next datagram. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
The master stores this incrementing index into every datagram, to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
make it easier to assign a received datagram to the one sent before. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
\item[domains] contains the list of domains created by the realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
module (section~\ref{sec:class-domain}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
\item[debug\_level] controls, how much debugging output is printed by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
the master: 0 means no debugging output, 1 means to output certain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
executing marks and actions, and 2 means to output frame contents in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
addition. This value can be changed at runtime via the Sysfs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
interface (see section~\ref{sec:sysfs}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
\item[stats] is a statistics object that contains certain counters |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
(like the number of missed frames). These statistics are output on |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
demand, but at most once a second. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
\item[workqueue] is the kernel workqueue used for idle mode. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
\item[idle\_work] is the work object, that is queued. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
\item[fsm] The attribute \textit{fsm} represents the master's finite |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
state machine, that does all the slave processing. See |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
sections~\ref{sec:class-fsm} and~\ref{sec:fsm} for further details. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
\item[mode] contains the current master mode, if it is orphaned, idle, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
or in operation mode. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
\item[eoe\_timer] is the kernel timer used for EoE\index{EoE} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
processing. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
\item[eoe\_running] marks the state of EoE processing. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
\item[eoe\_handlers] is the list of EoE handlers (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
section~\ref{sec:class-eoe}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
\item[internal\_lock] is a spinlock used in idle mode, that controls |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
the concurrency of the idle and EoE processes. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
\item[request\_cb] The ``request lock'' callback function, the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
has to provide for foreign instances, which want to access the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
master (see section~\ref{sec:concurr}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
\item[release\_cb] The callback function that will release the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
lock. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
\item[cb\_data] This value will be passed as an argument to each |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
callback. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
\item[eeprom\_write\_enable] flag can be written via Sysfs to enable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
the general writing of E$^2$PROM contents. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
\paragraph{Public Master Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
\item[ec\_master\_init()] is the master's constructor. It initializes |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
all attributes, creates the workqueue, creates EoE handlers and the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
state machine object, and adds the kernel object to the Sysfs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
hierarchy. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
\item[ec\_master\_clear()] is the destructor and undoes all these |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
actions. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
\item[ec\_master\_reset()] clears the master, but initializes it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
again. This is needed, when a realtime module disconnects: Slaves |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
and other attributes are cleared and are later rebuilt by the idle |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
process. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
\item[ec\_master\_idle\_start/stop()] These methods enable or disable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
the idle process. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
\item[ec\_master\_eoe\_start/stop()] These methods do the same for the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
EoE timer. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
\item[ec\_master\_receive\_datagrams()] This method is called by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
device, which uses it to pass received frames to the master. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
frame is dissected and the contained datagrams are assigned to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
datagram objects in the datagram queue, which are dequeued on |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
reception or error. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
\item[ec\_master\_queue\_datagram()] This method is used to queue a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
new datagram for sending and receiving. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
\item[ec\_master\_output\_stats()] This method is cyclically called to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
output a summary of the \textit{stats} attribute at most once a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
second. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
\item[ec\_master\_clear\_slaves()] clears the list of slaves. This is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
needed on connection/disconnection of a realtime module or at a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
topology change in idle mode, when all slaves objects are rebuilt. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
\paragraph{Private Master Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
A few of a master's methods are private, meaning, that they can only |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
be called from other master methods: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
\item[ec\_master\_send\_datagrams()] searches the datagram queue for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
unsent datagrams, allocates frames to send them, does the actual |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
sending and marks the datagrams as sent. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
\item[ec\_master\_idle\_run()] is the work function for the idle mode. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
It executes the idle state machine, described in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
section~\ref{sec:fsm-idle}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
\item[ec\_master\_eoe\_run()] is called by the EoE timer and is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
responsible for communicating with EoE-capable slaves. See |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
section~\ref{sec:eoeimp} for more information. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
\paragraph{Master Methods (Realtime Interface)} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
The master methods belonging to the Eth\-er\-CAT realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
interface\index{ecrt@\textit{ecrt}}\nomenclature{ecrt}{EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
Realtime Interface} begin with the prefix \textit{ecrt} instead of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
\textit{ec}. The functions of the realtime interface are explained in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
section~\ref{sec:ecrt-master}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
\subsubsection{The Slave Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
\label{sec:class-slave} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
\index{Slave!Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
Figure~\ref{fig:uml-slave} shows an UML class diagram of the slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
class. There is a short explanation of the attributes and methods |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
below. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
\includegraphics[width=.8\textwidth]{images/uml-slave} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
\caption{Slave UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
\label{fig:uml-slave} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
\paragraph{Slave Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
\item[list] The master holds a slave list, therefore the slave class |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
must contain this structure used as an anchor for the linked |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
list. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
\item[kobj] This pointer serves as base object for the slave's Sysfs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
representation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
\item[master] is the pointer to the master owning this slave object. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
\item[ring\_position] is the logical position in the logical ring |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
topology. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
\item[station\_address] is the configured station address. This is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
always the ring position~+~$1$). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
\item[coupler\_index] is the index of the last bus coupler. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
\item[coupler\_subindex] is the slave's position, counted from the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
last bus coupler. See section~\ref{sec:addr} for more information. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
\item[base\_*] These attributes contain base information about the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
slave, that are read from the ``DL Information'' attribute. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
\item[dl\_*] These fields store information of the ``DL Status'' |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
attribute, for example states of the the communication ports. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
\item[sii\_*] These attributes contain values from the ``Slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
Information Interface'' \cite[section~6.4]{dlspec}, mostly identity |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
and mailbox information, but also the list of sync manager |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
configurations and PDOs. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
\item[registered] This flag is set, if one or more PDOs of the slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
have been registered for process data exchange. Otherwise a warning |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
is output, because the slave is unused. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
\item[fmmus] Is an array of FMMU configurations, that have to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
applied to the slave. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
\item[fmmu\_count] contains number of FMMUs used. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
\item[eeprom\_*] These fields contain E$^2$PROM contents and the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
extracted category information \cite[section~5.4]{alspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
\item[new\_eeprom\_data] If this pointer is not \textit{NULL}, it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
points to new E$^2$PROM contents, that have to be written to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
slave. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
\item[new\_eeprom\_size] This field represents the size of the new |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
E$^2$PROM data. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
\item[requested\_state] is the requested slave state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
\item[current\_state] is the current slave state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
\item[error\_flag] is used by the operation and idle state machines |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
to indicate, that a state transisition has failed and should not be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
tried again until an external event happens. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
\item[online] This flag contains the online state of the slave (i.~e. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
if it currently responds to the masters commands). Changes of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
online state are always reported. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
\item[varsize\_fields] is only suitable for slaves that provide PDOs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
of variable size (like slaves that manage a sub-fieldbus) and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
contains information about what size this fields actually should |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
have. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
\paragraph{Public Slave Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
\item[ec\_slave\_init()] The slave's constructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
\item[ec\_slave\_clear()] The slave's destructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
\item[ec\_prepare\_fmmu()] prepares an FMMU configuration. The FMMU is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
configured for a certain sync manager and domain. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
\item[ec\_fetch\_*()] Serveral methods to extract information of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
E$^2$PROM category contents. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
\item[ec\_slave\_locate\_string()] extracts a string out of a STRING |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
category and allocates string memory. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
\item[ec\_slave\_calc\_sync\_size()] calculates the size of sync |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
manager contents, because they can be variable due to variable-sized |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
PDOs. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
\item[ec\_slave\_info()] This method prints all slave information into |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
a buffer for Sysfs reading. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
\item[ec\_slave\_mbox\_*()] These functions prepare datagrams for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
mailbox communication, or process mailbox responses, respectively. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
\paragraph{Private Slave Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
\item[ec\_slave\_write\_eeprom()] This function accepts E$^2$PROM data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
from user space, does a quick validation of the contents and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
schedules them for writing through the idle state machine. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
\paragraph{Slave Methods (Realtime Interface)} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
\item[ecrt\_slave\_conf\_sdo*()] These methods accept SDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
configurations, that are applied on slave activation (i.~e. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
everytime the slave is configured). The methods differ only in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
data size of the SDO (8, 16 or 32 bit). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
\item[ecrt\_slave\_pdo\_size()] This method specifies the size of a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
variable-sized PDO. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
\subsubsection{The Device Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
\label{sec:class-device} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
\index{Device!Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
The device class is responsible for communicating with the connected |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
EtherCAT-enabled network driver. Figure~\ref{fig:uml-device} shows its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
UML class diagram. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
\includegraphics[width=.3\textwidth]{images/uml-device} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
\caption{Device UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
\label{fig:uml-device} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
\paragraph{Device Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
\item[master] A pointer to the master, which owns the device object. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
\item[dev] This is the pointer to the \textit{net\_device} structure |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
of the connected network device driver. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
\item[open] This flag stores, if the network device is ``opened'' and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
ready for transmitting and receiving frames. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
\item[tx\_skb] The transmittion socket buffer. Instead of allocating a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
new socket buffer for each frame, the same socket buffer is recycled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
and used for every frame. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
\item[isr] The pointer to the network device's interrupt service |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
routine. \textit{ec\_isr\_t} is a type definition in the device |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
interface, which looks like below: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
\begin{lstlisting}[gobble=4,language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
typedef irqreturn_t (*ec_isr_t)(int, void *, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
struct pt_regs *); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
\item[module] A pointer to the network driver module, to increase and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
decrease the use counter (see paragraph ``Implicit Dependencies'' in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
section~\ref{sec:ecdev}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
\item[link\_state] The current link state. It can be 0 ``down'' or 1 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
``up''. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
\item[dbg] Every device objects contains a debugging interface (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
sectios~\ref{sec:class-debug} and~\ref{sec:debug}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
\paragraph{Public Device Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
\item[ec\_device\_init()] The device constructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
\item[ec\_device\_clear()] The device destructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
\item[ec\_device\_open()] ``Opens'' the device for transmittion and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
reception of frames. This is equivalent to the \textit{ifconfig up} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
command for ordinary Ethernet devices. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
\item[ec\_device\_close()] Stops frame transmittion and reception. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
This is equivalent to the \textit{ifconfig down} command for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
ordinary Ethernet devices. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
\item[ec\_device\_call\_isr()] Calls the interrupt service routine of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
the device. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
\item[ec\_device\_tx\_data()] Returns a pointer into the memory of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
transmittion socket buffer \textit{tx\_skb}. This is used by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
master to assemble a new EtherCAT frame. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
\item[ec\_device\_send()] Sends an assembled frame by passing it to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
the device's \textit{hard\_\-start\_\-xmit()} callback. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
\paragraph{Device Methods (Device Interface)} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
The device methods belonging to the device interface are explained in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
section~\ref{sec:ecdev}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
\subsubsection{The Datagram Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
\label{sec:class-datagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
\index{Datagram!Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
So send and receive a datagram, an object of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
\textit{ec\_datagram\_t} class is needed. It can be initialized with a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
datagram type \cite[section~5.4]{dlspec} and length (optionally filled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
with data) and appended to the master's datagram queue. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
Figure~\ref{fig:uml-datagram} shows its UML class diagram. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
\includegraphics[width=.3\textwidth]{images/uml-datagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
\caption{Datagram UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
\label{fig:uml-datagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
\paragraph{Datagram Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
\item[list] This attribute is needed to make a list of datagrams, as |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
used in the domain class (see section~\ref{sec:class-domain}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
\item[queue] This attribute is the anchor to the master's datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
queue, which is implemented as a linked list. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
\item[type] The datagram type. \textit{ec\_\-datagram\_\-type\_\-t} is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
an enumeration, which can have the values |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
\textit{EC\_\-DATAGRAM\_\-APRD}, \textit{EC\_\-DATAGRAM\_\-APWR}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
\textit{EC\_\-DATAGRAM\_\-NPRD}, \textit{EC\_\-DATAGRAM\_\-NPWR}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
\textit{EC\_\-DATAGRAM\_\-BRD}, \textit{EC\_\-DATAGRAM\_\-BWR} or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
\textit{EC\_\-DATAGRAM\_\-LRW}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
\item[address] The slave address. For all addressing schemes take 4 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
bytes, \textit{ec\_address\_t} is a union type: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
\begin{lstlisting}[gobble=4,language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
typedef union { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
struct { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
uint16_t slave; /**< configured or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
autoincrement |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
address */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
uint16_t mem; /**< physical memory |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
address */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
} physical; /**< physical address */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
uint32_t logical; /**< logical address */ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
} ec_address_t; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
\item[data] The actual data of the datagram. These are either filled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
in before sending (at writing access) or are inserted by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
adressed slave(s) (at reading access). In any case, the data memory |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
must be dynamically allocated. Besides, this can be done before |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
cyclic processing with the \textit{ec\_datagram\_prealloc()} method |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
(see below). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
\item[mem\_size] The size of the allocated memory, \textit{data} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
points to. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
\item[data\_size] The size of the actual data in the \textit{data} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
memory. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
\item[index] The sequential EtherCAT datagram index. This value is set |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
by the master on sending, to easier assign a received datagram to a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
queued datagram object. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
\item[working\_counter] The working counter of the datagram. This is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
set to zero on sending and filled with the real value of the working |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
counter on datagram reception. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
\item[state] The state of the datagram. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
\textit{ec\_\-datagram\_\-state\_\-t} is an enumeration and can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
\textit{EC\_\-DATA\-GRAM\_\-INIT}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
\textit{EC\_\-DATA\-GRAM\_\-QUEU\-ED}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
\textit{EC\_\-DATA\-GR\-AM\_\-SEN\-T}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
\textit{EC\_\-DATA\-GRAM\_\-REC\-EIVED}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
\textit{EC\_\-DATA\-GRAM\_\-TIMED\_\-OUT} or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
\textit{EC\_\-DA\-TA\-GRAM\_\-ERR\-OR}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
\item[t\_sent] This attribute is set to the timestamp, when the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
datagram was sent, to later detect a timeout. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
\paragraph{Public Datagram Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
\item[ec\_datagram\_init()] The datagram's constructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
\item[ec\_datagram\_clear()] The datagram's destructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
\item[ec\_datagram\_prealloc()] Allocates memory for the datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
data. This is especially needed, if the datagram structure will |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
later be used in a context, where no dynamic memory allocation is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
allowed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
\item[ec\_datagram\_nprd()] Initializes a ``Node-Addressed Physical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
Read'' datagram \cite[section~5.4.1.2]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
\item[ec\_datagram\_npwr()] Initializes a ``Node-Addressed Physical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
Write'' datagram \cite[section~5.4.2.2]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
\item[ec\_datagram\_aprd()] Initializes a ``Auto-Increment Physical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
Read'' datagram \cite[section~5.4.1.1]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
\item[ec\_datagram\_apwr()] Initializes a ``Auto-Increment Physical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
Write'' datagram \cite[section~5.4.2.1]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
\item[ec\_datagram\_brd()] Initializes a ``Broadcast Read'' datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
\cite[section~5.4.1.3]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
\item[ec\_datagram\_bwr()] Initializes a ``Broadcast Write'' datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
\cite[section~5.4.2.3]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
\item[ec\_datagram\_lrw()] Initializes a ``Logical ReadWrite'' |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
datagram \cite[section~5.4.3.4]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
\subsubsection{The Domain Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
\label{sec:class-domain} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
\index{Domain!Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
The domain class encapsules PDO registration and management of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
process data image and its exchange. The UML class diagram can be seen |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
in figure~\ref{fig:uml-domain}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
\includegraphics[width=.4\textwidth]{images/uml-domain} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
\caption{Domain UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
\label{fig:uml-domain} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
\paragraph{Domain Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
\item[kobj] This \textit{kobject} structure is needed for the Sysfs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
representation of the domain. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
\item[list] The master manages a list of domains, so this list anchor |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
is needed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
\item[index] The domain's index. The first domain will get index 0, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
the second index 1, and so on. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
\item[master] A pointer to the master owning the domain. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
\item[data\_size] The size of the domain's process data image. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
\item[datagram] A linked list with the datagram objects, the domain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
needs for process data exchange (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
section~\ref{sec:class-datagram}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
\item[base\_address] This attribute stores the logical offset, to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
which the domain's process data are mapped. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
\item[response\_count] The sum of the datagrams' working counters at |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
the last process data exchange. Changes are always reported. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
\item[data\_regs] The (linked) list of PDO registrations. The realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
module requests the exchange of certain PDOs and supplies the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
address of process data pointers, that will later point to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
respective locations in the process data image. These ``data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
registrations'' are saved in the \textit{data\_regs} list. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
\item[working\_counter\_changes] This field stores the number of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
working counter changes since the last notification. This helps to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
reduce syslog output in case of frequent changes. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
\item[t\_last] The timestamp of the last working counter change |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
notification. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
\paragraph{Public Domain Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
\item[ec\_domain\_init()] The domain's constructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
\item[ec\_domain\_clear()] The domain's destructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
\item[ec\_domain\_alloc()] Allocates the process data image and the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
respective datagrams based on the process data registrations. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
\item[ec\_domain\_queue()] Queues the domain's datagrams for exchange |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
via the master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
\paragraph{Private Domain Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
\item[ec\_domain\_reg\_pdo\_entry()] This method is used to do a PDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
registration. It finds the appropriate sync manager covering the PDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
data, calculates its offset in the sync-manager-protected memory and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
prepares the FMMU configurations for the related slave. Then the PDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
registration is appended to the list. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
\item[ec\_domain\_clear\_data\_regs()] Clearing all process data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
registrations is needed in serveral places and therefore has been |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
sourced out to an own method. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
\item[ec\_domain\_add\_datagram()] This methods allocates a datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
and appends it to the list. This is done during domain allocation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
\paragraph{Domain Methods (Realtime Interface)} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
The domain methods belonging to the realtime interface are introduced |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
in section~\ref{sec:ecrt-domain}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
\subsubsection{The Finite State Machine Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
\label{sec:class-fsm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
\index{FSM!Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
This class encapsules all state machines, except the EoE state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
machine. Its UML class diagram can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
figure~\ref{fig:uml-fsm}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
\includegraphics[width=.9\textwidth]{images/uml-fsm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
\caption{Finite State Machine UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
\label{fig:uml-fsm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
\paragraph{FSM Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
\item[master] A pointer to the master owning the FSM object. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
\item[slave] Serveral sub state machines are executed for single |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
slaves. This pointer stores the current slave for these FSMs. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
\item[datagram] The FSM class has its own datagram, which is used in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
every state and sub-state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
\item[master\_state] This function pointer stores the current state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
function for one of the master's state machines. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
\item[master\_slaves\_responding] This attribute is used in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
operation state machine (see section~\ref{sec:fsm-op}) to store the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
number of slaves, that responded to the last broadcast command. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
\item[master\_slave\_states] This attribute stores the slave states, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
that were determined by the last broadcast command. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
\item[master\_validation] This flag is used by the operation state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
machine and is non-zero, if a bus validation has to be done. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
\item[slave\_state] This function pointer stores the current state of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
the slave scan state machine (see section~\ref{sec:fsm-scan}) or the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
slave configuration state machine (see section~\ref{sec:fsm-conf}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
\item[sii\_state] This function pointer stores the current state of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
the SII state machine (see section~\ref{sec:fsm-sii}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
\item[sii\_offset] This attribute is used by the SII state machine to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
store the word address for the current read or write cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
\item[sii\_mode] If this attribute is zero, the SII access is done |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
with ``auto-increment'' datagrams \cite[section~5.4]{dlspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
If it is non-zero, ``station-address'' datagrams are used. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
\item[sii\_value] This attribute stores the value to write, or the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
read value, respectively. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
\item[sii\_start] A timestamp attribute, that stores the beginning |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
time of an SII operation to detect a timeout. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
\item[change\_state] This function pointer stores the current state of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
the state change state machine. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
\item[change\_new] This attribute stores the requested state for the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
state change state machine. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
\item[change\_start] A timestamp attribute to detect a timeout while |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
changing slave states. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
\item[coe\_state] This function pointer stores the current state of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
the CoE state machines. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
\item[sdodata] This is an SDO data object that stores information |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
about the current SDO to write. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
\item[coe\_start] A timestamp attribute to detect timeouts during CoE |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
configuration. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
\paragraph{Public FSM Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
\item[ec\_fsm\_init()] Constructor of the FSM class. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
\item[ec\_fsm\_clear()] Destructor of the FSM class. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
\item[ec\_fsm\_reset()] Resets the whole FSM object. This is needed to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
restart the master state machines. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
\item[ec\_fsm\_execute()] Executes one state of the current state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
machine and then returns. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
\item[ec\_fsm\_startup()] Initializes the master startup state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
machine, which determines the number of slaves and executes the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
slave scan state machine for each slave. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
\item[ec\_fsm\_startup\_running()] Returns non-zero, if the startup |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
state machine did not terminate yet. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
\item[ec\_fsm\_startup\_success()] Returns non-zero, if the startup |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
state machine terminated with success. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
\item[ec\_fsm\_configuration()] Initializes the master configuration |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
state machine, which executes the slave configuration state machine |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
for each slave. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
\item[ec\_fsm\_configuration\_running()] Returns non-zero, if the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
configuration state machine did not terminate yet. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
\item[ec\_fsm\_configuration\_success()] Returns non-zero, if the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
configuration state machine terminated with success. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
\paragraph{FSM State Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
The rest of the methods showed in the UML class diagram are state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
methods of the state machines. These states are described in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
section~\ref{sec:fsm}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
\subsubsection{The EoE Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
\label{sec:class-eoe} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
\index{EoE!Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
Objects of the \textit{ec\_eoe\_t} class are called EoE handlers. Each |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
EoE handler represents a virtual network interface and can be coupled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
to a EoE-capable slave on demand. The UML class diagram can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
figure~\ref{fig:uml-eoe}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
\includegraphics[width=.4\textwidth]{images/uml-eoe} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
\caption{EoE UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
\label{fig:uml-eoe} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
\paragraph{EoE Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
\item[list] The master class maintains a list of EoE handlers. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
Therefore this list anchor is needed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
\item[slave] If an EoE handler is coupled to a slave, this pointer |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
points to the related slave object. Otherwise it is \textit{NULL}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
\item[datagram] Every EoE handler owns a datagram object to exchange |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
data with the coupled slave via its state machine. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
\item[state] This function pointer points to the current state of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
EoE state machine (see section~\ref{sec:eoeimp}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
\item[dev] A pointer to the \textit{net\_device} structure that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
represents the network interface to the kernel. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
\item[stats] The statistics object for the network interface. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
\item[opened] This flag stores, if the network interface was opened. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
No EoE processing will be done, if the device is not opened. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
\item[t\_last] This timestamp attribute stores the time of the last |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
bit rate measurement. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
\item[rx\_skb] A pointer to the current receive socket buffer. On |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
every first fragment of a received frame, a new receive socket |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
buffer is allocated. On every last fragment, this buffer will be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
passed to the network stack. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
\item[rx\_skb\_offset] This attribute stores the offset for the next |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
fragment data in the receive socket buffer. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
\item[rx\_skb\_size] This attribute stores the current data size of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
the receive socket buffer. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
\item[rx\_expected\_fragment] The expected number of the next |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
fragment. If a fragment with an invalid number is received, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
whole frame will be dropped. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
\item[rx\_counter] This is the sum of the octets received since the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
last bit rate measurement. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
\item[rx\_rate] This attribute stores the receive bit rate in bps. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
\item[tx\_queue] Each EoE handler maintains a transmittion queue for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
frames, that come in via the network interface. This queue is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
implemented with a linked list and protected by a spinlock. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
\item[tx\_queue\_active] This flag stores, if the transmittion queue |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
is currently accepting frames from the network stack. If the queue |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
gets filled up, frame transmittion is suspended with a call to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
\textit{netif\_stop\_queue()}. If the fill state decreases below the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
half capacity, frame transmittion is restarted with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
\textit{netif\_wake\_queue()}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
\item[tx\_queued\_frames] The number of frames in the transmittion |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
queue. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
\item[tx\_queue\_lock] The spinlock used to protect the transmittion |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
queue. This is needed, because the queue is accessed both from |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
network stack context and from the master's EoE timer. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
\item[tx\_frame] The frame that is currently sent. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
\textit{ec\_eoe\_frame\_t} structure combines the socket buffer |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
structure with a list head to append it to the transmittion queue. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
\item[tx\_frame\_number] The EoE protocol demands to maintain a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
sequencial frame number, that must be increased with every frame |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
sent. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
\item[tx\_fragment\_number] The sequencial number of the next fragment |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
to transmit. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
\item[tx\_offset] Current frame data offset for the next fragment to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
transmit. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
\item[tx\_counter] The number of octets transferred since the last bit |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
rate measurement. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
\item[tx\_rate] The recent transmittion bit rate in bps. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
\paragraph{Public EoE Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
\item[ec\_eoe\_init()] The EoE handler's constructor. The network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
interface is allocated and registered. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
\item[ec\_eoe\_clear()] The EoE handler's destructor. The network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
interface is unregistered and all allocated memory is freed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
\item[ec\_eoe\_run()] Executes the EoE state machine (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
section~\ref{sec:eoeimp}) for this handler. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
\item[ec\_eoe\_active()] Returns true, if the handler has a slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
coupled and the network interface is opened. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
\paragraph{Private EoE Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
\item[ec\_eoe\_flush()] Clears the transmittion queue and drops all |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
frames queued for sending. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
\item[ec\_eoe\_send()] Sends one fragment of the current frame. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
\paragraph{EoE State Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
The rest of the private methods are state functions for the EoE state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
machine, which is discussed in section~\ref{sec:eoeimp}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
\subsubsection{The Debug Class} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
\label{sec:class-debug} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
The debug class maintains a virtual network interface. All frames that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
are sent and received by the master will be forwarded to this network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
interface, so that bus monitoring can be done with third party tools |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
(see section~\ref{sec:debug}). Figure~\ref{fig:uml-debug} shows the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
UML class diagram. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
\includegraphics[width=.3\textwidth]{images/uml-debug} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
\caption{Debug UML class diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
\label{fig:uml-debug} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
\paragraph{Debug Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
\item[dev] A pointer to the allocated \textit{net\_device} structure |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
that represents the network interface in the kernel. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
\item[stats] An object for interface statistics. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
\item[opened] Stores the state of the device. Frames will only be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
forwarded, if the device was opened with the \textit{ifconfig up} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
command (or something similar). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
\paragraph{Public Debug Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
\item[ec\_debug\_init()] The constructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
\item[ec\_debug\_clear()] The destructor. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
\item[ec\_debug\_send()] This method forwards a frame to the virtual |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
network interface. It dynamically allocates a new socket buffer and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
passes it to the network stack. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
\subsection{The Realtime Interface} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
\label{sec:ecrt} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
\index{Realtime interface} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
The realtime interface provides functions and data structures for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
realtime modules to access and use an EtherCAT master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
\subsubsection{Master Requesting and Releasing} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
Before a realtime module can access am EtherCAT master provided by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
master module, it has to reserve one for exclusive use. After use, it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
has to release the requested master and make it available for other |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
modules. This is done with the following functions: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
ec_master_t *ecrt_request_master(unsigned int master_index); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
void ecrt_release_master(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
The \textit{ecrt\_request\_master()} function has to be the first |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
function a module has to call, when using EtherCAT. The function takes |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
the index of the master as its argument. The first master has index 0, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
the $n$th master has index $n - 1$. The number of existent masters has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
to be specified when loading the master module (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
section~\ref{sec:mastermod}). The function tries to reserve the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
specified master and scans for slaves. It returns a pointer to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
reserved master object upon success, or \textit{NULL} if an error |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
occured. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
The \textit{ecrt\_release\_master()} function releases a reserved |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
master after use. It takes the pointer to the master object returned |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
by \textit{ecrt\_request\_master()} as its argument and can never |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
fail. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
\subsubsection{Master Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
\label{sec:ecrt-master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
\paragraph{Domain Creation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
For process data exchange, at least one process data domain is needed |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
(see section~\ref{sec:processdata}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
ec_domain_t *ecrt_master_create_domain(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
The \textit{ecrt\_master\_create\_domain()} method creates a new |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
process data domain and returns a pointer to the new domain object. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
This object can be used for registering process data objects and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
exchange process data in cyclic operation. On failure, the function |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
returns \textit{NULL}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
\paragraph{Slave Handlers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
To access a certain slave, there is a method to get a slave handler: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
ec_slave_t *ecrt_master_get_slave(const ec_master_t *, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
const char *); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
The \textit{ecrt\_master\_get\_slave()} method returns a pointer to a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
certain slave object, specified by its ASCII address (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
section~\ref{sec:addr}). If the address is invalid, \textit{NULL} is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
returned. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
\paragraph{Master Activation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
When all domains are created, and all process data objects are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
registered, the master can be activated: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
int ecrt_master_activate(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
void ecrt_master_deactivate(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
By calling the \textit{ecrt\_master\_activate()} method, all slaves |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
are configured according to the prior method calls and are brought |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2142 |
into OP state. In this case, the method has a return value of 0. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2143 |
Otherwise (wrong configuration or bus failure) the method returns |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
non-zero. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
The \textit{ecrt\_master\_deactivate()} method is the counterpart to |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2147 |
the activate call: It brings all slaves back into INIT state again. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2148 |
This method should be called prior to |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
\textit{ecrt\_\-master\_\-release()}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
\paragraph{Locking Callbacks} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
For concurrent master access, the realtime module has to provide a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
locking mechanism (see section~\ref{sec:concurr}): |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
void ecrt_master_callbacks(ec_master_t *master, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
int (*request_cb)(void *), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
void (*release_cb)(void *), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
void *cb_data); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
The ``request lock'' and ``release lock'' callbacks can be set with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
the \textit{ecrt\_master\_call\-backs()} method. It takes two function |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
pointers and a data value as additional arguments. The arbitrary data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
value will be passed as argument on every callback. Asynchronous |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
master access (like EoE processing) is only possible if these |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
callbacks have been set. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
\paragraph{Preparation of Cyclic Data Exchange} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
Cyclic operation mostly consists of the three steps input, processing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
and output. In EtherCAT terms this would mean: Receive datagrams, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
evaluate process data and send datagrams. The first cycle differs from |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
this principle, because no datagrams have been sent yet, so there is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
nothing to receive. To avoid having a case differantiation (in terms |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
of an \textit{if} clause), the following method exists: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
void ecrt_master_prepare(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
As a last thing before cyclic operation, a call to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
\textit{ecrt\_master\_prepare()} method should be issued. It makes all |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
process data domains queue their datagrams and issues a send command, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
so that the first receive call in cyclic operation will not fail. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
\paragraph{Frame Sending and Receiving} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
To send all queued datagrams and to later receive the sent datagrams |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
there are two methods: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
void ecrt_master_send(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
void ecrt_master_receive(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
The \textit{ecrt\_master\_send()} method takes all datagrams, that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
have been queued for transmission, packs them into frames, and passes |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
them to the network device for sending. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
The \textit{ecrt\_master\_receive()} queries the network device for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
received frames (by calling the ISR\index{ISR}), extracts received |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
datagrams and dispatches the results to the datagram objects in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
queue. Received datagrams, and the ones that timed out, will be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
marked, and then dequeued. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
\paragraph{Running the Operation State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
The master's operation state machine (see section~\ref{sec:fsm-op}) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
monitors the bus in cyclic operation and reconfigures slaves, if |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
necessary. Therefore, the following method should be called |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
cyclically: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
void ecrt_master_run(ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
The \textit{ecrt\_master\_run()} method executes the master's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
operation state machine step by step. It returns after processing one |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
state and queuing a datagram. Calling this function is not mandatory, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
but highly recommended. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
\paragraph{Master Monitoring} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
It is also highly recommended to evaluate the master's error state. In |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
this way it is possible to notice lost network links, failed bus |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
segments, and other issues: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
int ecrt_master_state(const ec_master_t *master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
The \textit{ecrt\_master\_state()} method returns the master's error |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
state. The following states are defined as part of the realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
interface: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
\item[EC\_MASTER\_OK] means, that no error has occurred. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
\item[EC\_MASTER\_LINK\_ERROR] means, that the network link is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
currently down. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
\item[EC\_MASTER\_BUS\_ERROR] means, that one or more slaves do not |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
respond. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
\subsubsection{Domain Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
\label{sec:ecrt-domain} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
\paragraph{PDO Registration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
To access data of a slave's PDO in cyclic operation, it is necessary |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
to make it part of a process data domain: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
ec_slave_t *ecrt_domain_register_pdo(ec_domain_t *domain, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
const char *address, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
uint32_t vendor_id, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
uint32_t product_code, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
const char *pdo_name |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
void **data_ptr); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
int ecrt_domain_register_pdo_list(ec_domain_t *domain, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
const ec_pdo_reg_t *pdos); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
The \textit{ecrt\_domain\_register\_pdo()} method registers a certain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
PDO as part of the domain and takes the address of the process data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
pointer. This pointer will be set on master activation and then can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
parameter to the \textit{EC\_READ\_*} and \textit{EC\_WRITE\_*} macros |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
described below. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
A perhaps easier way to register multiple PDOs at the same time is to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
fill an array of \textit{ec\_pdo\_reg\_t} and hand it to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
\textit{ecrt\_domain\_register\_pdo\_list()} method. Attention: This |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
array has to be terminated by an empty structure (\textit{\{\}})! |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
\paragraph{Evaluating Domain Data} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
To evaluate domain data, the following method has to be used: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
void ecrt_domain_process(ec_domain_t *domain); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
The \textit{ecrt\_domain\_process()} method sets the domains state and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
requeues its datagram for sending. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
\paragraph{Domain State} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
Similar to the master state, a domain has an own error state: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
int ecrt_domain_state(const ec_domain_t *domain); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
The \textit{ecrt\_domain\_state()} method returns the domain's error |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
state. It is non-zero if \underline{not} all process data values could |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
be exchanged, and zero otherwise. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
\subsubsection{Slave Methods} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
\label{sec:ecrt-slave} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
\paragraph{SDO Configuration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
To configure slave SDOs, the function interface below can be used: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
int ecrt_slave_conf_sdo8(ec_slave_t *slave, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
uint16_t sdo_index, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
uint8_t sdo_subindex, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
uint8_t value); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
int ecrt_slave_conf_sdo16(ec_slave_t *slave, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
uint16_t sdo_index, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
uint8_t sdo_subindex, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
uint16_t value); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
int ecrt_slave_conf_sdo32(ec_slave_t *slave, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
uint16_t sdo_index, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
uint8_t sdo_subindex, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
uint32_t value); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
The \textit{ecrt\_slave\_conf\_sdo*()} methods prepare the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
configuration of a certain SDO. The index and subindex of the SDO, and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
the value have to be specified. The configuration is done each time, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
the slave is reconfigured. The methods only differ in the SDO's data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
type. If the configuration could be prepared, zero is returned. If an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
error occured, non-zero is returned. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
\paragraph{Variable-sized PDOs} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
For specifying the size of variable-sized PDOs, the following method |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
can be used: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
int ecrt_slave_pdo_size(ec_slave_t *slave, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
const char *pdo_name, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
size_t size); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
The \textit{ecrt\_slave\_pdo\_size()} method takes the name of the PDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
and the size. It returns zero on success, otherwise non-zero. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
\subsubsection{Process Data Access} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
\label{sec:macros} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
The endianess of the process data could differ from that of the CPU. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
Therefore, process data access has to be done by the macros below, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
that are also provided by the realtime interface: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
#define EC_READ_BIT(DATA, POS) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
#define EC_WRITE_BIT(DATA, POS, VAL) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
#define EC_READ_U8(DATA) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
#define EC_READ_S8(DATA) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
#define EC_READ_U16(DATA) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
#define EC_READ_S16(DATA) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
#define EC_READ_U32(DATA) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
#define EC_READ_S32(DATA) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
#define EC_WRITE_U8(DATA, VAL) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
#define EC_WRITE_S8(DATA, VAL) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
#define EC_WRITE_U16(DATA, VAL) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
#define EC_WRITE_S16(DATA, VAL) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
#define EC_WRITE_U32(DATA, VAL) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
#define EC_WRITE_S32(DATA, VAL) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
There are macros for bitwise access (\textit{EC\_READ\_BIT()}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
\textit{EC\_WRITE\_BIT()}), and bytewise access |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
(\textit{EC\_READ\_*()}, \textit{EC\_WRITE\_*()}). The bytewise macros |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
carry the data type in their name. Example: \textit{EC\_WRITE\_S16()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
writes a 16 bit signed value to EtherCAT data. The \textit{DATA} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
parameter is supposed to be a process data pointer, as provided at PDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
registration. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
The macros use the kernel's endianess conversion macros, that are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
preprocessed to empty macros in case of equal endianess. This is the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
definition for the \textit{EC\_\-READ\_\-U16()} macro: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
\begin{lstlisting}[language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
#define EC_READ_U16(DATA) \ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
((uint16_t) le16_to_cpup((void *) (DATA))) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
The \textit{le16\_to\_cpup()} macro converts a little-endian, 16 bit |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
value to the CPU's architecture and takes a pointer to the input value |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
as its argument. If the CPU's architecture is little-endian, too (for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
example on X86 and compatible), nothing has to be converted. In this |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
case, the macro is replaced with an empty macro by the preprocessor |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
and so there is no unneeded function call or case differentiation in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
the code. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
For keeping it portable, it is highly recommended to make use of these |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
macros. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
\subsection{Slave Addressing} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
\label{sec:addr} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
\index{Slave!Addressing} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
The master offers the serveral slave addressing schemes (for PDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
registration or configuration) via the realtime interface. For this |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
reason, slave addresses are ASCII\nomenclature{ASCII}{American |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
Standard Code for Information Interchange}-coded and passed as a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
string. The addressing schemes are independent of the EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
protocol and represent an additional feature of the master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
Below, the allowed addressing schemes are described. The descriptions |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
are followed by a regular expression formally defining the addressing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
scheme, and one or more examples. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
\item[Position Addressing] This is the normal addressing scheme, where |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
each slave is addressed by its ring position. The first slave has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
address 0, and the $n$th slave has address $n - 1$. This addressing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
scheme is useful for small busses that have a fixed number of slaves.\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
RegEx: \texttt{[0-9]+} --- Example: \texttt{"42"} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
\item[Advanced Position Addressing] Bus couplers segment the bus into |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
(physical) blocks. Though the logical ring positions keep being the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
same, it is easier to address a slave with its block number and the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
relative position inside the block. This addressing is done by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
passing the (zero-based) index of the bus coupler (not the coupler's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
ring position), followed by a colon and the relative position of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
actual slave starting at the bus coupler.\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
RegEx: \texttt{[0-9]+:[0-9]+} --- Examples: \texttt{"0:42"}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
\texttt{"2:7"} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
\item[Alias Addressing] Each slave can have a ``secondary slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
address'' or ``alias address''\footnote{Information about how to set |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
the alias can be found in section~\ref{sec:eepromaccess}} stored |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
in its E$^2$PROM. The alias is evaluated by the master and can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
used to address the slave, which is useful when a clearly defined |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
slave has to be addressed and the ring position is not known or can |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
change over time. This scheme is used by starting the address string |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
with a mesh (\#) followed by the alias address. The latter can also |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
be provided as hexadecimal value, prefixed with \textit{0x}.\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
RegEx: \texttt{\#(0x[0-9A-F]+|[0-9]+)} --- Examples: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
\texttt{"\#6622"}, \texttt{"\#0xBEEF"} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
\item[Advanced Alias Addressing] This is a mixture of the ``Alias |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
Addressing'' and ``Advanced Position Addressing'' schemes. A certain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
slave is addressed by specifying its relative position after an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
aliased slave. This is very useful, if a complete block of slaves |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
can vary its position in the bus. The bus coupler preceeding the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
block should get an alias. The block slaves can then be addressed by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
specifying this alias and their position inside the block. This |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
scheme is used by starting the address string with a mesh (\#) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
followed by the alias address (which can be hexadecimal), then a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
colon and the relative posision of the slave to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
address.\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
RegEx: \texttt{\#(0x[0-9A-F]+|[0-9]+):[0-9]+} --- Examples: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
\texttt{"\#0xBEEF:7"}, \texttt{"\#6:2"} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
In anticipation of section~\ref{sec:ecrt}, the functions accepting |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
these address strings are \textit{ecrt\_\-master\_\-get\_slave()}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
\textit{ecrt\_domain\_register\_pdo()} and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
\textit{ecrt\_domain\_register\_pdo\_list()} (the latter through the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
\textit{ec\_pdo\_reg\_t} structure). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
\subsection{Concurrent Master Access} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
\label{sec:concurr} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
\index{Concurrency} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
In some cases, one master is used by serveral instances, for example |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
when a realtime module does cyclic process data exchange, and there |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
are EoE-capable slaves that require to exchange Ethernet data with the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
kernel (see section~\ref{sec:eoeimp}). For this reason, the master is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
a shared resource, and access to it has to be sequenctialized. This is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
usually done by locking with semaphores, or other methods to protect |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
critical sections. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
The master itself can not provide locking mechanisms, because it has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
no chance to know the appropriate kind of lock. Imagine, the realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
module uses RTAI functionality, then ordinary kernel semaphores would |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
not be sufficient. For that, an important design decision was made: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
The realtime module that reserved a master must have the total |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
control, therefore it has to take responsibility for providing the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
appropriate locking mechanisms. If another instance wants to access |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
the master, it has to request the master lock by callbacks, that have |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
to be set by the realtime module. Moreover the realtime module can |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
deny access to the master if it consideres it to be awkward at the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
moment. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
\includegraphics[width=.6\textwidth]{images/master-locks} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
\caption{Concurrent master access} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
\label{fig:locks} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
Figure~\ref{fig:locks} exemplary shows, how two processes share one |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
master: The realtime module's cyclic thread uses the master for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
process data exchange, while the master-internal EoE process uses it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
to communicate with EoE-capable slaves. Both have to aquire the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
lock before access: The realtime thread can access the lock natively, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
while the EoE process has to use the master callbacks. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
Section~\ref{sec:concurrency} gives an example, of how to implement |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
this. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
\section{The Master's State Machines} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
\label{sec:fsm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
\index{FSM} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
Many parts of the EtherCAT master are implemented as \textit{finite |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
state machines} (FSMs\nomenclature{FSM}{Finite State Machine}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
Though this leads to a higher grade of complexity in some aspects, is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
opens many new possibilities. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
The below short code example exemplary shows how to read all slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
states and moreover illustrates the restrictions of ``sequential'' |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
coding: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
ec_datagram_brd(datagram, 0x0130, 2); // prepare datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
if (ec_master_simple_io(master, datagram)) return -1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
slave_states = EC_READ_U8(datagram->data); // process datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
The \textit{ec\_master\_simple\_io()} function provides a simple |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
interface for synchronously sending a single datagram and receiving |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
the result\footnote{For all communication issues have been meanwhile |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
sourced out into state machines, the function is deprecated and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
stopped existing. Nevertheless it is adequate for showing it's own |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
restrictions.}. Internally, it queues the specified datagram, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
invokes the \textit{ec\_master\_send\_datagrams()} function to send a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
frame with the queued datagram and then waits actively for its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
reception. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
This sequential approach is very simple, reflecting in only three |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
lines of code. The disadvantage is, that the master is blocked for the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
time it waits for datagram reception. There is no difficulty when only |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
one instance is using the master, but if more instances want to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
(synchronously\footnote{At this time, synchronous master access will |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
be adequate to show the advantages of an FSM. The asynchronous |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
approach will be discussed in section~\ref{sec:eoeimp}}) use the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
master, it is inevitable to think about an alternative to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
sequential model. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
Master access has to be sequentialized for more than one instance |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
wanting to send and receive datagrams synchronously. With the present |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
approach, this would result in having one phase of active waiting for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
each instance, which would be non-acceptable especially in realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
circumstances, because of the huge time overhead. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
A possible solution is, that all instances would be executed |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
sequentially to queue their datagrams, then give the control to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
next instance instead of waiting for the datagram reception. Finally, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
bus IO is done by a higher instance, which means that all queued |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
datagrams are sent and received. The next step is to execute all |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
instances again, which then process their received datagrams and issue |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
new ones. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
This approach results in all instances having to retain their state, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
when giving the control back to the higher instance. It is quite |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
obvious to use a \textit{finite state machine} model in this case. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
Section~\ref{sec:fsmtheory} will introduce some of the theory used, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
while the listings below show the basic approach by coding the example |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
from above as a state machine: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
// state 1 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
ec_datagram_brd(datagram, 0x0130, 2); // prepare datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
ec_master_queue(master, datagram); // queue datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
next_state = state_2; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
// state processing finished |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
After all instances executed their current state and queued their |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
datagrams, these are sent and received. Then the respective next |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
states are executed: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
// state 2 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
if (datagram->state != EC_DGRAM_STATE_RECEIVED) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
next_state = state_error; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
return; // state processing finished |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
slave_states = EC_READ_U8(datagram->data); // process datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
// state processing finished. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
See section~\ref{sec:statemodel} for an introduction to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
state machine programming concept used in the master code. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
\subsection{State Machine Theory} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
\label{sec:fsmtheory} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
\index{FSM!Theory} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
A finite state machine \cite{automata} is a model of behavior with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
inputs and outputs, where the outputs not only depend on the inputs, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
but the history of inputs. The mathematical definition of a finite |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
state machine (or finite automaton) is a six-tuple $(\Sigma, \Gamma, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
S, s_0, \delta, \omega)$, with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
\item the input alphabet $\Sigma$, with $\Sigma \neq |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
\emptyset$, containing all input symbols, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
\item the output alphabet $\Gamma$, with $\Gamma \neq |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
\emptyset$, containing all output symbols, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
\item the set of states $S$, with $S \neq \emptyset$, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
\item the set of initial states $s_0$ with $s_0 \subseteq S, s_0 \neq |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
\emptyset$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
\item the transition function $\delta: S \times \Sigma \rightarrow S |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
\times \Gamma$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
\item the output function $\omega$. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
The state transition function $\delta$ is often specified by a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
\textit{state transition table}, or by a \textit{state transition |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
diagram}. The transition table offers a matrix view of the state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
machine behavior (see table~\ref{tab:statetrans}). The matrix rows |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
correspond to the states ($S = \{s_0, s_1, s_2\}$) and the columns |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
correspond to the input symbols ($\Gamma = \{a, b, \varepsilon\}$). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
The table contents in a certain row $i$ and column $j$ then represent |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
the next state (and possibly the output) for the case, that a certain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
input symbol $\sigma_j$ is read in the state $s_i$. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
\begin{table}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
\caption{A typical state transition table} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
\label{tab:statetrans} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
\vspace{2mm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
\begin{tabular}{l|ccc} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
& $a$ & $b$ & $\varepsilon$\\ \hline |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
$s_0$ & $s_1$ & $s_1$ & $s_2$\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
$s_1$ & $s_2$ & $s_1$ & $s_0$\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
$s_2$ & $s_0$ & $s_0$ & $s_0$\\ \hline |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
\end{tabular} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
\end{table} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
The state diagram for the same example looks like the one in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
figure~\ref{fig:statetrans}. The states are represented as circles or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
ellipses and the transitions are drawn as arrows between them. Close |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
to a transition arrow can be the condition that must be fulfilled to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
allow the transition. The initial state is marked by a filled black |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
circle with an arrow pointing to the respective state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
\includegraphics[width=.5\textwidth]{images/statetrans} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
\caption{A typical state transition diagram} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
\label{fig:statetrans} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
\paragraph{Deterministic and non-deterministic state machines} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
A state machine can be deterministic, meaning that for one state and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
input, there is one (and only one) following state. In this case, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
state machine has exactly one starting state. Non-deterministic state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
machines can have more than one transitions for a single state-input |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
combination. There is a set of starting states in the latter case. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
\paragraph{Moore and Mealy machines} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
There is a distinction between so-called \textit{Moore machines}, and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
\textit{Mealy machines}. Mathematically spoken, the distinction lies |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
in the output function $\omega$: If it only depends on the current |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
state ($\omega: S \rightarrow \Gamma$), the machine corresponds to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
``Moore Model''. Otherwise, if $\omega$ is a function of a state and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
the input alphabet ($\omega: S \times \Sigma \rightarrow \Gamma$) the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
state machine corresponds to the ``Mealy model''. Mealy machines are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
the more practical solution in most cases, because their design allows |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
machines with a minimum number of states. In practice, a mixture of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
both models is often used. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
\paragraph{Misunderstandings about state machines} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
There is a phenomenon called ``state explosion'', that is oftenly |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
taken as a counter-argument against general use of state machines in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
complex environments. It has to be mentioned, that this point is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
misleading~\cite{fsmmis}. State explosions happen usually as a result |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
of a bad state machine design: Common mistakes are storing the present |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
values of all inputs in a state, or not dividing a complex state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
machine into simpler sub state machines. The EtherCAT master uses |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
serveral state machines, that are executed hierarchically and so serve |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
as sub state machines. These are also described below. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
\subsection{The Master's State Model} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
\label{sec:statemodel} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
This section will introduce the techniques used in the master to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
implement state machines. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
\paragraph{State Machine Programming} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
There are certain ways to implement a state machine in \textit{C} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
code. An obvious way is to implement the different states and actions |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
by one big case differentiation: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
enum {STATE_1, STATE_2, STATE_3}; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
int state = STATE_1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
void state_machine_run(void *priv_data) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
switch (state) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
case STATE_1: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
action_1(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
state = STATE_2; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
break; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
case STATE_2: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
action_2() |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
if (some_condition) state = STATE_1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
else state = STATE_3; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
break; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
case STATE_3: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
action_3(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
state = STATE_1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
break; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
For small state machines, this is an option. The disadvantage is, that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
with an increasing number of states the code soon gets complex and an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
additional case differentiation is executed each run. Besides, lots of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
indentation is wasted. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
The method used in the master is to implement every state in an own |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
function and to store the current state function with a function |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
pointer: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
void (*state)(void *) = state1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
void state_machine_run(void *priv_data) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
state(priv_data); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
void state1(void *priv_data) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
action_1(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
state = state2; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
void state2(void *priv_data) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
action_2(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
if (some_condition) state = state1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
else state = state2; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
void state3(void *priv_data) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
action_3(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
state = state1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
In the master code, state pointers of all state machines\footnote{All |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
except for the EoE state machine, because multiple EoE slaves have |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
to be handled in parallel. For this reason each EoE handler object |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
has its own state pointer.} are gathered in a single object of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
\textit{ec\_fsm\_t} class. This is advantageous, because there is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
always one instance of every state machine available and can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
started on demand. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
\paragraph{Mealy and Moore} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
If a closer look is taken to the above listing, it can be seen that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
the actions executed (the ``outputs'' of the state machine) only |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
depend on the current state. This accords to the ``Moore'' model |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
introduced in section~\ref{sec:fsmtheory}. As mentioned, the ``Mealy'' |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
model offers a higher flexibility, which can be seen in the listing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
below: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
void state7(void *priv_data) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
if (some_condition) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
action_7a(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
state = state1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
else { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
action_7b(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
state = state8; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
\item[\normalfont\textcircled{\tiny 3} + \textcircled{\tiny 7}] The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
state function executes the actions depending on the state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
transition, that is about to be done. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
The most flexible alternative is to execute certain actions depending |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
on the state, followed by some actions dependent on the state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
transition: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
void state9(void *priv_data) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
action_9(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
if (some_condition) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
action_9a(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
state = state7; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
else { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
action_9b(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
state = state10; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
This model is oftenly used in the master. It combines the best aspects |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
of both approaches. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
\paragraph{Using Sub State Machines} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
To avoid having too much states, certain functions of the EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
master state machine have been sourced out into sub state machines. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
This helps to encapsule the related workflows and moreover avoids the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
``state explosion'' phenomenon described in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
section~\ref{sec:fsmtheory}. If the master would instead use one big |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
state machine, the number of states would be a multiple of the actual |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
number. This would increase the level of complexity to a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
non-manageable grade. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
\paragraph{Executing Sub State Machines} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
If a state machine starts to execute a sub state machine, it usually |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
remains in one state until the sub state machine terminates. This is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
usually done like in the listing below, which is taken out of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
slave configuration state machine code: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
\begin{lstlisting}[language=C,numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
void ec_fsm_slaveconf_saveop(ec_fsm_t *fsm) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
fsm->change_state(fsm); // execute state change |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
// sub state machine |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
if (fsm->change_state == ec_fsm_error) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
fsm->slave_state = ec_fsm_end; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
return; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
if (fsm->change_state != ec_fsm_end) return; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
// continue state processing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
\item[\normalfont\textcircled{\tiny 3}] \textit{change\_state} is the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
state pointer of the state change state machine. The state function, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
the pointer points on, is executed\ldots |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
\item[\normalfont\textcircled{\tiny 6}] \ldots either until the state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
machine terminates with the error state \ldots |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
\item[\normalfont\textcircled{\tiny 11}] \ldots or until the state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
machine terminates in the end state. Until then, the ``higher'' |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
state machine remains in the current state and executes the sub |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
state machine again in the next cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
\paragraph{State Machine Descriptions} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
The below sections describe every state machine used in the EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
master. The textual descriptions of the state machines contain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
references to the transitions in the corresponding state transition |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
diagrams, that are marked with an arrow followed by the name of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
successive state. Transitions caused by trivial error cases (i.~e. no |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
response from slave) are not described explicitly. These transitions |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
are drawn as dashed arrows in the diagrams. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
\subsection{The Operation State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
\label{sec:fsm-op} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
\index{FSM!Operation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
The Operation state machine is executed by calling the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
\textit{ecrt\_master\_run()} method in cyclic realtime code. Its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
purpose is to monitor the bus and to reconfigure slaves after a bus |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
failure or power failure. Figure~\ref{fig:fsm-op} shows its transition |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
diagram. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
\includegraphics[width=.8\textwidth]{images/fsm-op} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
\caption{Transition diagram of the operation state machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
\label{fig:fsm-op} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
\item[START] This is the beginning state of the operation state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
machine. There is a datagram issued, that queries the ``AL Control |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
Response'' attribute \cite[section~5.3.2]{alspec} of all slaves via |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
broadcast. In this way, all slave states and the number of slaves |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2892 |
responding can be determined. $\rightarrow$~BROADCAST |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
\item[BROADCAST] The broadcast datagram is evaluated. A change in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
number of responding slaves is treates as a topology change. If the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
number of slaves is not as expected, the bus is marked as |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
``tainted''. In this state, no slave reconfiguration is possible, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
because the assignment of known slaves and those present on the bus |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
is ambiguous. If the number of slaves is considered as right, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
bus is marked for validation, because it turned from tainted to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
normal state and it has to be checked, if all slaves are valid. Now, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
the state of every single slave has to be determined. For that, a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
(unicast) datagram is issued, that queries the first slave's ``AL |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2904 |
Control Response'' attribute. $\rightarrow$~READ STATES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
\item[READ STATES] If the current slave did not respond to its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
configured station address, it is marked as offline, and the next |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2908 |
slave is queried. $\rightarrow$~READ STATES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
If the slave responded, it is marked as online and its current state |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2911 |
is stored. The next slave is queried. $\rightarrow$~READ STATES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
If all slaves have been queried, and the bus is marked for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
validation, the validation is started by checking the first slaves |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2915 |
vendor ID. $\rightarrow$~VALIDATE VENDOR |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
If no validation has to be done, it is checked, if all slaves are in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
the state they are supposed to be. If not, the first of slave with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
the wrong state is reconfigured and brought in the required state. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2920 |
$\rightarrow$~CONFIGURE SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
If all slaves are in the correct state, the state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2923 |
restarted. $\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
\item[CONFIGURE SLAVES] The slave configuration state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2926 |
executed until termination. $\rightarrow$~CONFIGURE SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
If there are still slaves in the wrong state after another check, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
the first of these slaves is configured and brought into the correct |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2930 |
state again. $\rightarrow$~CONFIGURE SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
If all slaves are in the correct state, the state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2933 |
restarted. $\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
\item[VALIDATE VENDOR] The SII state machine is executed until |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
termination. If the slave has the wrong vendor ID, the state machine |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2937 |
is restarted. $\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
If the slave has the correct vendor ID, its product ID is queried. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2940 |
$\rightarrow$~VALIDATE PRODUCT |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
\item[VALIDATE PRODUCT] The SII state machine is executed until |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
termination. If the slave has the wrong product ID, the state |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2944 |
machine is restarted. $\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
If the slave has the correct product ID, the next slave's vendor ID |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2947 |
is queried. $\rightarrow$~VALIDATE VENDOR |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
If all slaves have the correct vendor IDs and product codes, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
configured station addresses can be safely rewritten. This is done |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
for the first slave marked as offline. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2952 |
$\rightarrow$~REWRITE ADDRESSES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
\item[REWRITE ADDRESSES] If the station address was successfully |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
written, it is sear\-ched for the next slave marked as offline. If |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
there is one, its address is reconfigured, too. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2957 |
$\rightarrow$~REWRITE ADDRESSES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
If there are no more slaves marked as offline, the state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2960 |
restarted. $\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
\subsection{The Idle State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
\label{sec:fsm-idle} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
\index{FSM!Idle} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
The Idle state machine is executed by a kernel workqueue, if no |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
realtime module is connected. Its purpose is to make slave information |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
available to user space, operate EoE-capable slaves, read and write |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
E$^2$PROM contents and test slave functionality. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
Figure~\ref{fig:fsm-idle} shows its transition diagram. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
\includegraphics[width=.8\textwidth]{images/fsm-idle} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
\caption{Transition diagram of the idle state machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
\label{fig:fsm-idle} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
\item[START] The beginning state of the idle state machine. Similar to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
the operation state machine, a broadcast datagram is issued, to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
query all slave states and the number of slaves. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2986 |
$\rightarrow$~BROADCAST |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
\item[BROADCAST] The number of responding slaves is evaluated. If it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
has changed since the last time, this is treated as a topology |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
change and the internal list of slaves is cleared and rebuild |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
completely. The slave scan state machine is started for the first |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2992 |
slave. $\rightarrow$~SCAN FOR SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
If no topology change happened, every single slave state is fetched. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2995 |
$\rightarrow$~READ STATES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
\item[SCAN FOR SLAVES] The slave scan state machine is executed until |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
2998 |
termination. $\rightarrow$~SCAN FOR SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
If there is another slave to scan, the slave scan state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3001 |
started again. $\rightarrow$~SCAN FOR SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
If all slave information has been fetched, slave addresses are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
calculated and EoE processing is started. Then, the state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3005 |
restarted. $\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
\item[READ STATES] If the slave did not respond to the query, it is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
marked as offline. The next slave is queried. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3009 |
$\rightarrow$~READ STATES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
If the slave responded, it is marked as online. And the next slave |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3012 |
is queried. $\rightarrow$~READ STATES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
If all slave states have been determined, it is checked, if any |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
slaves are not in the state they supposed to be. If this is true, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
the slave configuration state machine is started for the first of |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3017 |
them. $\rightarrow$~CONFIGURE SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3019 |
If all slaves are in the correct state, it is checked, if any |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
E$^2$PROM write operations are pending. If this is true, the first |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
pending operation is executed by starting the SII state machine for |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3022 |
writing access. $\rightarrow$~WRITE EEPROM |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
If all these conditions are false, there is nothing to do and the |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3025 |
state machine is restarted. $\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3026 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
\item[CONFIGURE SLAVES] The slave configuration state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3028 |
executed until termination. $\rightarrow$~CONFIGURE SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
After this, it is checked, if another slave needs a state change. If |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
this is true, the slave state change state machine is started for |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3032 |
this slave. $\rightarrow$~CONFIGURE SLAVES |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
If all slaves are in the correct state, it is determined, if any |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
E$^2$PROM write operations are pending. If this is true, the first |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
pending operation is executed by starting the SII state machine for |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3037 |
writing access. $\rightarrow$~WRITE EEPROM |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
If all prior conditions are false, the state machine is restarted. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3040 |
$\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
\item[WRITE EEPROM] The SII state machine is executed until |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3043 |
termination. $\rightarrow$~WRITE EEPROM |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
If the current word has been written successfully, and there are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
still word to write, the SII state machine is started for the next |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3047 |
word. $\rightarrow$~WRITE EEPROM |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
If all words have been written successfully, the new E$^2$PROM |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
contents are evaluated and the state machine is restarted. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3051 |
$\rightarrow$~START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
\subsection{The Slave Scan State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
\label{sec:fsm-scan} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
\index{FSM!Slave Scan} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
The slave scan state machine, which can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
figure~\ref{fig:fsm-slavescan}, leads through the process of fetching |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
all slave information. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
\includegraphics[width=.6\textwidth]{images/fsm-slavescan} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
\caption{Transition diagram of the slave scan state machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
\label{fig:fsm-slavescan} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
\item[START] In the beginning state of the slave scan state machine, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
the station address is written to the slave, which is always the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
ring position~+~$1$. In this way, the address 0x0000 (default |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
address) is not used, which makes it easy to detect unconfigured |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3077 |
slaves. $\rightarrow$~ADDRESS |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
\item[ADDRESS] The writing of the station address is verified. After |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
that, the slave's ``AL Control Response'' attribute is queried. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3081 |
$\rightarrow$~STATE |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
\item[STATE] The AL state is evaluated. A warning is output, if the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
slave has still the \textit{Change} bit set. After that, the slave's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
``DL Information'' attribute is queried. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3086 |
$\rightarrow$~BASE |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
\item[BASE] The queried base data are evaluated: Slave type, revision |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
and build number, and even more important, the number of supported |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
sync managers and FMMUs are stored. After that, the slave's data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
link layer information is read from the ``DL Status'' attribute at |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3092 |
address 0x0110. $\rightarrow$~DATALINK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
\item[DATALINK] In this state, the DL information is evaluated: This |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
information about the communication ports contains, if the link is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
up, if the loop has been closed and if there is a carrier detected |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
on the RX side of each port. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
Then, the state machine starts measuring the size of the slave's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
E$^2$PROM contents. This is done by subsequently reading out each |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
category header, until the last category is reached (type 0xFFFF). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
This procedure is started by querying the first category header at |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
word address 0x0040 via the SII state machine. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3104 |
$\rightarrow$~EEPROM SIZE |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
\item[EEPROM SIZE] The SII state machine is executed until |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3107 |
termination. $\rightarrow$~EEPROM SIZE |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
If the category type does not mark the end of the categories, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
position of the next category header is determined via the length of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
the current category, and the SII state machine is started again. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3112 |
$\rightarrow$~EEPROM SIZE |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
If the size of the E$^2$PROM contents has been determined, memory is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
allocated, to read all the contents. The SII state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3116 |
started to read the first word. $\rightarrow$~EEPROM DATA |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
\item[EEPROM DATA] The SII state machine is executed until |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3119 |
termination. $\rightarrow$~EEPROM DATA |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
Two words have been read. If more than one word is needed, the two |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
words are written in the allocated memory. Otherwise only one word |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
(the last word) is copied. If more words are to read, the SII state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
machine is started again to read the next two words. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3125 |
$\rightarrow$~EEPROM DATA |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
The complete E$^2$PROM contents have been read. The slave's identity |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
object and mailbox information are evaluated. Moreover the category |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
types STRINGS, GENERAL, SYNC and PDO are evaluated. The slave |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3130 |
scanning has been completed. $\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
\item[END] Slave scanning has been finished. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
\subsection{The Slave Configuration State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
\label{sec:fsm-conf} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
\index{FSM!Slave Configuration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
The slave configuration state machine, which can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
figure~\ref{fig:fsm-slaveconf}, leads through the process of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
configuring a slave and bringing it to a certain state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
\includegraphics[width=.6\textwidth]{images/fsm-slaveconf} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
\caption{Transition diagram of the slave configuration state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
\label{fig:fsm-slaveconf} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
\item[INIT] The state change state machine has been initialized to |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3156 |
bring the slave into the INIT state. Now, the slave state change |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3157 |
state machine is executed until termination. $\rightarrow$~INIT |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
If the slave state change failed, the configuration has to be |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3160 |
aborted. $\rightarrow$~END |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3161 |
|
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3162 |
The slave state change succeeded and the slave is now in INIT state. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3163 |
If this is the target state, the configuration is finished. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3164 |
$\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
If the slave does not support any sync managers, the sync manager |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
configuration can be skipped. The state change state machine is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3168 |
started to bring the slave into PREOP state. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3169 |
$\rightarrow$~PREOP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
Sync managers are configured conforming to the sync manager category |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
information provided in the slave's E$^2$PROM. The corresponding |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3173 |
datagram is issued. $\rightarrow$~SYNC |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
\item[SYNC] If the sync manager configuration datagram is accepted, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
the sync manager configuration was successful. The slave may now |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3177 |
enter the PREOP state, and the state change state machine is |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3178 |
started. $\rightarrow$~PREOP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
\item[PREOP] The state change state machine is executed until |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3181 |
termination. $\rightarrow$~PREOP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
If the state change failed, the configuration has to be aborted. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3184 |
$\rightarrow$~END |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3185 |
|
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3186 |
If the PREOP state was the target state, the configuration is |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3187 |
finished. $\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
If the slave supports no FMMUs, the FMMU configuration can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
skipped. If the slave has SDOs to configure, it is begun with |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3191 |
sending the first SDO. $\rightarrow$~SDO\_CONF |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
If no SDO configurations are provided, the slave can now directly be |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3194 |
brought into the SAVEOP state and the state change state machine is |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3195 |
started again. $\rightarrow$~SAVEOP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
Otherwise, all supported FMMUs are configured according to the PDOs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
requested via the master's realtime interface. The appropriate |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3199 |
datagram is issued. $\rightarrow$~FMMU |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
\item[FMMU] The FMMU configuration datagram was accepted. If the slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
has SDOs to configure, it is begun with sending the first SDO. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3203 |
$\rightarrow$~SDO\_CONF |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3204 |
|
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3205 |
Otherwise, the slave can now be brought into the SAVEOP state. The |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3206 |
state change state machine is started. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3207 |
$\rightarrow$~SAVEOP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
\item[SDO\_CONF] The CoE state machine is executed until termination. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3210 |
$\rightarrow$~SDO\_CONF |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
If another SDO has to be configured, a new SDO download sequence is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3213 |
begun. $\rightarrow$~SDO\_CONF |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3214 |
|
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3215 |
Otherwise, the slave can now be brought into the SAVEOP state. The |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3216 |
state change state machine is started. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3217 |
$\rightarrow$~SAVEOP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
\item[SAVEOP] The state change state machine is executed until |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3220 |
termination. $\rightarrow$~SAVEOP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
If the state change failed, the configuration has to be aborted. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3223 |
$\rightarrow$~END |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3224 |
|
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3225 |
If the SAVEOP state was the target state, the configuration is |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3226 |
finished. $\rightarrow$~END |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3227 |
|
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3228 |
The slave can now directly be brought into the OP state and the |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3229 |
state change state machine is started a last time. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3230 |
$\rightarrow$~OP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
\item[OP] The state change state machine is executed until |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3233 |
termination. $\rightarrow$~OP |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
If the state change state machine terminates, the slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
configuration is finished, regardless of its success. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3237 |
$\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
\item[END] The termination state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
\subsection{The State Change State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
\label{sec:fsm-change} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
\index{FSM!State Change} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
The state change state machine, which can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
figure~\ref{fig:fsm-change}, leads through the process of changing a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
slave's state. This implements the states and transitions described in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
\cite[section~6.4.1]{alspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
\includegraphics[width=.9\textwidth]{images/fsm-change} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
\caption{Transition diagram of the state change state machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
\label{fig:fsm-change} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
\item[START] The beginning state, where a datagram with the state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
change command is written to the slave's ``AL Control Request'' |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3264 |
attribute. Nothing can fail. $\rightarrow$~CHECK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
\item[CHECK] After the state change datagram has been sent, the ``AL |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
Control Response'' attribute is queried with a second datagram. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3268 |
$\rightarrow$~STATUS |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
\item[STATUS] The read memory contents are evaluated: While the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
parameter \textit{State} still contains the old slave state, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
slave is busy with reacting on the state change command. In this |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
case, the attribute has to be queried again. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3274 |
$\rightarrow$~STATUS |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
In case of success, the \textit{State} parameter contains the new |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
state and the \textit{Change} bit is cleared. The slave is in the |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3278 |
requested state. $\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
If the slave can not process the state change, the \textit{Change} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
bit is set: Now the master tries to get the reason for this by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
querying the \textit{AL Status Code} parameter. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3283 |
$\rightarrow$~CODE |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
\item[END] If the state machine ends in this state, the slaves's state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
change has been successful. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
\item[CODE] The status code query has been sent. Reading the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
\textit{AL Status Code} might fail, because not all slaves support |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
this parameter. Anyway, the master has to acknowledge the state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
change error by writing the current slave state to the ``AL Control |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
Request'' attribute with the \textit{Acknowledge} bit set. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3293 |
$\rightarrow$~ACK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
\item[ACK] After that, the ``AL Control Response'' attribute is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
queried for the state of the acknowledgement. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3297 |
$\rightarrow$~CHECK ACK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
\item[CHECK ACK] If the acknowledgement has been accepted by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
slave, the old state is kept. Still, the state change was |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3301 |
unsuccessful. $\rightarrow$~ERROR |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
If the acknowledgement is ignored by the slave, a timeout happens. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
In any case, the overall state change was unsuccessful. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3305 |
$\rightarrow$~ERROR |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
If there is still now response from the slave, but the timer did not |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
run out yet, the slave's ``AL Control Response'' attribute is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3309 |
queried again. $\rightarrow$~CHECK ACK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
\item[ERROR] If the state machine ends in this state, the slave's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
state change was unsuccessful. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
\subsection{The SII State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
\label{sec:fsm-sii} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
\index{FSM!SII} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
The SII\index{SII} state machine (shown in figure~\ref{fig:fsm-sii}) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
implements the process of reading or writing E$^2$PROM data via the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
Slave Information Interface described in \cite[section~5.4]{alspec}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
\includegraphics[width=.9\textwidth]{images/fsm-sii} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
\caption{Transition diagram of the SII state machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
\label{fig:fsm-sii} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
\item[READ\_START] The beginning state for reading access, where the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
read request and the requested address are written to the SII |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
attribute. Nothing can fail up to now. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3337 |
$\rightarrow$~READ\_CHECK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
\item[READ\_CHECK] When the SII read request has been sent |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
successfully, a timer is started. A check/fetch datagram is issued, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
that reads out the SII attribute for state and data. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3342 |
$\rightarrow$~READ\_FETCH |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
\item[READ\_FETCH] Upon reception of the check/fetch datagram, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3345 |
\textit{Read Operation} and \textit{Busy} parameters are checked: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3346 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
\item If the slave is still busy with fetching E$^2$PROM data into |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
the interface, the timer is checked. If it timed out, the reading |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3349 |
is aborted ($\rightarrow$~ERROR), if not, the check/fetch datagram |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3350 |
is issued again. $\rightarrow$~READ\_FETCH |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
\item If the slave is ready with reading data, these are copied from |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
the datagram and the read cycle is completed. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3354 |
$\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
The write access states behave nearly the same: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
\item[WRITE\_START] The beginning state for writing access, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
respectively. A write request, the target address and the data word |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
are written to the SII attribute. Nothing can fail. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3364 |
$\rightarrow$~WRITE\_CHECK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
\item[WRITE\_CHECK] When the SII write request has been sent |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
successfully, the timer is started. A check datagram is issued, that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
reads out the SII attribute for the state of the write operation. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3369 |
$\rightarrow$~WRITE\_CHECK2 |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
\item[WRITE\_CHECK2] Upon reception of the check datagram, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
\textit{Write Operation} and \textit{Busy} parameters are checked: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
\item If the slave is still busy with writing E$^2$PROM data, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
timer is checked. If it timed out, the operation is aborted |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3376 |
($\rightarrow$~ERROR), if not, the check datagram is issued again. |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3377 |
$\rightarrow$~WRITE\_CHECK2 |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
\item If the slave is ready with writing data, the write cycle is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3379 |
completed. $\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
\section{Mailbox Protocol Implementations} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
\index{Mailbox} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
The EtherCAT master implements the EoE and the CoE mailbox |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
protocols. See the below section for details. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
\subsection{Ethernet-over-EtherCAT (EoE)} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
\label{sec:eoeimp} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
\index{EoE} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
The EtherCAT master implements the Ethernet-over-EtherCAT mailbox |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
protocol to enable the tunneling of Ethernet frames to special slaves, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
that can either have physical Ethernet ports to forward the frames to, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
or have an own IP stack to receive the frames. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
\paragraph{Virtual Network Interfaces} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
The master creates a virtual EoE network interface for every |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
EoE-capable slave. These interfaces are called \textit{eoeX}, where X |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
is a number provided by the kernel on interface registration. Frames |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
sent to these interfaces are forwarded to the associated slaves by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
master. Frames, that are received by the slaves, are fetched by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
master and forwarded to the virtual interfaces. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
This bears the following advantages: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
\item Flexibility: The user can decide, how the EoE-capable slaves are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
interconnected with the rest of the world. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
\item Standard tools can be used to monitor the EoE activity and to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
configure the EoE interfaces. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
\item The Linux kernel's layer-2-bridging implementation (according to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
the IEEE 802.1D MAC Bridging standard) can be used natively to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
bridge Ethernet traffic between EoE-capable slaves. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
\item The Linux kernel's network stack can be used to route packets |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
between EoE-capable slaves and to track security issues, just like |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
having physical network interfaces. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
\paragraph{EoE Handlers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
The virtual EoE interfaces and the related functionality is encapsuled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
in the \textit{ec\_eoe\_t} class (see section~\ref{sec:class-eoe}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
So the master does not create the network interfaces directly: This is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
done inside the constructor of the \textit{ec\_eoe\_t} class. An |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
object of this class is called ``EoE handler'' below. An EoE handler |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
additionaly contains a frame queue. Each time, the kernel passes a new |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
socket buffer for sending via the interface's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
\textit{hard\_start\_xmit()} callback, the socket buffer is queued for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
transmittion by the EoE state machine (see below). If the queue gets |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
filled up, the passing of new socket buffers is suspended with a call |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
to \textit{netif\_stop\_queue()}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
\paragraph{Static Handler Creation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
The master creates a pool of EoE handlers at startup, that are coupled |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
to EoE-capable slaves on demand. The lifetime of the corresponding |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
network interfaces is equal to the lifetime of the master module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
This approach is opposed to creating the virtual network interfaces on |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
demand (i.~e. on running across a new EoE-capable slave). The latter |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
approach was considered as difficult, because of serveral reasons: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
\item The \textit{alloc\_netdev()} function can sleep and must be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
called from a non-interrupt context. This reduces the flexibility of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
choosing an appropriate method for cyclic EoE processing. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
\item Unregistering network interfaces requires them to be ``down'', |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
which can not be guaranteed upon sudden disappearing of an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
EoE-capable slave. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
\item The connection to the EoE-capable slaves must be as continuous |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
as possible. Especially the transition from idle to operation mode |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
(and vice versa) causes the rebuilding of the internal data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
structures. These transitions must be as transparent as possible for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
the instances using the network interfaces. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
\paragraph{Number of Handlers} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
The master module has a parameter \textit{ec\_eoeif\_count} to specify |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
the number of EoE interfaces (and handlers) per master to create. This |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
parameter can either be specified when manually loading the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
module, or (when using the init script) by setting the |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3469 |
\$EOE\_INTERFACES variable in the sysconfig file (see |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
section~\ref{sec:sysconfig}). Upon loading of the master module, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
virtual interfaces become available: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3474 |
# `\textbf{ifconfig -a}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
eoe0 Link encap:Ethernet HWaddr 00:11:22:33:44:06 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
BROADCAST MULTICAST MTU:1500 Metric:1 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
RX packets:0 errors:0 dropped:0 overruns:0 frame:0 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
collisions:0 txqueuelen:1000 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3482 |
eoe1 Link encap:Ethernet HWaddr 00:11:22:33:44:07 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3483 |
BROADCAST MULTICAST MTU:1500 Metric:1 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3484 |
RX packets:0 errors:0 dropped:0 overruns:0 frame:0 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
collisions:0 txqueuelen:1000 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
\paragraph{Coupling of EoE Slaves} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
During execution of the slave scan state machine (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
section~\ref{sec:fsm-scan}), the master determines the supported |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
mailbox protocols. This is done by examining the ``Supported Mailbox |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
Protocols'' mask field at word address 0x001C of the SII\index{SII}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
If bit 1 is set, the slave supports the EoE protocol. After slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
scanning, the master runs through all slaves again and couples each |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
EoE-capable slave to a free EoE handler. It can happen, that there are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
not enough EoE handlers to cover all EoE-capable slaves. In this case, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
the number of EoE handlers must be increased accordingly. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
\paragraph{EoE State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3504 |
\index{FSM!EoE} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3505 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
Every EoE handler owns an EoE state machine, that is used to send |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
frames to the coupled slave and receive frames from the it via the EoE |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
communication primitives. This state machine is showed in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
figure~\ref{fig:fsm-eoe}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3511 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3512 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3513 |
\includegraphics[width=.7\textwidth]{images/fsm-eoe} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3514 |
\caption{Transition diagram of the EoE state machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3515 |
\label{fig:fsm-eoe} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3516 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3517 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3518 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3519 |
\item[RX\_START] The beginning state of the EoE state machine. A |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3520 |
mailbox check datagram is sent, to query the slave's mailbox for new |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3521 |
frames. $\rightarrow$~RX\_CHECK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3522 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3523 |
\item[RX\_CHECK] The mailbox check datagram is received. If the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3524 |
slave's mailbox did not contain data, a transmit cycle is started. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3525 |
$\rightarrow$~TX\_START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3526 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3527 |
If there are new data in the mailbox, a datagram is sent to fetch |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3528 |
the new data. $\rightarrow$~RX\_FETCH |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3529 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3530 |
\item[RX\_FETCH] The fetch datagram is received. If the mailbox data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3531 |
do not contain a ``EoE Fragment request'' command, the data are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3532 |
dropped and a transmit sequence is started. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3533 |
$\rightarrow$~TX\_START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3534 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3535 |
If the received Ethernet frame fragment is the first fragment, a new |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3536 |
socket buffer is allocated. In either case, the data are copied into |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3537 |
the correct position of the socket buffer. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3538 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3539 |
If the fragment is the last fragment, the socket buffer is forwarded |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3540 |
to the network stack and a transmit sequence is started. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3541 |
$\rightarrow$~TX\_START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3542 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3543 |
Otherwise, a new receive sequence is started to fetch the next |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3544 |
fragment. $\rightarrow$~RX\_\-START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3545 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3546 |
\item[TX\_START] The beginning state of a transmit sequence. It is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3547 |
checked, if the transmittion queue contains a frame to send. If not, |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3548 |
a receive sequence is started. $\rightarrow$~RX\_START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3549 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3550 |
If there is a frame to send, it is dequeued. If the queue was |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3551 |
inactive before (because it was full), the queue is woken up with a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3552 |
call to \textit{netif\_wake\_queue()}. The first fragment of the |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3553 |
frame is sent. $\rightarrow$~TX\_SENT |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3554 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3555 |
\item[TX\_SENT] It is checked, if the first fragment was sent |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3556 |
successfully. If the current frame consists of further fragments, |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3557 |
the next one is sent. $\rightarrow$~TX\_SENT |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3558 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3559 |
If the last fragment was sent, a new receive sequence is started. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3560 |
$\rightarrow$~RX\_START |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3561 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3562 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3563 |
\paragraph{EoE Processing} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3564 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3565 |
To execute the EoE state machine of every active EoE handler, there |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3566 |
must be a cyclic process. The easiest thing would be to execute the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3567 |
EoE state machines synchronously to the operation state machine (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3568 |
section~\ref{sec:fsm-op}) with every realtime cycle. This approach has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3569 |
the following disadvantages: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3570 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3571 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3572 |
\item Only one EoE fragment can be sent or received every few cycles. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3573 |
This causes the data rate to be very low, because the EoE state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3574 |
machines are not executed in the time between the realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3575 |
cycles. Moreover, the data rate would be dependent on the frequency |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3576 |
of the realtime process. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3577 |
\item The receiving and forwarding of frames to the kernel requires |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3578 |
the dynamic allocation of frames. Some realtime extensions do not |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3579 |
support calling memory allocation functions in realtime context, so |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3580 |
the EoE state machine may not be executed with each realtime cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3581 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3582 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3583 |
To overcome these problems, an own cyclic process is needed to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3584 |
asynchronously execute the EoE state machines. For that, the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3585 |
owns a kernel timer, that is executed each timer interrupt. This |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3586 |
guarantees a constant bandwidth, but poses the new problem of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3587 |
concurrent access to the master. The locking mechanisms needed for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3588 |
this are introduced in section~\ref{sec:concurr}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3589 |
Section~\ref{sec:concurrency} gives practical implementation examples. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3590 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3591 |
\paragraph{Idle Mode} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3592 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3593 |
EoE data must also be exchanged idle mode, to guarantee the continuous |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3594 |
availability of the connection to the EoE-capable slaves. Although |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3595 |
there is no realtime module connected in this case, the master is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3596 |
still accessed by the idle state machine (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3597 |
section~\ref{sec:fsm-idle}), that is executed by the master's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3598 |
workqueue. With the EoE timer running in addition, there is still |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3599 |
concurrency, that has to be protected by a lock. Therefore the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3600 |
owns an internal spinlock that is used protect master access during |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3601 |
idle mode. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3602 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3603 |
\paragraph{Automatic Configuration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3604 |
|
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3605 |
By default, slaves are left in INIT state during idle mode. If an EoE |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3606 |
interface is set to running state (i.~e. with the \textit{ifconfig up} |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3607 |
command), the requested slave state of the related slave is |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3608 |
automatically set to OP, whereupon the idle state machine will attempt |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3609 |
to configure the slave and put it into operation. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3610 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3611 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3612 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3613 |
\subsection{CANopen-over-EtherCAT (CoE)} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3614 |
\label{sec:coeimp} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3615 |
\index{CoE} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3616 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3617 |
The CANopen-over-EtherCAT protocol \cite[section~5.6]{alspec} is used |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3618 |
to configure slaves on application level. Each CoE-capable slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3619 |
provides a list of SDOs for this reason. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3620 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3621 |
\paragraph{SDO Configuration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3622 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3623 |
The SDO configurations have to be provided by the realtime module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3624 |
This is done via the \textit{ecrt\_slave\_conf\_sdo*()} methods (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3625 |
section~\ref{sec:ecrt-slave}), that are part of the realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3626 |
interface. The slave stores the SDO configurations in a linked list, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3627 |
but does not apply them at once. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3628 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3629 |
\paragraph{SDO Download State Machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3630 |
|
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3631 |
The best time to apply SDO configurations is during the slave's PREOP |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3632 |
state, because mailbox communication is already possible and slave's |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3633 |
application will start with updating input data in the succeeding |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3634 |
SAVEOP state. Therefore the SDO configuration has to be part of the |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3635 |
slave configuration state machine (see section~\ref{sec:fsm-conf}): It |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3636 |
is implemented via an SDO download state machine, that is executed |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3637 |
just before entering the slave's SAVEOP state. In this way, it is |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3638 |
guaranteed that the SDO configurations are applied each time, the |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3639 |
slave is reconfigured. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3640 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3641 |
The transition diagram of the SDO Download state machine can be seen |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3642 |
in figure~\ref{fig:fsm-coedown}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3643 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3644 |
\begin{figure}[htbp] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3645 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3646 |
\includegraphics[width=.9\textwidth]{images/fsm-coedown} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3647 |
\caption{Transition diagram of the CoE download state machine} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3648 |
\label{fig:fsm-coedown} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3649 |
\end{figure} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3650 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3651 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3652 |
\item[START] The beginning state of the CoE download state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3653 |
machine. The ``SDO Download Normal Request'' mailbox command is |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3654 |
sent. $\rightarrow$~REQUEST |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3655 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3656 |
\item[REQUEST] It is checked, if the CoE download request has been |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3657 |
received by the slave. After that, a mailbox check command is issued |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3658 |
and a timer is started. $\rightarrow$~CHECK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3659 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3660 |
\item[CHECK] If no mailbox data is available, the timer is checked. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3661 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3662 |
\item If it timed out, the SDO download is aborted. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3663 |
$\rightarrow$~ERROR |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3664 |
\item Otherwise, the mailbox is queried again. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3665 |
$\rightarrow$~CHECK |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3666 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3667 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3668 |
If the mailbox contains new data, the response is fetched. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3669 |
$\rightarrow$~RESPONSE |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3670 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3671 |
\item[RESPONSE] If the mailbox response could not be fetched, the data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3672 |
is invalid, the wrong protocol was received, or a ``Abort SDO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3673 |
Transfer Request'' was received, the SDO download is aborted. |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3674 |
$\rightarrow$~ERROR |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3675 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3676 |
If a ``SDO Download Normal Response'' acknowledgement was received, |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3677 |
the SDO download was successful. $\rightarrow$~END |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3678 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3679 |
\item[END] The SDO download was successful. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3680 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3681 |
\item[ERROR] The SDO download was aborted due to an error. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3682 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3683 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3684 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3685 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3686 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3687 |
\section{User Space} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3688 |
\label{sec:user} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3689 |
\index{User space} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3690 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3691 |
For the master runs as a kernel module, accessing it is natively |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3692 |
limited to analyzing syslog messages and controlling using modutils. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3693 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3694 |
It is necessary to implement further interfaces, that make it easier |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3695 |
to access the master from user space and allow a finer influence. It |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3696 |
should be possible to view and to change special parameters at runtime. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3697 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3698 |
Bus visualization is a second point: For development and debugging |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3699 |
purposes it would be nice, if one could show the connected slaves with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3700 |
a single command. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3701 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3702 |
Another aspect is automatic startup and configuration. If the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3703 |
is to be integrated into a running system, it must be able to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3704 |
automatically start with a persistent configuration. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3705 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3706 |
A last thing is monitoring EtherCAT communication. For debugging |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3707 |
purposes, there had to be a way to analyze EtherCAT datagrams. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3708 |
best way would be with a popular network analyzer, like Wireshark |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3709 |
\cite{wireshark} (the former Ethereal) or others. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3710 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3711 |
This section covers all those points and introduces the interfaces and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3712 |
tools to make all that possible. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3713 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3714 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3715 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3716 |
\subsection{The Sysfs Interface} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3717 |
\label{sec:sysfs} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3718 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3719 |
The system filesystem (Sysfs\index{Sysfs}) was introduced with Linux |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3720 |
kernel 2.5 and is a well-defined interface for drivers to export |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3721 |
information to user space. It serves also as an relief for the process |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3722 |
filesystem (Procfs), where over the years much non-process information |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3723 |
was concentrated. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3724 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3725 |
Sysfs exports information about devices, classes and busses via a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3726 |
virtual filesystem, usually mounted to \textit{/sys}. The EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3727 |
master slightly differs from this concept, because the only physical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3728 |
device is the network adapter it uses for bus communication, which is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3729 |
already represented in Sysfs. For the EtherCAT bus is no system bus |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3730 |
like PCI (with device and driver structures), it would not make any |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3731 |
sense to represent it as bus structure in Sysfs. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3732 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3733 |
Therefore, the EtherCAT master is represented as a new directory |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3734 |
directly unter the Sysfs root. Every master gets its own Sysfs entry |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3735 |
named \textit{ethercatX}, where X is the index of the master. Two |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3736 |
masters would result in the directories \textit{/sys/ethercat0} and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3737 |
\textit{/sys/ethercat1}, respectively. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3738 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3739 |
The Sysfs base class in the kernel code is the \textit{kobject} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3740 |
structure. Each object structure, that is to be represented in Sysfs, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3741 |
has to contain such a structure, because due to the concurrent access |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3742 |
(through ``normal'' kernel code and Sysfs code) the object deletion |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3743 |
gets a little more complicated: The object may not be freed until no |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3744 |
instance uses it any more. Therefore, each kobject maintains a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3745 |
reference counter. If the reference counter gets zero, the object is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3746 |
finally freed. A kobject can be registered to appear as a directory in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3747 |
Sysfs with a call to \textit{kobject\_add()}. Each kobject type can |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3748 |
define attributes, that appear as files in the kobject's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3749 |
directory. Callback functions have to be provided for reading (and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3750 |
perhaps writing) access. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3751 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3752 |
\subsubsection{Master Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3753 |
\label{sec:sysfs-master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3754 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3755 |
Below is a typical listing of the masters Sysfs directory (that is a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3756 |
file system representation of the master's kobject): |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3757 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3758 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3759 |
`\$` `\textbf{ls /sys/ethercat0}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3760 |
debug_level slave000 slave003 slave006 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3761 |
eeprom_write_enable slave001 slave004 slave007 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3762 |
info slave002 slave005 slave008 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3763 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3764 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3765 |
The following attributes exist in the master directory: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3766 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3767 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3768 |
\item[debug\_level] (read/write) This attribute contains the master's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3769 |
debug level, which controls, how much information is printed into |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3770 |
syslog. The values 0 (no additional debug messages), 1 (a few |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3771 |
additional debug messages) and 2 (all additional debug messages) are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3772 |
defined. Writing is done with command like |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3773 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3774 |
\begin{lstlisting}[gobble=4] |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3775 |
# `\textbf{echo 1 > /sys/ethercat0/debug\_level}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3776 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3777 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3778 |
and is receipted with a syslog message by the master: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3779 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3780 |
\begin{lstlisting}[gobble=4] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3781 |
EtherCAT: Master debug level set to 1. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3782 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3783 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3784 |
\item[enable\_eeprom\_writing] (read/write) See |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3785 |
section~\ref{sec:eepromaccess} for how to use this attribute. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3786 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3787 |
\item[info] (read only) This attribute contains information about the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3788 |
master. Example contents are below: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3789 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3790 |
\begin{lstlisting}[gobble=4] |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3791 |
`\$` `\textbf{cat /sys/ethercat0/info}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3792 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3793 |
Mode: IDLE |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3794 |
Slaves: 9 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3795 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3796 |
Timing (min/avg/max) [us]: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3797 |
Idle cycle: 4 / 4.38 / 34 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3798 |
EoE cycle: 9 / 11.91 / 23 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3799 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3800 |
EoE statistics (RX/TX) [bps]: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3801 |
eoe0: 0 / 3184 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3802 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3803 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3804 |
The mode can be \textit{ORPHANED}, \textit{IDLE} or |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3805 |
\textit{OPERATION}. The other parameters are self-explanatory. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3806 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3807 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3808 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3809 |
\subsubsection{Domain Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3810 |
\label{sec:sysfs-domain} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3811 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3812 |
In operation mode, each created domain is represented as a directory |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3813 |
\textit{domainX}, where X is the domain index. Below is a listing of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3814 |
the domain directory contents: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3815 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3816 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3817 |
`\$` `\textbf{ls /sys/ethercat0/domain0}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3818 |
image_size |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3819 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3820 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3821 |
The domain directories currently only export the domain's image size. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3822 |
It is planned to export the whole process data mapping for debugging |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3823 |
purposes. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3824 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3825 |
\subsubsection{Slave Attributes} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3826 |
\label{sec:sysfs-slave} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3827 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3828 |
Each slave on the bus is represented in its own directory |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3829 |
\textit{slaveXXX}, where XXX is the slave's 3-digit ring position in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3830 |
the EtherCAT bus. Below is a listing of a slave directory: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3831 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3832 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3833 |
`\$` `\textbf{ls /sys/ethercat0/slave003}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3834 |
eeprom info state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3835 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3836 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3837 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3838 |
\item[eeprom] (read/write) See section~\ref{sec:eepromaccess} for how |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3839 |
to use this attribute. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3840 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3841 |
\item[info] (read only) This attribute contains a bunch of information |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3842 |
about the slave. Below is an example output: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3843 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3844 |
\begin{lstlisting}[gobble=4] |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3845 |
`\$` `\textbf{cat /sys/ethercat0/slave003/info}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3846 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3847 |
Name: EL4132 2K. Ana. Ausgang +/-10V |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3848 |
Vendor ID: 0x00000002 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3849 |
Product code: 0x10243052 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3850 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3851 |
State: INIT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3852 |
Ring position: 3 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3853 |
Advanced position: 1:3 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3854 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3855 |
Data link status: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3856 |
Port 0 (EBUS) Link down, Loop open, Signal detected |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3857 |
Port 1 (EBUS) Link down, Loop open, Signal detected |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3858 |
Port 2 (EBUS) Link down, Loop closed, No signal |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3859 |
Port 3 (EBUS) Link down, Loop closed, No signal |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3860 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3861 |
Mailboxes: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3862 |
RX mailbox: 0x1800/246, TX mailbox: 0x18F6/246 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3863 |
Supported protocols: CoE, FoE |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3864 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3865 |
SII data: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3866 |
Group: AnaOut |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3867 |
Image: TERM_AO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3868 |
Order#: EL4132 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3869 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3870 |
Sync-Managers: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3871 |
0: 0x1800, length 246, control 0x26, enable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3872 |
1: 0x18F6, length 246, control 0x22, enable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3873 |
2: 0x1000, length 0, control 0x24, enable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3874 |
3: 0x1100, length 0, control 0x20, enable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3875 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3876 |
PDOs: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3877 |
RXPDO "Channel 1" (0x1600), Sync-Manager 2 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3878 |
"Output" 0x6411:1, 16 bit |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3879 |
RXPDO "Channel 2" (0x1601), Sync-Manager 2 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3880 |
"Output" 0x6411:2, 16 bit |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3881 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3882 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3883 |
This is nearly all of the SII category information needed to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3884 |
configure the slave, supplemented with state and addressing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3885 |
information. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3886 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3887 |
\item[state] (read/write) This attribute contains the slave's state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3888 |
It can be read or written: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3889 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3890 |
\begin{lstlisting}[gobble=4] |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3891 |
# `\textbf{cat /sys/ethercat0/slave003/state}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3892 |
OP |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3893 |
# `\textbf{echo SAVEOP > /sys/ethercat0/slave003/state}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3894 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3895 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3896 |
This command should also be receipted with a syslog message: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3897 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3898 |
\begin{lstlisting}[gobble=4] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3899 |
EtherCAT: Accepted new state SAVEOP for slave 3. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3900 |
EtherCAT: Changing state of slave 3 from OP to SAVEOP. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3901 |
EtherCAT: Slave states: INIT, SAVEOP, OP. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3902 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3903 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3904 |
After the new requested state was accepted from user space, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3905 |
operation state machine (see section~\ref{sec:fsm-op}) or the idle |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3906 |
state machine (section~\ref{sec:fsm-idle}) notices, that the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3907 |
requested slave state differs from the current one, and therefore |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3908 |
executes the slave configuration state machine, until the slave has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3909 |
reached the requested state. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3910 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3911 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3912 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3913 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3914 |
\subsubsection{E$^2$PROM Access} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3915 |
\label{sec:eepromaccess} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3916 |
\index{E$^2$PROM!Access} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3917 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3918 |
It is possible to directly read or write the complete E$^2$PROM |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3919 |
contents of the slaves. This was introduced for the reasons below: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3920 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3921 |
\begin{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3922 |
\item The format of the E$^2$PROM data is still in development and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3923 |
categories can be added in the future. With read and write access, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3924 |
the complete memory contents can be easily backed up and restored. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3925 |
\item Some E$^2$PROM data fields have to be altered (like the alias |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3926 |
address). A quick writing must be possible for that. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3927 |
\item Through read access, analyzing category data is possible from |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3928 |
user space. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3929 |
\end{itemize} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3930 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3931 |
Reading out E$^2$PROM data is as easy as reading other |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3932 |
attributes. Though the data are in binary format, analyzation is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3933 |
easier with a tool like \textit{hexdump}: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3934 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3935 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3936 |
`\$` `\textbf{cat /sys/ethercat0/slave003/eeprom | hexdump}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3937 |
0000000 0103 0000 0000 0000 0000 0000 0000 008c |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3938 |
0000010 0002 0000 3052 07f0 0000 0000 0000 0000 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3939 |
0000020 0000 0000 0000 0000 0000 0000 0000 0000 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3940 |
... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3941 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3942 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3943 |
Backing up E$^2$PROM contents gets as easy as copying a file: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3944 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3945 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3946 |
`\$` `\textbf{cp /sys/ethercat0/slave003/eeprom slave003.eep}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3947 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3948 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3949 |
Writing access is only possible as \textit{root}. Moreover writing has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3950 |
to be explicitly enabled and is only allowed in idle mode. This is a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3951 |
safety measure, because without the correct memory contents, a slave |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3952 |
is unusable. Writing E$^2$PROM contents in operation mode is not |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3953 |
provided yet. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3954 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3955 |
E$^2$PROM writing is enabled with the command below: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3956 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3957 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3958 |
# `\textbf{echo 1 > /sys/ethercat0/eeprom\_write\_enable}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3959 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3960 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3961 |
The success can be seen in the syslog messages again: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3962 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3963 |
\begin{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3964 |
EtherCAT: Slave EEPROM writing enabled. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3965 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3966 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3967 |
Now, it is possible to write E$^2$PROM contents to a slave. The master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3968 |
will accept data through the \textit{eeprom} file and will perform a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3969 |
short validation of the contents, before starting the write operation. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3970 |
This validation checks the complete size and the category headers. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3971 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3972 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3973 |
# `\textbf{cat slave003.eep > /sys/ethercat0/slave003/eeprom}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3974 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3975 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3976 |
The write operation can take a few seconds. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3977 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3978 |
\begin{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3979 |
EtherCAT: EEPROM writing scheduled for slave 3, 88 words. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3980 |
EtherCAT: Writing EEPROM of slave 3... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3981 |
EtherCAT: Finished writing EEPROM of slave 3. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3982 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3983 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3984 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3985 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3986 |
\subsection{User Space Tools} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3987 |
\index{User space!Tools} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3988 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3989 |
There is a user space tool called \textit{lsec}\index{lsec} (``List |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3990 |
EtherCAT'') to visualize the EtherCAT bus. Running it usually results |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3991 |
in an output like this: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3992 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3993 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
3994 |
`\$` `\textbf{lsec}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3995 |
EtherCAT bus listing for master 0: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3996 |
0 1:0 OP EK1100 Ethernet Kopplerklemme (2A E-Bus) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3997 |
1 1:1 INIT EL4132 2K. Ana. Ausgang +/-10V |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3998 |
2 1:2 INIT EL4132 2K. Ana. Ausgang +/-10V |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3999 |
3 1:3 SAVEOP EL4132 2K. Ana. Ausgang +/-10V |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4000 |
4 1:4 INIT EL5101 Incremental Encoder Interface |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4001 |
5 1:5 INIT EL1014 4K. Dig. Eingang 24V, 10s |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4002 |
6 1:6 OP EL6601 1 Port Switch (Ethernet, CoE) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4003 |
7 1:7 INIT EL5101 Incremental Encoder Interface |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4004 |
8 1:8 INIT EL5001 1K. SSI Encoder |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4005 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4006 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4007 |
Every slave is displayed as one text row. The first column shows its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4008 |
ring position, the second displays the ``advanced position address'' |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4009 |
(see section~\ref{sec:addr}) and the third column displays the current |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4010 |
slave state. The last column is the slave's name, as it appears in the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4011 |
``general'' E$^2$PROM category. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4012 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4013 |
The lsec program is a Perl script, that evaluates the Sysfs |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4014 |
\textit{info} attributes of the slaves (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4015 |
section~\ref{sec:sysfs-slave}). This is done for master $0$ by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4016 |
default, but the master index can be specified via command line: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4017 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4018 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4019 |
`\$` `\textbf{lsec -h}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4020 |
Usage: ec_list [OPTIONS] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4021 |
-m <IDX> Query master <IDX>. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4022 |
-h Show this help. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4023 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4024 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4025 |
This script has proved as useful for troubleshooting: If it displays |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4026 |
slaves, the master is up and running, and the bus connection is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4027 |
present, too. It is also useful when building up a bus: It can verify |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4028 |
the list of slaves and help to create a process data image (see |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4029 |
chapter~\ref{chapter:usage}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4030 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4031 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4032 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4033 |
\subsection{System Integration} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4034 |
\label{sec:system} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4035 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4036 |
To integrate the EtherCAT master into a running system, it has to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4037 |
guaranteed, that it is started on system startup. In addition, there has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4038 |
to be a persistent configuration, that is also applied on startup. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4039 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4040 |
\subsubsection{The EtherCAT Init Script} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4041 |
\label{sec:init} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4042 |
\index{Init script} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4043 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4044 |
The EtherCAT master provides an ``init script'', that conforms to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4045 |
requirements of the ``Linux Standard Base'' (LSB\index{LSB}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4046 |
\cite{lsb}). The script is installed to \textit{etc/init.d/ethercat} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4047 |
below the installation prefix and has to be copied to the appropriate |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4048 |
location (see section~\ref{sec:make}), before the master can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4049 |
inserted as a service. The different Linux distributions offer |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4050 |
different ways to mark the service for starting and stopping in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4051 |
certain runlevels (for example, SUSE Linux provides the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4052 |
\textit{insserv} command). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4053 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4054 |
To provide service dependencies (i.~e. which services have to be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4055 |
started before) right inside the init script code, LSB defines a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4056 |
special comment block. System tools can extract this information to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4057 |
insert the EtherCAT init script at the correct place in the startup |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4058 |
sequence: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4059 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4060 |
\begin{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4061 |
### BEGIN INIT INFO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4062 |
# Provides: ethercat |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4063 |
# Required-Start: $local_fs $syslog $network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4064 |
# Should-Start: $time |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4065 |
# Required-Stop: $local_fs $syslog $network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4066 |
# Should-Stop: $time |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4067 |
# Default-Start: 3 5 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4068 |
# Default-Stop: 0 1 2 6 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4069 |
# Short-Description: EtherCAT master modules |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4070 |
# Description: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4071 |
### END INIT INFO |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4072 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4073 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4074 |
The init script can also be used for manually starting and stopping |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4075 |
the EtherCAT master. It has to be executed with one of the parameters |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4076 |
\texttt{start}, \texttt{stop}, \texttt{restart} or \texttt{status}. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4077 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4078 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4079 |
# `\textbf{/etc/init.d/ethercat restart}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4080 |
Shutting down EtherCAT master done |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4081 |
Starting EtherCAT master done |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4082 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4083 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4084 |
\subsubsection{The EtherCAT Sysconfig File} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4085 |
\label{sec:sysconfig} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4086 |
\index{Sysconfig file} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4087 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4088 |
For persistent configuration, the init script uses a sysconfig file |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4089 |
installed to \textit{etc/sysconfig/ethercat} (below the installation |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4090 |
prefix), that is mandatory for the init script. The sysconfig file |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4091 |
contains all configuration variables needed to operate a master: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4092 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4093 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4094 |
\item[DEVICE\_INDEX] This variable must contain the PCI index of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4095 |
EtherCAT device. Setting this is mandatory for the EtherCAT init |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4096 |
script. Default: $-1$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4097 |
\item[EOE\_INTERFACES] The number of virtual Ethernet-over-EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4098 |
interfaces, every master creates on startup. See |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4099 |
section~\ref{sec:eoeimp}. Default: $0$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4100 |
\item[EOE\_BRIDGE] If this variable is set, all EoE interfaces will be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4101 |
added to a network bridge according to IEEE 802.1D after master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4102 |
startup. The variable must contain the name of the bridge. To use |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4103 |
this functionality, the kernel must be configured with the |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4104 |
CONFIG\_BRIDGE option and the \textit{bridge-utils} package must be |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4105 |
installed (i.~e. the \textit{brctl} command is needed). |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4106 |
\item[EOE\_IP\_ADDRESS] The IP address of the EoE bridge. Setting this |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4107 |
together with \$EOE\_IP\_NETMASK will let the local host communicate |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4108 |
with devices on the EoE bridge. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4109 |
\item[EOE\_IP\_NETMASK] IP netmask of the EoE bridge. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4110 |
\item[EOE\_EXTRA\_INTERFACES] The list of extra interfaces to include |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4111 |
in the EoE brid\-ge. Set this to interconnect the EoE bridge with |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4112 |
other local interfaces. If \$EOE\_\-BRIDGE is empty or undefined, |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4113 |
setting this variable has no effect. Important: The IP address of |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4114 |
the listed interfaces will be cleared. Setting |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4115 |
\$EOE\_\-IP\_\-ADDRESS and \$EOE\_IP\_NETMASK will re-enable them |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4116 |
for IP traffic. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4117 |
\item[EOE\_GATEWAY] The IP address of the default gateway. If this |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4118 |
variable is set, the gateway will be renewed after bridge |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4119 |
installation. This is necessary, if the default gateway's interface |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4120 |
is one of the \$EOE\_EXTRA\_INTERFACES. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4121 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4122 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4123 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4124 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4125 |
\subsection{Monitoring and Debugging} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4126 |
\label{sec:debug} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4127 |
\index{Monitoring} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4128 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4129 |
For debugging purposes, every EtherCAT master registeres a read-only |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4130 |
network interface \textit{ecX}, where X is a number, provided by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4131 |
kernel on device registration. While it is ``up'', the master forwards |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4132 |
every frame sent and received to this interface. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4133 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4134 |
This makes it possible to connect an network monitor (like Wireshark |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4135 |
or tcpdump) to the debug interface and monitor the EtherCAT frames. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4136 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4137 |
It has to be considered, that can be frame rate can be very high. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4138 |
idle state machine usually runs every kernel timer interrupt (up to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4139 |
$1$~kHz) and with a connected realtime module, the rate can be even |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4140 |
higher. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4141 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4142 |
\paragraph{Attention:} The socket buffers needed for the operation of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4143 |
the debugging interface have to be allocated dynamically. Some Linux |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4144 |
realtime extensions do not allow this in realtime context! |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4145 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4146 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4147 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4148 |
\section{Timing Aspects} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4149 |
\label{sec:timing} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4150 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4151 |
Although EtherCAT's timing is highly deterministic and therefore |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4152 |
timing issues are rare, there are a few aspects that can (and should |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4153 |
be) dealt with. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4154 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4155 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4156 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4157 |
\subsection{Realtime Interface Profiling} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4158 |
\label{sec:timing-profile} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4159 |
\index{Realtime!Profiling} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4160 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4161 |
One of the most important timing aspects are the runtimes of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4162 |
realtime interface functions, that are called in cyclic context. These |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4163 |
functions make up an important part of the overall timing of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4164 |
realtime module. To measure the timing of the functions, the following |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4165 |
code was used: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4166 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4167 |
\begin{lstlisting}[gobble=2,language=C] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4168 |
c0 = get_cycles(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4169 |
ecrt_master_receive(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4170 |
c1 = get_cycles(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4171 |
ecrt_domain_process(domain1); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4172 |
c2 = get_cycles(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4173 |
ecrt_master_run(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4174 |
c3 = get_cycles(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4175 |
ecrt_master_send(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4176 |
c4 = get_cycles(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4177 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4178 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4179 |
Between each call of an interface function, the CPU timestamp counter |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4180 |
is read. The counter differences are converted to microseconds with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4181 |
help of the \textit{cpu\_khz} variable, that contains the number of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4182 |
increments per millisecond. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4183 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4184 |
For the actual measuring, a system with a $2.0$~GHz CPU was used, that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4185 |
ran the above code in an RTAI thread with a cycle time of $100$ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4186 |
\textmu s. The measuring was repeated $n = 100$ times and the results |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4187 |
were averaged. These can be seen in table~\ref{tab:profile}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4188 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4189 |
\begin{table}[htpb] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4190 |
\centering |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4191 |
\caption{Profiling of a Realtime Cycle on a $2.0$~GHz Processor} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4192 |
\label{tab:profile} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4193 |
\vspace{2mm} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4194 |
\begin{tabular}{l|r|r} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4195 |
Element & Mean Duration [\textmu s] & Standard Deviancy [\textmu s] \\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4196 |
\hline |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4197 |
\textit{ecrt\_master\_receive()} & 8.04 & 0.48\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4198 |
\textit{ecrt\_domain\_process()} & 0.14 & 0.03\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4199 |
\textit{ecrt\_master\_run()} & 0.29 & 0.12\\ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4200 |
\textit{ecrt\_master\_send()} & 2.18 & 0.17\\ \hline |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4201 |
Complete Cycle & 10.65 & 0.69\\ \hline |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4202 |
\end{tabular} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4203 |
\end{table} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4204 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4205 |
It is obvious, that the the functions accessing hardware make up the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4206 |
lion's share. The \textit{ec\_master\_receive()} executes the ISR of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4207 |
the Ethernet device, analyzes datagrams and copies their contents into |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4208 |
the memory of the datagram objects. The \textit{ec\_master\_send()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4209 |
assembles a frame out of different datagrams and copies it to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4210 |
hardware buffers. Interestingly, this makes up only a quarter of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4211 |
receiving time. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4212 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4213 |
The functions that only operate on the masters internal data |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4214 |
structures are very fast ($\Delta t < 1$~\textmu s). Interestingly the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4215 |
runtime of \textit{ec\_domain\_process()} has a small standard |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4216 |
deviancy relative to the mean value, while this ratio is about twice |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4217 |
as big for \textit{ec\_master\_run()}: This probably results from the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4218 |
latter function having to execute code depending on the current state |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4219 |
and the different state functions are more or less complex. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4220 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4221 |
For a realtime cycle makes up about $10$~\textmu s, the theoretical |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4222 |
frequency can be up to $100$~kHz. For two reasons, this frequency |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4223 |
keeps being theoretical: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4224 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4225 |
\begin{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4226 |
\item The processor must still be able to run the operating system |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4227 |
between the realtime cycles. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4228 |
\item The EtherCAT frame must be sent and received, before the next |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4229 |
realtime cycle begins. The determination of the bus cycle time is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4230 |
difficult and covered in section~\ref{sec:timing-bus}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4231 |
\end{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4232 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4233 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4234 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4235 |
\subsection{Bus Cycle Measuring} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4236 |
\label{sec:timing-bus} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4237 |
\index{Bus cycle} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4238 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4239 |
For measuring the time, a frame is ``on the wire'', two timestamps |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4240 |
must be be taken: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4241 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4242 |
\begin{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4243 |
\item The time, the Ethernet hardware begins with physically sending |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4244 |
the frame. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4245 |
\item The time, the frame is completely received by the Ethernet |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4246 |
hardware. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4247 |
\end{enumerate} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4248 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4249 |
Both times are difficult to determine. The first reason is, that the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4250 |
interrupts are disabled and the master is not notified, when a frame |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4251 |
is sent or received (polling would distort the results). The second |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4252 |
reason is, that even with interrupts enabled, the time from the event |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4253 |
to the notification is unknown. Therefore the only way to confidently |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4254 |
determine the bus cycle time is an electrical measuring. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4255 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4256 |
Anyway, the bus cycle time is an important factor when designing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4257 |
realtime code, because it limits the maximum frequency for the cyclic |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4258 |
part of the realtime module. In practice, these timing parameters are |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4259 |
highly dependent on the hardware and often a trial and error method |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4260 |
must be used to determine the limits of the system. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4261 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4262 |
The central question is: What happens, if the cycle frequency is too |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4263 |
high? The answer is, that the EtherCAT frames that have been sent at |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4264 |
the end of the cycle are not yet received, when the next cycle starts. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4265 |
First this is noticed by \textit{ecrt\_domain\_process()}, because the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4266 |
working counter of the process data datagrams were not increased. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4267 |
function will notify the user via syslog\footnote{To limit syslog |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4268 |
output, a mechanism has been implementet, that outputs a summarized |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4269 |
notification at maximum once a second.}. In this case, the process |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4270 |
data keeps being the same as in the last cycle, because it is not |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4271 |
erased by the domain. When the domain datagrams are queued again, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4272 |
master notices, that they are already queued (and marked as sent). The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4273 |
master will mark them as unsent again and output a warning, that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4274 |
datagrams were ``skipped''. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4275 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4276 |
On the mentioned $2.0$~GHz system, the possible cycle frequency can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4277 |
up to $25$~kHz without skipped frames. This value can surely be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4278 |
increased by choosing faster hardware. Especially the RealTek network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4279 |
hardware could be replaced by a faster one. Besides, implementing a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4280 |
dedicated ISR for EtherCAT devices would also contribute to increasing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4281 |
the latency. These are two points on the author's to-do list. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4282 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4283 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4284 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4285 |
\chapter{Using the EtherCAT Master} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4286 |
\label{chapter:usage} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4287 |
\index{Master!Usage} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4288 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4289 |
This chapter will give practical examples of how to use the EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4290 |
master via the realtime interface by writing a realtime module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4291 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4292 |
Section~\ref{sec:make} shows how to compile and install the master, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4293 |
while the sections~\ref{sec:mini} to~\ref{sec:concurrency} give |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4294 |
examples for different realtime modules. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4295 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4296 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4297 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4298 |
\section{Compiling and Installing} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4299 |
\label{sec:make} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4300 |
\index{Master!Compilation} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4301 |
|
1728
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4302 |
The current EtherCAT master code is available at~\cite{etherlab} or |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4303 |
can be obtained from the EtherLab\textsuperscript{\textregistered} CD. |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4304 |
The \textit{tar.bz2} file has to be unpacked with the commands below |
1728
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4305 |
(or similar): |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4306 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4307 |
\begin{lstlisting} |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4308 |
`\$` `\textbf{tar xjf ethercat-\masterversion.tar.bz2}` |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4309 |
`\$` `\textbf{cd ethercat-\masterversion/}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4310 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4311 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4312 |
The tarball was created with GNU Autotools, so the build process |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4313 |
follows the below commands: |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4314 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4315 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4316 |
`\$` `\textbf{./configure}` |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4317 |
`\$` `\textbf{make modules}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4318 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4319 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4320 |
The default installation prefix is \textit{/opt/etherlab}. It can be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4321 |
changed with the \texttt{--prefix} argument. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4322 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4323 |
Linux kernel sources are needed for compilation\footnote{If a realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4324 |
extension shall to be used, the kernel should be patched before |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4325 |
compiling the EtherCAT master.}. To compile the EtherCAT master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4326 |
modules for a different kernel than the running kernel, the target |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4327 |
kernel version can be specified with the \texttt{--with-linux} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4328 |
argument. Example: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4329 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4330 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4331 |
`\$` `\textbf{./configure --with-linux="2.6.17-ipipe"}` |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4332 |
`\$` `\textbf{make modules}` |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4333 |
\end{lstlisting} |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4334 |
|
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4335 |
The below commands have to be entered as \textit{root}: The first one |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4336 |
will install the kernel modules to the kernel's modules directory. The |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4337 |
second one will install EtherCAT headers, the init script, the |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4338 |
sysconfig file and the user space tools to the prefix path. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4339 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4340 |
\begin{lstlisting} |
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4341 |
# `\textbf{make modules\_install}` |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4342 |
# `\textbf{make install}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4343 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4344 |
|
1732
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4345 |
If the target kernel's modules directory is not under |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4346 |
\textit{/lib/modules}, a different destination directory can be |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4347 |
specified with the \textit{DESTDIR} make variable. For example: |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4348 |
|
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4349 |
\begin{lstlisting} |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4350 |
# `\textbf{make DESTDIR=/vol/nfs/root modules\_install}` |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4351 |
\end{lstlisting} |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4352 |
|
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4353 |
This command will install the compiled kernel modules to |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4354 |
\textit{/vol/nfs/root/lib/modules}, prepended by the kernel release. |
1cc865ba17c2
MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
1729
diff
changeset
|
4355 |
|
1728
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4356 |
If the EtherCAT master shall be run as a service |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4357 |
(recommended\footnote{Even if the EtherCAT master shall not be loaded |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4358 |
on system startup, the use of the init script is recommended for |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4359 |
manual (un-)loading.}), the init script and the sysconfig file have |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4360 |
to be copied to the appropriate locations. The below example is |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4361 |
suitable for SUSE Linux. It may vary for other distributions. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4362 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4363 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4364 |
# `\textbf{cd /opt/etherlab}` |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4365 |
# `\textbf{cp etc/sysconfig/ethercat /etc/sysconfig/}` |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4366 |
# `\textbf{cp etc/init.d/ethercat /etc/init.d/}` |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4367 |
# `\textbf{insserv ethercat}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4368 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4369 |
|
1728
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4370 |
Now the sysconfig file \texttt{/etc/sysconfig/ethercat} (see |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4371 |
section~\ref{sec:sysconfig}) has to be customized: This is mainly done |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4372 |
by uncommenting and adjusting the \$DEVICE\_INDEX variable. It has to |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4373 |
be set to the index of the compatible network device to use with |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4374 |
EtherCAT, where the order of devices is dependent on their position in |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4375 |
the PCI bus: |
1728
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4376 |
|
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4377 |
\begin{lstlisting}[numbers=left,basicstyle=\ttfamily\scriptsize] |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4378 |
# `\textbf{lspci}` |
1728
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4379 |
00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 03) |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4380 |
00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP] |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4381 |
00:04.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 40) |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4382 |
00:04.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C... |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4383 |
00:04.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller... |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4384 |
00:04.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller... |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4385 |
00:04.4 Bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40) |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4386 |
00:09.0 Ethernet controller: D-Link System Inc RTL8139 Ethernet (rev 10) |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4387 |
00:0a.0 Ethernet controller: Intel Corporation 82557/8/9 [Ethernet Pro 100] (rev 08) |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4388 |
00:0b.0 Ethernet controller: D-Link System Inc RTL8139 Ethernet (rev 10) |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4389 |
00:0c.0 VGA compatible controller: ATI Technologies Inc Rage XL (rev 27) |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4390 |
00:11.0 Unknown mass storage controller: Promise Technology, Inc. PDC20265... |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4391 |
\end{lstlisting} |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4392 |
|
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4393 |
In the above output of the \textit{lspci} command, two compatible |
4cf9c3e9f0bd
MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents:
1727
diff
changeset
|
4394 |
network devices can be found in lines~\textcircled{\tiny 9} and |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4395 |
\textcircled{\tiny 11}. The \$DEVICE\_INDEX variable should be set to |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4396 |
$0$ or $1$, respectively. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4397 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4398 |
After the basic configuration is done, the master can be started with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4399 |
the below command: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4400 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4401 |
\begin{lstlisting} |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4402 |
# `\textbf{/etc/init.d/ethercat start}` |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4403 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4404 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4405 |
The operation of the master can be observed by looking at the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4406 |
syslog\index{syslog} messages, which should look like the ones below. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4407 |
If EtherCAT slaves are connected to the master's EtherCAT device, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4408 |
activity indicators should begin to flash. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4409 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4410 |
\begin{lstlisting}[numbers=left] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4411 |
EtherCAT: Master driver, 1.1 (stable) - rev. 513, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4412 |
compiled by fp at Aug 09 2006 10:23:20 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4413 |
EtherCAT: Initializing 1 EtherCAT master(s)... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4414 |
EtherCAT: Initializing master 0. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4415 |
EtherCAT: Master driver initialized. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4416 |
ec_8139too Fast Ethernet driver 0.9.27 Revision 513, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4417 |
compiled by fp at Aug 09 2006 10:23:20 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4418 |
ec_device_index is 0 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4419 |
ACPI: PCI Interrupt 0000:01:00.0[A] -> Link [LNKC] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4420 |
-> GSI 11 (level, low) -> IRQ 11 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4421 |
ec0: RealTek RTL8139 at 0xd047c000, 00:c0:26:00:c6:aa, IRQ 11 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4422 |
ec0: Identified 8139 chip type 'RTL-8100B/8139D' |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4423 |
Registering EtherCAT device... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4424 |
Starting EtherCAT device... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4425 |
EtherCAT: Link state changed to UP. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4426 |
EtherCAT: Starting Idle mode. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4427 |
EtherCAT: 11 slaves responding. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4428 |
EtherCAT: Slave states: INIT, OP. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4429 |
EtherCAT: Scanning bus. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4430 |
EtherCAT: Bus scanning completed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4431 |
EtherCAT: No EoE handlers coupled. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4432 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4433 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4434 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4435 |
\item[\normalfont\textcircled{\tiny 1}] The master module is loaded, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4436 |
and one master is initialized. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4437 |
\item[\normalfont\textcircled{\tiny 6}] The EtherCAT-capable RTL8139 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4438 |
device driver is loaded. It connects its first network device to the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4439 |
master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4440 |
\item[\normalfont\textcircled{\tiny 16}] The master starts idle mode |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4441 |
and begins scanning the bus for slaves. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4442 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4443 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4444 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4445 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4446 |
\section{A Minimal Example Module} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4447 |
\label{sec:mini} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4448 |
\index{Examples!Minimal} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4449 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4450 |
This section will explain the usage of the EtherCAT master from a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4451 |
minimal kernel module. The complete module code is obtainable as a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4452 |
part of the EtherCAT master code release (see~\cite{etherlab}, file |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4453 |
\textit{examples/mini/mini.c}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4454 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4455 |
The minimal example uses a kernel timer (software interrupt) to handle |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4456 |
cyclic code. After the timer function is executed, it re-adds itself |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4457 |
with a delay of one \textit{jiffy}\index{jiffies}, which results in a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4458 |
timer frequency of \textit{HZ}\nomenclature{HZ}{Kernel macro |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4459 |
containing the timer interrupt frequency} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4460 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4461 |
The module-global variables, needed to operate the master can be seen |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4462 |
in listing~\ref{lst:minivar}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4463 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4464 |
\begin{lstlisting}[language=C,numbers=left,caption={Minimal |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4465 |
variables},label=lst:minivar] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4466 |
struct timer_list timer; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4467 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4468 |
ec_master_t *master = NULL; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4469 |
ec_domain_t *domain1 = NULL; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4470 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4471 |
void *r_dig_in, *r_ana_out; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4472 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4473 |
ec_pdo_reg_t domain1_pdos[] = { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4474 |
{"1", Beckhoff_EL1014_Inputs, &r_dig_in}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4475 |
{"2", Beckhoff_EL4132_Ouput1, &r_ana_out}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4476 |
{} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4477 |
}; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4478 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4479 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4480 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4481 |
\item[\normalfont\textcircled{\tiny 1}] There is a timer object |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4482 |
declared, that is needed to tell the kernel to install a timer and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4483 |
execute a certain function, if it runs out. This is done by a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4484 |
variable of the \textit{timer\_list} structure. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4485 |
\item[\normalfont\textcircled{\tiny 3} -- \textcircled{\tiny 4}] There |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4486 |
is a pointer declared, that will later point to a requested EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4487 |
master. Additionally there is a pointer to a domain object needed, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4488 |
that will manage process data IO. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4489 |
\item[\normalfont\textcircled{\tiny 6}] The pointers \textit{r\_*} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4490 |
will later point to the \underline{r}aw process data values inside |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4491 |
the domain memory. The addresses they point to will be set during a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4492 |
call to \textit{ec\_\-master\_\-activate()}, that will create the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4493 |
domain memory and configure the mapped process data image. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4494 |
\item[\normalfont\textcircled{\tiny 8} -- \textcircled{\tiny 12}] The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4495 |
configuration of the mapping of certain PDOs in a domain can easily |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4496 |
be done with the help of an initialization array of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4497 |
\textit{ec\_pdo\_reg\_t} type, defined as part of the realtime |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4498 |
interface. Each record must contain the ASCII bus-address of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4499 |
slave (see section~\ref{sec:addr}), the slave's vendor ID and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4500 |
product code, and the index and subindex of the PDO to map (these |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4501 |
four fields can be specified in junction, by using one of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4502 |
defines out of the \textit{include/ecdb.h} header). The last field |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4503 |
has to be the address of the process data pointer, so it can later |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4504 |
be redirected appropriately. Attention: The initialization array |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4505 |
must end with an empty record (\textit{\{\}})! |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4506 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4507 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4508 |
The initialization of the minimal realtime module is done by the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4509 |
``Minimal init function'' in listing~\ref{lst:miniinit}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4510 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4511 |
\begin{lstlisting}[language=C,numbers=left,caption={Minimal init |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4512 |
function},label={lst:miniinit}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4513 |
int __init init_mini_module(void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4514 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4515 |
if (!(master = ecrt_request_master(0))) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4516 |
goto out_return; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4517 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4518 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4519 |
if (!(domain1 = ecrt_master_create_domain(master))) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4520 |
goto out_release_master; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4521 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4522 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4523 |
if (ecrt_domain_register_pdo_list(domain1, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4524 |
domain1_pdos)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4525 |
goto out_release_master; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4526 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4527 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4528 |
if (ecrt_master_activate(master)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4529 |
goto out_release_master; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4530 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4531 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4532 |
ecrt_master_prepare(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4533 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4534 |
init_timer(&timer); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4535 |
timer.function = run; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4536 |
timer.expires = jiffies + 10; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4537 |
add_timer(&timer); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4538 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4539 |
return 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4540 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4541 |
out_release_master: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4542 |
ecrt_release_master(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4543 |
out_return: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4544 |
return -1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4545 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4546 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4547 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4548 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4549 |
\item[\normalfont\textcircled{\tiny 3}] It is tried to request the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4550 |
first EtherCAT master (index 0). On success, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4551 |
\textit{ecrt\_\-request\_\-master()} function returns a pointer to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4552 |
the reserved master, that can be used as an object to following |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4553 |
functions calls. On failure, the function returns \textit{NULL}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4554 |
\item[\normalfont\textcircled{\tiny 7}] In order to exchange process |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4555 |
data, a domain object has to be created. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4556 |
\textit{ecrt\_\-master\_\-create\_domain()} function also returns a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4557 |
pointer to the created domain, or \textit{NULL} in error case. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4558 |
\item[\normalfont\textcircled{\tiny 11}] The registration of domain |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4559 |
PDOs with an initialization array results in a single function call. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4560 |
Alternatively the data fields could be registered with individual |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4561 |
calls of \textit{ecrt\_domain\_register\_pdo()}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4562 |
\item[\normalfont\textcircled{\tiny 16}] After the configuration of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4563 |
process data mapping, the master can be activated for cyclic |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4564 |
operation. This will configure all slaves and bring them into |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4565 |
OP state. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4566 |
\item[\normalfont\textcircled{\tiny 20}] This call is needed to avoid |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4567 |
a case differentiation in cyclic operation: The first operation in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4568 |
cyclic mode is a receive call. Due to the fact, that there is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4569 |
nothing to receive during the first cycle, there had to be an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4570 |
\textit{if}-statement to avoid a warning. A call to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4571 |
\textit{ec\_master\_prepare()} sends a first datagram containing a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4572 |
process data exchange datagram, so that the first receive call will |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4573 |
not fail. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4574 |
\item[\normalfont\textcircled{\tiny 22} -- \textcircled{\tiny 25}] The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4575 |
master is now ready for cyclic operation. The kernel timer that |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4576 |
cyclically executes the \textit{run()} function is initialized and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4577 |
started. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4578 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4579 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4580 |
The coding of a cleanup function fo the minimal module can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4581 |
listing~\ref{lst:miniclean}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4582 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4583 |
\begin{lstlisting}[language=C,numbers=left,caption={Minimal cleanup |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4584 |
function},label={lst:miniclean}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4585 |
void __exit cleanup_mini_module(void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4586 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4587 |
del_timer_sync(&timer); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4588 |
ecrt_master_deactivate(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4589 |
ecrt_release_master(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4590 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4591 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4592 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4593 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4594 |
\item[\normalfont\textcircled{\tiny 3}] To cleanup the module, it it |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4595 |
necessary to stop the cyclic processing. This is done by a call to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4596 |
\textit{del\_timer\_sync()} which safely removes a queued timer |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4597 |
object. It is assured, that no cyclic work will be done after this |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4598 |
call returns. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4599 |
\item[\normalfont\textcircled{\tiny 4}] This call deactivates the |
1729
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4600 |
master, which results in all slaves being brought to their INIT |
bcc41c8986bc
MERGE trunk -r569:570 -> branches/stable-1.1 (doc)
Florian Pose <fp@igh-essen.com>
parents:
1728
diff
changeset
|
4601 |
state again. |
1727
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4602 |
\item[\normalfont\textcircled{\tiny 5}] This call releases the master, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4603 |
removes any existing configuration and silently starts the idle |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4604 |
mode. The value of the master pointer is invalid after this call and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4605 |
the module can be safely unloaded. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4606 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4607 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4608 |
The final part of the minimal module is that for the cyclic work. Its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4609 |
coding can be seen in listing~\ref{lst:minirun}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4610 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4611 |
\begin{lstlisting}[language=C,numbers=left,caption={Minimal cyclic |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4612 |
function},label={lst:minirun}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4613 |
void run(unsigned long data) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4614 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4615 |
static uint8_t dig_in_0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4616 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4617 |
ecrt_master_receive(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4618 |
ecrt_domain_process(domain1); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4619 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4620 |
dig_in_0 = EC_READ_BIT(r_dig_in, 0); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4621 |
EC_WRITE_S16(r_ana_out, dig_in_0 * 0x3FFF); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4622 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4623 |
ecrt_master_run(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4624 |
ecrt_master_send(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4625 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4626 |
timer.expires += 1; // frequency = HZ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4627 |
add_timer(&timer); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4628 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4629 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4630 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4631 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4632 |
\item[\normalfont\textcircled{\tiny 5}] The cyclic processing starts |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4633 |
with receiving datagrams, that were sent in the last cycle. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4634 |
frames containing these datagrams have to be received by the network |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4635 |
interface card prior to this call. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4636 |
\item[\normalfont\textcircled{\tiny 6}] The process data of domain 1 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4637 |
has been automatically copied into domain memory while datagram |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4638 |
reception. This call checks the working counter for changes and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4639 |
re-queues the domain's datagram for sending. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4640 |
\item[\normalfont\textcircled{\tiny 8}] This is an example for reading |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4641 |
out a bit-oriented process data value (i.~e. bit 0) via the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4642 |
\textit{EC\_READ\_BIT()} macro. See section~\ref{sec:macros} for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4643 |
more information about those macros. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4644 |
\item[\normalfont\textcircled{\tiny 9}] This line shows how to write a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4645 |
signed, 16-bit process data value. In this case, the slave is able |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4646 |
to output voltages of $-10$~V to $+10$~V with a resolution of 16 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4647 |
bit. This write command outputs either $0$~V or $+5$~V, depending |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4648 |
of the value of \textit{dig\_in\_0}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4649 |
\item[\normalfont\textcircled{\tiny 11}] This call runs the master's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4650 |
operation state machine (see section~\ref{sec:fsm-op}). A single |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4651 |
state is processed, and datagrams are queued. Mainly bus observation |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4652 |
is done: The bus state is determined and in case of slaves that lost |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4653 |
their configuration, reconfiguration is tried. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4654 |
\item[\normalfont\textcircled{\tiny 12}] This method sends all queued |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4655 |
datagrams, in this case the domain's datagram and one of the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4656 |
state machine. In best case, all datagrams fit into one frame. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4657 |
\item[\normalfont\textcircled{\tiny 14} -- \textcircled{\tiny 15}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4658 |
Kernel timers are implemented as ``one-shot'' timers, so they have |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4659 |
to be re-added after each execution. The time of the next execution |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4660 |
is specified in \textit{jiffies} and will happen at the time of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4661 |
next system timer interrupt. This results in the \textit{run()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4662 |
function being executed with a frequency of \textit{HZ}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4663 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4664 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4665 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4666 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4667 |
\section{An RTAI Example Module} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4668 |
\label{sec:rtai} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4669 |
\index{Examples!RTAI} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4670 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4671 |
The whole code can be seen in the EtherCAT master code release |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4672 |
(see~\cite{etherlab}, file \textit{examples/rtai/rtai\_sample.c}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4673 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4674 |
Listing~\ref{lst:rtaivar} shows the defines and global variables |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4675 |
needed for a minimal RTAI module with EtherCAT processing. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4676 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4677 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI task |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4678 |
declaration},label={lst:rtaivar}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4679 |
#define FREQUENCY 10000 |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4680 |
#define TIMERTICKS (1000000000 / FREQUENCY) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4681 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4682 |
RT_TASK task; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4683 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4684 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4685 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4686 |
\item[\normalfont\textcircled{\tiny 1} -- \textcircled{\tiny 2}] RTAI |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4687 |
takes the cycle period as nanoseconds, so the easiest way is to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4688 |
define a frequency and convert it to a cycle time in nanoseconds. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4689 |
\item[\normalfont\textcircled{\tiny 4}] The \textit{task} variable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4690 |
later contains information about the running RTAI task. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4691 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4692 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4693 |
Listing~\ref{lst:rtaiinit} shows the module init function for the RTAI |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4694 |
module. Most lines are the same as in listing~\ref{lst:miniinit}, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4695 |
differences come up when starting the cyclic code. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4696 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4697 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI module init |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4698 |
function},label={lst:rtaiinit}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4699 |
int __init init_mod(void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4700 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4701 |
RTIME requested_ticks, tick_period, now; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4702 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4703 |
if (!(master = ecrt_request_master(0))) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4704 |
goto out_return; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4705 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4706 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4707 |
if (!(domain1 = ecrt_master_create_domain(master))) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4708 |
goto out_release_master; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4709 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4710 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4711 |
if (ecrt_domain_register_pdo_list(domain1, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4712 |
domain1_pdos)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4713 |
goto out_release_master; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4714 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4715 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4716 |
if (ecrt_master_activate(master)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4717 |
goto out_release_master; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4718 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4719 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4720 |
ecrt_master_prepare(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4721 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4722 |
requested_ticks = nano2count(TIMERTICKS); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4723 |
tick_period = start_rt_timer(requested_ticks); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4724 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4725 |
if (rt_task_init(&task, run, 0, 2000, 0, 1, NULL)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4726 |
goto out_stop_timer; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4727 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4728 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4729 |
now = rt_get_time(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4730 |
if (rt_task_make_periodic(&task, now + tick_period, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4731 |
tick_period)) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4732 |
goto out_stop_task; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4733 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4734 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4735 |
return 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4736 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4737 |
out_stop_task: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4738 |
rt_task_delete(&task); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4739 |
out_stop_timer: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4740 |
stop_rt_timer(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4741 |
out_deactivate: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4742 |
ecrt_master_deactivate(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4743 |
out_release_master: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4744 |
ecrt_release_master(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4745 |
out_return: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4746 |
return -1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4747 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4748 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4749 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4750 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4751 |
\item[\normalfont\textcircled{\tiny 24} -- \textcircled{\tiny 25}] The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4752 |
nanoseconds are converted to RTAI timer ticks and an RTAI timer is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4753 |
started. \textit{tick\_period} will be the ``real'' number of ticks |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4754 |
used for the timer period (which can be different to the requested |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4755 |
one). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4756 |
\item[\normalfont\textcircled{\tiny 27}] The RTAI task is initialized |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4757 |
by specifying the cyclic function, the parameter to hand over, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4758 |
stack size, priority, a flag that tells, if the function will use |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4759 |
floating point operations and a signal handler. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4760 |
\item[\normalfont\textcircled{\tiny 32}] The task is made periodic by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4761 |
specifying a start time and a period. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4762 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4763 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4764 |
The cleanup function of the RTAI module in listing~\ref{lst:rtaiclean} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4765 |
is nearly as simple as that of the minimal module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4766 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4767 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI module |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4768 |
cleanup function},label={lst:rtaiclean}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4769 |
void __exit cleanup_mod(void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4770 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4771 |
rt_task_delete(&task); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4772 |
stop_rt_timer(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4773 |
ecrt_master_deactivate(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4774 |
ecrt_release_master(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4775 |
rt_sem_delete(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4776 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4777 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4778 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4779 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4780 |
\item[\normalfont\textcircled{\tiny 2}] The RTAI task will be stopped |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4781 |
and deleted. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4782 |
\item[\normalfont\textcircled{\tiny 3}] After that, the RTAI timer can |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4783 |
be stopped. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4784 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4785 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4786 |
The rest is the same as for the minimal module. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4787 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4788 |
Worth to mention is, that the cyclic function of the RTAI module |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4789 |
(listing~\ref{lst:rtairun}) has a slightly different architecture. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4790 |
function is not executed until returning for every cycle, but has an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4791 |
infinite loop in it, that is placed in a waiting state for the rest of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4792 |
each cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4793 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4794 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI module cyclic |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4795 |
function},label={lst:rtairun}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4796 |
void run(long data) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4797 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4798 |
while (1) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4799 |
ecrt_master_receive(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4800 |
ecrt_domain_process(domain1); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4801 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4802 |
k_pos = EC_READ_U32(r_ssi_input); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4803 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4804 |
ecrt_master_run(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4805 |
ecrt_master_send(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4806 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4807 |
rt_task_wait_period(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4808 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4809 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4810 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4811 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4812 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4813 |
\item[\normalfont\textcircled{\tiny 3}] The \textit{while (1)} loop |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4814 |
executes for the lifetime of the RTAI task. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4815 |
\item[\normalfont\textcircled{\tiny 12}] The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4816 |
\textit{rt\_task\_wait\_period()} function sets the process into a |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4817 |
sleeping state until the beginning of the next cycle. It also |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4818 |
checks, if the cyclic function has to be terminated. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4819 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4820 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4821 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4822 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4823 |
\section{Concurrency Example} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4824 |
\label{sec:concurrency} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4825 |
\index{Examples!Concurrency} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4826 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4827 |
As mentioned before, there can be concurrent access to the EtherCAT |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4828 |
master. The realtime module and a EoE\index{EoE} process can compete |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4829 |
for master access, for example. In this case, the module has to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4830 |
provide the locking mechanism, because it depends on the module's |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4831 |
architecture which lock has to be used. The module makes this locking |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4832 |
mechanism available to the master through the master's locking |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4833 |
callbacks. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4834 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4835 |
In case of RTAI, the lock can be an RTAI semaphore, as shown in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4836 |
listing~\ref{lst:convar}. A normal linux semaphore would not be |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4837 |
appropriate, because it could not block the RTAI task due to RTAI |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4838 |
running in a higher domain than the linux kernel (see~\cite{rtai}). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4839 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4840 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI semaphore for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4841 |
concurrent access},label={lst:convar}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4842 |
SEM master_sem; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4843 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4844 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4845 |
The module has to implement the two callbacks for requesting and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4846 |
releasing the master lock. An exemplary coding can be seen in |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4847 |
listing~\ref{lst:conlock}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4848 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4849 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI locking |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4850 |
callbacks for concurrent access},label={lst:conlock}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4851 |
int request_lock(void *data) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4852 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4853 |
rt_sem_wait(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4854 |
return 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4855 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4856 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4857 |
void release_lock(void *data) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4858 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4859 |
rt_sem_signal(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4860 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4861 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4862 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4863 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4864 |
\item[\normalfont\textcircled{\tiny 1}] The \textit{request\_lock()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4865 |
function has a data parameter. The master always passes the value, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4866 |
that was specified when registering the callback function. This can |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4867 |
be used for handing the master pointer. Notice, that it has an |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4868 |
integer return value (see line 4). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4869 |
\item[\normalfont\textcircled{\tiny 3}] The call to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4870 |
\textit{rt\_sem\_wait()} either returns at once, when the semaphore |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4871 |
was free, or blocks until the semaphore is freed again. In any case, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4872 |
the semaphore finally is reserved for the process calling the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4873 |
request function. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4874 |
\item[\normalfont\textcircled{\tiny 4}] When the lock was requested |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4875 |
successfully, the function should return 0. The module can prohibit |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4876 |
requesting the lock by returning non-zero (see paragraph ``Tuning |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4877 |
the jitter'' below). |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4878 |
\item[\normalfont\textcircled{\tiny 7}] The \textit{release\_lock()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4879 |
function gets the same argument passed, but has a void return value, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4880 |
because is always succeeds. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4881 |
\item[\normalfont\textcircled{\tiny 9}] The \textit{rt\_sem\_signal()} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4882 |
function frees the semaphore, that was prior reserved with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4883 |
\textit{rt\_sem\_wait()}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4884 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4885 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4886 |
In the module's init function, the semaphore must be initialized, and |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4887 |
the callbacks must be passed to the EtherCAT master: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4888 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4889 |
\begin{lstlisting}[language=C,numbers=left,caption={Module init |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4890 |
function for concurrent access},label={lst:coninit}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4891 |
int __init init_mod(void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4892 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4893 |
RTIME tick_period, requested_ticks, now; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4894 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4895 |
rt_sem_init(&master_sem, 1); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4896 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4897 |
if (!(master = ecrt_request_master(0))) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4898 |
goto out_return; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4899 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4900 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4901 |
ecrt_master_callbacks(master, request_lock, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4902 |
release_lock, NULL); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4903 |
// ... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4904 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4905 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4906 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4907 |
\item[\normalfont\textcircled{\tiny 5}] The call to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4908 |
\textit{rt\_sem\_init()} initializes the semaphore and sets its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4909 |
value to 1, meaning that only one process can reserve the semaphore |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4910 |
without blocking. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4911 |
\item[\normalfont\textcircled{\tiny 11}] The callbacks are passed to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4912 |
the master with a call to \textit{ecrt\_master\_callbacks()}. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4913 |
last parameter is the argument, that the master should pass with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4914 |
each call to a callback function. Here it is not used and set to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4915 |
\textit{NULL}. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4916 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4917 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4918 |
For the cyclic function being only one competitor for master access, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4919 |
it has to request the lock like any other process. There is no need to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4920 |
use the callbacks (which are meant for processes of lower priority), |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4921 |
so it can access the semaphore directly: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4922 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4923 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI cyclic |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4924 |
function for concurrent access},label={lst:conrun}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4925 |
void run(long data) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4926 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4927 |
while (1) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4928 |
rt_sem_wait(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4929 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4930 |
ecrt_master_receive(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4931 |
ecrt_domain_process(domain1); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4932 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4933 |
k_pos = EC_READ_U32(r_ssi_input); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4934 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4935 |
ecrt_master_run(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4936 |
ecrt_master_send(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4937 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4938 |
rt_sem_signal(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4939 |
rt_task_wait_period(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4940 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4941 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4942 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4943 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4944 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4945 |
\item[\normalfont\textcircled{\tiny 4}] Every access to the master has |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4946 |
to be preceeded by a call to \textit{rt\_sem\_wait()}, because |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4947 |
another instance might currently access the master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4948 |
\item[\normalfont\textcircled{\tiny 14}] When cyclic processing |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4949 |
finished, the semaphore has to be freed again, so that other |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4950 |
processes have the possibility to access the master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4951 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4952 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4953 |
A little change has to be made to the cleanup function in case of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4954 |
concurrent master access. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4955 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4956 |
\begin{lstlisting}[language=C,numbers=left,caption={RTAI module |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4957 |
cleanup function for concurrent access},label={lst:conclean}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4958 |
void __exit cleanup_mod(void) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4959 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4960 |
rt_task_delete(&task); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4961 |
stop_rt_timer(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4962 |
ecrt_master_deactivate(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4963 |
ecrt_release_master(master); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4964 |
rt_sem_delete(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4965 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4966 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4967 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4968 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4969 |
\item[\normalfont\textcircled{\tiny 7}] Upon module cleanup, the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4970 |
semaphore has to be deleted, so that memory can be freed. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4971 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4972 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4973 |
\paragraph{Tuning the Jitter} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4974 |
\index{Jitter} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4975 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4976 |
Concurrent access leads to higher jitter of the realtime process, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4977 |
because there are situations, in which the realtime process has to |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4978 |
wait for a process of lower priority to finish accessing the master. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4979 |
In most cases this is acceptable, because a master access cycle |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4980 |
(receive/process/send) only takes $10$~\textmu s to $20$~\textmu s on |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4981 |
recent systems, what would be the maximum additional jitter. However |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4982 |
some applications demand a minimum jitter. For this reason the master |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4983 |
access can be prohibited by the realtime module: If the time, another |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4984 |
process wants to access the master, is to close to the beginning of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4985 |
the next realtime cycle, the module can disallow, that the lock is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4986 |
taken. In this case, the request callback has to return $1$, meaning |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4987 |
that the lock has not been taken. The foreign process must abort its |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4988 |
master access and try again next time. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4989 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4990 |
This measure helps to significantly reducing the jitter produced by |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4991 |
concurrent master access. Below are exerpts of an example coding: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4992 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4993 |
\begin{lstlisting}[language=C,numbers=left,caption={Variables for |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4994 |
jitter reduction},label={lst:redvar}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4995 |
#define FREQUENCY 10000 // RTAI task frequency in Hz |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4996 |
// ... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4997 |
cycles_t t_last_cycle = 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4998 |
const cycles_t t_critical = cpu_khz * 1000 / FREQUENCY |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4999 |
- cpu_khz * 30 / 1000; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5000 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5001 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5002 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5003 |
\item[\normalfont\textcircled{\tiny 3}] The variable |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5004 |
\textit{t\_last\_cycle} holds the timer ticks at the beginning of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5005 |
the last realtime cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5006 |
\item[\normalfont\textcircled{\tiny 4}] \textit{t\_critical} contains |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5007 |
the number of ticks, that may have passed since the beginning of the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5008 |
last cycle, until there is no more foreign access possible. It is |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5009 |
calculated by substracting the ticks for $30$~\textmu s from the |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5010 |
ticks for a complete cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5011 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5012 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5013 |
\begin{lstlisting}[language=C,numbers=left,caption={Cyclic function |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5014 |
with reduced jitter},label={lst:redrun}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5015 |
void run(long data) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5016 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5017 |
while (1) { |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5018 |
t_last_cycle = get_cycles(); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5019 |
rt_sem_wait(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5020 |
// ... |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5021 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5022 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5023 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5024 |
\item[\normalfont\textcircled{\tiny 4}] The ticks of the beginning of |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5025 |
the current realtime cycle are taken before reserving the semaphore. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5026 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5027 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5028 |
\begin{lstlisting}[language=C,numbers=left,caption={Request callback |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5029 |
for reduced jitter},label={lst:redreq}] |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5030 |
int request_lock(void *data) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5031 |
{ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5032 |
// too close to the next RT cycle: deny access. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5033 |
if (get_cycles() - t_last_cycle > t_critical) |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5034 |
return -1; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5035 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5036 |
// allow access |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5037 |
rt_sem_wait(&master_sem); |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5038 |
return 0; |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5039 |
} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5040 |
\end{lstlisting} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5041 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5042 |
\begin{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5043 |
\item[\normalfont\textcircled{\tiny 4}] If the time of request is too |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5044 |
close to the next realtime cycle (here: \textless~$30$~\textmu s |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5045 |
before the estimated beginning), the locking is denied. The |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5046 |
requesting process must abort its cycle. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5047 |
\end{description} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5048 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5049 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5050 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5051 |
\begin{thebibliography}{99} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5052 |
\bibitem{etherlab} Ingenieurgemeinschaft IgH: EtherLab -- Open Source |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5053 |
Toolkit for rapid realtime code generation under Linux with |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5054 |
Simulink/RTW and EtherCAT technology. URL: http://etherlab.org, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5055 |
July~31, 2006. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5056 |
\bibitem{dlspec} IEC 61158-4-12: Data-link Protocol Specification. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5057 |
International Electrotechnical Comission (IEC), 2005. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5058 |
\bibitem{alspec} IEC 61158-6-12: Application Layer Protocol |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5059 |
Specification. International Electrotechnical Comission (IEC), 2005. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5060 |
\bibitem{gpl} GNU General Public License, Version 2. URL: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5061 |
http://www.gnu.org/licenses/gpl.txt. August~9, 2006. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5062 |
\bibitem{lsb} Linux Standard Base. URL: |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5063 |
http://www.freestandards.org/en/LSB. August~9, 2006. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5064 |
\bibitem{wireshark} Wireshark. URL: http://www.wireshark.org. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5065 |
August~9, 2006. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5066 |
\bibitem{automata} {\it Hopcroft, J.~E. / Ullman, J.~D.}: Introduction |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5067 |
to Automata Theory, Languages and Computation. Adison-Wesley, |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5068 |
Reading, Mass.~1979. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5069 |
\bibitem{fsmmis} {\it Wagner, F. / Wolstenholme, P.}: State machine |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5070 |
misunderstandings. In: IEE journal ``Computing and Control |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5071 |
Engineering'', 2004. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5072 |
\bibitem{rtai} RTAI. The RealTime Application Interface for Linux from |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5073 |
DIAPM. URL: http://www.rtai.org, 2006. |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5074 |
\end{thebibliography} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5075 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5076 |
\printglossary |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5077 |
\addcontentsline{toc}{chapter}{\nomname} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5078 |
\markleft{\nomname} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5079 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5080 |
\printindex |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5081 |
\markleft{Index} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5082 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5083 |
%------------------------------------------------------------------------------ |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5084 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5085 |
\end{document} |
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5086 |
|
861f4715ed6f
MERGE trunk -r556:562 -> branches/stable-1.1 (new doc)
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5087 |
%------------------------------------------------------------------------------ |