mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-03-24 13:42:42 +08:00
merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
This commit is contained in:
18
FEATURES
18
FEATURES
@@ -29,11 +29,11 @@ General Features:
|
||||
* Common API for Realtime-Applications in kernel- and userspace.
|
||||
- Requesting and releasing masters.
|
||||
- Dynamic slave configuration, even for slaves that are offline.
|
||||
- Detailed configuration of the slaves' Pdos and Sdos.
|
||||
- Creation of process data domains (see below). Registration of Pdo entries
|
||||
- Detailed configuration of the slaves' PDOs and SDOs.
|
||||
- Creation of process data domains (see below). Registration of PDO entries
|
||||
for exchange within a domain.
|
||||
- Monitoring the states of masters, slave configurations and domains.
|
||||
- Sdo handlers for application-triggered CoE transfers (see below).
|
||||
- SDO handlers for application-triggered CoE transfers (see below).
|
||||
- VoE handlers for Vendor-specific mailbox protocols (see below).
|
||||
- Similar userspace implementation of the kernel API via a C-library.
|
||||
- Avoidance of unnecessary copy operations for process data.
|
||||
@@ -51,17 +51,17 @@ General Features:
|
||||
- Automatic configuration of slaves, if a application-layer state change is
|
||||
requested.
|
||||
|
||||
* Implementation of the CANopen-over-EtherCAT (CoE) mailbox protocol.
|
||||
* Implementation of the CANopen over EtherCAT (CoE) mailbox protocol.
|
||||
- Configuration of CoE-capable slaves.
|
||||
- Sdo information service (dictionary listing).
|
||||
- Sdo transfers both via the application interface and the command-line tool.
|
||||
- SDO information service (dictionary listing).
|
||||
- SDO transfers both via the application interface and the command-line tool.
|
||||
|
||||
* Implementation of the Ethernet-over-EtherCAT (EoE) mailbox protocol.
|
||||
* Implementation of the Ethernet over EtherCAT (EoE) mailbox protocol.
|
||||
- Virtual network interface for any EoE-capable slave.
|
||||
- Both a switched and a routed EoE network architecture is natively supported
|
||||
and configurable with standard tools.
|
||||
|
||||
* Implementation of the Vendor-specific-over-EtherCAT (VoE) mailbox protocol.
|
||||
* Implementation of the Vendor specific over EtherCAT (VoE) mailbox protocol.
|
||||
- Communication with vendor-specific mailbox protocols via the API.
|
||||
|
||||
* Userspace command-line tool 'ethercat'.
|
||||
@@ -69,7 +69,7 @@ General Features:
|
||||
- Reading/Writing alias addresses.
|
||||
- Listing slave configurations.
|
||||
- Viewing process data.
|
||||
- Sdo download/upload; listing Sdo dictionaries.
|
||||
- SDO download/upload; listing SDO dictionaries.
|
||||
- Access to slave registers.
|
||||
- Slave SII (EEPROM) access.
|
||||
- Controlling application-layer states.
|
||||
|
||||
44
NEWS
44
NEWS
@@ -34,6 +34,8 @@ Changes since 1.4.0-rc3:
|
||||
frame.
|
||||
* Modified licence headers to avoid conflicts with the GPL.
|
||||
* Restricted licence to GPLv2 only.
|
||||
* Fixed spelling of 'PDO', 'SDO' (all uppercase) and 'xx over EtherCAT'
|
||||
(without hyphens).
|
||||
|
||||
Changes in 1.4.0-rc3:
|
||||
|
||||
@@ -42,7 +44,7 @@ Changes in 1.4.0-rc3:
|
||||
semaphore was not released.
|
||||
* Minor fix in 'slaves' command that fixed duplicate display of supported
|
||||
mailbox protocols.
|
||||
* The Sdo Information Service is only queried, if the slave has the
|
||||
* The SDO Information Service is only queried, if the slave has the
|
||||
corresponding SII bit set.
|
||||
* Added some missing header files in the command-line-tool code.
|
||||
* Removed unstable e100, forcedeth, and r8169 drivers.
|
||||
@@ -73,18 +75,18 @@ Changes in version 1.4.0-rc1:
|
||||
offers the possibility to use a shared-memory region. Therefore,
|
||||
added the domain methods ecrt_domain_size() and
|
||||
ecrt_domain_external_memory().
|
||||
- Pdo entry registration functions do not return a process data pointer,
|
||||
- PDO entry registration functions do not return a process data pointer,
|
||||
but an offset in the domain's process data. In addition, an optional bit
|
||||
position can be requested. This was necessary for the external domain
|
||||
memory. An additional advantage is, that the returned offset is
|
||||
immediately valid. If the domain's process data is allocated internally,
|
||||
the start address can be retrieved with ecrt_domain_data().
|
||||
- Replaced ecrt_slave_pdo_mapping/add/clear() with
|
||||
ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo
|
||||
assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a
|
||||
Pdo's mapping. ecrt_slave_config_pdos() is a convenience function
|
||||
ecrt_slave_config_pdo_assign_add() to add a PDO to a sync manager's PDO
|
||||
assignment and ecrt_slave_config_pdo_mapping_add() to add a PDO entry to a
|
||||
PDO's mapping. ecrt_slave_config_pdos() is a convenience function
|
||||
for both, that uses the new data types ec_pdo_info_t and
|
||||
ec_pdo_entry_info_t. Pdo entries, that are mapped with these functions
|
||||
ec_pdo_entry_info_t. PDO entries, that are mapped with these functions
|
||||
can now immediately be registered, even if the bus is offline.
|
||||
- Renamed ec_bus_status_t, ec_master_status_t to ec_bus_state_t and
|
||||
ec_master_state_t, respectively. Renamed ecrt_master_get_status() to
|
||||
@@ -92,15 +94,15 @@ Changes in version 1.4.0-rc1:
|
||||
- Added ec_domain_state_t and ec_wc_state_t for a new output parameter
|
||||
of ecrt_domain_state(). The domain state object does now contain
|
||||
information, if the process data was exchanged completely.
|
||||
- Former "Pdo registration" meant Pdo entry registration in fact, therefore
|
||||
- Former "PDO registration" meant PDO entry registration in fact, therefore
|
||||
renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo()
|
||||
to ecrt_slave_config_reg_pdo_entry().
|
||||
- Removed ecrt_domain_register_pdo_range(), because it's functionality can
|
||||
be reached by specifying an explicit Pdo assignment/mapping and
|
||||
registering the mapped Pdo entries.
|
||||
- Added an Sdo access interface, working with Sdo requests. These can be
|
||||
be reached by specifying an explicit PDO assignment/mapping and
|
||||
registering the mapped PDO entries.
|
||||
- Added an SDO access interface, working with SDO requests. These can be
|
||||
scheduled for reading and writing during realtime operation.
|
||||
- Exported ecrt_slave_config_sdo(), the generic Sdo configuration function.
|
||||
- Exported ecrt_slave_config_sdo(), the generic SDO configuration function.
|
||||
- Removed the bus_state and bus_tainted flags from ec_master_state_t.
|
||||
* Device interface changes:
|
||||
- Moved device output parameter of ecdev_offer() to return value.
|
||||
@@ -113,10 +115,10 @@ Changes in version 1.4.0-rc1:
|
||||
- Set the master's debug level.
|
||||
- Show domain information.
|
||||
- Show master information.
|
||||
- List Pdo assignment/mapping.
|
||||
- Write an Sdo entry.
|
||||
- List Sdo dictionaries.
|
||||
- Read an Sdo entry.
|
||||
- List PDO assignment/mapping.
|
||||
- Write an SDO entry.
|
||||
- List SDO dictionaries.
|
||||
- Read an SDO entry.
|
||||
- Output a slave's SII contents.
|
||||
- Write slave's SII contents.
|
||||
- Show slaves.
|
||||
@@ -125,11 +127,11 @@ Changes in version 1.4.0-rc1:
|
||||
* Removed include/ecdb.h.
|
||||
* Using the timestamp counter is now optional (configure --enable-cycles),
|
||||
because it is only available on Intel architectures.
|
||||
* Sdo dictionaries will now also be fetched in operation mode.
|
||||
* SDO dictionaries will now also be fetched in operation mode.
|
||||
* SII write requests will now also be processed in operation mode.
|
||||
* Mapping of Pdo entries is now supported.
|
||||
* Current Pdo assignment/mapping is now read via CoE during bus scan, using
|
||||
direct Sdo access, independent of the dictionary.
|
||||
* Mapping of PDO entries is now supported.
|
||||
* Current PDO assignment/mapping is now read via CoE during bus scan, using
|
||||
direct SDO access, independent of the dictionary.
|
||||
* Network driver news:
|
||||
- Added 8139too driver for kernel 2.6.22, thanks to Erwin Burgstaller.
|
||||
- Added 8139too driver for kernel 2.6.23, thanks to Richard Hacker.
|
||||
@@ -151,8 +153,8 @@ Changes in version 1.4.0-rc1:
|
||||
* Added support for slaves that do not support the LRW datagram type. Separate
|
||||
domains have to be used for inputs and output.
|
||||
* CoE implementation:
|
||||
- Use expedites transfer type for Sdos <= 4 byte (thanks to J. Mohre).
|
||||
- Allow gaps in Pdo mapping (thanks to R. Roesch).
|
||||
- Use expedites transfer type for SDOs <= 4 byte (thanks to J. Mohre).
|
||||
- Allow gaps in PDO mapping (thanks to R. Roesch).
|
||||
- Added some transfer timeouts.
|
||||
- Ansynchronous handling of Emergency requests.
|
||||
- Bugfixes.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
$Id$
|
||||
|
||||
This file shall give additional information on how to set up a network
|
||||
environment with Ethernet-over-EtherCAT devices.
|
||||
environment with Ethernet over EtherCAT devices.
|
||||
|
||||
A virtual network interface will appear for every EoE-capable slave. The
|
||||
interface naming scheme is either eoeXsY, where X is the master index and Y is
|
||||
|
||||
7
TODO
7
TODO
@@ -11,8 +11,8 @@ vim: spelllang=en spell
|
||||
Version 1.5.0:
|
||||
|
||||
* Remove ecrt_domain_state().
|
||||
* Segmented Sdo downloads.
|
||||
* Implement Sdo handlers in userspace library.
|
||||
* Segmented SDO downloads.
|
||||
* Implement SDO handlers in userspace library.
|
||||
* Clear slave list on link down.
|
||||
* Check force_config flag before error.
|
||||
* Remove allow_scanning flag.
|
||||
@@ -20,11 +20,10 @@ Version 1.5.0:
|
||||
* Improve application-triggered SDO transfers by moving the statemachine into
|
||||
the SDO handlers.
|
||||
* External memory for SDO transfers.
|
||||
* Bus information via userspace library (slaves, sync managers, pdos, entries).
|
||||
* Bus information via userspace library (slaves, sync managers, PDOs, entries).
|
||||
* C++ implementation of the library.
|
||||
* Distributed clocks.
|
||||
* Bus simulator interface.
|
||||
* Pdo -> PDO. Sdo -> SDO "-over-"
|
||||
|
||||
Future issues:
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ if test "x${debugring}" = "x1"; then
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Ethernet-over-EtherCAT support
|
||||
# Ethernet over EtherCAT support
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([eoe],
|
||||
|
||||
@@ -227,19 +227,19 @@ EtherCAT functionality (see chap.~\ref{chap:api}).
|
||||
|
||||
\end{itemize}
|
||||
|
||||
\item CANopen-over-EtherCAT (CoE)
|
||||
\item CANopen over EtherCAT (CoE)
|
||||
|
||||
\begin{itemize}
|
||||
|
||||
\item Sdo upload, download and information service.
|
||||
\item SDO upload, download and information service.
|
||||
|
||||
\item Slave configuration via Sdos.
|
||||
\item Slave configuration via SDOs.
|
||||
|
||||
\item Sdo access from userspace and from the application.
|
||||
\item SDO access from userspace and from the application.
|
||||
|
||||
\end{itemize}
|
||||
|
||||
\item Ethernet-over-EtherCAT (EoE)
|
||||
\item Ethernet over EtherCAT (EoE)
|
||||
|
||||
\begin{itemize}
|
||||
|
||||
@@ -254,12 +254,12 @@ EtherCAT functionality (see chap.~\ref{chap:api}).
|
||||
|
||||
\begin{itemize}
|
||||
|
||||
\item Showing the current bus with slaves, Pdos and Sdos.
|
||||
\item Showing the current bus with slaves, PDOs and SDOs.
|
||||
\item Showing the bus configuration.
|
||||
\item Showing domains and process data.
|
||||
\item Setting the master's debug level.
|
||||
\item Writing alias addresses.
|
||||
\item Sdo uploading/downloading.
|
||||
\item SDO uploading/downloading.
|
||||
\item Reading/writing a slave's SII.
|
||||
\item Setting slave states.
|
||||
\item Generate slave description XML.
|
||||
@@ -457,7 +457,7 @@ possible until then.
|
||||
an Ethernet device, but is not requested by any application yet. The master
|
||||
runs its state machine (see sec.~\ref{sec:fsm-master}), that automatically
|
||||
scans the bus for slaves and executes pending operations from the userspace
|
||||
interface (for example Sdo access). The command-line tool can be used to
|
||||
interface (for example SDO access). The command-line tool can be used to
|
||||
access the bus, but there is no process data exchange because of the missing
|
||||
bus configuration.
|
||||
|
||||
@@ -478,12 +478,12 @@ process data.
|
||||
\index{Process data}
|
||||
|
||||
Slaves offer their inputs and outputs by presenting the master so-called
|
||||
``Process Data Objects'' (Pdos\index{Pdo}). The available Pdos can be either
|
||||
``Process Data Objects'' (PDOs\index{PDO}). The available PDOs can be either
|
||||
determined by reading out the slave's TXPDO and RXPDO SII categories from the
|
||||
E$^2$PROM (in case of fixed Pdos) or by reading out the appropriate CoE
|
||||
E$^2$PROM (in case of fixed PDOs) or by reading out the appropriate CoE
|
||||
objects (see sec.~\ref{sec:coe}), if available. The application can register
|
||||
the Pdos' entries for exchange during cyclic operation. The sum of all
|
||||
registered Pdo entries defines the ``process data image'', which is exchanged
|
||||
the PDOs' entries for exchange during cyclic operation. The sum of all
|
||||
registered PDO entries defines the ``process data image'', which is exchanged
|
||||
via datagrams with ``logical'' memory access (like LWR, LRD or LRW) introduced
|
||||
in~\cite[sec.~5.4]{dlspec}.
|
||||
|
||||
@@ -491,8 +491,8 @@ in~\cite[sec.~5.4]{dlspec}.
|
||||
\index{Domain}
|
||||
|
||||
The process data image can be easily managed by creating so-called
|
||||
``domains'', which allow grouped Pdo exchange. They also take care of managing
|
||||
the datagram structures needed to exchange the Pdos. Domains are mandatory for
|
||||
``domains'', which allow grouped PDO exchange. They also take care of managing
|
||||
the datagram structures needed to exchange the PDOs. Domains are mandatory for
|
||||
process data exchange, so there has to be at least one. They were introduced
|
||||
for the following reasons:
|
||||
|
||||
@@ -506,10 +506,10 @@ image exceeds this limit, multiple frames have to be sent, and the image has
|
||||
to be partitioned for the use of multiple datagrams. A domain manages this
|
||||
automatically.
|
||||
|
||||
\item Not every Pdo has to be exchanged with the same frequency: The values of
|
||||
Pdos can vary slowly over time (for example temperature values), so exchanging
|
||||
\item Not every PDO has to be exchanged with the same frequency: The values of
|
||||
PDOs can vary slowly over time (for example temperature values), so exchanging
|
||||
them with a high frequency would just waste bus bandwidth. For this reason,
|
||||
multiple domains can be created, to group different Pdos and so allow separate
|
||||
multiple domains can be created, to group different PDOs and so allow separate
|
||||
exchange.
|
||||
|
||||
\end{itemize}
|
||||
@@ -521,21 +521,21 @@ limited by the slaves.
|
||||
\paragraph{FMMU Configuration}
|
||||
\index{FMMU!Configuration}
|
||||
|
||||
An application can register Pdo entries for exchange. Every Pdo entry and its
|
||||
parent Pdo is part of a memory area in the slave's physical memory, that is
|
||||
An application can register PDO entries for exchange. Every PDO entry and its
|
||||
parent PDO is part of a memory area in the slave's physical memory, that is
|
||||
protected by a sync manager \cite[sec.~6.7]{dlspec} for synchronized access.
|
||||
In order to make a sync manager react on a datagram accessing its memory, it
|
||||
is necessary to access the last byte covered by the sync manager. Otherwise
|
||||
the sync manager will not react on the datagram and no data will be exchanged.
|
||||
That is why the whole synchronized memory area has to be included into the
|
||||
process data image: For example, if a certain Pdo entry of a slave is
|
||||
process data image: For example, if a certain PDO entry of a slave is
|
||||
registered for exchange with a certain domain, one FMMU will be configured to
|
||||
map the complete sync-manager-protected memory, the Pdo entry resides in. If a
|
||||
second Pdo entry of the same slave is registered for process data exchange
|
||||
map the complete sync-manager-protected memory, the PDO entry resides in. If a
|
||||
second PDO entry of the same slave is registered for process data exchange
|
||||
within the same domain, and it resides in the same sync-manager-protected
|
||||
memory as the first one, the FMMU configuration is not altered, because the
|
||||
desired memory is already part of the domain's process data image. If the
|
||||
second Pdo entry would belong to another sync-manager-protected area, this
|
||||
second PDO entry would belong to another sync-manager-protected area, this
|
||||
complete area would also be included into the domains process data image.
|
||||
|
||||
Figure~\ref{fig:fmmus} gives an overview, how FMMUs are configured to map
|
||||
@@ -559,11 +559,11 @@ physical memory to logical process data images.
|
||||
% Interface version
|
||||
% Master Requesting and Releasing
|
||||
% Master Locking
|
||||
% Configuring Pdo assignment and mapping
|
||||
% Configuring PDO assignment and mapping
|
||||
% Domains (memory)
|
||||
% Pdo entry registration
|
||||
% Sdo configuration
|
||||
% Sdo access
|
||||
% PDO entry registration
|
||||
% SDO configuration
|
||||
% SDO access
|
||||
|
||||
The application interface provides functions and data structures for
|
||||
applications to access an EtherCAT master. The complete documentation of the
|
||||
@@ -580,7 +580,7 @@ Every application should use the master in two steps:
|
||||
\begin{description}
|
||||
|
||||
\item[Configuration] The master is requested and the configuration is applied.
|
||||
For example, domains are created, slaves are configured and Pdo entries are
|
||||
For example, domains are created, slaves are configured and PDO entries are
|
||||
registered (see sec.~\ref{sec:masterconfig}).
|
||||
|
||||
\item[Operation] Cyclic code is run and process data are exchanged (see
|
||||
@@ -1470,7 +1470,7 @@ monitored. If a slave is not in the state it supposed to be, the slave is
|
||||
|
||||
\item[Request handling] Requests (either originating from the application or
|
||||
from external sources) are handled. A request is a job that the master shall
|
||||
process asynchronously, for example an SII access, Sdo access, or similar.
|
||||
process asynchronously, for example an SII access, SDO access, or similar.
|
||||
|
||||
\end{description}
|
||||
|
||||
@@ -1512,10 +1512,10 @@ image memory.
|
||||
|
||||
\item[PREOP] If the slave supports CoE, it is set to PREOP state using the
|
||||
State change FSM (see sec.~\ref{sec:fsm-change}) to enable mailbox
|
||||
communication and read the Pdo configuration via CoE.
|
||||
communication and read the PDO configuration via CoE.
|
||||
|
||||
\item[Pdos] The Pdos are read via CoE (if supported) using the Pdo Reading FSM
|
||||
(see sec.~\ref{sec:fsm-pdo}). If this is successful, the Pdo information from
|
||||
\item[PDOs] The PDOs are read via CoE (if supported) using the PDO Reading FSM
|
||||
(see sec.~\ref{sec:fsm-pdo}). If this is successful, the PDO information from
|
||||
the SII (if any) is overwritten.
|
||||
|
||||
\end{description}
|
||||
@@ -1554,18 +1554,18 @@ is skipped.
|
||||
\item[PREOP] The state change FSM is used to bring the slave to PREOP state.
|
||||
If this is the requested state, the state machine is finished.
|
||||
|
||||
\item[Sdo Configuration] If there is a slave configuration attached (see
|
||||
sec.~\ref{sec:masterconfig}), and there are any Sdo configurations are
|
||||
\item[SDO Configuration] If there is a slave configuration attached (see
|
||||
sec.~\ref{sec:masterconfig}), and there are any SDO configurations are
|
||||
provided by the application, these are sent to the slave.
|
||||
|
||||
\item[Pdo Configuration] The Pdo configuration state machine is executed to
|
||||
apply all necessary Pdo configurations.
|
||||
\item[PDO Configuration] The PDO configuration state machine is executed to
|
||||
apply all necessary PDO configurations.
|
||||
|
||||
\item[Pdo Sync Manager Configuration] If any Pdo sync managers exist, they are
|
||||
\item[PDO Sync Manager Configuration] If any PDO sync managers exist, they are
|
||||
configured.
|
||||
|
||||
\item[FMMU Configuration] If there are FMMUs configurations supplied by the
|
||||
application (i.\,e.\ if the application registered Pdo entries), they are
|
||||
application (i.\,e.\ if the application registered PDO entries), they are
|
||||
applied.
|
||||
|
||||
\item[SAFEOP] The state change FSM is used to bring the slave to SAFEOP state.
|
||||
@@ -1677,60 +1677,60 @@ this state to avoid that another write operation is issued too early.
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\section{The Pdo State Machines}
|
||||
\section{The PDO State Machines}
|
||||
\label{sec:fsm-pdo}
|
||||
\index{FSM!Pdo}
|
||||
\index{FSM!PDO}
|
||||
|
||||
The Pdo state machines are a set of state machines that read or write the Pdo
|
||||
assignment and the Pdo mapping via the ``CoE Communication Area'' described in
|
||||
\cite[sec. 5.6.7.4]{alspec}. For the object access, the CANopen-over-EtherCAT
|
||||
The PDO state machines are a set of state machines that read or write the PDO
|
||||
assignment and the PDO mapping via the ``CoE Communication Area'' described in
|
||||
\cite[sec. 5.6.7.4]{alspec}. For the object access, the CANopen over EtherCAT
|
||||
access primitives are used (see sec.~\ref{sec:coe}), so the slave must support
|
||||
the CoE mailbox protocol.
|
||||
|
||||
\paragraph{Pdo Reading FSM} This state machine (fig.~\ref{fig:fsm-pdo-read})
|
||||
has the purpose to read the complete Pdo configuration of a slave. It reads
|
||||
the Pdo assignment for each Sync Manager and uses the Pdo Entry Reading FSM
|
||||
(fig.~\ref{fig:fsm-pdo-entry-read}) to read the mapping for each assigned Pdo.
|
||||
\paragraph{PDO Reading FSM} This state machine (fig.~\ref{fig:fsm-pdo-read})
|
||||
has the purpose to read the complete PDO configuration of a slave. It reads
|
||||
the PDO assignment for each Sync Manager and uses the PDO Entry Reading FSM
|
||||
(fig.~\ref{fig:fsm-pdo-entry-read}) to read the mapping for each assigned PDO.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=.4\textwidth]{graphs/fsm_pdo_read}
|
||||
\caption{Transition Diagram of the Pdo Reading State Machine}
|
||||
\caption{Transition Diagram of the PDO Reading State Machine}
|
||||
\label{fig:fsm-pdo-read}
|
||||
\end{figure}
|
||||
|
||||
Basically it reads the every Sync manager's Pdo assignment Sdo's
|
||||
Basically it reads the every Sync manager's PDO assignment SDO's
|
||||
(\lstinline+0x1C1x+) number of elements to determine the number of assigned
|
||||
Pdos for this sync manager and then reads out the subindices of the Sdo to get
|
||||
the assigned Pdo's indices. When a Pdo index is read, the Pdo Entry Reading
|
||||
FSM is executed to read the Pdo's mapped Pdo entries.
|
||||
PDOs for this sync manager and then reads out the subindices of the SDO to get
|
||||
the assigned PDO's indices. When a PDO index is read, the PDO Entry Reading
|
||||
FSM is executed to read the PDO's mapped PDO entries.
|
||||
|
||||
\paragraph{Pdo Entry Reading FSM} This state machine
|
||||
(fig.~\ref{fig:fsm-pdo-entry-read}) reads the Pdo mapping (the Pdo entries) of
|
||||
a Pdo. It reads the respective mapping Sdo (\lstinline+0x1600+ --
|
||||
\paragraph{PDO Entry Reading FSM} This state machine
|
||||
(fig.~\ref{fig:fsm-pdo-entry-read}) reads the PDO mapping (the PDO entries) of
|
||||
a PDO. It reads the respective mapping SDO (\lstinline+0x1600+ --
|
||||
\lstinline+0x17ff+, or \lstinline+0x1a00+ -- \lstinline+0x1bff+) for the given
|
||||
Pdo by reading first the subindex zero (number of elements) to determine the
|
||||
number of mapped Pdo entries. After that, each subindex is read to get the
|
||||
mapped Pdo entry index, subindex and bit size.
|
||||
PDO by reading first the subindex zero (number of elements) to determine the
|
||||
number of mapped PDO entries. After that, each subindex is read to get the
|
||||
mapped PDO entry index, subindex and bit size.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=.4\textwidth]{graphs/fsm_pdo_entry_read}
|
||||
\caption{Transition Diagram of the Pdo Entry Reading State Machine}
|
||||
\caption{Transition Diagram of the PDO Entry Reading State Machine}
|
||||
\label{fig:fsm-pdo-entry-read}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=.9\textwidth]{graphs/fsm_pdo_conf}
|
||||
\caption{Transition Diagram of the Pdo Configuration State Machine}
|
||||
\caption{Transition Diagram of the PDO Configuration State Machine}
|
||||
\label{fig:fsm-pdo-conf}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=.4\textwidth]{graphs/fsm_pdo_entry_conf}
|
||||
\caption{Transition Diagram of the Pdo Entry Configuration State Machine}
|
||||
\caption{Transition Diagram of the PDO Entry Configuration State Machine}
|
||||
\label{fig:fsm-pdo-entry-conf}
|
||||
\end{figure}
|
||||
|
||||
@@ -1744,12 +1744,12 @@ protocols. See the below section for details.
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\section{Ethernet-over-EtherCAT (EoE)}
|
||||
\section{Ethernet over EtherCAT (EoE)}
|
||||
\label{sec:eoe}
|
||||
\index{EoE}
|
||||
|
||||
The EtherCAT master implements the
|
||||
Ethernet-over-EtherCAT\nomenclature{EoE}{Ethernet-over-EtherCAT, Mailbox
|
||||
Ethernet over EtherCAT\nomenclature{EoE}{Ethernet over EtherCAT, Mailbox
|
||||
Protocol} mailbox protocol~\cite[sec.~5.7]{alspec} to enable the tunneling of
|
||||
Ethernet frames to special slaves, that can either have physical Ethernet
|
||||
ports to forward the frames to, or have an own IP stack to receive the frames.
|
||||
@@ -1903,11 +1903,11 @@ application-layer state is automatically set to OP.
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\section{CANopen-over-EtherCAT (CoE)}
|
||||
\section{CANopen over EtherCAT (CoE)}
|
||||
\label{sec:coe}
|
||||
\index{CoE}
|
||||
|
||||
The CANopen-over-EtherCAT\nomenclature{CoE}{CANopen-over-EtherCAT, Mailbox
|
||||
The CANopen over EtherCAT\nomenclature{CoE}{CANopen over EtherCAT, Mailbox
|
||||
Protocol} protocol~\cite[sec.~5.6]{alspec} is used to configure slaves and
|
||||
exchange data objects on application level.
|
||||
|
||||
@@ -1916,23 +1916,23 @@ exchange data objects on application level.
|
||||
% Download / Upload
|
||||
% Expedited / Normal
|
||||
% Segmenting
|
||||
% Sdo Info Services
|
||||
% SDO Info Services
|
||||
%
|
||||
|
||||
\ldots
|
||||
|
||||
\paragraph{Sdo Download State Machine}
|
||||
\paragraph{SDO Download State Machine}
|
||||
|
||||
The best time to apply Sdo configurations is during the slave's PREOP state,
|
||||
The best time to apply SDO configurations is during the slave's PREOP state,
|
||||
because mailbox communication is already possible and slave's application will
|
||||
start with updating input data in the succeeding SAFEOP state. Therefore the
|
||||
Sdo configuration has to be part of the slave configuration state machine (see
|
||||
sec.~\ref{sec:fsm-conf}): It is implemented via an Sdo download state machine,
|
||||
SDO configuration has to be part of the slave configuration state machine (see
|
||||
sec.~\ref{sec:fsm-conf}): It is implemented via an SDO download state machine,
|
||||
that is executed just before entering the slave's SAFEOP state. In this way,
|
||||
it is guaranteed that the Sdo configurations are applied each time, the slave
|
||||
it is guaranteed that the SDO configurations are applied each time, the slave
|
||||
is reconfigured.
|
||||
|
||||
The transition diagram of the Sdo Download state machine can be seen
|
||||
The transition diagram of the SDO Download state machine can be seen
|
||||
in figure~\ref{fig:fsm-coedown}.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
@@ -1946,7 +1946,7 @@ in figure~\ref{fig:fsm-coedown}.
|
||||
|
||||
\begin{description}
|
||||
\item[START] The beginning state of the CoE download state
|
||||
machine. The ``Sdo Download Normal Request'' mailbox command is
|
||||
machine. The ``SDO Download Normal Request'' mailbox command is
|
||||
sent. $\rightarrow$~REQUEST
|
||||
|
||||
\item[REQUEST] It is checked, if the CoE download request has been
|
||||
@@ -1955,7 +1955,7 @@ in figure~\ref{fig:fsm-coedown}.
|
||||
|
||||
\item[CHECK] If no mailbox data is available, the timer is checked.
|
||||
\begin{itemize}
|
||||
\item If it timed out, the Sdo download is aborted.
|
||||
\item If it timed out, the SDO download is aborted.
|
||||
$\rightarrow$~ERROR
|
||||
\item Otherwise, the mailbox is queried again.
|
||||
$\rightarrow$~CHECK
|
||||
@@ -1965,22 +1965,22 @@ in figure~\ref{fig:fsm-coedown}.
|
||||
$\rightarrow$~RESPONSE
|
||||
|
||||
\item[RESPONSE] If the mailbox response could not be fetched, the data
|
||||
is invalid, the wrong protocol was received, or a ``Abort Sdo
|
||||
Transfer Request'' was received, the Sdo download is aborted.
|
||||
is invalid, the wrong protocol was received, or a ``Abort SDO
|
||||
Transfer Request'' was received, the SDO download is aborted.
|
||||
$\rightarrow$~ERROR
|
||||
|
||||
If a ``Sdo Download Normal Response'' acknowledgement was received,
|
||||
the Sdo download was successful. $\rightarrow$~END
|
||||
If a ``SDO Download Normal Response'' acknowledgement was received,
|
||||
the SDO download was successful. $\rightarrow$~END
|
||||
|
||||
\item[END] The Sdo download was successful.
|
||||
\item[END] The SDO download was successful.
|
||||
|
||||
\item[ERROR] The Sdo download was aborted due to an error.
|
||||
\item[ERROR] The SDO download was aborted due to an error.
|
||||
|
||||
\end{description}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\section{Vendor-specific-over-EtherCAT (VoE)}
|
||||
\section{Vendor specific over EtherCAT (VoE)}
|
||||
\label{sec:voe}
|
||||
\index{VoE}
|
||||
|
||||
@@ -2087,19 +2087,19 @@ sec.~\ref{sec:autonode} for how to install and configure it.
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\subsection{Sync Managers, Pdos and Pdo Entries}
|
||||
\subsection{Sync Managers, PDOs and PDO Entries}
|
||||
|
||||
\lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_pdos}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\subsection{Sdo Dictionary}
|
||||
\subsection{SDO Dictionary}
|
||||
|
||||
\lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_sdos}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\subsection{Sdo Access}
|
||||
\subsection{SDO Access}
|
||||
|
||||
\lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_download}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ digraph pdo_conf {
|
||||
start -> end [fontname="Helvetica",label="No config"]
|
||||
|
||||
action_next_sync [shape=point,label=""]
|
||||
action_next_sync -> action_check_assignment [fontname="Helvetica",label="No Pdos"]
|
||||
action_next_sync -> action_pdo_mapping [fontname="Helvetica",label="First Pdo",weight=10]
|
||||
action_next_sync -> action_check_assignment [fontname="Helvetica",label="No PDOs"]
|
||||
action_next_sync -> action_pdo_mapping [fontname="Helvetica",label="First PDO",weight=10]
|
||||
action_next_sync -> end [fontname="Helvetica",label="No more SMs"]
|
||||
|
||||
action_pdo_mapping [shape=point,label=""]
|
||||
@@ -29,22 +29,22 @@ digraph pdo_conf {
|
||||
action_next_pdo_mapping [shape=point,label=""]
|
||||
action_next_pdo_mapping -> action_check_assignment [weight=10]
|
||||
action_next_pdo_mapping -> action_pdo_mapping
|
||||
[fontname="Helvetica",label="Next Pdo"]
|
||||
[fontname="Helvetica",label="Next PDO"]
|
||||
|
||||
action_check_assignment [shape=point,label=""]
|
||||
action_check_assignment -> action_next_sync [fontname="Helvetica",label="Assign ok"]
|
||||
action_check_assignment -> zero_pdo_count [weight=10]
|
||||
|
||||
zero_pdo_count [fontname="Helvetica"]
|
||||
zero_pdo_count -> action_next_sync [fontname="Helvetica",label="No Pdos"]
|
||||
zero_pdo_count -> action_assign_pdo [fontname="Helvetica",label="First Pdo", weight=10]
|
||||
zero_pdo_count -> action_next_sync [fontname="Helvetica",label="No PDOs"]
|
||||
zero_pdo_count -> action_assign_pdo [fontname="Helvetica",label="First PDO", weight=10]
|
||||
|
||||
action_assign_pdo [shape=point,label=""]
|
||||
action_assign_pdo -> assign_pdo [weight=10]
|
||||
|
||||
assign_pdo [fontname="Helvetica"]
|
||||
assign_pdo -> set_pdo_count [fontname="Helvetica",label="No more Pdos", weight=10]
|
||||
assign_pdo -> action_assign_pdo [fontname="Helvetica",label="Next Pdo"]
|
||||
assign_pdo -> set_pdo_count [fontname="Helvetica",label="No more PDOs", weight=10]
|
||||
assign_pdo -> action_assign_pdo [fontname="Helvetica",label="Next PDO"]
|
||||
|
||||
set_pdo_count [fontname="Helvetica"]
|
||||
set_pdo_count -> action_next_sync
|
||||
|
||||
@@ -14,8 +14,8 @@ digraph pdo_read {
|
||||
pdo_count -> action_next_pdo [weight=5]
|
||||
|
||||
action_next_pdo [shape=point,label=""]
|
||||
action_next_pdo -> pdo [fontname="Helvetica", label="Next Pdo", weight=5]
|
||||
action_next_pdo -> action_next_sync [fontname="Helvetica", label="No more Pdos"]
|
||||
action_next_pdo -> pdo [fontname="Helvetica", label="Next PDO", weight=5]
|
||||
action_next_pdo -> action_next_sync [fontname="Helvetica", label="No more PDOs"]
|
||||
|
||||
pdo [fontname="Helvetica"]
|
||||
pdo -> pdo_entries [weight=5]
|
||||
|
||||
@@ -31,7 +31,7 @@ digraph slaveconf {
|
||||
preop -> enter_sdo_conf [weight=10]
|
||||
|
||||
enter_sdo_conf [shape=point, label=""]
|
||||
enter_sdo_conf -> enter_pdo_conf [fontname="Helvetica", label="No Sdos\nconfigured"]
|
||||
enter_sdo_conf -> enter_pdo_conf [fontname="Helvetica", label="No SDOs\nconfigured"]
|
||||
enter_sdo_conf -> sdo_conf [weight=10]
|
||||
|
||||
sdo_conf [fontname="Helvetica"]
|
||||
@@ -46,7 +46,7 @@ digraph slaveconf {
|
||||
pdo_conf -> enter_pdo_sync [weight=10]
|
||||
|
||||
enter_pdo_sync [shape=point, label=""]
|
||||
enter_pdo_sync -> enter_fmmu [fontname="Helvetica", label="No Pdo SMs"]
|
||||
enter_pdo_sync -> enter_fmmu [fontname="Helvetica", label="No PDO SMs"]
|
||||
enter_pdo_sync -> pdo_sync [weight=10]
|
||||
|
||||
pdo_sync [fontname="Helvetica"]
|
||||
|
||||
@@ -95,16 +95,16 @@ Single
|
||||
4 0 0 50 -1 18 12 0.0000 4 180 1290 3735 2025 Sync Manager\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 450 3735 2385 Index\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 750 3735 2610 Direction\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 180 1575 3735 3420 Sdo Configuration\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 180 1575 3735 3420 SDO Configuration\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 450 3735 3780 Index\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 780 3735 4005 Subindex\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 390 3735 4230 Data\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 180 1140 3735 5040 Sdo Request\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 180 1140 3735 5040 SDO Request\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 450 3735 5310 Index\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 780 3735 5535 Subindex\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 135 330 6210 2025 Pdo\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 135 330 6210 2025 PDO\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 450 6210 2385 Index\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 180 885 7785 2025 Pdo Entry\001
|
||||
4 0 0 50 -1 18 12 0.0000 4 180 885 7785 2025 PDO Entry\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 450 7785 2340 Index\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 780 7785 2565 Subindex\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 720 7785 2790 Bitlength\001
|
||||
|
||||
@@ -13,7 +13,7 @@ Single
|
||||
6 3465 4455 5640 4680
|
||||
2 2 0 1 0 7 50 -1 42 0.000 0 0 -1 0 0 5
|
||||
3465 4455 3645 4455 3645 4680 3465 4680 3465 4455
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 1905 3735 4635 Registered Pdo Entries\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 1905 3735 4635 Registered PDO Entries\001
|
||||
-6
|
||||
2 1 1 1 0 7 52 -1 46 4.000 0 0 -1 0 0 2
|
||||
1215 1665 1620 3870
|
||||
|
||||
@@ -75,7 +75,7 @@ static uint8_t *domain1_pd; // process data memory
|
||||
#define Beckhoff_EL3152 0x00000002, 0x0c503052
|
||||
#define Beckhoff_EL4102 0x00000002, 0x10063052
|
||||
|
||||
// offsets for Pdo entries
|
||||
// offsets for PDO entries
|
||||
static unsigned int off_ana_in;
|
||||
static unsigned int off_ana_out;
|
||||
static unsigned int off_dig_out;
|
||||
@@ -255,12 +255,12 @@ void read_sdo(void)
|
||||
printk(KERN_INFO PFX "Still busy...\n");
|
||||
break;
|
||||
case EC_REQUEST_SUCCESS:
|
||||
printk(KERN_INFO PFX "Sdo value: 0x%04X\n",
|
||||
printk(KERN_INFO PFX "SDO value: 0x%04X\n",
|
||||
EC_READ_U16(ecrt_sdo_request_data(sdo)));
|
||||
ecrt_sdo_request_read(sdo); // trigger next read
|
||||
break;
|
||||
case EC_REQUEST_ERROR:
|
||||
printk(KERN_INFO PFX "Failed to read Sdo!\n");
|
||||
printk(KERN_INFO PFX "Failed to read SDO!\n");
|
||||
ecrt_sdo_request_read(sdo); // retry reading
|
||||
break;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ void cyclic_task(unsigned long data)
|
||||
check_slave_config_states();
|
||||
|
||||
#if SDO_ACCESS
|
||||
// read process data Sdo
|
||||
// read process data SDO
|
||||
read_sdo();
|
||||
#endif
|
||||
|
||||
@@ -394,9 +394,9 @@ int __init init_mini_module(void)
|
||||
}
|
||||
|
||||
#if CONFIGURE_PDOS
|
||||
printk(KERN_INFO PFX "Configuring Pdos...\n");
|
||||
printk(KERN_INFO PFX "Configuring PDOs...\n");
|
||||
if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3152_syncs)) {
|
||||
printk(KERN_ERR PFX "Failed to configure Pdos.\n");
|
||||
printk(KERN_ERR PFX "Failed to configure PDOs.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ int __init init_mini_module(void)
|
||||
}
|
||||
|
||||
if (ecrt_slave_config_pdos(sc, EC_END, el4102_syncs)) {
|
||||
printk(KERN_ERR PFX "Failed to configure Pdos.\n");
|
||||
printk(KERN_ERR PFX "Failed to configure PDOs.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
@@ -418,15 +418,15 @@ int __init init_mini_module(void)
|
||||
}
|
||||
|
||||
if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) {
|
||||
printk(KERN_ERR PFX "Failed to configure Pdos.\n");
|
||||
printk(KERN_ERR PFX "Failed to configure PDOs.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SDO_ACCESS
|
||||
printk(KERN_INFO PFX "Creating Sdo requests...\n");
|
||||
printk(KERN_INFO PFX "Creating SDO requests...\n");
|
||||
if (!(sdo = ecrt_slave_config_create_sdo_request(sc_ana_in, 0x3102, 2, 2))) {
|
||||
printk(KERN_ERR PFX "Failed to create Sdo request.\n");
|
||||
printk(KERN_ERR PFX "Failed to create SDO request.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
ecrt_sdo_request_timeout(sdo, 500); // ms
|
||||
@@ -440,9 +440,9 @@ int __init init_mini_module(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
printk(KERN_INFO PFX "Registering Pdo entries...\n");
|
||||
printk(KERN_INFO PFX "Registering PDO entries...\n");
|
||||
if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {
|
||||
printk(KERN_ERR PFX "Pdo entry registration failed!\n");
|
||||
printk(KERN_ERR PFX "PDO entry registration failed!\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ static uint8_t *domain1_pd; // process data memory
|
||||
#define Beckhoff_EL2004 0x00000002, 0x07D43052
|
||||
#define Beckhoff_EL3162 0x00000002, 0x0C5A3052
|
||||
|
||||
static unsigned int off_ana_in; // offsets for Pdo entries
|
||||
static unsigned int off_ana_in; // offsets for PDO entries
|
||||
static unsigned int off_dig_out;
|
||||
|
||||
const static ec_pdo_entry_reg_t domain1_regs[] = {
|
||||
@@ -297,9 +297,9 @@ int __init init_mod(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIGURE_PDOS
|
||||
printk(KERN_INFO PFX "Configuring Pdos...\n");
|
||||
printk(KERN_INFO PFX "Configuring PDOs...\n");
|
||||
if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3162_syncs)) {
|
||||
printk(KERN_ERR PFX "Failed to configure Pdos.\n");
|
||||
printk(KERN_ERR PFX "Failed to configure PDOs.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
@@ -309,14 +309,14 @@ int __init init_mod(void)
|
||||
}
|
||||
|
||||
if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) {
|
||||
printk(KERN_ERR PFX "Failed to configure Pdos.\n");
|
||||
printk(KERN_ERR PFX "Failed to configure PDOs.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
#endif
|
||||
|
||||
printk(KERN_INFO PFX "Registering Pdo entries...\n");
|
||||
printk(KERN_INFO PFX "Registering PDO entries...\n");
|
||||
if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {
|
||||
printk(KERN_ERR PFX "Pdo entry registration failed!\n");
|
||||
printk(KERN_ERR PFX "PDO entry registration failed!\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ static uint8_t *domain1_pd = NULL;
|
||||
#define Beckhoff_EL3152 0x00000002, 0x0c503052
|
||||
#define Beckhoff_EL4102 0x00000002, 0x10063052
|
||||
|
||||
// offsets for Pdo entries
|
||||
// offsets for PDO entries
|
||||
static unsigned int off_ana_in_status;
|
||||
static unsigned int off_ana_in_value;
|
||||
static unsigned int off_ana_out;
|
||||
@@ -293,9 +293,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#if CONFIGURE_PDOS
|
||||
printf("Configuring Pdos...\n");
|
||||
printf("Configuring PDOs...\n");
|
||||
if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3152_syncs)) {
|
||||
fprintf(stderr, "Failed to configure Pdos.\n");
|
||||
fprintf(stderr, "Failed to configure PDOs.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (ecrt_slave_config_pdos(sc, EC_END, el4102_syncs)) {
|
||||
fprintf(stderr, "Failed to configure Pdos.\n");
|
||||
fprintf(stderr, "Failed to configure PDOs.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) {
|
||||
fprintf(stderr, "Failed to configure Pdos.\n");
|
||||
fprintf(stderr, "Failed to configure PDOs.\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@@ -328,7 +328,7 @@ int main(int argc, char **argv)
|
||||
return -1;
|
||||
|
||||
if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {
|
||||
fprintf(stderr, "Pdo entry registration failed!\n");
|
||||
fprintf(stderr, "PDO entry registration failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
178
include/ecrt.h
178
include/ecrt.h
@@ -56,18 +56,18 @@
|
||||
* offers the possibility to use a shared-memory region. Therefore,
|
||||
* added the domain methods ecrt_domain_size() and
|
||||
* ecrt_domain_external_memory().
|
||||
* - Pdo entry registration functions do not return a process data pointer,
|
||||
* - PDO entry registration functions do not return a process data pointer,
|
||||
* but an offset in the domain's process data. In addition, an optional bit
|
||||
* position can be requested. This was necessary for the external domain
|
||||
* memory. An additional advantage is, that the returned offset is
|
||||
* immediately valid. If the domain's process data is allocated internally,
|
||||
* the start address can be retrieved with ecrt_domain_data().
|
||||
* - Replaced ecrt_slave_pdo_mapping/add/clear() with
|
||||
* ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo
|
||||
* assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a
|
||||
* Pdo's mapping. ecrt_slave_config_pdos() is a convenience function
|
||||
* ecrt_slave_config_pdo_assign_add() to add a PDO to a sync manager's PDO
|
||||
* assignment and ecrt_slave_config_pdo_mapping_add() to add a PDO entry to a
|
||||
* PDO's mapping. ecrt_slave_config_pdos() is a convenience function
|
||||
* for both, that uses the new data types ec_pdo_info_t and
|
||||
* ec_pdo_entry_info_t. Pdo entries, that are mapped with these functions
|
||||
* ec_pdo_entry_info_t. PDO entries, that are mapped with these functions
|
||||
* can now immediately be registered, even if the bus is offline.
|
||||
* - Renamed ec_bus_status_t, ec_master_status_t to ec_bus_state_t and
|
||||
* ec_master_state_t, respectively. Renamed ecrt_master_get_status() to
|
||||
@@ -75,15 +75,15 @@
|
||||
* - Added ec_domain_state_t and #ec_wc_state_t for a new output parameter
|
||||
* of ecrt_domain_state(). The domain state object does now contain
|
||||
* information, if the process data was exchanged completely.
|
||||
* - Former "Pdo registration" meant Pdo entry registration in fact, therefore
|
||||
* - Former "PDO registration" meant PDO entry registration in fact, therefore
|
||||
* renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo()
|
||||
* to ecrt_slave_config_reg_pdo_entry().
|
||||
* - Removed ecrt_domain_register_pdo_range(), because it's functionality can
|
||||
* be reached by specifying an explicit Pdo assignment/mapping and
|
||||
* registering the mapped Pdo entries.
|
||||
* - Added an Sdo access interface, working with Sdo requests. These can be
|
||||
* be reached by specifying an explicit PDO assignment/mapping and
|
||||
* registering the mapped PDO entries.
|
||||
* - Added an SDO access interface, working with SDO requests. These can be
|
||||
* scheduled for reading and writing during realtime operation.
|
||||
* - Exported ecrt_slave_config_sdo(), the generic Sdo configuration function.
|
||||
* - Exported ecrt_slave_config_sdo(), the generic SDO configuration function.
|
||||
* - Removed the bus_state and bus_tainted flags from ec_master_state_t.
|
||||
*
|
||||
* @{
|
||||
@@ -223,7 +223,7 @@ typedef struct {
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Direction type for Pdo assignment functions.
|
||||
/** Direction type for PDO assignment functions.
|
||||
*/
|
||||
typedef enum {
|
||||
EC_DIR_INVALID, /**< Invalid direction. Do not use this value. */
|
||||
@@ -234,33 +234,33 @@ typedef enum {
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo entry configuration information.
|
||||
/** PDO entry configuration information.
|
||||
*
|
||||
* This is the data type of the \a entries field in ec_pdo_info_t.
|
||||
*
|
||||
* \see ecrt_slave_config_pdos().
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t index; /**< Pdo entry index. */
|
||||
uint8_t subindex; /**< Pdo entry subindex. */
|
||||
uint8_t bit_length; /**< Size of the Pdo entry in bit. */
|
||||
uint16_t index; /**< PDO entry index. */
|
||||
uint8_t subindex; /**< PDO entry subindex. */
|
||||
uint8_t bit_length; /**< Size of the PDO entry in bit. */
|
||||
} ec_pdo_entry_info_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo configuration information.
|
||||
/** PDO configuration information.
|
||||
*
|
||||
* This is the data type of the \a pdos field in ec_sync_info_t.
|
||||
*
|
||||
* \see ecrt_slave_config_pdos().
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t index; /**< Pdo index. */
|
||||
unsigned int n_entries; /**< Number of Pdo entries in \a entries to map.
|
||||
uint16_t index; /**< PDO index. */
|
||||
unsigned int n_entries; /**< Number of PDO entries in \a entries to map.
|
||||
Zero means, that the default mapping shall be
|
||||
used (this can only be done if the slave is
|
||||
present at bus configuration time). */
|
||||
ec_pdo_entry_info_t *entries; /**< Array of Pdo entries to map. Can either
|
||||
ec_pdo_entry_info_t *entries; /**< Array of PDO entries to map. Can either
|
||||
be \a NULL, or must contain at
|
||||
least \a n_entries values. */
|
||||
} ec_pdo_info_t;
|
||||
@@ -269,8 +269,8 @@ typedef struct {
|
||||
|
||||
/** Sync manager configuration information.
|
||||
*
|
||||
* This can be use to configure multiple sync managers including the Pdo
|
||||
* assignment and Pdo mapping. It is used as an input parameter type in
|
||||
* This can be use to configure multiple sync managers including the PDO
|
||||
* assignment and PDO mapping. It is used as an input parameter type in
|
||||
* ecrt_slave_config_pdos().
|
||||
*/
|
||||
typedef struct {
|
||||
@@ -278,14 +278,14 @@ typedef struct {
|
||||
than #EC_MAX_SYNC_MANAGERS for a valid sync manager,
|
||||
but can also be \a 0xff to mark the end of the list. */
|
||||
ec_direction_t dir; /**< Sync manager direction. */
|
||||
unsigned int n_pdos; /**< Number of Pdos in \a pdos. */
|
||||
ec_pdo_info_t *pdos; /**< Array with Pdos to assign. This must contain
|
||||
at least \a n_pdos Pdos. */
|
||||
unsigned int n_pdos; /**< Number of PDOs in \a pdos. */
|
||||
ec_pdo_info_t *pdos; /**< Array with PDOs to assign. This must contain
|
||||
at least \a n_pdos PDOs. */
|
||||
} ec_sync_info_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** List record type for Pdo entry mass-registration.
|
||||
/** List record type for PDO entry mass-registration.
|
||||
*
|
||||
* This type is used for the array parameter of the
|
||||
* ecrt_domain_reg_pdo_entry_list()
|
||||
@@ -295,14 +295,14 @@ typedef struct {
|
||||
uint16_t position; /**< Slave position. */
|
||||
uint32_t vendor_id; /**< Slave vendor ID. */
|
||||
uint32_t product_code; /**< Slave product code. */
|
||||
uint16_t index; /**< Pdo entry index. */
|
||||
uint8_t subindex; /**< Pdo entry subindex. */
|
||||
unsigned int *offset; /**< Pointer to a variable to store the Pdo entry's
|
||||
uint16_t index; /**< PDO entry index. */
|
||||
uint8_t subindex; /**< PDO entry subindex. */
|
||||
unsigned int *offset; /**< Pointer to a variable to store the PDO entry's
|
||||
(byte-)offset in the process data. */
|
||||
unsigned int *bit_position; /**< Pointer to a variable to store a bit
|
||||
position (0-7) within the \a offset. Can be
|
||||
NULL, in which case an error is raised if the
|
||||
Pdo entry does not byte-align. */
|
||||
PDO entry does not byte-align. */
|
||||
} ec_pdo_entry_reg_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -389,7 +389,7 @@ void ecrt_master_callbacks(
|
||||
*
|
||||
* For process data exchange, at least one process data domain is needed.
|
||||
* This method creates a new process data domain and returns a pointer to the
|
||||
* new domain object. This object can be used for registering Pdos and
|
||||
* new domain object. This object can be used for registering PDOs and
|
||||
* exchanging them in cyclic operation.
|
||||
*
|
||||
* \return Pointer to the new domain on success, else NULL.
|
||||
@@ -506,7 +506,7 @@ int ecrt_slave_config_sync_manager(
|
||||
ec_direction_t dir /**< Input/Output. */
|
||||
);
|
||||
|
||||
/** Add a Pdo to a sync manager's Pdo assignment.
|
||||
/** Add a PDO to a sync manager's PDO assignment.
|
||||
*
|
||||
* \see ecrt_slave_config_pdos()
|
||||
* \return zero on success, else non-zero
|
||||
@@ -515,12 +515,12 @@ int ecrt_slave_config_pdo_assign_add(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint8_t sync_index, /**< Sync manager index. Must be less
|
||||
than #EC_MAX_SYNC_MANAGERS. */
|
||||
uint16_t index /**< Index of the Pdo to assign. */
|
||||
uint16_t index /**< Index of the PDO to assign. */
|
||||
);
|
||||
|
||||
/** Clear a sync manager's Pdo assignment.
|
||||
/** Clear a sync manager's PDO assignment.
|
||||
*
|
||||
* This can be called before assigning Pdos via
|
||||
* This can be called before assigning PDOs via
|
||||
* ecrt_slave_config_pdo_assign_add(), to clear the default assignment of a
|
||||
* sync manager.
|
||||
*
|
||||
@@ -532,34 +532,34 @@ void ecrt_slave_config_pdo_assign_clear(
|
||||
than #EC_MAX_SYNC_MANAGERS. */
|
||||
);
|
||||
|
||||
/** Add a Pdo entry to the given Pdo's mapping.
|
||||
/** Add a PDO entry to the given PDO's mapping.
|
||||
*
|
||||
* \see ecrt_slave_config_pdos()
|
||||
* \return zero on success, else non-zero
|
||||
*/
|
||||
int ecrt_slave_config_pdo_mapping_add(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint16_t pdo_index, /**< Index of the Pdo. */
|
||||
uint16_t entry_index, /**< Index of the Pdo entry to add to the Pdo's
|
||||
uint16_t pdo_index, /**< Index of the PDO. */
|
||||
uint16_t entry_index, /**< Index of the PDO entry to add to the PDO's
|
||||
mapping. */
|
||||
uint8_t entry_subindex, /**< Subindex of the Pdo entry to add to the
|
||||
Pdo's mapping. */
|
||||
uint8_t entry_bit_length /**< Size of the Pdo entry in bit. */
|
||||
uint8_t entry_subindex, /**< Subindex of the PDO entry to add to the
|
||||
PDO's mapping. */
|
||||
uint8_t entry_bit_length /**< Size of the PDO entry in bit. */
|
||||
);
|
||||
|
||||
/** Clear the mapping of a given Pdo.
|
||||
/** Clear the mapping of a given PDO.
|
||||
*
|
||||
* This can be called before mapping Pdo entries via
|
||||
* This can be called before mapping PDO entries via
|
||||
* ecrt_slave_config_pdo_mapping_add(), to clear the default mapping.
|
||||
*
|
||||
* \see ecrt_slave_config_pdos()
|
||||
*/
|
||||
void ecrt_slave_config_pdo_mapping_clear(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint16_t pdo_index /**< Index of the Pdo. */
|
||||
uint16_t pdo_index /**< Index of the PDO. */
|
||||
);
|
||||
|
||||
/** Specify a complete Pdo configuration.
|
||||
/** Specify a complete PDO configuration.
|
||||
*
|
||||
* This function is a convenience wrapper for the functions
|
||||
* ecrt_slave_config_sync_manager(), ecrt_slave_config_pdo_assign_clear(),
|
||||
@@ -568,7 +568,7 @@ void ecrt_slave_config_pdo_mapping_clear(
|
||||
* automatic code generation.
|
||||
*
|
||||
* The following example shows, how to specify a complete configuration,
|
||||
* including the Pdo mappings. With this information, the master is able to
|
||||
* including the PDO mappings. With this information, the master is able to
|
||||
* reserve the complete process data, even if the slave is not present at
|
||||
* configuration time:
|
||||
*
|
||||
@@ -599,9 +599,9 @@ void ecrt_slave_config_pdo_mapping_clear(
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* The next example shows, how to configure the Pdo assignment only. The
|
||||
* entries for each assigned Pdo are taken from the Pdo's default mapping.
|
||||
* Please note, that Pdo entry registration will fail, if the Pdo
|
||||
* The next example shows, how to configure the PDO assignment only. The
|
||||
* entries for each assigned PDO are taken from the PDO's default mapping.
|
||||
* Please note, that PDO entry registration will fail, if the PDO
|
||||
* configuration is left empty and the slave is offline.
|
||||
*
|
||||
* \code
|
||||
@@ -635,44 +635,44 @@ int ecrt_slave_config_pdos(
|
||||
configurations. */
|
||||
);
|
||||
|
||||
/** Registers a Pdo entry for process data exchange in a domain.
|
||||
/** Registers a PDO entry for process data exchange in a domain.
|
||||
*
|
||||
* Searches the assigned Pdos for the given Pdo entry. An error is raised, if
|
||||
* Searches the assigned PDOs for the given PDO entry. An error is raised, if
|
||||
* the given entry is not mapped. Otherwise, the corresponding sync manager
|
||||
* and FMMU configurations are provided for slave configuration and the
|
||||
* respective sync manager's assigned Pdos are appended to the given domain,
|
||||
* if not already done. The offset of the requested Pdo entry's data inside
|
||||
* the domain's process data is returned. Optionally, the Pdo entry bit
|
||||
* respective sync manager's assigned PDOs are appended to the given domain,
|
||||
* if not already done. The offset of the requested PDO entry's data inside
|
||||
* the domain's process data is returned. Optionally, the PDO entry bit
|
||||
* position (0-7) can be retrieved via the \a bit_position output parameter.
|
||||
* This pointer may be \a NULL, in this case an error is raised if the Pdo
|
||||
* This pointer may be \a NULL, in this case an error is raised if the PDO
|
||||
* entry does not byte-align.
|
||||
*
|
||||
* \retval >=0 Success: Offset of the Pdo entry's process data.
|
||||
* \retval >=0 Success: Offset of the PDO entry's process data.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
int ecrt_slave_config_reg_pdo_entry(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint16_t entry_index, /**< Index of the Pdo entry to register. */
|
||||
uint8_t entry_subindex, /**< Subindex of the Pdo entry to register. */
|
||||
uint16_t entry_index, /**< Index of the PDO entry to register. */
|
||||
uint8_t entry_subindex, /**< Subindex of the PDO entry to register. */
|
||||
ec_domain_t *domain, /**< Domain. */
|
||||
unsigned int *bit_position /**< Optional address if bit addressing
|
||||
is desired */
|
||||
);
|
||||
|
||||
/** Add an Sdo configuration.
|
||||
/** Add an SDO configuration.
|
||||
*
|
||||
* An Sdo configuration is stored in the slave configuration object and is
|
||||
* An SDO configuration is stored in the slave configuration object and is
|
||||
* downloaded to the slave whenever the slave is being configured by the
|
||||
* master. This usually happens once on master activation, but can be repeated
|
||||
* subsequently, for example after the slave's power supply failed.
|
||||
*
|
||||
* \attention The Sdos for Pdo assignment (\p 0x1C10 - \p 0x1C2F) and Pdo
|
||||
* \attention The SDOs for PDO assignment (\p 0x1C10 - \p 0x1C2F) and PDO
|
||||
* mapping (\p 0x1600 - \p 0x17FF and \p 0x1A00 - \p 0x1BFF) should not be
|
||||
* configured with this function, because they are part of the slave
|
||||
* configuration done by the master. Please use ecrt_slave_config_pdos() and
|
||||
* friends instead.
|
||||
*
|
||||
* This is the generic function for adding an Sdo configuration. Please note
|
||||
* This is the generic function for adding an SDO configuration. Please note
|
||||
* that the this function does not do any endianess correction. If
|
||||
* datatype-specific functions are needed (that automatically correct the
|
||||
* endianess), have a look at ecrt_slave_config_sdo8(),
|
||||
@@ -683,8 +683,8 @@ int ecrt_slave_config_reg_pdo_entry(
|
||||
*/
|
||||
int ecrt_slave_config_sdo(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint16_t index, /**< Index of the Sdo to configure. */
|
||||
uint8_t subindex, /**< Subindex of the Sdo to configure. */
|
||||
uint16_t index, /**< Index of the SDO to configure. */
|
||||
uint8_t subindex, /**< Subindex of the SDO to configure. */
|
||||
const uint8_t *data, /**< Pointer to the data. */
|
||||
size_t size /**< Size of the \a data. */
|
||||
);
|
||||
@@ -731,15 +731,15 @@ int ecrt_slave_config_sdo32(
|
||||
uint32_t value /**< Value to set. */
|
||||
);
|
||||
|
||||
/** Create an Sdo request to exchange Sdos during realtime operation.
|
||||
/** Create an SDO request to exchange SDOs during realtime operation.
|
||||
*
|
||||
* The created Sdo request object is freed automatically when the master is
|
||||
* The created SDO request object is freed automatically when the master is
|
||||
* released.
|
||||
*/
|
||||
ec_sdo_request_t *ecrt_slave_config_create_sdo_request(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint16_t index, /**< Sdo index. */
|
||||
uint8_t subindex, /**< Sdo subindex. */
|
||||
uint16_t index, /**< SDO index. */
|
||||
uint8_t subindex, /**< SDO subindex. */
|
||||
size_t size /**< Data size to reserve. */
|
||||
);
|
||||
|
||||
@@ -771,7 +771,7 @@ void ecrt_slave_config_state(
|
||||
* Domain methods
|
||||
*****************************************************************************/
|
||||
|
||||
/** Registers a bunch of Pdo entries for a domain.
|
||||
/** Registers a bunch of PDO entries for a domain.
|
||||
*
|
||||
* \todo doc
|
||||
* \attention The registration array has to be terminated with an empty
|
||||
@@ -780,7 +780,7 @@ void ecrt_slave_config_state(
|
||||
*/
|
||||
int ecrt_domain_reg_pdo_entry_list(
|
||||
ec_domain_t *domain, /**< Domain. */
|
||||
const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of Pdo
|
||||
const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of PDO
|
||||
registrations. */
|
||||
);
|
||||
|
||||
@@ -796,11 +796,11 @@ size_t ecrt_domain_size(
|
||||
|
||||
/** Provide external memory to store the domain's process data.
|
||||
*
|
||||
* Call this after all Pdo entries have been registered and before activating
|
||||
* Call this after all PDO entries have been registered and before activating
|
||||
* the master.
|
||||
*
|
||||
* The size of the allocated memory must be at least ecrt_domain_size(), after
|
||||
* all Pdo entries have been registered.
|
||||
* all PDO entries have been registered.
|
||||
*/
|
||||
void ecrt_domain_external_memory(
|
||||
ec_domain_t *domain, /**< Domain. */
|
||||
@@ -858,10 +858,10 @@ void ecrt_domain_state(
|
||||
);
|
||||
|
||||
/*****************************************************************************
|
||||
* Sdo request methods.
|
||||
* SDO request methods.
|
||||
****************************************************************************/
|
||||
|
||||
/** Set the timeout for an Sdo request.
|
||||
/** Set the timeout for an SDO request.
|
||||
*
|
||||
* If the request cannot be processed in the specified time, if will be marked
|
||||
* as failed.
|
||||
@@ -870,14 +870,14 @@ void ecrt_domain_state(
|
||||
* the next call of this method.
|
||||
*/
|
||||
void ecrt_sdo_request_timeout(
|
||||
ec_sdo_request_t *req, /**< Sdo request. */
|
||||
ec_sdo_request_t *req, /**< SDO request. */
|
||||
uint32_t timeout /**< Timeout in milliseconds. Zero means no
|
||||
timeout. */
|
||||
);
|
||||
|
||||
/** Access to the Sdo request's data.
|
||||
/** Access to the SDO request's data.
|
||||
*
|
||||
* This function returns a pointer to the request's internal Sdo data memory.
|
||||
* This function returns a pointer to the request's internal SDO data memory.
|
||||
*
|
||||
* - After a read operation was successful, integer data can be evaluated using
|
||||
* the EC_READ_*() macros as usual. Example:
|
||||
@@ -893,45 +893,45 @@ void ecrt_sdo_request_timeout(
|
||||
* \endcode
|
||||
*
|
||||
* \attention The return value can be invalid during a read operation, because
|
||||
* the internal Sdo data memory could be re-allocated if the read Sdo data do
|
||||
* the internal SDO data memory could be re-allocated if the read SDO data do
|
||||
* not fit inside.
|
||||
*
|
||||
* \return Pointer to the internal Sdo data memory.
|
||||
* \return Pointer to the internal SDO data memory.
|
||||
*/
|
||||
uint8_t *ecrt_sdo_request_data(
|
||||
ec_sdo_request_t *req /**< Sdo request. */
|
||||
ec_sdo_request_t *req /**< SDO request. */
|
||||
);
|
||||
|
||||
/** Returns the current Sdo data size.
|
||||
/** Returns the current SDO data size.
|
||||
*
|
||||
* When the Sdo request is created, the data size is set to the size of the
|
||||
* When the SDO request is created, the data size is set to the size of the
|
||||
* reserved memory. After a read operation the size is set to the size of the
|
||||
* read data. The size is not modified in any other situation.
|
||||
*
|
||||
* \return Sdo data size in bytes.
|
||||
* \return SDO data size in bytes.
|
||||
*/
|
||||
size_t ecrt_sdo_request_data_size(
|
||||
const ec_sdo_request_t *req /**< Sdo request. */
|
||||
const ec_sdo_request_t *req /**< SDO request. */
|
||||
);
|
||||
|
||||
/** Get the current state of the Sdo request.
|
||||
/** Get the current state of the SDO request.
|
||||
*
|
||||
* \return Request state.
|
||||
*/
|
||||
ec_request_state_t ecrt_sdo_request_state(
|
||||
const ec_sdo_request_t *req /**< Sdo request. */
|
||||
const ec_sdo_request_t *req /**< SDO request. */
|
||||
);
|
||||
|
||||
/** Schedule an Sdo write operation.
|
||||
/** Schedule an SDO write operation.
|
||||
*
|
||||
* \attention This method may not be called while ecrt_sdo_request_state()
|
||||
* returns EC_SDO_REQUEST_BUSY.
|
||||
*/
|
||||
void ecrt_sdo_request_write(
|
||||
ec_sdo_request_t *req /**< Sdo request. */
|
||||
ec_sdo_request_t *req /**< SDO request. */
|
||||
);
|
||||
|
||||
/** Schedule an Sdo read operation.
|
||||
/** Schedule an SDO read operation.
|
||||
*
|
||||
* \attention This method may not be called while ecrt_sdo_request_state()
|
||||
* returns EC_SDO_REQUEST_BUSY.
|
||||
@@ -941,7 +941,7 @@ void ecrt_sdo_request_write(
|
||||
* ecrt_sdo_request_state() returns EC_SDO_REQUEST_BUSY.
|
||||
*/
|
||||
void ecrt_sdo_request_read(
|
||||
ec_sdo_request_t *req /**< Sdo request. */
|
||||
ec_sdo_request_t *req /**< SDO request. */
|
||||
);
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
@@ -73,7 +73,7 @@ int ecrt_slave_config_pdo_assign_add(ec_slave_config_t *sc,
|
||||
data.index = pdo_index;
|
||||
|
||||
if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_PDO, &data) == -1) {
|
||||
fprintf(stderr, "Failed to add Pdo: %s\n",
|
||||
fprintf(stderr, "Failed to add PDO: %s\n",
|
||||
strerror(errno));
|
||||
return -1; // FIXME
|
||||
}
|
||||
@@ -92,7 +92,7 @@ void ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc,
|
||||
data.sync_index = sync_index;
|
||||
|
||||
if (ioctl(sc->master->fd, EC_IOCTL_SC_CLEAR_PDOS, &data) == -1) {
|
||||
fprintf(stderr, "Failed to clear Pdos: %s\n",
|
||||
fprintf(stderr, "Failed to clear PDOs: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc,
|
||||
data.entry_bit_length = entry_bit_length;
|
||||
|
||||
if (ioctl(sc->master->fd, EC_IOCTL_SC_ADD_ENTRY, &data) == -1) {
|
||||
fprintf(stderr, "Failed to add Pdo entry: %s\n",
|
||||
fprintf(stderr, "Failed to add PDO entry: %s\n",
|
||||
strerror(errno));
|
||||
return -1; // FIXME
|
||||
}
|
||||
@@ -131,7 +131,7 @@ void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc,
|
||||
data.index = pdo_index;
|
||||
|
||||
if (ioctl(sc->master->fd, EC_IOCTL_SC_CLEAR_ENTRIES, &data) == -1) {
|
||||
fprintf(stderr, "Failed to clear Pdo entries: %s\n",
|
||||
fprintf(stderr, "Failed to clear PDO entries: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
@@ -219,7 +219,7 @@ int ecrt_slave_config_reg_pdo_entry(
|
||||
|
||||
ret = ioctl(sc->master->fd, EC_IOCTL_SC_REG_PDO_ENTRY, &data);
|
||||
if (ret == -1) {
|
||||
fprintf(stderr, "Failed to register Pdo entry: %s\n",
|
||||
fprintf(stderr, "Failed to register PDO entry: %s\n",
|
||||
strerror(errno));
|
||||
return -2; // FIXME
|
||||
}
|
||||
@@ -228,7 +228,7 @@ int ecrt_slave_config_reg_pdo_entry(
|
||||
*bit_position = data.bit_position;
|
||||
} else {
|
||||
if (data.bit_position) {
|
||||
fprintf(stderr, "Pdo entry 0x%04X:%02X does not byte-align "
|
||||
fprintf(stderr, "PDO entry 0x%04X:%02X does not byte-align "
|
||||
"in config %u:%u.\n", index, subindex,
|
||||
sc->alias, sc->position);
|
||||
return -3; // FIXME
|
||||
@@ -252,7 +252,7 @@ int ecrt_slave_config_sdo(ec_slave_config_t *sc, uint16_t index,
|
||||
data.size = size;
|
||||
|
||||
if (ioctl(sc->master->fd, EC_IOCTL_SC_REG_PDO_ENTRY, &data) == -1) {
|
||||
fprintf(stderr, "Failed to configure Sdo.\n");
|
||||
fprintf(stderr, "Failed to configure SDO.\n");
|
||||
return -1; // FIXME
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/** \file
|
||||
* Vendor-specific-over-EtherCAT protocol handler functions.
|
||||
* Vendor specific over EtherCAT protocol handler functions.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -306,7 +306,7 @@ int ec_cdev_ioctl_slave_sync(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get slave sync manager Pdo information.
|
||||
/** Get slave sync manager PDO information.
|
||||
*/
|
||||
int ec_cdev_ioctl_slave_sync_pdo(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -343,7 +343,7 @@ int ec_cdev_ioctl_slave_sync_pdo(
|
||||
if (!(pdo = ec_pdo_list_find_pdo_by_pos_const(
|
||||
&sync->pdos, data.pdo_pos))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Sync manager %u does not contain a Pdo with "
|
||||
EC_ERR("Sync manager %u does not contain a PDO with "
|
||||
"position %u in slave %u!\n", data.sync_index,
|
||||
data.pdo_pos, data.slave_position);
|
||||
return -EINVAL;
|
||||
@@ -363,7 +363,7 @@ int ec_cdev_ioctl_slave_sync_pdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get slave sync manager Pdo entry information.
|
||||
/** Get slave sync manager PDO entry information.
|
||||
*/
|
||||
int ec_cdev_ioctl_slave_sync_pdo_entry(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -401,7 +401,7 @@ int ec_cdev_ioctl_slave_sync_pdo_entry(
|
||||
if (!(pdo = ec_pdo_list_find_pdo_by_pos_const(
|
||||
&sync->pdos, data.pdo_pos))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Sync manager %u does not contain a Pdo with "
|
||||
EC_ERR("Sync manager %u does not contain a PDO with "
|
||||
"position %u in slave %u!\n", data.sync_index,
|
||||
data.pdo_pos, data.slave_position);
|
||||
return -EINVAL;
|
||||
@@ -410,7 +410,7 @@ int ec_cdev_ioctl_slave_sync_pdo_entry(
|
||||
if (!(entry = ec_pdo_find_entry_by_pos_const(
|
||||
pdo, data.entry_pos))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Pdo 0x%04X does not contain an entry with "
|
||||
EC_ERR("PDO 0x%04X does not contain an entry with "
|
||||
"position %u in slave %u!\n", data.pdo_pos,
|
||||
data.entry_pos, data.slave_position);
|
||||
return -EINVAL;
|
||||
@@ -604,7 +604,7 @@ int ec_cdev_ioctl_slave_state(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get slave Sdo information.
|
||||
/** Get slave SDO information.
|
||||
*/
|
||||
int ec_cdev_ioctl_slave_sdo(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -632,7 +632,7 @@ int ec_cdev_ioctl_slave_sdo(
|
||||
if (!(sdo = ec_slave_get_sdo_by_pos_const(
|
||||
slave, data.sdo_position))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Sdo %u does not exist in slave %u!\n",
|
||||
EC_ERR("SDO %u does not exist in slave %u!\n",
|
||||
data.sdo_position, data.slave_position);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -651,7 +651,7 @@ int ec_cdev_ioctl_slave_sdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get slave Sdo entry information.
|
||||
/** Get slave SDO entry information.
|
||||
*/
|
||||
int ec_cdev_ioctl_slave_sdo_entry(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -681,7 +681,7 @@ int ec_cdev_ioctl_slave_sdo_entry(
|
||||
if (!(sdo = ec_slave_get_sdo_by_pos_const(
|
||||
slave, -data.sdo_spec))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Sdo %u does not exist in slave %u!\n",
|
||||
EC_ERR("SDO %u does not exist in slave %u!\n",
|
||||
-data.sdo_spec, data.slave_position);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -689,7 +689,7 @@ int ec_cdev_ioctl_slave_sdo_entry(
|
||||
if (!(sdo = ec_slave_get_sdo_const(
|
||||
slave, data.sdo_spec))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Sdo 0x%04X does not exist in slave %u!\n",
|
||||
EC_ERR("SDO 0x%04X does not exist in slave %u!\n",
|
||||
data.sdo_spec, data.slave_position);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -698,7 +698,7 @@ int ec_cdev_ioctl_slave_sdo_entry(
|
||||
if (!(entry = ec_sdo_get_entry_const(
|
||||
sdo, data.sdo_entry_subindex))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Sdo entry 0x%04X:%02X does not exist "
|
||||
EC_ERR("SDO entry 0x%04X:%02X does not exist "
|
||||
"in slave %u!\n", sdo->index,
|
||||
data.sdo_entry_subindex, data.slave_position);
|
||||
return -EINVAL;
|
||||
@@ -718,7 +718,7 @@ int ec_cdev_ioctl_slave_sdo_entry(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Upload Sdo.
|
||||
/** Upload SDO.
|
||||
*/
|
||||
int ec_cdev_ioctl_slave_sdo_upload(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -803,7 +803,7 @@ int ec_cdev_ioctl_slave_sdo_upload(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Download Sdo.
|
||||
/** Download SDO.
|
||||
*/
|
||||
int ec_cdev_ioctl_slave_sdo_download(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1219,7 +1219,7 @@ int ec_cdev_ioctl_config(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get slave configuration Pdo information.
|
||||
/** Get slave configuration PDO information.
|
||||
*/
|
||||
int ec_cdev_ioctl_config_pdo(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1255,7 +1255,7 @@ int ec_cdev_ioctl_config_pdo(
|
||||
&sc->sync_configs[data.sync_index].pdos,
|
||||
data.pdo_pos))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Invalid Pdo position!\n");
|
||||
EC_ERR("Invalid PDO position!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1273,7 +1273,7 @@ int ec_cdev_ioctl_config_pdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get slave configuration Pdo entry information.
|
||||
/** Get slave configuration PDO entry information.
|
||||
*/
|
||||
int ec_cdev_ioctl_config_pdo_entry(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1310,7 +1310,7 @@ int ec_cdev_ioctl_config_pdo_entry(
|
||||
&sc->sync_configs[data.sync_index].pdos,
|
||||
data.pdo_pos))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Invalid Pdo position!\n");
|
||||
EC_ERR("Invalid PDO position!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1336,7 +1336,7 @@ int ec_cdev_ioctl_config_pdo_entry(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get slave configuration Sdo information.
|
||||
/** Get slave configuration SDO information.
|
||||
*/
|
||||
int ec_cdev_ioctl_config_sdo(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1365,7 +1365,7 @@ int ec_cdev_ioctl_config_sdo(
|
||||
if (!(req = ec_slave_config_get_sdo_by_pos_const(
|
||||
sc, data.sdo_pos))) {
|
||||
up(&master->master_sem);
|
||||
EC_ERR("Invalid Sdo position!\n");
|
||||
EC_ERR("Invalid SDO position!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1642,7 +1642,7 @@ out_return:
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Add a Pdo to the assignment.
|
||||
/** Add a PDO to the assignment.
|
||||
*/
|
||||
int ec_cdev_ioctl_sc_add_pdo(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1674,7 +1674,7 @@ int ec_cdev_ioctl_sc_add_pdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Clears the Pdo assignment.
|
||||
/** Clears the PDO assignment.
|
||||
*/
|
||||
int ec_cdev_ioctl_sc_clear_pdos(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1707,7 +1707,7 @@ int ec_cdev_ioctl_sc_clear_pdos(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Add an entry to a Pdo's mapping.
|
||||
/** Add an entry to a PDO's mapping.
|
||||
*/
|
||||
int ec_cdev_ioctl_sc_add_entry(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1740,7 +1740,7 @@ int ec_cdev_ioctl_sc_add_entry(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Clears the mapping of a Pdo.
|
||||
/** Clears the mapping of a PDO.
|
||||
*/
|
||||
int ec_cdev_ioctl_sc_clear_entries(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1773,7 +1773,7 @@ int ec_cdev_ioctl_sc_clear_entries(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Registers a Pdo entry.
|
||||
/** Registers a PDO entry.
|
||||
*/
|
||||
int ec_cdev_ioctl_sc_reg_pdo_entry(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
@@ -1818,7 +1818,7 @@ int ec_cdev_ioctl_sc_reg_pdo_entry(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Configures an Sdo.
|
||||
/** Configures an SDO.
|
||||
*/
|
||||
int ec_cdev_ioctl_sc_sdo(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
Ethernet-over-EtherCAT (EoE).
|
||||
Ethernet over EtherCAT (EoE).
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
Ethernet-over-EtherCAT (EoE)
|
||||
Ethernet over EtherCAT (EoE)
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -56,7 +56,7 @@ ec_eoe_frame_t;
|
||||
typedef struct ec_eoe ec_eoe_t; /**< \see ec_eoe */
|
||||
|
||||
/**
|
||||
Ethernet-over-EtherCAT (EoE) handler.
|
||||
Ethernet over EtherCAT (EoE) handler.
|
||||
The master creates one of these objects for each slave that supports the
|
||||
EoE protocol.
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
/** FMMU configuration constructor.
|
||||
*
|
||||
* Inits an FMMU configuration, sets the logical start address and adds the
|
||||
* process data size for the mapped Pdos of the given direction to the domain
|
||||
* process data size for the mapped PDOs of the given direction to the domain
|
||||
* data size.
|
||||
*/
|
||||
void ec_fmmu_config_init(
|
||||
@@ -49,7 +49,7 @@ void ec_fmmu_config_init(
|
||||
ec_slave_config_t *sc, /**< EtherCAT slave configuration. */
|
||||
ec_domain_t *domain, /**< EtherCAT domain. */
|
||||
uint8_t sync_index, /**< Sync manager index to use. */
|
||||
ec_direction_t dir /**< Pdo direction. */
|
||||
ec_direction_t dir /**< PDO direction. */
|
||||
)
|
||||
{
|
||||
INIT_LIST_HEAD(&fmmu->list);
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct {
|
||||
uint8_t sync_index; /**< Index of sync manager to use. */
|
||||
ec_direction_t dir; /**< FMMU direction. */
|
||||
uint32_t logical_start_address; /**< Logical start address. */
|
||||
unsigned int data_size; /**< Covered Pdo size. */
|
||||
unsigned int data_size; /**< Covered PDO size. */
|
||||
} ec_fmmu_config_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
206
master/fsm_coe.c
206
master/fsm_coe.c
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@
|
||||
|
||||
typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */
|
||||
|
||||
/** Finite state machines for the CANopen-over-EtherCAT protocol.
|
||||
/** Finite state machines for the CANopen over EtherCAT protocol.
|
||||
*/
|
||||
struct ec_fsm_coe {
|
||||
ec_slave_t *slave; /**< slave the FSM runs on */
|
||||
@@ -53,9 +53,9 @@ struct ec_fsm_coe {
|
||||
|
||||
void (*state)(ec_fsm_coe_t *); /**< CoE state function */
|
||||
unsigned long jiffies_start; /**< CoE timestamp. */
|
||||
ec_sdo_t *sdo; /**< current Sdo */
|
||||
ec_sdo_t *sdo; /**< current SDO */
|
||||
uint8_t subindex; /**< current subindex */
|
||||
ec_sdo_request_t *request; /**< Sdo request */
|
||||
ec_sdo_request_t *request; /**< SDO request */
|
||||
uint8_t toggle; /**< toggle bit for segment commands */
|
||||
};
|
||||
|
||||
|
||||
@@ -374,9 +374,9 @@ int ec_fsm_master_action_process_phy(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Check for pending Sdo requests and process one.
|
||||
/** Check for pending SDO requests and process one.
|
||||
*
|
||||
* \return non-zero, if an Sdo request is processed.
|
||||
* \return non-zero, if an SDO request is processed.
|
||||
*/
|
||||
int ec_fsm_master_action_process_sdo(
|
||||
ec_fsm_master_t *fsm /**< Master state machine. */
|
||||
@@ -399,7 +399,7 @@ int ec_fsm_master_action_process_sdo(
|
||||
if (ec_sdo_request_timed_out(req)) {
|
||||
req->state = EC_INT_REQUEST_FAILURE;
|
||||
if (master->debug_level)
|
||||
EC_DBG("Sdo request for slave %u timed out...\n",
|
||||
EC_DBG("SDO request for slave %u timed out...\n",
|
||||
slave->ring_position);
|
||||
continue;
|
||||
}
|
||||
@@ -411,7 +411,7 @@ int ec_fsm_master_action_process_sdo(
|
||||
|
||||
req->state = EC_INT_REQUEST_BUSY;
|
||||
if (master->debug_level)
|
||||
EC_DBG("Processing Sdo request for slave %u...\n",
|
||||
EC_DBG("Processing SDO request for slave %u...\n",
|
||||
slave->ring_position);
|
||||
|
||||
fsm->idle = 0;
|
||||
@@ -438,19 +438,19 @@ int ec_fsm_master_action_process_sdo(
|
||||
|
||||
slave = request->slave;
|
||||
if (slave->current_state == EC_SLAVE_STATE_INIT) {
|
||||
EC_ERR("Discarding Sdo request, slave %u is in INIT.\n",
|
||||
EC_ERR("Discarding SDO request, slave %u is in INIT.\n",
|
||||
slave->ring_position);
|
||||
request->req.state = EC_INT_REQUEST_FAILURE;
|
||||
wake_up(&master->sdo_queue);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Found pending Sdo request. Execute it!
|
||||
// Found pending SDO request. Execute it!
|
||||
if (master->debug_level)
|
||||
EC_DBG("Processing Sdo request for slave %u...\n",
|
||||
EC_DBG("Processing SDO request for slave %u...\n",
|
||||
slave->ring_position);
|
||||
|
||||
// Start uploading Sdo
|
||||
// Start uploading SDO
|
||||
fsm->idle = 0;
|
||||
fsm->sdo_request = &request->req;
|
||||
fsm->slave = slave;
|
||||
@@ -476,11 +476,11 @@ void ec_fsm_master_action_idle(
|
||||
ec_master_t *master = fsm->master;
|
||||
ec_slave_t *slave;
|
||||
|
||||
// Check for pending Sdo requests
|
||||
// Check for pending SDO requests
|
||||
if (ec_fsm_master_action_process_sdo(fsm))
|
||||
return;
|
||||
|
||||
// check, if slaves have an Sdo dictionary to read out.
|
||||
// check, if slaves have an SDO dictionary to read out.
|
||||
for (slave = master->slaves;
|
||||
slave < master->slaves + master->slave_count;
|
||||
slave++) {
|
||||
@@ -494,13 +494,13 @@ void ec_fsm_master_action_idle(
|
||||
) continue;
|
||||
|
||||
if (master->debug_level) {
|
||||
EC_DBG("Fetching Sdo dictionary from slave %u.\n",
|
||||
EC_DBG("Fetching SDO dictionary from slave %u.\n",
|
||||
slave->ring_position);
|
||||
}
|
||||
|
||||
slave->sdo_dictionary_fetched = 1;
|
||||
|
||||
// start fetching Sdo dictionary
|
||||
// start fetching SDO dictionary
|
||||
fsm->idle = 0;
|
||||
fsm->slave = slave;
|
||||
fsm->state = ec_fsm_master_state_sdo_dictionary;
|
||||
@@ -869,12 +869,12 @@ void ec_fsm_master_state_sdo_dictionary(
|
||||
return;
|
||||
}
|
||||
|
||||
// Sdo dictionary fetching finished
|
||||
// SDO dictionary fetching finished
|
||||
|
||||
if (master->debug_level) {
|
||||
unsigned int sdo_count, entry_count;
|
||||
ec_slave_sdo_dict_info(slave, &sdo_count, &entry_count);
|
||||
EC_DBG("Fetched %u Sdos and %u entries from slave %u.\n",
|
||||
EC_DBG("Fetched %u SDOs and %u entries from slave %u.\n",
|
||||
sdo_count, entry_count, slave->ring_position);
|
||||
}
|
||||
|
||||
@@ -898,7 +898,7 @@ void ec_fsm_master_state_sdo_request(
|
||||
if (ec_fsm_coe_exec(&fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(&fsm->fsm_coe)) {
|
||||
EC_DBG("Failed to process Sdo request for slave %u.\n",
|
||||
EC_DBG("Failed to process SDO request for slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
request->state = EC_INT_REQUEST_FAILURE;
|
||||
wake_up(&master->sdo_queue);
|
||||
@@ -906,15 +906,15 @@ void ec_fsm_master_state_sdo_request(
|
||||
return;
|
||||
}
|
||||
|
||||
// Sdo request finished
|
||||
// SDO request finished
|
||||
request->state = EC_INT_REQUEST_SUCCESS;
|
||||
wake_up(&master->sdo_queue);
|
||||
|
||||
if (master->debug_level)
|
||||
EC_DBG("Finished Sdo request for slave %u.\n",
|
||||
EC_DBG("Finished SDO request for slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
|
||||
// check for another Sdo request
|
||||
// check for another SDO request
|
||||
if (ec_fsm_master_action_process_sdo(fsm))
|
||||
return; // processing another request
|
||||
|
||||
|
||||
@@ -70,12 +70,12 @@ typedef struct {
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Slave/Sdo request record for master's Sdo request list.
|
||||
/** Slave/SDO request record for master's SDO request list.
|
||||
*/
|
||||
typedef struct {
|
||||
struct list_head list; /**< List element. */
|
||||
ec_slave_t *slave; /**< Slave. */
|
||||
ec_sdo_request_t req; /**< Sdo request. */
|
||||
ec_sdo_request_t req; /**< SDO request. */
|
||||
} ec_master_sdo_request_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -98,11 +98,11 @@ struct ec_fsm_master {
|
||||
ec_slave_t *slave; /**< current slave */
|
||||
ec_sii_write_request_t *sii_request; /**< SII write request */
|
||||
off_t sii_index; /**< index to SII write request data */
|
||||
ec_sdo_request_t *sdo_request; /**< Sdo request to process. */
|
||||
ec_sdo_request_t *sdo_request; /**< SDO request to process. */
|
||||
ec_phy_request_t *phy_request; /**< Physical memory request to process. */
|
||||
|
||||
ec_fsm_coe_t fsm_coe; /**< CoE state machine */
|
||||
ec_fsm_pdo_t fsm_pdo; /**< Pdo configuration state machine. */
|
||||
ec_fsm_pdo_t fsm_pdo; /**< PDO configuration state machine. */
|
||||
ec_fsm_change_t fsm_change; /**< State change state machine */
|
||||
ec_fsm_slave_config_t fsm_slave_config; /**< slave state machine */
|
||||
ec_fsm_slave_scan_t fsm_slave_scan; /**< slave state machine */
|
||||
|
||||
182
master/fsm_pdo.c
182
master/fsm_pdo.c
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT Pdo configuration state machine structures.
|
||||
EtherCAT PDO configuration state machine structures.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -46,23 +46,23 @@
|
||||
*/
|
||||
typedef struct ec_fsm_pdo ec_fsm_pdo_t;
|
||||
|
||||
/** Pdo configuration state machine.
|
||||
/** PDO configuration state machine.
|
||||
*/
|
||||
struct ec_fsm_pdo
|
||||
{
|
||||
void (*state)(ec_fsm_pdo_t *); /**< State function. */
|
||||
ec_fsm_coe_t *fsm_coe; /**< CoE state machine to use. */
|
||||
ec_fsm_pdo_entry_t fsm_pdo_entry; /**< Pdo entry state machine. */
|
||||
ec_pdo_list_t pdos; /**< Pdo configuration. */
|
||||
ec_sdo_request_t request; /**< Sdo request. */
|
||||
ec_pdo_t slave_pdo; /**< Pdo actually appearing in a slave. */
|
||||
ec_fsm_pdo_entry_t fsm_pdo_entry; /**< PDO entry state machine. */
|
||||
ec_pdo_list_t pdos; /**< PDO configuration. */
|
||||
ec_sdo_request_t request; /**< SDO request. */
|
||||
ec_pdo_t slave_pdo; /**< PDO actually appearing in a slave. */
|
||||
|
||||
ec_slave_t *slave; /**< Slave the FSM runs on. */
|
||||
uint8_t sync_index; /**< Current sync manager index. */
|
||||
ec_sync_t *sync; /**< Current sync manager. */
|
||||
ec_pdo_t *pdo; /**< Current Pdo. */
|
||||
unsigned int pdo_pos; /**< Assignment position of current Pdos. */
|
||||
unsigned int pdo_count; /**< Number of assigned Pdos. */
|
||||
ec_pdo_t *pdo; /**< Current PDO. */
|
||||
unsigned int pdo_pos; /**< Assignment position of current PDOs. */
|
||||
unsigned int pdo_count; /**< Number of assigned PDOs. */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/** \file
|
||||
* EtherCAT Pdo mapping state machine.
|
||||
* EtherCAT PDO mapping state machine.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -60,7 +60,7 @@ void ec_fsm_pdo_entry_state_error(ec_fsm_pdo_entry_t *);
|
||||
/** Constructor.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_init(
|
||||
ec_fsm_pdo_entry_t *fsm, /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */
|
||||
ec_fsm_coe_t *fsm_coe /**< CoE state machine to use. */
|
||||
)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ void ec_fsm_pdo_entry_init(
|
||||
/** Destructor.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_clear(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
ec_sdo_request_clear(&fsm->request);
|
||||
@@ -81,12 +81,12 @@ void ec_fsm_pdo_entry_clear(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Start reading a Pdo's entries.
|
||||
/** Start reading a PDO's entries.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_start_reading(
|
||||
ec_fsm_pdo_entry_t *fsm, /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */
|
||||
ec_slave_t *slave, /**< slave to configure */
|
||||
ec_pdo_t *pdo /**< Pdo to read entries for. */
|
||||
ec_pdo_t *pdo /**< PDO to read entries for. */
|
||||
)
|
||||
{
|
||||
fsm->slave = slave;
|
||||
@@ -99,12 +99,12 @@ void ec_fsm_pdo_entry_start_reading(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Start Pdo mapping state machine.
|
||||
/** Start PDO mapping state machine.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_start_configuration(
|
||||
ec_fsm_pdo_entry_t *fsm, /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */
|
||||
ec_slave_t *slave, /**< slave to configure */
|
||||
const ec_pdo_t *pdo /**< Pdo with the desired entries. */
|
||||
const ec_pdo_t *pdo /**< PDO with the desired entries. */
|
||||
)
|
||||
{
|
||||
fsm->slave = slave;
|
||||
@@ -120,7 +120,7 @@ void ec_fsm_pdo_entry_start_configuration(
|
||||
* \return false, if state machine has terminated
|
||||
*/
|
||||
int ec_fsm_pdo_entry_running(
|
||||
const ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
const ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
return fsm->state != ec_fsm_pdo_entry_state_end
|
||||
@@ -134,7 +134,7 @@ int ec_fsm_pdo_entry_running(
|
||||
* \return false, if state machine has terminated
|
||||
*/
|
||||
int ec_fsm_pdo_entry_exec(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
fsm->state(fsm);
|
||||
@@ -148,7 +148,7 @@ int ec_fsm_pdo_entry_exec(
|
||||
* \return true, if the state machine terminated gracefully
|
||||
*/
|
||||
int ec_fsm_pdo_entry_success(
|
||||
const ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
const ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
return fsm->state == ec_fsm_pdo_entry_state_end;
|
||||
@@ -158,10 +158,10 @@ int ec_fsm_pdo_entry_success(
|
||||
* Reading state functions.
|
||||
*****************************************************************************/
|
||||
|
||||
/** Request reading the number of mapped Pdo entries.
|
||||
/** Request reading the number of mapped PDO entries.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_read_state_start(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
ec_sdo_request_address(&fsm->request, fsm->target_pdo->index, 0);
|
||||
@@ -174,7 +174,7 @@ void ec_fsm_pdo_entry_read_state_start(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Read number of mapped Pdo entries.
|
||||
/** Read number of mapped PDO entries.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_read_state_count(
|
||||
ec_fsm_pdo_entry_t *fsm /**< finite state machine */
|
||||
@@ -184,13 +184,13 @@ void ec_fsm_pdo_entry_read_state_count(
|
||||
return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to read number of mapped Pdo entries.\n");
|
||||
EC_ERR("Failed to read number of mapped PDO entries.\n");
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fsm->request.data_size != sizeof(uint8_t)) {
|
||||
EC_ERR("Invalid data size %u at uploading Sdo 0x%04X:%02X.\n",
|
||||
EC_ERR("Invalid data size %u at uploading SDO 0x%04X:%02X.\n",
|
||||
fsm->request.data_size, fsm->request.index,
|
||||
fsm->request.subindex);
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
@@ -200,16 +200,16 @@ void ec_fsm_pdo_entry_read_state_count(
|
||||
fsm->entry_count = EC_READ_U8(fsm->request.data);
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("%u Pdo entries mapped.\n", fsm->entry_count);
|
||||
EC_DBG("%u PDO entries mapped.\n", fsm->entry_count);
|
||||
|
||||
// read first Pdo entry
|
||||
// read first PDO entry
|
||||
fsm->entry_pos = 1;
|
||||
ec_fsm_pdo_entry_read_action_next(fsm);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Read next Pdo entry.
|
||||
/** Read next PDO entry.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_read_action_next(
|
||||
ec_fsm_pdo_entry_t *fsm /**< finite state machine */
|
||||
@@ -230,7 +230,7 @@ void ec_fsm_pdo_entry_read_action_next(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Read Pdo entry information.
|
||||
/** Read PDO entry information.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_read_state_entry(
|
||||
ec_fsm_pdo_entry_t *fsm /**< finite state machine */
|
||||
@@ -239,13 +239,13 @@ void ec_fsm_pdo_entry_read_state_entry(
|
||||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to read mapped Pdo entry.\n");
|
||||
EC_ERR("Failed to read mapped PDO entry.\n");
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fsm->request.data_size != sizeof(uint32_t)) {
|
||||
EC_ERR("Invalid data size %u at uploading Sdo 0x%04X:%02X.\n",
|
||||
EC_ERR("Invalid data size %u at uploading SDO 0x%04X:%02X.\n",
|
||||
fsm->request.data_size, fsm->request.index,
|
||||
fsm->request.subindex);
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
@@ -257,7 +257,7 @@ void ec_fsm_pdo_entry_read_state_entry(
|
||||
|
||||
if (!(pdo_entry = (ec_pdo_entry_t *)
|
||||
kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate Pdo entry.\n");
|
||||
EC_ERR("Failed to allocate PDO entry.\n");
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
return;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ void ec_fsm_pdo_entry_read_state_entry(
|
||||
}
|
||||
|
||||
if (fsm->slave->master->debug_level) {
|
||||
EC_DBG("Pdo entry 0x%04X:%02X, %u bit, \"%s\".\n",
|
||||
EC_DBG("PDO entry 0x%04X:%02X, %u bit, \"%s\".\n",
|
||||
pdo_entry->index, pdo_entry->subindex,
|
||||
pdo_entry->bit_length,
|
||||
pdo_entry->name ? pdo_entry->name : "???");
|
||||
@@ -285,7 +285,7 @@ void ec_fsm_pdo_entry_read_state_entry(
|
||||
|
||||
list_add_tail(&pdo_entry->list, &fsm->target_pdo->entries);
|
||||
|
||||
// next Pdo entry
|
||||
// next PDO entry
|
||||
fsm->entry_pos++;
|
||||
ec_fsm_pdo_entry_read_action_next(fsm);
|
||||
}
|
||||
@@ -295,17 +295,17 @@ void ec_fsm_pdo_entry_read_state_entry(
|
||||
* Configuration state functions.
|
||||
*****************************************************************************/
|
||||
|
||||
/** Start Pdo mapping.
|
||||
/** Start PDO mapping.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_conf_state_start(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
// Pdo mapping has to be changed. Does the slave support this?
|
||||
// PDO mapping has to be changed. Does the slave support this?
|
||||
if (!(fsm->slave->sii.mailbox_protocols & EC_MBOX_COE)
|
||||
|| (fsm->slave->sii.has_general
|
||||
&& !fsm->slave->sii.coe_details.enable_pdo_configuration)) {
|
||||
EC_WARN("Slave %u does not support changing the Pdo mapping!\n",
|
||||
EC_WARN("Slave %u does not support changing the PDO mapping!\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
return;
|
||||
@@ -316,7 +316,7 @@ void ec_fsm_pdo_entry_conf_state_start(
|
||||
return;
|
||||
}
|
||||
|
||||
// set mapped Pdo entry count to zero
|
||||
// set mapped PDO entry count to zero
|
||||
EC_WRITE_U8(fsm->request.data, 0);
|
||||
fsm->request.data_size = 1;
|
||||
ec_sdo_request_address(&fsm->request, fsm->source_pdo->index, 0);
|
||||
@@ -332,10 +332,10 @@ void ec_fsm_pdo_entry_conf_state_start(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Process next Pdo entry.
|
||||
/** Process next PDO entry.
|
||||
*/
|
||||
ec_pdo_entry_t *ec_fsm_pdo_entry_conf_next_entry(
|
||||
const ec_fsm_pdo_entry_t *fsm, /**< Pdo mapping state machine. */
|
||||
const ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */
|
||||
const struct list_head *list /**< current entry list item */
|
||||
)
|
||||
{
|
||||
@@ -350,14 +350,14 @@ ec_pdo_entry_t *ec_fsm_pdo_entry_conf_next_entry(
|
||||
/** Set the number of mapped entries to zero.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_conf_state_zero_entry_count(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
if (ec_fsm_coe_exec(fsm->fsm_coe))
|
||||
return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_WARN("Failed to clear Pdo mapping.\n");
|
||||
EC_WARN("Failed to clear PDO mapping.\n");
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
return;
|
||||
}
|
||||
@@ -380,16 +380,16 @@ void ec_fsm_pdo_entry_conf_state_zero_entry_count(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Starts to add a Pdo entry.
|
||||
/** Starts to add a PDO entry.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_conf_action_map(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
uint32_t value;
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Mapping Pdo entry 0x%04X:%02X (%u bit) at position %u.\n",
|
||||
EC_DBG("Mapping PDO entry 0x%04X:%02X (%u bit) at position %u.\n",
|
||||
fsm->entry->index, fsm->entry->subindex,
|
||||
fsm->entry->bit_length, fsm->entry_pos);
|
||||
|
||||
@@ -407,16 +407,16 @@ void ec_fsm_pdo_entry_conf_action_map(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Add a Pdo entry.
|
||||
/** Add a PDO entry.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_conf_state_map_entry(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_WARN("Failed to map Pdo entry 0x%04X:%02X (%u bit) to "
|
||||
EC_WARN("Failed to map PDO entry 0x%04X:%02X (%u bit) to "
|
||||
"position %u.\n", fsm->entry->index, fsm->entry->subindex,
|
||||
fsm->entry->bit_length, fsm->entry_pos);
|
||||
fsm->state = ec_fsm_pdo_entry_state_error;
|
||||
@@ -434,7 +434,7 @@ void ec_fsm_pdo_entry_conf_state_map_entry(
|
||||
ecrt_sdo_request_write(&fsm->request);
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Setting number of Pdo entries to %u.\n", fsm->entry_pos);
|
||||
EC_DBG("Setting number of PDO entries to %u.\n", fsm->entry_pos);
|
||||
|
||||
fsm->state = ec_fsm_pdo_entry_conf_state_set_entry_count;
|
||||
ec_fsm_coe_transfer(fsm->fsm_coe, fsm->slave, &fsm->request);
|
||||
@@ -452,7 +452,7 @@ void ec_fsm_pdo_entry_conf_state_map_entry(
|
||||
/** Set the number of entries.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_conf_state_set_entry_count(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
@@ -464,7 +464,7 @@ void ec_fsm_pdo_entry_conf_state_set_entry_count(
|
||||
}
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Successfully configured mapping for Pdo 0x%04X.\n",
|
||||
EC_DBG("Successfully configured mapping for PDO 0x%04X.\n",
|
||||
fsm->source_pdo->index);
|
||||
|
||||
fsm->state = ec_fsm_pdo_entry_state_end; // finished
|
||||
@@ -477,7 +477,7 @@ void ec_fsm_pdo_entry_conf_state_set_entry_count(
|
||||
/** State: ERROR.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_state_error(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
}
|
||||
@@ -487,7 +487,7 @@ void ec_fsm_pdo_entry_state_error(
|
||||
/** State: END.
|
||||
*/
|
||||
void ec_fsm_pdo_entry_state_end(
|
||||
ec_fsm_pdo_entry_t *fsm /**< Pdo mapping state machine. */
|
||||
ec_fsm_pdo_entry_t *fsm /**< PDO mapping state machine. */
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/** \file
|
||||
* EtherCAT Pdo entry configuration state machine structures.
|
||||
* EtherCAT PDO entry configuration state machine structures.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -44,20 +44,20 @@
|
||||
*/
|
||||
typedef struct ec_fsm_pdo_entry ec_fsm_pdo_entry_t;
|
||||
|
||||
/** Pdo configuration state machine.
|
||||
/** PDO configuration state machine.
|
||||
*/
|
||||
struct ec_fsm_pdo_entry
|
||||
{
|
||||
void (*state)(ec_fsm_pdo_entry_t *); /**< state function */
|
||||
ec_fsm_coe_t *fsm_coe; /**< CoE state machine to use */
|
||||
ec_sdo_request_t request; /**< Sdo request. */
|
||||
ec_sdo_request_t request; /**< SDO request. */
|
||||
|
||||
ec_slave_t *slave; /**< Slave the FSM runs on. */
|
||||
ec_pdo_t *target_pdo; /**< Pdo to read the mapping for. */
|
||||
const ec_pdo_t *source_pdo; /**< Pdo with desired mapping. */
|
||||
ec_pdo_t *target_pdo; /**< PDO to read the mapping for. */
|
||||
const ec_pdo_t *source_pdo; /**< PDO with desired mapping. */
|
||||
const ec_pdo_entry_t *entry; /**< Current entry. */
|
||||
unsigned int entry_count; /**< Number of entries. */
|
||||
unsigned int entry_pos; /**< Position in Pdo mapping. */
|
||||
unsigned int entry_pos; /**< Position in PDO mapping. */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -74,7 +74,7 @@ void ec_fsm_slave_config_init(
|
||||
ec_datagram_t *datagram, /**< datagram structure to use */
|
||||
ec_fsm_change_t *fsm_change, /**< State change state machine to use. */
|
||||
ec_fsm_coe_t *fsm_coe, /**< CoE state machine to use. */
|
||||
ec_fsm_pdo_t *fsm_pdo /**< Pdo configuration state machine to use. */
|
||||
ec_fsm_pdo_t *fsm_pdo /**< PDO configuration state machine to use. */
|
||||
)
|
||||
{
|
||||
ec_sdo_request_init(&fsm->request_copy);
|
||||
@@ -436,7 +436,7 @@ void ec_fsm_slave_config_state_preop(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Check for Sdo configurations to be applied.
|
||||
/** Check for SDO configurations to be applied.
|
||||
*/
|
||||
void ec_fsm_slave_config_enter_sdo_conf(
|
||||
ec_fsm_slave_config_t *fsm /**< slave state machine */
|
||||
@@ -445,12 +445,12 @@ void ec_fsm_slave_config_enter_sdo_conf(
|
||||
ec_slave_t *slave = fsm->slave;
|
||||
|
||||
// No CoE configuration to be applied?
|
||||
if (list_empty(&slave->config->sdo_configs)) { // skip Sdo configuration
|
||||
if (list_empty(&slave->config->sdo_configs)) { // skip SDO configuration
|
||||
ec_fsm_slave_config_enter_pdo_conf(fsm);
|
||||
return;
|
||||
}
|
||||
|
||||
// start Sdo configuration
|
||||
// start SDO configuration
|
||||
fsm->state = ec_fsm_slave_config_state_sdo_conf;
|
||||
fsm->request = list_entry(fsm->slave->config->sdo_configs.next,
|
||||
ec_sdo_request_t, list);
|
||||
@@ -471,7 +471,7 @@ void ec_fsm_slave_config_state_sdo_conf(
|
||||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Sdo configuration failed for slave %u.\n",
|
||||
EC_ERR("SDO configuration failed for slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->slave->error_flag = 1;
|
||||
fsm->state = ec_fsm_slave_config_state_error;
|
||||
@@ -483,7 +483,7 @@ void ec_fsm_slave_config_state_sdo_conf(
|
||||
return;
|
||||
}
|
||||
|
||||
// Another Sdo to configure?
|
||||
// Another SDO to configure?
|
||||
if (fsm->request->list.next != &fsm->slave->config->sdo_configs) {
|
||||
fsm->request = list_entry(fsm->request->list.next,
|
||||
ec_sdo_request_t, list);
|
||||
@@ -494,7 +494,7 @@ void ec_fsm_slave_config_state_sdo_conf(
|
||||
return;
|
||||
}
|
||||
|
||||
// All Sdos are now configured.
|
||||
// All SDOs are now configured.
|
||||
ec_fsm_slave_config_enter_pdo_conf(fsm);
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ void ec_fsm_slave_config_enter_pdo_conf(
|
||||
ec_fsm_slave_config_t *fsm /**< slave state machine */
|
||||
)
|
||||
{
|
||||
// Start configuring Pdos
|
||||
// Start configuring PDOs
|
||||
ec_fsm_pdo_start_configuration(fsm->fsm_pdo, fsm->slave);
|
||||
fsm->state = ec_fsm_slave_config_state_pdo_conf;
|
||||
fsm->state(fsm); // execute immediately
|
||||
@@ -529,7 +529,7 @@ void ec_fsm_slave_config_state_pdo_conf(
|
||||
}
|
||||
|
||||
if (!ec_fsm_pdo_success(fsm->fsm_pdo)) {
|
||||
EC_WARN("Pdo configuration failed on slave %u.\n",
|
||||
EC_WARN("PDO configuration failed on slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ void ec_fsm_slave_config_state_pdo_conf(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Check for Pdo sync managers to be configured.
|
||||
/** Check for PDO sync managers to be configured.
|
||||
*/
|
||||
void ec_fsm_slave_config_enter_pdo_sync(
|
||||
ec_fsm_slave_config_t *fsm /**< slave state machine */
|
||||
@@ -559,7 +559,7 @@ void ec_fsm_slave_config_enter_pdo_sync(
|
||||
}
|
||||
|
||||
if (slave->sii.sync_count <= offset) {
|
||||
// no Pdo sync managers to configure
|
||||
// no PDO sync managers to configure
|
||||
ec_fsm_slave_config_enter_fmmu(fsm);
|
||||
return;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ void ec_fsm_slave_config_enter_pdo_sync(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Configure Pdo sync managers.
|
||||
/** Configure PDO sync managers.
|
||||
*/
|
||||
void ec_fsm_slave_config_state_pdo_sync(
|
||||
ec_fsm_slave_config_t *fsm /**< slave state machine */
|
||||
@@ -661,7 +661,7 @@ void ec_fsm_slave_config_enter_fmmu(
|
||||
if (!(sync = ec_slave_get_sync(slave, fmmu->sync_index))) {
|
||||
slave->error_flag = 1;
|
||||
fsm->state = ec_fsm_slave_config_state_error;
|
||||
EC_ERR("Failed to determine Pdo sync manager for FMMU on slave"
|
||||
EC_ERR("Failed to determine PDO sync manager for FMMU on slave"
|
||||
" %u!\n", slave->ring_position);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,13 +53,13 @@ struct ec_fsm_slave_config
|
||||
ec_datagram_t *datagram; /**< Datagram used in the state machine. */
|
||||
ec_fsm_change_t *fsm_change; /**< State change state machine. */
|
||||
ec_fsm_coe_t *fsm_coe; /**< CoE state machine. */
|
||||
ec_fsm_pdo_t *fsm_pdo; /**< Pdo configuration state machine. */
|
||||
ec_fsm_pdo_t *fsm_pdo; /**< PDO configuration state machine. */
|
||||
|
||||
ec_slave_t *slave; /**< Slave the FSM runs on. */
|
||||
void (*state)(ec_fsm_slave_config_t *); /**< State function. */
|
||||
unsigned int retries; /**< Retries on datagram timeout. */
|
||||
ec_sdo_request_t *request; /**< Sdo request for Sdo configuration. */
|
||||
ec_sdo_request_t request_copy; /**< Copied Sdo request. */
|
||||
ec_sdo_request_t *request; /**< SDO request for SDO configuration. */
|
||||
ec_sdo_request_t request_copy; /**< Copied SDO request. */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -65,7 +65,7 @@ void ec_fsm_slave_scan_init(
|
||||
ec_datagram_t *datagram, /**< Datagram to use. */
|
||||
ec_fsm_slave_config_t *fsm_slave_config, /**< Slave configuration
|
||||
state machine to use. */
|
||||
ec_fsm_pdo_t *fsm_pdo /**< Pdo configuration machine to use. */
|
||||
ec_fsm_pdo_t *fsm_pdo /**< PDO configuration machine to use. */
|
||||
)
|
||||
{
|
||||
fsm->datagram = datagram;
|
||||
@@ -536,12 +536,12 @@ void ec_fsm_slave_scan_state_sii_data(ec_fsm_slave_scan_t *fsm /**< slave state
|
||||
break;
|
||||
case 0x0032:
|
||||
if (ec_slave_fetch_sii_pdos( slave, (uint8_t *) cat_word,
|
||||
cat_size * 2, EC_DIR_INPUT)) // TxPdo
|
||||
cat_size * 2, EC_DIR_INPUT)) // TxPDO
|
||||
goto end;
|
||||
break;
|
||||
case 0x0033:
|
||||
if (ec_slave_fetch_sii_pdos( slave, (uint8_t *) cat_word,
|
||||
cat_size * 2, EC_DIR_OUTPUT)) // RxPdo
|
||||
cat_size * 2, EC_DIR_OUTPUT)) // RxPDO
|
||||
goto end;
|
||||
break;
|
||||
default:
|
||||
@@ -625,7 +625,7 @@ void ec_fsm_slave_scan_enter_pdos(
|
||||
ec_slave_t *slave = fsm->slave;
|
||||
|
||||
if (slave->master->debug_level)
|
||||
EC_DBG("Scanning Pdo assignment and mapping of slave %u.\n",
|
||||
EC_DBG("Scanning PDO assignment and mapping of slave %u.\n",
|
||||
slave->ring_position);
|
||||
fsm->state = ec_fsm_slave_scan_state_pdos;
|
||||
ec_fsm_pdo_start_reading(fsm->fsm_pdo, slave);
|
||||
@@ -648,7 +648,7 @@ void ec_fsm_slave_scan_state_pdos(
|
||||
return;
|
||||
}
|
||||
|
||||
// reading Pdo configuration finished
|
||||
// reading PDO configuration finished
|
||||
fsm->state = ec_fsm_slave_scan_state_end;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ struct ec_fsm_slave_scan
|
||||
ec_datagram_t *datagram; /**< Datagram used in the state machine. */
|
||||
ec_fsm_slave_config_t *fsm_slave_config; /**< Slave configuration state
|
||||
machine to use. */
|
||||
ec_fsm_pdo_t *fsm_pdo; /**< Pdo configuration state machine to use. */
|
||||
ec_fsm_pdo_t *fsm_pdo; /**< PDO configuration state machine to use. */
|
||||
unsigned int retries; /**< Retries on datagram timeout. */
|
||||
|
||||
void (*state)(ec_fsm_slave_scan_t *); /**< State function. */
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
/** Number of state machine retries on datagram timeout. */
|
||||
#define EC_FSM_RETRIES 3
|
||||
|
||||
/** Seconds to wait before fetching Sdo dictionary
|
||||
/** Seconds to wait before fetching SDO dictionary
|
||||
after slave entered PREOP state. */
|
||||
#define EC_WAIT_SDO_DICT 3
|
||||
|
||||
@@ -126,21 +126,21 @@ typedef enum {
|
||||
/** Supported mailbox protocols.
|
||||
*/
|
||||
enum {
|
||||
EC_MBOX_AOE = 0x01, /**< ADS-over-EtherCAT */
|
||||
EC_MBOX_EOE = 0x02, /**< Ethernet-over-EtherCAT */
|
||||
EC_MBOX_COE = 0x04, /**< CANopen-over-EtherCAT */
|
||||
EC_MBOX_FOE = 0x08, /**< File-Access-over-EtherCAT */
|
||||
EC_MBOX_SOE = 0x10, /**< Servo-Profile-over-EtherCAT */
|
||||
EC_MBOX_AOE = 0x01, /**< ADS over EtherCAT */
|
||||
EC_MBOX_EOE = 0x02, /**< Ethernet over EtherCAT */
|
||||
EC_MBOX_COE = 0x04, /**< CANopen over EtherCAT */
|
||||
EC_MBOX_FOE = 0x08, /**< File-Access over EtherCAT */
|
||||
EC_MBOX_SOE = 0x10, /**< Servo-Profile over EtherCAT */
|
||||
EC_MBOX_VOE = 0x20 /**< Vendor specific */
|
||||
};
|
||||
|
||||
/** Slave information interface CANopen-over-EtherCAT details flags.
|
||||
/** Slave information interface CANopen over EtherCAT details flags.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t enable_sdo : 1; /**< Enable Sdo access. */
|
||||
uint8_t enable_sdo : 1; /**< Enable SDO access. */
|
||||
uint8_t enable_sdo_info : 1; /**< SDO information service available. */
|
||||
uint8_t enable_pdo_assign : 1; /**< Pdo mapping configurable. */
|
||||
uint8_t enable_pdo_configuration : 1; /**< Pdo configuration possible. */
|
||||
uint8_t enable_pdo_assign : 1; /**< PDO mapping configurable. */
|
||||
uint8_t enable_pdo_configuration : 1; /**< PDO configuration possible. */
|
||||
uint8_t enable_upload_at_startup : 1; /**< ?. */
|
||||
uint8_t enable_sdo_complete_access : 1; /**< Complete access possible. */
|
||||
} ec_sii_coe_details_t;
|
||||
|
||||
@@ -981,7 +981,7 @@ schedule:
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef EC_EOE
|
||||
/** Starts Ethernet-over-EtherCAT processing on demand.
|
||||
/** Starts Ethernet over EtherCAT processing on demand.
|
||||
*/
|
||||
void ec_master_eoe_start(ec_master_t *master /**< EtherCAT master */)
|
||||
{
|
||||
@@ -1008,7 +1008,7 @@ void ec_master_eoe_start(ec_master_t *master /**< EtherCAT master */)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Stops the Ethernet-over-EtherCAT processing.
|
||||
/** Stops the Ethernet over EtherCAT processing.
|
||||
*/
|
||||
void ec_master_eoe_stop(ec_master_t *master /**< EtherCAT master */)
|
||||
{
|
||||
@@ -1022,7 +1022,7 @@ void ec_master_eoe_stop(ec_master_t *master /**< EtherCAT master */)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Does the Ethernet-over-EtherCAT processing.
|
||||
/** Does the Ethernet over EtherCAT processing.
|
||||
*/
|
||||
void ec_master_eoe_run(unsigned long data /**< master pointer */)
|
||||
{
|
||||
|
||||
@@ -139,7 +139,7 @@ struct ec_master {
|
||||
#ifdef EC_EOE
|
||||
struct timer_list eoe_timer; /**< EoE timer object. */
|
||||
unsigned int eoe_running; /**< \a True, if EoE processing is active. */
|
||||
struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers. */
|
||||
struct list_head eoe_handlers; /**< Ethernet over EtherCAT handlers. */
|
||||
#endif
|
||||
|
||||
spinlock_t internal_lock; /**< Spinlock used in \a IDLE phase. */
|
||||
@@ -154,8 +154,8 @@ struct ec_master {
|
||||
wait_queue_head_t sii_queue; /**< Wait queue for SII
|
||||
write requests from user space. */
|
||||
|
||||
struct list_head slave_sdo_requests; /**< Sdo access requests. */
|
||||
wait_queue_head_t sdo_queue; /**< Wait queue for Sdo access requests
|
||||
struct list_head slave_sdo_requests; /**< SDO access requests. */
|
||||
wait_queue_head_t sdo_queue; /**< Wait queue for SDO access requests
|
||||
from user space. */
|
||||
|
||||
struct list_head phy_requests; /**< Physical memory requests. */
|
||||
|
||||
50
master/pdo.c
50
master/pdo.c
@@ -38,10 +38,10 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo constructor.
|
||||
/** PDO constructor.
|
||||
*/
|
||||
void ec_pdo_init(
|
||||
ec_pdo_t *pdo /**< EtherCAT Pdo */
|
||||
ec_pdo_t *pdo /**< EtherCAT PDO */
|
||||
)
|
||||
{
|
||||
pdo->sync_index = -1; // not assigned
|
||||
@@ -51,7 +51,7 @@ void ec_pdo_init(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo copy constructor.
|
||||
/** PDO copy constructor.
|
||||
*
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
@@ -83,9 +83,9 @@ out_return:
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo destructor.
|
||||
/** PDO destructor.
|
||||
*/
|
||||
void ec_pdo_clear(ec_pdo_t *pdo /**< EtherCAT Pdo. */)
|
||||
void ec_pdo_clear(ec_pdo_t *pdo /**< EtherCAT PDO. */)
|
||||
{
|
||||
if (pdo->name)
|
||||
kfree(pdo->name);
|
||||
@@ -95,13 +95,13 @@ void ec_pdo_clear(ec_pdo_t *pdo /**< EtherCAT Pdo. */)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Clear Pdo entry list.
|
||||
/** Clear PDO entry list.
|
||||
*/
|
||||
void ec_pdo_clear_entries(ec_pdo_t *pdo /**< EtherCAT Pdo. */)
|
||||
void ec_pdo_clear_entries(ec_pdo_t *pdo /**< EtherCAT PDO. */)
|
||||
{
|
||||
ec_pdo_entry_t *entry, *next;
|
||||
|
||||
// free all Pdo entries
|
||||
// free all PDO entries
|
||||
list_for_each_entry_safe(entry, next, &pdo->entries, list) {
|
||||
list_del(&entry->list);
|
||||
ec_pdo_entry_clear(entry);
|
||||
@@ -111,13 +111,13 @@ void ec_pdo_clear_entries(ec_pdo_t *pdo /**< EtherCAT Pdo. */)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Set Pdo name.
|
||||
/** Set PDO name.
|
||||
*
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
int ec_pdo_set_name(
|
||||
ec_pdo_t *pdo, /**< Pdo. */
|
||||
ec_pdo_t *pdo, /**< PDO. */
|
||||
const char *name /**< New name. */
|
||||
)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ int ec_pdo_set_name(
|
||||
|
||||
if (name && (len = strlen(name))) {
|
||||
if (!(pdo->name = (char *) kmalloc(len + 1, GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate Pdo name.\n");
|
||||
EC_ERR("Failed to allocate PDO name.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(pdo->name, name, len + 1);
|
||||
@@ -144,7 +144,7 @@ int ec_pdo_set_name(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Add a new Pdo entry to the configuration.
|
||||
/** Add a new PDO entry to the configuration.
|
||||
*
|
||||
* \retval Pointer to the added entry, otherwise a ERR_PTR() code.
|
||||
*/
|
||||
@@ -158,7 +158,7 @@ ec_pdo_entry_t *ec_pdo_add_entry(
|
||||
ec_pdo_entry_t *entry;
|
||||
|
||||
if (!(entry = kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate memory for Pdo entry.\n");
|
||||
EC_ERR("Failed to allocate memory for PDO entry.\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ ec_pdo_entry_t *ec_pdo_add_entry(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Copy Pdo entries from another Pdo.
|
||||
/** Copy PDO entries from another PDO.
|
||||
*
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
@@ -187,7 +187,7 @@ int ec_pdo_copy_entries(ec_pdo_t *pdo, const ec_pdo_t *other)
|
||||
list_for_each_entry(other_entry, &other->entries, list) {
|
||||
if (!(entry = (ec_pdo_entry_t *)
|
||||
kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate memory for Pdo entry copy.\n");
|
||||
EC_ERR("Failed to allocate memory for PDO entry copy.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -205,14 +205,14 @@ int ec_pdo_copy_entries(ec_pdo_t *pdo, const ec_pdo_t *other)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Compares the entries of two Pdos.
|
||||
/** Compares the entries of two PDOs.
|
||||
*
|
||||
* \retval 1 The entries of the given Pdos are equal.
|
||||
* \retval 0 The entries of the given Pdos differ.
|
||||
* \retval 1 The entries of the given PDOs are equal.
|
||||
* \retval 0 The entries of the given PDOs differ.
|
||||
*/
|
||||
int ec_pdo_equal_entries(
|
||||
const ec_pdo_t *pdo1, /**< First Pdo. */
|
||||
const ec_pdo_t *pdo2 /**< Second Pdo. */
|
||||
const ec_pdo_t *pdo1, /**< First PDO. */
|
||||
const ec_pdo_t *pdo2 /**< Second PDO. */
|
||||
)
|
||||
{
|
||||
const struct list_head *head1, *head2, *item1, *item2;
|
||||
@@ -241,12 +241,12 @@ int ec_pdo_equal_entries(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the number of Pdo entries.
|
||||
/** Get the number of PDO entries.
|
||||
*
|
||||
* \return Number of Pdo entries.
|
||||
* \return Number of PDO entries.
|
||||
*/
|
||||
unsigned int ec_pdo_entry_count(
|
||||
const ec_pdo_t *pdo /**< Pdo. */
|
||||
const ec_pdo_t *pdo /**< PDO. */
|
||||
)
|
||||
{
|
||||
const ec_pdo_entry_t *entry;
|
||||
@@ -261,12 +261,12 @@ unsigned int ec_pdo_entry_count(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Finds a Pdo entry via its position in the list.
|
||||
/** Finds a PDO entry via its position in the list.
|
||||
*
|
||||
* Const version.
|
||||
*/
|
||||
const ec_pdo_entry_t *ec_pdo_find_entry_by_pos_const(
|
||||
const ec_pdo_t *pdo, /**< Pdo. */
|
||||
const ec_pdo_t *pdo, /**< PDO. */
|
||||
unsigned int pos /**< Position in the list. */
|
||||
)
|
||||
{
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo description.
|
||||
/** PDO description.
|
||||
*/
|
||||
typedef struct {
|
||||
struct list_head list; /**< List item. */
|
||||
uint16_t index; /**< Pdo index. */
|
||||
uint16_t index; /**< PDO index. */
|
||||
int8_t sync_index; /**< Assigned sync manager. \todo remove? */
|
||||
char *name; /**< Pdo name. */
|
||||
struct list_head entries; /**< List of Pdo entries. */
|
||||
char *name; /**< PDO name. */
|
||||
struct list_head entries; /**< List of PDO entries. */
|
||||
} ec_pdo_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -37,10 +37,10 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo entry constructor.
|
||||
/** PDO entry constructor.
|
||||
*/
|
||||
void ec_pdo_entry_init(
|
||||
ec_pdo_entry_t *entry /**< Pdo entry. */
|
||||
ec_pdo_entry_t *entry /**< PDO entry. */
|
||||
)
|
||||
{
|
||||
entry->name = NULL;
|
||||
@@ -48,14 +48,14 @@ void ec_pdo_entry_init(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo entry copy constructor.
|
||||
/** PDO entry copy constructor.
|
||||
*
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
int ec_pdo_entry_init_copy(
|
||||
ec_pdo_entry_t *entry, /**< Pdo entry. */
|
||||
const ec_pdo_entry_t *other /**< Pdo entry to copy from. */
|
||||
ec_pdo_entry_t *entry, /**< PDO entry. */
|
||||
const ec_pdo_entry_t *other /**< PDO entry to copy from. */
|
||||
)
|
||||
{
|
||||
entry->index = other->index;
|
||||
@@ -68,9 +68,9 @@ int ec_pdo_entry_init_copy(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo entry destructor.
|
||||
/** PDO entry destructor.
|
||||
*/
|
||||
void ec_pdo_entry_clear(ec_pdo_entry_t *entry /**< Pdo entry. */)
|
||||
void ec_pdo_entry_clear(ec_pdo_entry_t *entry /**< PDO entry. */)
|
||||
{
|
||||
if (entry->name)
|
||||
kfree(entry->name);
|
||||
@@ -78,13 +78,13 @@ void ec_pdo_entry_clear(ec_pdo_entry_t *entry /**< Pdo entry. */)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Set Pdo entry name.
|
||||
/** Set PDO entry name.
|
||||
*
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
int ec_pdo_entry_set_name(
|
||||
ec_pdo_entry_t *entry, /**< Pdo entry. */
|
||||
ec_pdo_entry_t *entry, /**< PDO entry. */
|
||||
const char *name /**< New name. */
|
||||
)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ int ec_pdo_entry_set_name(
|
||||
|
||||
if (name && (len = strlen(name))) {
|
||||
if (!(entry->name = (char *) kmalloc(len + 1, GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate Pdo entry name.\n");
|
||||
EC_ERR("Failed to allocate PDO entry name.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(entry->name, name, len + 1);
|
||||
@@ -111,14 +111,14 @@ int ec_pdo_entry_set_name(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Compares two Pdo entries.
|
||||
/** Compares two PDO entries.
|
||||
*
|
||||
* \retval 1 The entries are equal.
|
||||
* \retval 0 The entries differ.
|
||||
*/
|
||||
int ec_pdo_entry_equal(
|
||||
const ec_pdo_entry_t *entry1, /**< First Pdo entry. */
|
||||
const ec_pdo_entry_t *entry2 /**< Second Pdo entry. */
|
||||
const ec_pdo_entry_t *entry1, /**< First PDO entry. */
|
||||
const ec_pdo_entry_t *entry2 /**< Second PDO entry. */
|
||||
)
|
||||
{
|
||||
return entry1->index == entry2->index
|
||||
|
||||
@@ -40,12 +40,12 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo entry description.
|
||||
/** PDO entry description.
|
||||
*/
|
||||
typedef struct {
|
||||
struct list_head list; /**< list item */
|
||||
uint16_t index; /**< Pdo entry index */
|
||||
uint8_t subindex; /**< Pdo entry subindex */
|
||||
uint16_t index; /**< PDO entry index */
|
||||
uint8_t subindex; /**< PDO entry subindex */
|
||||
char *name; /**< entry name */
|
||||
uint8_t bit_length; /**< entry length in bit */
|
||||
} ec_pdo_entry_t;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT Pdo list methods.
|
||||
EtherCAT PDO list methods.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -42,10 +42,10 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo list constructor.
|
||||
/** PDO list constructor.
|
||||
*/
|
||||
void ec_pdo_list_init(
|
||||
ec_pdo_list_t *pl /**< Pdo list. */
|
||||
ec_pdo_list_t *pl /**< PDO list. */
|
||||
)
|
||||
{
|
||||
INIT_LIST_HEAD(&pl->list);
|
||||
@@ -53,18 +53,18 @@ void ec_pdo_list_init(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Pdo list destructor.
|
||||
/** PDO list destructor.
|
||||
*/
|
||||
void ec_pdo_list_clear(ec_pdo_list_t *pl /**< Pdo list. */)
|
||||
void ec_pdo_list_clear(ec_pdo_list_t *pl /**< PDO list. */)
|
||||
{
|
||||
ec_pdo_list_clear_pdos(pl);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Clears the list of mapped Pdos.
|
||||
/** Clears the list of mapped PDOs.
|
||||
*/
|
||||
void ec_pdo_list_clear_pdos(ec_pdo_list_t *pl /**< Pdo list. */)
|
||||
void ec_pdo_list_clear_pdos(ec_pdo_list_t *pl /**< PDO list. */)
|
||||
{
|
||||
ec_pdo_t *pdo, *next;
|
||||
|
||||
@@ -77,12 +77,12 @@ void ec_pdo_list_clear_pdos(ec_pdo_list_t *pl /**< Pdo list. */)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Calculates the total size of the mapped Pdo entries.
|
||||
/** Calculates the total size of the mapped PDO entries.
|
||||
*
|
||||
* \retval Data size in byte.
|
||||
*/
|
||||
uint16_t ec_pdo_list_total_size(
|
||||
const ec_pdo_list_t *pl /**< Pdo list. */
|
||||
const ec_pdo_list_t *pl /**< PDO list. */
|
||||
)
|
||||
{
|
||||
unsigned int bit_size;
|
||||
@@ -107,19 +107,19 @@ uint16_t ec_pdo_list_total_size(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Add a new Pdo to the list.
|
||||
/** Add a new PDO to the list.
|
||||
*
|
||||
* \return Pointer to new Pdo, otherwise an ERR_PTR() code.
|
||||
* \return Pointer to new PDO, otherwise an ERR_PTR() code.
|
||||
*/
|
||||
ec_pdo_t *ec_pdo_list_add_pdo(
|
||||
ec_pdo_list_t *pl, /**< Pdo list. */
|
||||
uint16_t index /**< Pdo index. */
|
||||
ec_pdo_list_t *pl, /**< PDO list. */
|
||||
uint16_t index /**< PDO index. */
|
||||
)
|
||||
{
|
||||
ec_pdo_t *pdo;
|
||||
|
||||
if (!(pdo = (ec_pdo_t *) kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate memory for Pdo.\n");
|
||||
EC_ERR("Failed to allocate memory for PDO.\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
@@ -131,27 +131,27 @@ ec_pdo_t *ec_pdo_list_add_pdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Add the copy of an existing Pdo to the list.
|
||||
/** Add the copy of an existing PDO to the list.
|
||||
*
|
||||
* \return 0 on success, else < 0
|
||||
*/
|
||||
int ec_pdo_list_add_pdo_copy(
|
||||
ec_pdo_list_t *pl, /**< Pdo list. */
|
||||
const ec_pdo_t *pdo /**< Pdo to add. */
|
||||
ec_pdo_list_t *pl, /**< PDO list. */
|
||||
const ec_pdo_t *pdo /**< PDO to add. */
|
||||
)
|
||||
{
|
||||
ec_pdo_t *mapped_pdo;
|
||||
int ret;
|
||||
|
||||
// Pdo already mapped?
|
||||
// PDO already mapped?
|
||||
list_for_each_entry(mapped_pdo, &pl->list, list) {
|
||||
if (mapped_pdo->index != pdo->index) continue;
|
||||
EC_ERR("Pdo 0x%04X is already mapped!\n", pdo->index);
|
||||
EC_ERR("PDO 0x%04X is already mapped!\n", pdo->index);
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
if (!(mapped_pdo = kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate Pdo memory.\n");
|
||||
EC_ERR("Failed to allocate PDO memory.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -167,13 +167,13 @@ int ec_pdo_list_add_pdo_copy(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Makes a deep copy of another Pdo list.
|
||||
/** Makes a deep copy of another PDO list.
|
||||
*
|
||||
* \return 0 on success, else < 0
|
||||
*/
|
||||
int ec_pdo_list_copy(
|
||||
ec_pdo_list_t *pl, /**< Pdo list. */
|
||||
const ec_pdo_list_t *other /**< Pdo list to copy from. */
|
||||
ec_pdo_list_t *pl, /**< PDO list. */
|
||||
const ec_pdo_list_t *other /**< PDO list to copy from. */
|
||||
)
|
||||
{
|
||||
ec_pdo_t *other_pdo;
|
||||
@@ -181,7 +181,7 @@ int ec_pdo_list_copy(
|
||||
|
||||
ec_pdo_list_clear_pdos(pl);
|
||||
|
||||
// Pdo already mapped?
|
||||
// PDO already mapped?
|
||||
list_for_each_entry(other_pdo, &other->list, list) {
|
||||
ret = ec_pdo_list_add_pdo_copy(pl, other_pdo);
|
||||
if (ret)
|
||||
@@ -193,13 +193,13 @@ int ec_pdo_list_copy(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Compares two Pdo lists.
|
||||
/** Compares two PDO lists.
|
||||
*
|
||||
* Only the list is compared, not the Pdo entries (i. e. the Pdo
|
||||
* Only the list is compared, not the PDO entries (i. e. the PDO
|
||||
* mapping).
|
||||
*
|
||||
* \retval 1 The given Pdo lists are equal.
|
||||
* \retval 0 The given Pdo lists differ.
|
||||
* \retval 1 The given PDO lists are equal.
|
||||
* \retval 0 The given PDO lists differ.
|
||||
*/
|
||||
int ec_pdo_list_equal(
|
||||
const ec_pdo_list_t *pl1, /**< First list. */
|
||||
@@ -233,11 +233,11 @@ int ec_pdo_list_equal(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Finds a Pdo with the given index.
|
||||
/** Finds a PDO with the given index.
|
||||
*/
|
||||
ec_pdo_t *ec_pdo_list_find_pdo(
|
||||
const ec_pdo_list_t *pl, /**< Pdo list. */
|
||||
uint16_t index /**< Pdo index. */
|
||||
const ec_pdo_list_t *pl, /**< PDO list. */
|
||||
uint16_t index /**< PDO index. */
|
||||
)
|
||||
{
|
||||
ec_pdo_t *pdo;
|
||||
@@ -253,11 +253,11 @@ ec_pdo_t *ec_pdo_list_find_pdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Finds a Pdo with the given index and returns a const pointer.
|
||||
/** Finds a PDO with the given index and returns a const pointer.
|
||||
*/
|
||||
const ec_pdo_t *ec_pdo_list_find_pdo_const(
|
||||
const ec_pdo_list_t *pl, /**< Pdo list. */
|
||||
uint16_t index /**< Pdo index. */
|
||||
const ec_pdo_list_t *pl, /**< PDO list. */
|
||||
uint16_t index /**< PDO index. */
|
||||
)
|
||||
{
|
||||
const ec_pdo_t *pdo;
|
||||
@@ -273,12 +273,12 @@ const ec_pdo_t *ec_pdo_list_find_pdo_const(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Finds a Pdo via its position in the list.
|
||||
/** Finds a PDO via its position in the list.
|
||||
*
|
||||
* Const version.
|
||||
*/
|
||||
const ec_pdo_t *ec_pdo_list_find_pdo_by_pos_const(
|
||||
const ec_pdo_list_t *pl, /**< Pdo list. */
|
||||
const ec_pdo_list_t *pl, /**< PDO list. */
|
||||
unsigned int pos /**< Position in the list. */
|
||||
)
|
||||
{
|
||||
@@ -295,12 +295,12 @@ const ec_pdo_t *ec_pdo_list_find_pdo_by_pos_const(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the number of Pdos in the list.
|
||||
/** Get the number of PDOs in the list.
|
||||
*
|
||||
* \return Number of Pdos.
|
||||
* \return Number of PDOs.
|
||||
*/
|
||||
unsigned int ec_pdo_list_count(
|
||||
const ec_pdo_list_t *pl /**< Pdo list. */
|
||||
const ec_pdo_list_t *pl /**< PDO list. */
|
||||
)
|
||||
{
|
||||
const ec_pdo_t *pdo;
|
||||
@@ -315,10 +315,10 @@ unsigned int ec_pdo_list_count(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Outputs the Pdos in the list.
|
||||
/** Outputs the PDOs in the list.
|
||||
*/
|
||||
void ec_pdo_list_print(
|
||||
const ec_pdo_list_t *pl /**< Pdo list. */
|
||||
const ec_pdo_list_t *pl /**< PDO list. */
|
||||
)
|
||||
{
|
||||
const ec_pdo_t *pdo;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT Pdo list structure.
|
||||
EtherCAT PDO list structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -41,10 +41,10 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** EtherCAT Pdo list.
|
||||
/** EtherCAT PDO list.
|
||||
*/
|
||||
typedef struct {
|
||||
struct list_head list; /**< List of Pdos. */
|
||||
struct list_head list; /**< List of PDOs. */
|
||||
} ec_pdo_list_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
28
master/sdo.c
28
master/sdo.c
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
CANopen Sdo functions.
|
||||
CANopen SDO functions.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -42,9 +42,9 @@
|
||||
/** Constructor.
|
||||
*/
|
||||
void ec_sdo_init(
|
||||
ec_sdo_t *sdo, /**< Sdo. */
|
||||
ec_sdo_t *sdo, /**< SDO. */
|
||||
ec_slave_t *slave, /**< Parent slave. */
|
||||
uint16_t index /**< Sdo index. */
|
||||
uint16_t index /**< SDO index. */
|
||||
)
|
||||
{
|
||||
sdo->slave = slave;
|
||||
@@ -57,12 +57,12 @@ void ec_sdo_init(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Sdo destructor.
|
||||
/** SDO destructor.
|
||||
*
|
||||
* Clears and frees an Sdo object.
|
||||
* Clears and frees an SDO object.
|
||||
*/
|
||||
void ec_sdo_clear(
|
||||
ec_sdo_t *sdo /**< Sdo. */
|
||||
ec_sdo_t *sdo /**< SDO. */
|
||||
)
|
||||
{
|
||||
ec_sdo_entry_t *entry, *next;
|
||||
@@ -80,13 +80,13 @@ void ec_sdo_clear(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get an Sdo entry from an Sdo via its subindex.
|
||||
/** Get an SDO entry from an SDO via its subindex.
|
||||
*
|
||||
* \retval >0 Pointer to the requested Sdo entry.
|
||||
* \retval NULL Sdo entry not found.
|
||||
* \retval >0 Pointer to the requested SDO entry.
|
||||
* \retval NULL SDO entry not found.
|
||||
*/
|
||||
ec_sdo_entry_t *ec_sdo_get_entry(
|
||||
ec_sdo_t *sdo, /**< Sdo. */
|
||||
ec_sdo_t *sdo, /**< SDO. */
|
||||
uint8_t subindex /**< Entry subindex. */
|
||||
)
|
||||
{
|
||||
@@ -103,15 +103,15 @@ ec_sdo_entry_t *ec_sdo_get_entry(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get an Sdo entry from an Sdo via its subindex.
|
||||
/** Get an SDO entry from an SDO via its subindex.
|
||||
*
|
||||
* const version.
|
||||
*
|
||||
* \retval >0 Pointer to the requested Sdo entry.
|
||||
* \retval NULL Sdo entry not found.
|
||||
* \retval >0 Pointer to the requested SDO entry.
|
||||
* \retval NULL SDO entry not found.
|
||||
*/
|
||||
const ec_sdo_entry_t *ec_sdo_get_entry_const(
|
||||
const ec_sdo_t *sdo, /**< Sdo. */
|
||||
const ec_sdo_t *sdo, /**< SDO. */
|
||||
uint8_t subindex /**< Entry subindex. */
|
||||
)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT CANopen Sdo structure.
|
||||
EtherCAT CANopen SDO structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -41,14 +41,14 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** CANopen Sdo.
|
||||
/** CANopen SDO.
|
||||
*/
|
||||
struct ec_sdo {
|
||||
struct list_head list; /**< List item. */
|
||||
ec_slave_t *slave; /**< Parent slave. */
|
||||
uint16_t index; /**< Sdo index. */
|
||||
uint16_t index; /**< SDO index. */
|
||||
uint8_t object_code; /**< Object code. */
|
||||
char *name; /**< Sdo name. */
|
||||
char *name; /**< SDO name. */
|
||||
uint8_t max_subindex; /**< Maximum subindex. */
|
||||
struct list_head entries; /**< List of entries. */
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
CANopen-over-EtherCAT Sdo entry functions.
|
||||
CANopen over EtherCAT SDO entry functions.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -40,8 +40,8 @@
|
||||
/** Constructor.
|
||||
*/
|
||||
void ec_sdo_entry_init(
|
||||
ec_sdo_entry_t *entry, /**< Sdo entry. */
|
||||
ec_sdo_t *sdo, /**< Parent Sdo. */
|
||||
ec_sdo_entry_t *entry, /**< SDO entry. */
|
||||
ec_sdo_t *sdo, /**< Parent SDO. */
|
||||
uint8_t subindex /**< Subindex. */
|
||||
)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ void ec_sdo_entry_init(
|
||||
/** Destructor.
|
||||
*/
|
||||
void ec_sdo_entry_clear(
|
||||
ec_sdo_entry_t *entry /**< Sdo entry. */
|
||||
ec_sdo_entry_t *entry /**< SDO entry. */
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT CANopen Sdo entry structure.
|
||||
EtherCAT CANopen SDO entry structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -46,11 +46,11 @@ typedef struct ec_sdo ec_sdo_t; /**< \see ec_sdo. */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** CANopen Sdo entry.
|
||||
/** CANopen SDO entry.
|
||||
*/
|
||||
typedef struct {
|
||||
struct list_head list; /**< List item. */
|
||||
ec_sdo_t *sdo; /**< Parent Sdo. */
|
||||
ec_sdo_t *sdo; /**< Parent SDO. */
|
||||
uint8_t subindex; /**< Subindex. */
|
||||
uint16_t data_type; /**< Data type. */
|
||||
uint16_t bit_length; /**< Data size in bit. */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/** \file
|
||||
* Canopen-over-EtherCAT Sdo request functions.
|
||||
* Canopen over EtherCAT SDO request functions.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Default timeout in ms to wait for Sdo transfer responses.
|
||||
/** Default timeout in ms to wait for SDO transfer responses.
|
||||
*/
|
||||
#define EC_SDO_REQUEST_RESPONSE_TIMEOUT 3000
|
||||
|
||||
@@ -47,10 +47,10 @@ void ec_sdo_request_clear_data(ec_sdo_request_t *);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Sdo request constructor.
|
||||
/** SDO request constructor.
|
||||
*/
|
||||
void ec_sdo_request_init(
|
||||
ec_sdo_request_t *req /**< Sdo request. */
|
||||
ec_sdo_request_t *req /**< SDO request. */
|
||||
)
|
||||
{
|
||||
req->data = NULL;
|
||||
@@ -65,10 +65,10 @@ void ec_sdo_request_init(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Sdo request destructor.
|
||||
/** SDO request destructor.
|
||||
*/
|
||||
void ec_sdo_request_clear(
|
||||
ec_sdo_request_t *req /**< Sdo request. */
|
||||
ec_sdo_request_t *req /**< SDO request. */
|
||||
)
|
||||
{
|
||||
ec_sdo_request_clear_data(req);
|
||||
@@ -76,7 +76,7 @@ void ec_sdo_request_clear(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Copy another Sdo request.
|
||||
/** Copy another SDO request.
|
||||
*
|
||||
* \attention Only the index subindex and data are copied.
|
||||
*/
|
||||
@@ -92,10 +92,10 @@ int ec_sdo_request_copy(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Sdo request destructor.
|
||||
/** SDO request destructor.
|
||||
*/
|
||||
void ec_sdo_request_clear_data(
|
||||
ec_sdo_request_t *req /**< Sdo request. */
|
||||
ec_sdo_request_t *req /**< SDO request. */
|
||||
)
|
||||
{
|
||||
if (req->data) {
|
||||
@@ -109,12 +109,12 @@ void ec_sdo_request_clear_data(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Set the Sdo address.
|
||||
/** Set the SDO address.
|
||||
*/
|
||||
void ec_sdo_request_address(
|
||||
ec_sdo_request_t *req, /**< Sdo request. */
|
||||
uint16_t index, /**< Sdo index. */
|
||||
uint8_t subindex /**< Sdo subindex. */
|
||||
ec_sdo_request_t *req, /**< SDO request. */
|
||||
uint16_t index, /**< SDO index. */
|
||||
uint8_t subindex /**< SDO subindex. */
|
||||
)
|
||||
{
|
||||
req->index = index;
|
||||
@@ -130,7 +130,7 @@ void ec_sdo_request_address(
|
||||
* \return 0 on success, otherwise -ENOMEM.
|
||||
*/
|
||||
int ec_sdo_request_alloc(
|
||||
ec_sdo_request_t *req, /**< Sdo request. */
|
||||
ec_sdo_request_t *req, /**< SDO request. */
|
||||
size_t size /**< Data size to allocate. */
|
||||
)
|
||||
{
|
||||
@@ -140,7 +140,7 @@ int ec_sdo_request_alloc(
|
||||
ec_sdo_request_clear_data(req);
|
||||
|
||||
if (!(req->data = (uint8_t *) kmalloc(size, GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate %u bytes of Sdo memory.\n", size);
|
||||
EC_ERR("Failed to allocate %u bytes of SDO memory.\n", size);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ int ec_sdo_request_alloc(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Copies Sdo data from an external source.
|
||||
/** Copies SDO data from an external source.
|
||||
*
|
||||
* If the \a mem_size is to small, new memory is allocated.
|
||||
*
|
||||
@@ -159,7 +159,7 @@ int ec_sdo_request_alloc(
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
int ec_sdo_request_copy_data(
|
||||
ec_sdo_request_t *req, /**< Sdo request. */
|
||||
ec_sdo_request_t *req, /**< SDO request. */
|
||||
const uint8_t *source, /**< Source data. */
|
||||
size_t size /**< Number of bytes in \a source. */
|
||||
)
|
||||
@@ -179,7 +179,7 @@ int ec_sdo_request_copy_data(
|
||||
*
|
||||
* \return non-zero if the timeout was exceeded, else zero.
|
||||
*/
|
||||
int ec_sdo_request_timed_out(const ec_sdo_request_t *req /**< Sdo request. */)
|
||||
int ec_sdo_request_timed_out(const ec_sdo_request_t *req /**< SDO request. */)
|
||||
{
|
||||
return req->issue_timeout
|
||||
&& jiffies - req->jiffies_start > HZ * req->issue_timeout / 1000;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT CANopen Sdo request structure.
|
||||
EtherCAT CANopen SDO request structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -40,15 +40,15 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** CANopen Sdo request.
|
||||
/** CANopen SDO request.
|
||||
*/
|
||||
struct ec_sdo_request {
|
||||
struct list_head list; /**< List item. */
|
||||
uint16_t index; /**< Sdo index. */
|
||||
uint8_t subindex; /**< Sdo subindex. */
|
||||
uint8_t *data; /**< Pointer to Sdo data. */
|
||||
size_t mem_size; /**< Size of Sdo data memory. */
|
||||
size_t data_size; /**< Size of Sdo data. */
|
||||
uint16_t index; /**< SDO index. */
|
||||
uint8_t subindex; /**< SDO subindex. */
|
||||
uint8_t *data; /**< Pointer to SDO data. */
|
||||
size_t mem_size; /**< Size of SDO data memory. */
|
||||
size_t data_size; /**< Size of SDO data. */
|
||||
uint32_t issue_timeout; /**< Maximum time in ms, the processing of the
|
||||
request may take. */
|
||||
uint32_t response_timeout; /**< Maximum time in ms, the transfer is
|
||||
@@ -56,11 +56,11 @@ struct ec_sdo_request {
|
||||
ec_direction_t dir; /**< Direction. EC_DIR_OUTPUT means downloading to
|
||||
the slave, EC_DIR_INPUT means uploading from the
|
||||
slave. */
|
||||
ec_internal_request_state_t state; /**< Sdo request state. */
|
||||
ec_internal_request_state_t state; /**< SDO request state. */
|
||||
unsigned long jiffies_start; /**< Jiffies, when the request was issued. */
|
||||
unsigned long jiffies_sent; /**< Jiffies, when the upload/download
|
||||
request was sent. */
|
||||
uint32_t abort_code; /**< Sdo request abort code. Zero on success. */
|
||||
uint32_t abort_code; /**< SDO request abort code. Zero on success. */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -140,7 +140,7 @@ void ec_slave_clear(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
if (slave->config)
|
||||
ec_slave_config_detach(slave->config);
|
||||
|
||||
// free all Sdos
|
||||
// free all SDOs
|
||||
list_for_each_entry_safe(sdo, next_sdo, &slave->sdo_dictionary, list) {
|
||||
list_del(&sdo->list);
|
||||
ec_sdo_clear(sdo);
|
||||
@@ -157,7 +157,7 @@ void ec_slave_clear(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
// free all sync managers
|
||||
ec_slave_clear_sync_managers(slave);
|
||||
|
||||
// free all SII Pdos
|
||||
// free all SII PDOs
|
||||
list_for_each_entry_safe(pdo, next_pdo, &slave->sii.pdos, list) {
|
||||
list_del(&pdo->list);
|
||||
ec_pdo_clear(pdo);
|
||||
@@ -398,7 +398,7 @@ int ec_slave_fetch_sii_syncs(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Fetches data from a [RT]XPdo category.
|
||||
Fetches data from a [RT]xPDO category.
|
||||
\return 0 in case of success, else < 0
|
||||
*/
|
||||
|
||||
@@ -406,7 +406,7 @@ int ec_slave_fetch_sii_pdos(
|
||||
ec_slave_t *slave, /**< EtherCAT slave */
|
||||
const uint8_t *data, /**< category data */
|
||||
size_t data_size, /**< number of bytes */
|
||||
ec_direction_t dir /**< Pdo direction. */
|
||||
ec_direction_t dir /**< PDO direction. */
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
@@ -416,7 +416,7 @@ int ec_slave_fetch_sii_pdos(
|
||||
|
||||
while (data_size >= 8) {
|
||||
if (!(pdo = kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate Pdo memory.\n");
|
||||
EC_ERR("Failed to allocate PDO memory.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ int ec_slave_fetch_sii_pdos(
|
||||
|
||||
for (i = 0; i < entry_count; i++) {
|
||||
if (!(entry = kmalloc(sizeof(ec_pdo_entry_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate Pdo entry memory.\n");
|
||||
EC_ERR("Failed to allocate PDO entry memory.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -459,12 +459,12 @@ int ec_slave_fetch_sii_pdos(
|
||||
data += 8;
|
||||
}
|
||||
|
||||
// if sync manager index is positive, the Pdo is mapped by default
|
||||
// if sync manager index is positive, the PDO is mapped by default
|
||||
if (pdo->sync_index >= 0) {
|
||||
ec_sync_t *sync;
|
||||
|
||||
if (!(sync = ec_slave_get_sync(slave, pdo->sync_index))) {
|
||||
EC_ERR("Invalid SM index %i for Pdo 0x%04X in slave %u.",
|
||||
EC_ERR("Invalid SM index %i for PDO 0x%04X in slave %u.",
|
||||
pdo->sync_index, pdo->index, slave->ring_position);
|
||||
return -ENOENT;
|
||||
}
|
||||
@@ -524,11 +524,11 @@ ec_sync_t *ec_slave_get_sync(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Counts the total number of Sdos and entries in the dictionary.
|
||||
Counts the total number of SDOs and entries in the dictionary.
|
||||
*/
|
||||
|
||||
void ec_slave_sdo_dict_info(const ec_slave_t *slave, /**< EtherCAT slave */
|
||||
unsigned int *sdo_count, /**< number of Sdos */
|
||||
unsigned int *sdo_count, /**< number of SDOs */
|
||||
unsigned int *entry_count /**< total number of
|
||||
entries */
|
||||
)
|
||||
@@ -551,13 +551,13 @@ void ec_slave_sdo_dict_info(const ec_slave_t *slave, /**< EtherCAT slave */
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Get an Sdo from the dictionary.
|
||||
* \returns The desired Sdo, or NULL.
|
||||
* Get an SDO from the dictionary.
|
||||
* \returns The desired SDO, or NULL.
|
||||
*/
|
||||
|
||||
ec_sdo_t *ec_slave_get_sdo(
|
||||
ec_slave_t *slave, /**< EtherCAT slave */
|
||||
uint16_t index /**< Sdo index */
|
||||
uint16_t index /**< SDO index */
|
||||
)
|
||||
{
|
||||
ec_sdo_t *sdo;
|
||||
@@ -574,16 +574,16 @@ ec_sdo_t *ec_slave_get_sdo(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Get an Sdo from the dictionary.
|
||||
* Get an SDO from the dictionary.
|
||||
*
|
||||
* const version.
|
||||
*
|
||||
* \returns The desired Sdo, or NULL.
|
||||
* \returns The desired SDO, or NULL.
|
||||
*/
|
||||
|
||||
const ec_sdo_t *ec_slave_get_sdo_const(
|
||||
const ec_slave_t *slave, /**< EtherCAT slave */
|
||||
uint16_t index /**< Sdo index */
|
||||
uint16_t index /**< SDO index */
|
||||
)
|
||||
{
|
||||
const ec_sdo_t *sdo;
|
||||
@@ -599,13 +599,13 @@ const ec_sdo_t *ec_slave_get_sdo_const(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get an Sdo from the dictionary, given its position in the list.
|
||||
* \returns The desired Sdo, or NULL.
|
||||
/** Get an SDO from the dictionary, given its position in the list.
|
||||
* \returns The desired SDO, or NULL.
|
||||
*/
|
||||
|
||||
const ec_sdo_t *ec_slave_get_sdo_by_pos_const(
|
||||
const ec_slave_t *slave, /**< EtherCAT slave. */
|
||||
uint16_t sdo_position /**< Sdo list position. */
|
||||
uint16_t sdo_position /**< SDO list position. */
|
||||
)
|
||||
{
|
||||
const ec_sdo_t *sdo;
|
||||
@@ -621,8 +621,8 @@ const ec_sdo_t *ec_slave_get_sdo_by_pos_const(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the number of Sdos in the dictionary.
|
||||
* \returns Sdo count.
|
||||
/** Get the number of SDOs in the dictionary.
|
||||
* \returns SDO count.
|
||||
*/
|
||||
|
||||
uint16_t ec_slave_sdo_count(
|
||||
@@ -641,12 +641,12 @@ uint16_t ec_slave_sdo_count(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Finds a mapped Pdo.
|
||||
* \returns The desired Pdo object, or NULL.
|
||||
/** Finds a mapped PDO.
|
||||
* \returns The desired PDO object, or NULL.
|
||||
*/
|
||||
const ec_pdo_t *ec_slave_find_pdo(
|
||||
const ec_slave_t *slave, /**< Slave. */
|
||||
uint16_t index /**< Pdo index to find. */
|
||||
uint16_t index /**< PDO index to find. */
|
||||
)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -667,7 +667,7 @@ const ec_pdo_t *ec_slave_find_pdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Find name for a Pdo and its entries.
|
||||
/** Find name for a PDO and its entries.
|
||||
*/
|
||||
void ec_slave_find_names_for_pdo(
|
||||
ec_slave_t *slave,
|
||||
@@ -698,7 +698,7 @@ void ec_slave_find_names_for_pdo(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Attach Pdo names.
|
||||
/** Attach PDO names.
|
||||
*/
|
||||
void ec_slave_attach_pdo_names(
|
||||
ec_slave_t *slave
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user