Chapter with userspace application example.

This commit is contained in:
Florian Pose 2024-06-07 10:31:01 +02:00
parent c2996a8bd9
commit f538987d66
1 changed files with 29 additions and 2 deletions

View File

@ -971,11 +971,38 @@ comments of this header. There is also a Doxygen-generated online version at
escapeinside={//*}{\^^M},
language=C,
keywordstyle=\textbf,
commentstyle=\color{blue}
commentstyle=\color{blue},
numbers=left,
caption={Application Interface Header ecrt.h}
]{../include/ecrt.h}
%------------------------------------------------------------------------------
\section{Userspace Application Example}
\label{sec:example}
There are multiple examples of how to use the application interface included
in the master sources (under \textit{examples/}). This section lists a very
common application, the usage of the master from the user-space. The example
code reserves an EtherCAT master, creates slave configurations and domains and
goes into cyclic mode, where the \lstinline+cyclic_task()+ function is called
repeatedly. For more general information on how to do real-time programming
under Linux, please have a look at the code examples in
\url{https://gitlab.com/etherlab.org/realtime}.
\lstinputlisting[
basicstyle=\ttfamily\scriptsize,
texcl=false,
escapeinside={//*}{\^^M},
language=C,
keywordstyle=\textbf,
commentstyle=\color{blue},
numbers=left,
caption={Userspace application example example/user/main.c}
]{../examples/user/main.c}
%------------------------------------------------------------------------------
\chapter{Ethernet Devices}
\label{sec:devices}
@ -2689,7 +2716,7 @@ be used both in kernel and in user context.
The following minimal example shows how to build a program with EtherCAT
functionality. An entire example can be found in the \textit{examples/user/}
path of the master sources.
path of the master sources and in \autoref{sec:example}.
\begin{lstlisting}[language=C]
#include <ecrt.h>