Renamed [PS]DO to [PS]do.
This commit is contained in:
parent
0921c356a1
commit
350c159a9d
1
TODO
1
TODO
|
|
@ -23,7 +23,6 @@ Version 1.4.0:
|
|||
* Distributed clocks.
|
||||
* Support slaves, that don't support the LRW datagram, only LRD/LWR.
|
||||
* Implement all EtherCAT datagram types.
|
||||
* Rename all occurrences of PDO to Pdo.
|
||||
|
||||
Future issues:
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ implemented EtherCAT master.
|
|||
\end{itemize}
|
||||
\item Implementation of the CANopen-over-EtherCAT (CoE) protocol.
|
||||
\begin{itemize}
|
||||
\item Configuration of CoE-capable slaves via SDO interface.
|
||||
\item Configuration of CoE-capable slaves via Sdo interface.
|
||||
\end{itemize}
|
||||
\item Implementation of the Ethernet-over-EtherCAT (EoE) protocol.
|
||||
\begin{itemize}
|
||||
|
|
@ -323,10 +323,10 @@ appropriate.
|
|||
\index{Process data}
|
||||
|
||||
The slaves offer their inputs and outputs by presenting the master
|
||||
so-called ``Process Data Objects'' (PDOs\index{PDO}). The available
|
||||
PDOs can be determined by reading out the slave's TXPDO and RXPDO
|
||||
E$^2$PROM categories. The realtime module can register the PDOs for
|
||||
data exchange during cyclic operation. The sum of all registered PDOs
|
||||
so-called ``Process Data Objects'' (Pdos\index{Pdo}). The available
|
||||
Pdos can be determined by reading out the slave's TXPDO and RXPDO
|
||||
E$^2$PROM categories. The realtime module can register the Pdos for
|
||||
data exchange during cyclic operation. The sum of all registered Pdos
|
||||
defines the ``process data image'', which is exchanged via the
|
||||
``Logical ReadWrite'' datagrams introduced
|
||||
in~\cite[section~5.4.2.4]{dlspec}.
|
||||
|
|
@ -335,7 +335,7 @@ in~\cite[section~5.4.2.4]{dlspec}.
|
|||
\index{Domain}
|
||||
|
||||
The process data image can be easily managed by creating co-called
|
||||
``domains'', which group PDOs and allocate the datagrams needed to
|
||||
``domains'', which group Pdos and allocate the datagrams needed to
|
||||
exchange them. Domains are mandatory for process data exchange, so
|
||||
there has to be at least one. They were introduced for the following
|
||||
reasons:
|
||||
|
|
@ -349,11 +349,11 @@ reasons:
|
|||
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
|
||||
\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 exchange.
|
||||
group different Pdos and so allow separate exchange.
|
||||
\end{itemize}
|
||||
|
||||
There is no upper limit for the number of domains, but each domain
|
||||
|
|
@ -363,22 +363,22 @@ domains is also limited by the slaves' capabilities.
|
|||
\paragraph{FMMU Configuration}
|
||||
\index{FMMU!Configuration}
|
||||
|
||||
A realtime module can register PDOs for process data exchange. Every
|
||||
PDO is part of a memory area in the slave's physical memory, that is
|
||||
A realtime module can register Pdos for process data exchange. Every
|
||||
Pdo is part of a memory area in the slave's physical memory, that is
|
||||
protected by a sync manager \cite[section~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 of a slave is registered for
|
||||
image: For example, if a certain Pdo 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 resides in. If a
|
||||
second PDO of the same slave is registered for process data exchange
|
||||
within the same domain, and this PDO resides in the same
|
||||
sync-manager-protected memory as the first PDO, the FMMU configuration
|
||||
complete sync-manager-protected memory, the Pdo resides in. If a
|
||||
second Pdo of the same slave is registered for process data exchange
|
||||
within the same domain, and this Pdo resides in the same
|
||||
sync-manager-protected memory as the first Pdo, the FMMU configuration
|
||||
is not touched, because the appropriate memory is already part of the
|
||||
domain's process data image. If the second PDO belongs to another
|
||||
domain's process data image. If the second Pdo belongs to another
|
||||
sync-manager-protected area, this complete area is also included into
|
||||
the domains process data image. See figure~\ref{fig:fmmus} for an
|
||||
overview, how FMMU's are configured to map physical memory to logical
|
||||
|
|
@ -394,7 +394,7 @@ process data images.
|
|||
\paragraph{Process Data Pointers}
|
||||
|
||||
The figure also demonstrates the way, the realtime module can access the
|
||||
exchanged process data: At PDO registration, the realtime module has
|
||||
exchanged process data: At Pdo registration, the realtime module has
|
||||
to provide the address of a process data pointer. Upon calculation of
|
||||
the domain image and allocation of process data memory, this pointer
|
||||
is redirected to the appropriate location inside the domain's process
|
||||
|
|
@ -454,7 +454,7 @@ Operation mode is entered when a realtime module requests the master.
|
|||
The idle mode is stopped and the bus is scanned by getting the number
|
||||
of slaves and executing the ``Slave scan state machine'' (see
|
||||
section~\ref{sec:fsm-scan}) for each slave. The master is now ready to
|
||||
create domains and accept PDO registrations and slave configurations.
|
||||
create domains and accept Pdo registrations and slave configurations.
|
||||
After that, cyclic communication can be done by the realtime module.
|
||||
|
||||
\paragraph{Master Phases}
|
||||
|
|
@ -463,7 +463,7 @@ Every realtime module should use the master in three phases:
|
|||
|
||||
\begin{enumerate}
|
||||
\item \textit{Startup} - The master is requested and the bus is
|
||||
validated. Domains are created and PDOs are registered. Slave
|
||||
validated. Domains are created and Pdos are registered. Slave
|
||||
configurations are applied.
|
||||
\item \textit{Operation} - Cyclic code is run, process data is
|
||||
exchanged and the master state machine is executed.
|
||||
|
|
@ -1508,8 +1508,8 @@ below.
|
|||
\item[sii\_*] These attributes contain values from the ``Slave
|
||||
Information Interface'' \cite[section~6.4]{dlspec}, mostly identity
|
||||
and mailbox information, but also the list of sync manager
|
||||
configurations and PDOs.
|
||||
\item[registered] This flag is set, if one or more PDOs of the slave
|
||||
configurations and Pdos.
|
||||
\item[registered] This flag is set, if one or more Pdos of the slave
|
||||
have been registered for process data exchange. Otherwise a warning
|
||||
is output, because the slave is unused.
|
||||
\item[fmmus] Is an array of FMMU configurations, that have to be
|
||||
|
|
@ -1530,7 +1530,7 @@ below.
|
|||
\item[online] This flag contains the online state of the slave (i.~e.
|
||||
if it currently responds to the masters commands). Changes of the
|
||||
online state are always reported.
|
||||
\item[varsize\_fields] is only suitable for slaves that provide PDOs
|
||||
\item[varsize\_fields] is only suitable for slaves that provide Pdos
|
||||
of variable size (like slaves that manage a sub-fieldbus) and
|
||||
contains information about what size this fields actually should
|
||||
have.
|
||||
|
|
@ -1549,7 +1549,7 @@ below.
|
|||
category and allocates string memory.
|
||||
\item[ec\_slave\_calc\_sync\_size()] calculates the size of sync
|
||||
manager contents, because they can be variable due to variable-sized
|
||||
PDOs.
|
||||
Pdos.
|
||||
\item[ec\_slave\_info()] This method prints all slave information into
|
||||
a buffer for Sysfs reading.
|
||||
\item[ec\_slave\_mbox\_*()] These functions prepare datagrams for
|
||||
|
|
@ -1567,12 +1567,12 @@ below.
|
|||
\paragraph{Slave Methods (Realtime Interface)}
|
||||
|
||||
\begin{description}
|
||||
\item[ecrt\_slave\_conf\_sdo*()] These methods accept SDO
|
||||
\item[ecrt\_slave\_conf\_sdo*()] These methods accept Sdo
|
||||
configurations, that are applied on slave activation (i.~e.
|
||||
everytime the slave is configured). The methods differ only in the
|
||||
data size of the SDO (8, 16 or 32 bit).
|
||||
data size of the Sdo (8, 16 or 32 bit).
|
||||
\item[ecrt\_slave\_pdo\_size()] This method specifies the size of a
|
||||
variable-sized PDO.
|
||||
variable-sized Pdo.
|
||||
\end{description}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
|
@ -1749,7 +1749,7 @@ Figure~\ref{fig:uml-datagram} shows its UML class diagram.
|
|||
\label{sec:class-domain}
|
||||
\index{Domain!Class}
|
||||
|
||||
The domain class encapsules PDO registration and management of the
|
||||
The domain class encapsules Pdo registration and management of the
|
||||
process data image and its exchange. The UML class diagram can be seen
|
||||
in figure~\ref{fig:uml-domain}.
|
||||
|
||||
|
|
@ -1778,8 +1778,8 @@ in figure~\ref{fig:uml-domain}.
|
|||
which the domain's process data are mapped.
|
||||
\item[response\_count] The sum of the datagrams' working counters at
|
||||
the last process data exchange. Changes are always reported.
|
||||
\item[data\_regs] The (linked) list of PDO registrations. The realtime
|
||||
module requests the exchange of certain PDOs and supplies the
|
||||
\item[data\_regs] The (linked) list of Pdo registrations. The realtime
|
||||
module requests the exchange of certain Pdos and supplies the
|
||||
address of process data pointers, that will later point to the
|
||||
respective locations in the process data image. These ``data
|
||||
registrations'' are saved in the \textit{data\_regs} list.
|
||||
|
|
@ -1804,10 +1804,10 @@ in figure~\ref{fig:uml-domain}.
|
|||
\paragraph{Private Domain Methods}
|
||||
|
||||
\begin{description}
|
||||
\item[ec\_domain\_reg\_pdo\_entry()] This method is used to do a PDO
|
||||
registration. It finds the appropriate sync manager covering the PDO
|
||||
\item[ec\_domain\_reg\_pdo\_entry()] This method is used to do a Pdo
|
||||
registration. It finds the appropriate sync manager covering the Pdo
|
||||
data, calculates its offset in the sync-manager-protected memory and
|
||||
prepares the FMMU configurations for the related slave. Then the PDO
|
||||
prepares the FMMU configurations for the related slave. Then the Pdo
|
||||
registration is appended to the list.
|
||||
\item[ec\_domain\_clear\_data\_regs()] Clearing all process data
|
||||
registrations is needed in serveral places and therefore has been
|
||||
|
|
@ -1877,8 +1877,8 @@ figure~\ref{fig:uml-fsm}.
|
|||
changing slave states.
|
||||
\item[coe\_state] This function pointer stores the current state of
|
||||
the CoE state machines.
|
||||
\item[sdodata] This is an SDO data object that stores information
|
||||
about the current SDO to write.
|
||||
\item[sdodata] This is an Sdo data object that stores information
|
||||
about the current Sdo to write.
|
||||
\item[coe\_start] A timestamp attribute to detect timeouts during CoE
|
||||
configuration.
|
||||
\end{description}
|
||||
|
|
@ -2246,9 +2246,9 @@ interface:
|
|||
\subsubsection{Domain Methods}
|
||||
\label{sec:ecrt-domain}
|
||||
|
||||
\paragraph{PDO Registration}
|
||||
\paragraph{Pdo Registration}
|
||||
|
||||
To access data of a slave's PDO in cyclic operation, it is necessary
|
||||
To access data of a slave's Pdo in cyclic operation, it is necessary
|
||||
to make it part of a process data domain:
|
||||
|
||||
\begin{lstlisting}[language=C]
|
||||
|
|
@ -2263,12 +2263,12 @@ to make it part of a process data domain:
|
|||
\end{lstlisting}
|
||||
|
||||
The \textit{ecrt\_domain\_register\_pdo()} method registers a certain
|
||||
PDO as part of the domain and takes the address of the process data
|
||||
Pdo as part of the domain and takes the address of the process data
|
||||
pointer. This pointer will be set on master activation and then can be
|
||||
parameter to the \textit{EC\_READ\_*} and \textit{EC\_WRITE\_*} macros
|
||||
described below.
|
||||
|
||||
A perhaps easier way to register multiple PDOs at the same time is to
|
||||
A perhaps easier way to register multiple Pdos at the same time is to
|
||||
fill an array of \textit{ec\_pdo\_reg\_t} and hand it to the
|
||||
\textit{ecrt\_domain\_register\_pdo\_list()} method. Attention: This
|
||||
array has to be terminated by an empty structure (\textit{\{\}})!
|
||||
|
|
@ -2299,9 +2299,9 @@ be exchanged, and zero otherwise.
|
|||
\subsubsection{Slave Methods}
|
||||
\label{sec:ecrt-slave}
|
||||
|
||||
\paragraph{SDO Configuration}
|
||||
\paragraph{Sdo Configuration}
|
||||
|
||||
To configure slave SDOs, the function interface below can be used:
|
||||
To configure slave Sdos, the function interface below can be used:
|
||||
|
||||
\begin{lstlisting}[language=C]
|
||||
int ecrt_slave_conf_sdo8(ec_slave_t *slave,
|
||||
|
|
@ -2319,15 +2319,15 @@ To configure slave SDOs, the function interface below can be used:
|
|||
\end{lstlisting}
|
||||
|
||||
The \textit{ecrt\_slave\_conf\_sdo*()} methods prepare the
|
||||
configuration of a certain SDO. The index and subindex of the SDO, and
|
||||
configuration of a certain Sdo. The index and subindex of the Sdo, and
|
||||
the value have to be specified. The configuration is done each time,
|
||||
the slave is reconfigured. The methods only differ in the SDO's data
|
||||
the slave is reconfigured. The methods only differ in the Sdo's data
|
||||
type. If the configuration could be prepared, zero is returned. If an
|
||||
error occured, non-zero is returned.
|
||||
|
||||
\paragraph{Variable-sized PDOs}
|
||||
\paragraph{Variable-sized Pdos}
|
||||
|
||||
For specifying the size of variable-sized PDOs, the following method
|
||||
For specifying the size of variable-sized Pdos, the following method
|
||||
can be used:
|
||||
|
||||
\begin{lstlisting}[language=C]
|
||||
|
|
@ -2336,7 +2336,7 @@ can be used:
|
|||
size_t size);
|
||||
\end{lstlisting}
|
||||
|
||||
The \textit{ecrt\_slave\_pdo\_size()} method takes the name of the PDO
|
||||
The \textit{ecrt\_slave\_pdo\_size()} method takes the name of the Pdo
|
||||
and the size. It returns zero on success, otherwise non-zero.
|
||||
|
||||
\subsubsection{Process Data Access}
|
||||
|
|
@ -2370,7 +2370,7 @@ There are macros for bitwise access (\textit{EC\_READ\_BIT()},
|
|||
(\textit{EC\_READ\_*()}, \textit{EC\_WRITE\_*()}). The bytewise macros
|
||||
carry the data type in their name. Example: \textit{EC\_WRITE\_S16()}
|
||||
writes a 16 bit signed value to EtherCAT data. The \textit{DATA}
|
||||
parameter is supposed to be a process data pointer, as provided at PDO
|
||||
parameter is supposed to be a process data pointer, as provided at Pdo
|
||||
registration.
|
||||
|
||||
The macros use the kernel's endianess conversion macros, that are
|
||||
|
|
@ -2399,7 +2399,7 @@ macros.
|
|||
\label{sec:addr}
|
||||
\index{Slave!Addressing}
|
||||
|
||||
The master offers the serveral slave addressing schemes (for PDO
|
||||
The master offers the serveral slave addressing schemes (for Pdo
|
||||
registration or configuration) via the realtime interface. For this
|
||||
reason, slave addresses are ASCII\nomenclature{ASCII}{American
|
||||
Standard Code for Information Interchange}-coded and passed as a
|
||||
|
|
@ -3187,19 +3187,19 @@ configuring a slave and bringing it to a certain state.
|
|||
finished. $\rightarrow$~END
|
||||
|
||||
If the slave supports no FMMUs, the FMMU configuration can be
|
||||
skipped. If the slave has SDOs to configure, it is begun with
|
||||
sending the first SDO. $\rightarrow$~SDO\_CONF
|
||||
skipped. If the slave has Sdos to configure, it is begun with
|
||||
sending the first Sdo. $\rightarrow$~SDO\_CONF
|
||||
|
||||
If no SDO configurations are provided, the slave can now directly be
|
||||
If no Sdo configurations are provided, the slave can now directly be
|
||||
brought into the SAFEOP state and the state change state machine is
|
||||
started again. $\rightarrow$~SAFEOP
|
||||
|
||||
Otherwise, all supported FMMUs are configured according to the PDOs
|
||||
Otherwise, all supported FMMUs are configured according to the Pdos
|
||||
requested via the master's realtime interface. The appropriate
|
||||
datagram is issued. $\rightarrow$~FMMU
|
||||
|
||||
\item[FMMU] The FMMU configuration datagram was accepted. If the slave
|
||||
has SDOs to configure, it is begun with sending the first SDO.
|
||||
has Sdos to configure, it is begun with sending the first Sdo.
|
||||
$\rightarrow$~SDO\_CONF
|
||||
|
||||
Otherwise, the slave can now be brought into the SAFEOP state. The
|
||||
|
|
@ -3209,7 +3209,7 @@ configuring a slave and bringing it to a certain state.
|
|||
\item[SDO\_CONF] The CoE state machine is executed until termination.
|
||||
$\rightarrow$~SDO\_CONF
|
||||
|
||||
If another SDO has to be configured, a new SDO download sequence is
|
||||
If another Sdo has to be configured, a new Sdo download sequence is
|
||||
begun. $\rightarrow$~SDO\_CONF
|
||||
|
||||
Otherwise, the slave can now be brought into the SAFEOP state. The
|
||||
|
|
@ -3616,29 +3616,29 @@ to configure the slave and put it into operation.
|
|||
|
||||
The CANopen-over-EtherCAT protocol \cite[section~5.6]{alspec} is used
|
||||
to configure slaves on application level. Each CoE-capable slave
|
||||
provides a list of SDOs for this reason.
|
||||
provides a list of Sdos for this reason.
|
||||
|
||||
\paragraph{SDO Configuration}
|
||||
\paragraph{Sdo Configuration}
|
||||
|
||||
The SDO configurations have to be provided by the realtime module.
|
||||
The Sdo configurations have to be provided by the realtime module.
|
||||
This is done via the \textit{ecrt\_slave\_conf\_sdo*()} methods (see
|
||||
section~\ref{sec:ecrt-slave}), that are part of the realtime
|
||||
interface. The slave stores the SDO configurations in a linked list,
|
||||
interface. The slave stores the Sdo configurations in a linked list,
|
||||
but does not apply them at once.
|
||||
|
||||
\paragraph{SDO Download State Machine}
|
||||
\paragraph{Sdo Download State Machine}
|
||||
|
||||
The best time to apply SDO configurations is during the slave's PREOP
|
||||
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
|
||||
SAFEOP state. Therefore the Sdo configuration has to be part of the
|
||||
slave configuration state machine (see section~\ref{sec:fsm-conf}): It
|
||||
is implemented via an SDO download state machine, that is executed
|
||||
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
|
||||
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]
|
||||
|
|
@ -3650,7 +3650,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
|
||||
|
|
@ -3659,7 +3659,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
|
||||
|
|
@ -3669,16 +3669,16 @@ 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}
|
||||
|
||||
|
|
@ -3873,7 +3873,7 @@ the EtherCAT bus. Below is a listing of a slave directory:
|
|||
2: 0x1000, length 0, control 0x24, enable
|
||||
3: 0x1100, length 0, control 0x20, enable
|
||||
|
||||
PDOs:
|
||||
Pdos:
|
||||
RXPDO "Channel 1" (0x1600), Sync-Manager 2
|
||||
"Output" 0x6411:1, 16 bit
|
||||
RXPDO "Channel 2" (0x1601), Sync-Manager 2
|
||||
|
|
@ -4492,12 +4492,12 @@ in listing~\ref{lst:minivar}.
|
|||
call to \textit{ec\_\-master\_\-activate()}, that will create the
|
||||
domain memory and configure the mapped process data image.
|
||||
\item[\normalfont\textcircled{\tiny 8} -- \textcircled{\tiny 12}] The
|
||||
configuration of the mapping of certain PDOs in a domain can easily
|
||||
configuration of the mapping of certain Pdos in a domain can easily
|
||||
be done with the help of an initialization array of the
|
||||
\textit{ec\_pdo\_reg\_t} type, defined as part of the realtime
|
||||
interface. Each record must contain the ASCII bus-address of the
|
||||
slave (see section~\ref{sec:addr}), the slave's vendor ID and
|
||||
product code, and the index and subindex of the PDO to map (these
|
||||
product code, and the index and subindex of the Pdo to map (these
|
||||
four fields can be specified in junction, by using one of the
|
||||
defines out of the \textit{include/ecdb.h} header). The last field
|
||||
has to be the address of the process data pointer, so it can later
|
||||
|
|
@ -4556,7 +4556,7 @@ The initialization of the minimal realtime module is done by the
|
|||
\textit{ecrt\_\-master\_\-create\_domain()} function also returns a
|
||||
pointer to the created domain, or \textit{NULL} in error case.
|
||||
\item[\normalfont\textcircled{\tiny 11}] The registration of domain
|
||||
PDOs with an initialization array results in a single function call.
|
||||
Pdos with an initialization array results in a single function call.
|
||||
Alternatively the data fields could be registered with individual
|
||||
calls of \textit{ecrt\_domain\_register\_pdo()}.
|
||||
\item[\normalfont\textcircled{\tiny 16}] After the configuration of
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ digraph slaveconf {
|
|||
preop -> end [label="PREOP req."]
|
||||
preop -> enter_sdo_conf [weight=10]
|
||||
enter_sdo_conf -> enter_safeop [label="No configuration"]
|
||||
enter_sdo_conf -> enter_mapping [label="No SDO configs"]
|
||||
enter_sdo_conf -> sdo_conf [label="SDO configs", weight=10]
|
||||
enter_sdo_conf -> enter_mapping [label="No Sdo configs"]
|
||||
enter_sdo_conf -> sdo_conf [label="Sdo configs", weight=10]
|
||||
sdo_conf -> sdo_conf
|
||||
sdo_conf -> error
|
||||
sdo_conf -> enter_mapping [weight=10]
|
||||
|
|
@ -44,7 +44,7 @@ digraph slaveconf {
|
|||
pdo_conf -> pdo_conf
|
||||
pdo_conf -> error
|
||||
pdo_conf -> enter_pdo_sync [weight=10]
|
||||
enter_pdo_sync -> pdo_sync [label="PDO SMs", weight=10]
|
||||
enter_pdo_sync -> pdo_sync [label="Pdo SMs", weight=10]
|
||||
enter_pdo_sync -> enter_fmmu
|
||||
pdo_sync -> pdo_sync
|
||||
pdo_sync -> error
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
%!PS-Adobe-2.0 EPSF-2.0
|
||||
%%Title: fmmus.fig
|
||||
%%Creator: fig2dev Version 3.2 Patchlevel 4
|
||||
%%CreationDate: Sat Aug 5 16:55:20 2006
|
||||
%%For: fp@jupiter (Florian Pose)
|
||||
%%CreationDate: Fri Feb 22 12:53:29 2008
|
||||
%%For: fp@fetlas (Florian Pose)
|
||||
%%BoundingBox: 0 0 555 299
|
||||
%%Magnification: 1.0000
|
||||
%%EndComments
|
||||
|
|
@ -47,7 +47,7 @@ $F2psDict /mtrx matrix put
|
|||
end
|
||||
save
|
||||
newpath 0 299 moveto 0 0 lineto 555 0 lineto 555 299 lineto closepath clip newpath
|
||||
-27.6 337.3 translate
|
||||
-27.6 337.9 translate
|
||||
1 -1 scale
|
||||
|
||||
% This junk string is used by the show operators
|
||||
|
|
@ -933,7 +933,7 @@ gs 1 -1 sc (Domain1 Image) col0 sh gr
|
|||
gs 1 -1 sc (Process data pointers) col0 sh gr
|
||||
/Helvetica ff 180.00 scf sf
|
||||
3735 4995 m
|
||||
gs 1 -1 sc (Registered PDOs) col0 sh gr
|
||||
gs 1 -1 sc (Registered Pdo entries) col0 sh gr
|
||||
% here ends figure;
|
||||
$F2psEnd
|
||||
rs
|
||||
|
|
|
|||
|
|
@ -206,18 +206,18 @@ Single
|
|||
3645 5265 3330 5265
|
||||
2 2 0 1 0 7 50 -1 42 0.000 0 0 -1 0 0 5
|
||||
3465 4815 3645 4815 3645 5040 3465 5040 3465 4815
|
||||
4 0 0 50 -1 16 12 0.0000 4 120 720 675 1395 RAM\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 120 660 4095 1350 SM1\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 120 720 6390 1395 RAM\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 120 1005 540 855 Slave0\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 120 1005 6255 855 Slave1\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 120 1125 7290 2745 FMMU0\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 120 1125 1980 2745 FMMU0\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 120 1125 3555 2745 FMMU1\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 120 1125 4725 2745 FMMU2\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 120 660 1755 1305 SM0\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 120 660 8190 1305 SM3\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 165 2235 1080 3825 Domain0 Image\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 165 2235 4050 3825 Domain1 Image\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 150 3090 3735 5310 Process data pointers\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 165 2520 3735 4995 Registered PDOs\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 420 675 1395 RAM\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 135 390 4095 1350 SM1\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 420 6390 1395 RAM\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 585 540 855 Slave0\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 135 585 6255 855 Slave1\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 135 675 7290 2745 FMMU0\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 135 675 1980 2745 FMMU0\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 135 675 3555 2745 FMMU1\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 135 675 4725 2745 FMMU2\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 135 390 1755 1305 SM0\001
|
||||
4 1 0 50 -1 16 12 0.0000 4 135 390 8190 1305 SM3\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 1290 1080 3825 Domain0 Image\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 1290 4050 3825 Domain1 Image\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 1815 3735 5310 Process data pointers\001
|
||||
4 0 0 50 -1 16 12 0.0000 4 180 1890 3735 4995 Registered Pdo entries\001
|
||||
|
|
|
|||
|
|
@ -233,10 +233,10 @@ int __init init_mini_module(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
printk(KERN_INFO PFX "Registering PDO entries...\n");
|
||||
printk(KERN_INFO PFX "Registering Pdo entries...\n");
|
||||
#ifdef PDOS
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -164,9 +164,9 @@ int __init init_mod(void)
|
|||
goto out_release_master;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "Registering PDOs...\n");
|
||||
printk(KERN_INFO "Registering Pdos...\n");
|
||||
if (ecrt_domain_register_pdo_list(domain1, domain1_pdos)) {
|
||||
printk(KERN_ERR "Failed to register PDOs.\n");
|
||||
printk(KERN_ERR "Failed to register Pdos.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,9 +179,9 @@ int __init init_mod(void)
|
|||
goto out_release_master;
|
||||
}
|
||||
|
||||
printk(KERN_INFO PFX "Registering PDOs...\n");
|
||||
printk(KERN_INFO PFX "Registering Pdos...\n");
|
||||
if (ecrt_domain_register_pdo_list(domain1, domain1_pdo_regs)) {
|
||||
printk(KERN_ERR PFX "PDO registration failed!\n");
|
||||
printk(KERN_ERR PFX "Pdo registration failed!\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ static struct kobj_type ktype_ec_sdo_entry = {
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
SDO constructor.
|
||||
Sdo constructor.
|
||||
*/
|
||||
|
||||
int ec_sdo_init(ec_sdo_t *sdo, /**< SDO */
|
||||
uint16_t index, /**< SDO index */
|
||||
int ec_sdo_init(ec_sdo_t *sdo, /**< Sdo */
|
||||
uint16_t index, /**< Sdo index */
|
||||
ec_slave_t *slave /**< parent slave */
|
||||
)
|
||||
{
|
||||
|
|
@ -122,7 +122,7 @@ int ec_sdo_init(ec_sdo_t *sdo, /**< SDO */
|
|||
return -1;
|
||||
}
|
||||
if (kobject_add(&sdo->kobj)) {
|
||||
EC_ERR("Failed to add SDO kobject.\n");
|
||||
EC_ERR("Failed to add Sdo kobject.\n");
|
||||
kobject_put(&sdo->kobj);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -133,11 +133,11 @@ int ec_sdo_init(ec_sdo_t *sdo, /**< SDO */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
SDO destructor.
|
||||
Clears and frees an SDO object.
|
||||
Sdo destructor.
|
||||
Clears and frees an Sdo object.
|
||||
*/
|
||||
|
||||
void ec_sdo_destroy(ec_sdo_t *sdo /**< SDO */)
|
||||
void ec_sdo_destroy(ec_sdo_t *sdo /**< Sdo */)
|
||||
{
|
||||
ec_sdo_entry_t *entry, *next;
|
||||
|
||||
|
|
@ -155,12 +155,12 @@ void ec_sdo_destroy(ec_sdo_t *sdo /**< SDO */)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Clear and free SDO.
|
||||
Clear and free Sdo.
|
||||
This method is called by the kobject,
|
||||
once there are no more references to it.
|
||||
*/
|
||||
|
||||
void ec_sdo_clear(struct kobject *kobj /**< SDO's kobject */)
|
||||
void ec_sdo_clear(struct kobject *kobj /**< Sdo's kobject */)
|
||||
{
|
||||
ec_sdo_t *sdo = container_of(kobj, ec_sdo_t, kobj);
|
||||
|
||||
|
|
@ -172,12 +172,12 @@ void ec_sdo_clear(struct kobject *kobj /**< SDO's kobject */)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Get and SDO entry from an SDO via its subindex.
|
||||
* \return pointer to SDO entry, or NULL.
|
||||
* Get and Sdo entry from an Sdo via its subindex.
|
||||
* \return pointer to Sdo entry, or NULL.
|
||||
*/
|
||||
|
||||
ec_sdo_entry_t *ec_sdo_get_entry(
|
||||
ec_sdo_t *sdo, /**< SDO */
|
||||
ec_sdo_t *sdo, /**< Sdo */
|
||||
uint8_t subindex /**< entry subindex */
|
||||
)
|
||||
{
|
||||
|
|
@ -194,11 +194,11 @@ ec_sdo_entry_t *ec_sdo_get_entry(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Print SDO information to a buffer.
|
||||
* Print Sdo information to a buffer.
|
||||
* /return size of bytes written to buffer.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_info(ec_sdo_t *sdo, /**< SDO */
|
||||
ssize_t ec_sdo_info(ec_sdo_t *sdo, /**< Sdo */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
{
|
||||
|
|
@ -214,7 +214,7 @@ ssize_t ec_sdo_info(ec_sdo_t *sdo, /**< SDO */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Show an SDO as Sysfs attribute.
|
||||
* Show an Sdo as Sysfs attribute.
|
||||
* /return size of bytes written to buffer.
|
||||
*/
|
||||
|
||||
|
|
@ -235,12 +235,12 @@ ssize_t ec_show_sdo_attribute(struct kobject *kobj, /**< kobject */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
SDO entry constructor.
|
||||
Sdo entry constructor.
|
||||
*/
|
||||
|
||||
int ec_sdo_entry_init(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
uint8_t subindex, /**< SDO entry subindex */
|
||||
ec_sdo_t *sdo /**< parent SDO */
|
||||
int ec_sdo_entry_init(ec_sdo_entry_t *entry, /**< Sdo entry */
|
||||
uint8_t subindex, /**< Sdo entry subindex */
|
||||
ec_sdo_t *sdo /**< parent Sdo */
|
||||
)
|
||||
{
|
||||
entry->sdo = sdo;
|
||||
|
|
@ -271,11 +271,11 @@ int ec_sdo_entry_init(ec_sdo_entry_t *entry, /**< SDO entry */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
SDO entry destructor.
|
||||
Clears and frees an SDO entry object.
|
||||
Sdo entry destructor.
|
||||
Clears and frees an Sdo entry object.
|
||||
*/
|
||||
|
||||
void ec_sdo_entry_destroy(ec_sdo_entry_t *entry /**< SDO entry */)
|
||||
void ec_sdo_entry_destroy(ec_sdo_entry_t *entry /**< Sdo entry */)
|
||||
{
|
||||
// destroy self
|
||||
kobject_del(&entry->kobj);
|
||||
|
|
@ -285,12 +285,12 @@ void ec_sdo_entry_destroy(ec_sdo_entry_t *entry /**< SDO entry */)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Clear and free SDO entry.
|
||||
Clear and free Sdo entry.
|
||||
This method is called by the kobject,
|
||||
once there are no more references to it.
|
||||
*/
|
||||
|
||||
void ec_sdo_entry_clear(struct kobject *kobj /**< SDO entry's kobject */)
|
||||
void ec_sdo_entry_clear(struct kobject *kobj /**< Sdo entry's kobject */)
|
||||
{
|
||||
ec_sdo_entry_t *entry = container_of(kobj, ec_sdo_entry_t, kobj);
|
||||
|
||||
|
|
@ -302,11 +302,11 @@ void ec_sdo_entry_clear(struct kobject *kobj /**< SDO entry's kobject */)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Print SDO entry information to a buffer.
|
||||
* Print Sdo entry information to a buffer.
|
||||
* \return number of bytes written.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_entry_info(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
ssize_t ec_sdo_entry_info(ec_sdo_entry_t *entry, /**< Sdo entry */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
{
|
||||
|
|
@ -328,8 +328,8 @@ ssize_t ec_sdo_entry_info(ec_sdo_entry_t *entry, /**< SDO entry */
|
|||
* \return number of bytes written.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_entry_format_data(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
ec_sdo_request_t *request, /**< SDO request */
|
||||
ssize_t ec_sdo_entry_format_data(ec_sdo_entry_t *entry, /**< Sdo entry */
|
||||
ec_sdo_request_t *request, /**< Sdo request */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
{
|
||||
|
|
@ -402,13 +402,13 @@ raw_data:
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Start SDO entry reading.
|
||||
* Start Sdo entry reading.
|
||||
* This function blocks, until reading is finished, and is interruptible as
|
||||
* long as the master state machine has not begun with reading.
|
||||
* \return number of bytes written to buffer, or error code.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_entry_read_value(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
ssize_t ec_sdo_entry_read_value(ec_sdo_entry_t *entry, /**< Sdo entry */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
{
|
||||
|
|
@ -452,7 +452,7 @@ ssize_t ec_sdo_entry_read_value(ec_sdo_entry_t *entry, /**< SDO entry */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Show an SDO entry as Sysfs attribute.
|
||||
* Show an Sdo entry as Sysfs attribute.
|
||||
* /return size of bytes written to buffer.
|
||||
*/
|
||||
|
||||
|
|
@ -476,11 +476,11 @@ ssize_t ec_show_sdo_entry_attribute(struct kobject *kobj, /**< kobject */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
SDO request constructor.
|
||||
Sdo request constructor.
|
||||
*/
|
||||
|
||||
void ec_sdo_request_init_read(ec_sdo_request_t *req, /**< SDO request */
|
||||
ec_sdo_entry_t *entry /**< SDO entry */
|
||||
void ec_sdo_request_init_read(ec_sdo_request_t *req, /**< Sdo request */
|
||||
ec_sdo_entry_t *entry /**< Sdo entry */
|
||||
)
|
||||
{
|
||||
req->entry = entry;
|
||||
|
|
@ -492,10 +492,10 @@ void ec_sdo_request_init_read(ec_sdo_request_t *req, /**< SDO request */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
SDO request destructor.
|
||||
Sdo request destructor.
|
||||
*/
|
||||
|
||||
void ec_sdo_request_clear(ec_sdo_request_t *req /**< SDO request */)
|
||||
void ec_sdo_request_clear(ec_sdo_request_t *req /**< Sdo request */)
|
||||
{
|
||||
if (req->data) kfree(req->data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
CANopen SDO.
|
||||
CANopen Sdo.
|
||||
*/
|
||||
|
||||
struct ec_sdo
|
||||
|
|
@ -58,9 +58,9 @@ struct ec_sdo
|
|||
struct kobject kobj; /**< kobject */
|
||||
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 subindices; /**< subindices */
|
||||
struct list_head entries; /**< entry list */
|
||||
};
|
||||
|
|
@ -68,14 +68,14 @@ struct ec_sdo
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
CANopen SDO entry.
|
||||
CANopen Sdo entry.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct kobject kobj; /**< kobject */
|
||||
struct list_head list; /**< list item */
|
||||
ec_sdo_t *sdo; /**< parent SDO */
|
||||
ec_sdo_t *sdo; /**< parent Sdo */
|
||||
uint8_t subindex; /**< entry subindex */
|
||||
uint16_t data_type; /**< entry data type */
|
||||
uint16_t bit_length; /**< entry length in bit */
|
||||
|
|
@ -86,32 +86,32 @@ ec_sdo_entry_t;
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
CANopen SDO configuration data.
|
||||
CANopen Sdo configuration data.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
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 size; /**< size of SDO data */
|
||||
uint16_t index; /**< Sdo index */
|
||||
uint8_t subindex; /**< Sdo subindex */
|
||||
uint8_t *data; /**< pointer to Sdo data */
|
||||
size_t size; /**< size of Sdo data */
|
||||
}
|
||||
ec_sdo_data_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
CANopen SDO request.
|
||||
CANopen Sdo request.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct list_head list; /**< list item */
|
||||
ec_sdo_entry_t *entry; /**< SDO entry */
|
||||
uint8_t *data; /**< pointer to SDO data */
|
||||
size_t size; /**< size of SDO data */
|
||||
ec_request_state_t state; /**< SDO request state */
|
||||
ec_sdo_entry_t *entry; /**< Sdo entry */
|
||||
uint8_t *data; /**< pointer to Sdo data */
|
||||
size_t size; /**< size of Sdo data */
|
||||
ec_request_state_t state; /**< Sdo request state */
|
||||
}
|
||||
ec_sdo_request_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@
|
|||
/** 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(
|
||||
ec_fmmu_config_t *fmmu, /**< EtherCAT FMMU configuration. */
|
||||
ec_slave_config_t *sc, /**< EtherCAT slave configuration. */
|
||||
ec_domain_t *domain, /**< EtherCAT domain. */
|
||||
ec_direction_t dir /**< PDO direction. */
|
||||
ec_direction_t dir /**< Pdo direction. */
|
||||
)
|
||||
{
|
||||
fmmu->sc = sc;
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ typedef struct
|
|||
{
|
||||
const ec_slave_config_t *sc; /**< EtherCAT slave config. */
|
||||
const ec_domain_t *domain; /**< Domain. */
|
||||
ec_direction_t dir; /**< PDO direction. */
|
||||
ec_direction_t dir; /**< Pdo 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;
|
||||
|
||||
|
|
|
|||
204
master/fsm_coe.c
204
master/fsm_coe.c
|
|
@ -75,24 +75,24 @@ void ec_fsm_coe_error(ec_fsm_coe_t *);
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
SDO abort messages.
|
||||
The "abort SDO transfer request" supplies an abort code,
|
||||
Sdo abort messages.
|
||||
The "abort Sdo transfer request" supplies an abort code,
|
||||
which can be translated to clear text. This table does
|
||||
the mapping of the codes and messages.
|
||||
*/
|
||||
|
||||
const ec_code_msg_t sdo_abort_messages[] = {
|
||||
{0x05030000, "Toggle bit not changed"},
|
||||
{0x05040000, "SDO protocol timeout"},
|
||||
{0x05040000, "Sdo protocol timeout"},
|
||||
{0x05040001, "Client/Server command specifier not valid or unknown"},
|
||||
{0x05040005, "Out of memory"},
|
||||
{0x06010000, "Unsupported access to an object"},
|
||||
{0x06010001, "Attempt to read a write-only object"},
|
||||
{0x06010002, "Attempt to write a read-only object"},
|
||||
{0x06020000, "This object does not exist in the object directory"},
|
||||
{0x06040041, "The object cannot be mapped into the PDO"},
|
||||
{0x06040041, "The object cannot be mapped into the Pdo"},
|
||||
{0x06040042, "The number and length of the objects to be mapped would"
|
||||
" exceed the PDO length"},
|
||||
" exceed the Pdo length"},
|
||||
{0x06040043, "General parameter incompatibility reason"},
|
||||
{0x06040047, "Gerneral internal incompatibility in device"},
|
||||
{0x06060000, "Access failure due to a hardware error"},
|
||||
|
|
@ -121,7 +121,7 @@ const ec_code_msg_t sdo_abort_messages[] = {
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Outputs an SDO abort message.
|
||||
Outputs an Sdo abort message.
|
||||
*/
|
||||
|
||||
void ec_canopen_abort_msg(uint32_t abort_code)
|
||||
|
|
@ -130,13 +130,13 @@ void ec_canopen_abort_msg(uint32_t abort_code)
|
|||
|
||||
for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) {
|
||||
if (abort_msg->code == abort_code) {
|
||||
EC_ERR("SDO abort message 0x%08X: \"%s\".\n",
|
||||
EC_ERR("Sdo abort message 0x%08X: \"%s\".\n",
|
||||
abort_msg->code, abort_msg->message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code);
|
||||
EC_ERR("Unknown Sdo abort code 0x%08X.\n", abort_code);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -166,7 +166,7 @@ void ec_fsm_coe_clear(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Starts reading a slaves' SDO dictionary.
|
||||
Starts reading a slaves' Sdo dictionary.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_dictionary(ec_fsm_coe_t *fsm, /**< finite state machine */
|
||||
|
|
@ -180,12 +180,12 @@ void ec_fsm_coe_dictionary(ec_fsm_coe_t *fsm, /**< finite state machine */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Starts to download an SDO to a slave.
|
||||
Starts to download an Sdo to a slave.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_download(ec_fsm_coe_t *fsm, /**< finite state machine */
|
||||
ec_slave_t *slave, /**< EtherCAT slave */
|
||||
ec_sdo_data_t *sdodata /**< SDO data object */
|
||||
ec_sdo_data_t *sdodata /**< Sdo data object */
|
||||
)
|
||||
{
|
||||
fsm->slave = slave;
|
||||
|
|
@ -196,12 +196,12 @@ void ec_fsm_coe_download(ec_fsm_coe_t *fsm, /**< finite state machine */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Starts to upload an SDO from a slave.
|
||||
Starts to upload an Sdo from a slave.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_upload(ec_fsm_coe_t *fsm, /**< finite state machine */
|
||||
ec_slave_t *slave, /**< EtherCAT slave */
|
||||
ec_sdo_request_t *request /**< SDO request */
|
||||
ec_sdo_request_t *request /**< Sdo request */
|
||||
)
|
||||
{
|
||||
fsm->slave = slave;
|
||||
|
|
@ -254,11 +254,11 @@ void ec_fsm_coe_dict_start(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x8 << 12); // SDO information
|
||||
EC_WRITE_U16(data, 0x8 << 12); // Sdo information
|
||||
EC_WRITE_U8 (data + 2, 0x01); // Get OD List Request
|
||||
EC_WRITE_U8 (data + 3, 0x00);
|
||||
EC_WRITE_U16(data + 4, 0x0000);
|
||||
EC_WRITE_U16(data + 6, 0x0001); // deliver all SDOs!
|
||||
EC_WRITE_U16(data + 6, 0x0001); // deliver all Sdos!
|
||||
|
||||
fsm->retries = EC_FSM_RETRIES;
|
||||
fsm->state = ec_fsm_coe_dict_request;
|
||||
|
|
@ -336,7 +336,7 @@ void ec_fsm_coe_dict_check(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
if (datagram->cycles_received
|
||||
- fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Timeout while checking SDO dictionary on slave %i.\n",
|
||||
EC_ERR("Timeout while checking Sdo dictionary on slave %i.\n",
|
||||
slave->ring_position);
|
||||
return;
|
||||
}
|
||||
|
|
@ -400,18 +400,18 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information
|
||||
if (EC_READ_U16(data) >> 12 == 0x8 && // Sdo information
|
||||
(EC_READ_U8(data + 2) & 0x7F) == 0x07) { // error response
|
||||
EC_ERR("SDO information error response at slave %i!\n",
|
||||
EC_ERR("Sdo information error response at slave %i!\n",
|
||||
slave->ring_position);
|
||||
ec_canopen_abort_msg(EC_READ_U32(data + 6));
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information
|
||||
if (EC_READ_U16(data) >> 12 != 0x8 || // Sdo information
|
||||
(EC_READ_U8 (data + 2) & 0x7F) != 0x02) { // Get OD List response
|
||||
EC_ERR("Invalid SDO list response at slave %i!\n",
|
||||
EC_ERR("Invalid Sdo list response at slave %i!\n",
|
||||
slave->ring_position);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
|
|
@ -431,19 +431,19 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
sdo_index = EC_READ_U16(data + 8 + i * 2);
|
||||
if (!sdo_index) {
|
||||
if (slave->master->debug_level)
|
||||
EC_WARN("SDO dictionary of slave %i contains index 0x0000.\n",
|
||||
EC_WARN("Sdo dictionary of slave %i contains index 0x0000.\n",
|
||||
slave->ring_position);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(sdo = (ec_sdo_t *) kmalloc(sizeof(ec_sdo_t), GFP_ATOMIC))) {
|
||||
EC_ERR("Failed to allocate memory for SDO!\n");
|
||||
EC_ERR("Failed to allocate memory for Sdo!\n");
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ec_sdo_init(sdo, sdo_index, slave)) {
|
||||
EC_ERR("Failed to init SDO!\n");
|
||||
EC_ERR("Failed to init Sdo!\n");
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
|
@ -453,7 +453,7 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
|
||||
fragments_left = EC_READ_U16(data + 4);
|
||||
if (slave->master->debug_level && fragments_left) {
|
||||
EC_DBG("SDO list fragments left: %u\n", fragments_left);
|
||||
EC_DBG("Sdo list fragments left: %u\n", fragments_left);
|
||||
}
|
||||
|
||||
if (EC_READ_U8(data + 2) & 0x80 || fragments_left) { // more messages waiting. check again.
|
||||
|
|
@ -465,12 +465,12 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
}
|
||||
|
||||
if (list_empty(&slave->sdo_dictionary)) {
|
||||
// no SDOs in dictionary. finished.
|
||||
// no Sdos in dictionary. finished.
|
||||
fsm->state = ec_fsm_coe_end; // success
|
||||
return;
|
||||
}
|
||||
|
||||
// fetch SDO descriptions
|
||||
// fetch Sdo descriptions
|
||||
fsm->sdo = list_entry(slave->sdo_dictionary.next, ec_sdo_t, list);
|
||||
|
||||
if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) {
|
||||
|
|
@ -478,11 +478,11 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x8 << 12); // SDO information
|
||||
EC_WRITE_U16(data, 0x8 << 12); // Sdo information
|
||||
EC_WRITE_U8 (data + 2, 0x03); // Get object description request
|
||||
EC_WRITE_U8 (data + 3, 0x00);
|
||||
EC_WRITE_U16(data + 4, 0x0000);
|
||||
EC_WRITE_U16(data + 6, fsm->sdo->index); // SDO index
|
||||
EC_WRITE_U16(data + 6, fsm->sdo->index); // Sdo index
|
||||
|
||||
fsm->retries = EC_FSM_RETRIES;
|
||||
fsm->state = ec_fsm_coe_dict_desc_request;
|
||||
|
|
@ -505,7 +505,7 @@ void ec_fsm_coe_dict_desc_request(ec_fsm_coe_t *fsm /**< finite state machine */
|
|||
|
||||
if (datagram->state != EC_DATAGRAM_RECEIVED) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Failed to receive CoE SDO description request datagram for"
|
||||
EC_ERR("Failed to receive CoE Sdo description request datagram for"
|
||||
" slave %i (datagram state %i).\n",
|
||||
slave->ring_position, datagram->state);
|
||||
return;
|
||||
|
|
@ -513,7 +513,7 @@ void ec_fsm_coe_dict_desc_request(ec_fsm_coe_t *fsm /**< finite state machine */
|
|||
|
||||
if (datagram->working_counter != 1) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Reception of CoE SDO description"
|
||||
EC_ERR("Reception of CoE Sdo description"
|
||||
" request failed on slave %i: ", slave->ring_position);
|
||||
ec_datagram_print_wc_error(datagram);
|
||||
return;
|
||||
|
|
@ -560,7 +560,7 @@ void ec_fsm_coe_dict_desc_check(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
if (datagram->cycles_received
|
||||
- fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Timeout while checking SDO description on slave %i.\n",
|
||||
EC_ERR("Timeout while checking Sdo description on slave %i.\n",
|
||||
slave->ring_position);
|
||||
return;
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ void ec_fsm_coe_dict_desc_response(ec_fsm_coe_t *fsm
|
|||
|
||||
if (datagram->state != EC_DATAGRAM_RECEIVED) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Failed to receive CoE SDO description response datagram from"
|
||||
EC_ERR("Failed to receive CoE Sdo description response datagram from"
|
||||
" slave %i (datagram state %i).\n",
|
||||
slave->ring_position, datagram->state);
|
||||
return;
|
||||
|
|
@ -605,7 +605,7 @@ void ec_fsm_coe_dict_desc_response(ec_fsm_coe_t *fsm
|
|||
|
||||
if (datagram->working_counter != 1) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Reception of CoE SDO description"
|
||||
EC_ERR("Reception of CoE Sdo description"
|
||||
" response failed on slave %i: ", slave->ring_position);
|
||||
ec_datagram_print_wc_error(datagram);
|
||||
return;
|
||||
|
|
@ -623,21 +623,21 @@ void ec_fsm_coe_dict_desc_response(ec_fsm_coe_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information
|
||||
if (EC_READ_U16(data) >> 12 == 0x8 && // Sdo information
|
||||
(EC_READ_U8 (data + 2) & 0x7F) == 0x07) { // error response
|
||||
EC_ERR("SDO information error response at slave %i while"
|
||||
" fetching SDO 0x%04X!\n", slave->ring_position,
|
||||
EC_ERR("Sdo information error response at slave %i while"
|
||||
" fetching Sdo 0x%04X!\n", slave->ring_position,
|
||||
sdo->index);
|
||||
ec_canopen_abort_msg(EC_READ_U32(data + 6));
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information
|
||||
if (EC_READ_U16(data) >> 12 != 0x8 || // Sdo information
|
||||
(EC_READ_U8 (data + 2) & 0x7F) != 0x04 || // Object desc. response
|
||||
EC_READ_U16(data + 6) != sdo->index) { // SDO index
|
||||
EC_READ_U16(data + 6) != sdo->index) { // Sdo index
|
||||
EC_ERR("Invalid object description response at slave %i while"
|
||||
" fetching SDO 0x%04X!\n", slave->ring_position,
|
||||
" fetching Sdo 0x%04X!\n", slave->ring_position,
|
||||
sdo->index);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
|
|
@ -657,7 +657,7 @@ void ec_fsm_coe_dict_desc_response(ec_fsm_coe_t *fsm
|
|||
name_size = rec_size - 12;
|
||||
if (name_size) {
|
||||
if (!(sdo->name = kmalloc(name_size + 1, GFP_ATOMIC))) {
|
||||
EC_ERR("Failed to allocate SDO name!\n");
|
||||
EC_ERR("Failed to allocate Sdo name!\n");
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
|
@ -681,12 +681,12 @@ void ec_fsm_coe_dict_desc_response(ec_fsm_coe_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x8 << 12); // SDO information
|
||||
EC_WRITE_U16(data, 0x8 << 12); // Sdo information
|
||||
EC_WRITE_U8 (data + 2, 0x05); // Get entry description request
|
||||
EC_WRITE_U8 (data + 3, 0x00);
|
||||
EC_WRITE_U16(data + 4, 0x0000);
|
||||
EC_WRITE_U16(data + 6, sdo->index); // SDO index
|
||||
EC_WRITE_U8 (data + 8, fsm->subindex); // SDO subindex
|
||||
EC_WRITE_U16(data + 6, sdo->index); // Sdo index
|
||||
EC_WRITE_U8 (data + 8, fsm->subindex); // Sdo subindex
|
||||
EC_WRITE_U8 (data + 9, 0x00); // value info (no values)
|
||||
|
||||
fsm->retries = EC_FSM_RETRIES;
|
||||
|
|
@ -711,7 +711,7 @@ void ec_fsm_coe_dict_entry_request(ec_fsm_coe_t *fsm
|
|||
|
||||
if (datagram->state != EC_DATAGRAM_RECEIVED) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Failed to receive CoE SDO entry request datagram for"
|
||||
EC_ERR("Failed to receive CoE Sdo entry request datagram for"
|
||||
" slave %i (datagram state %i).\n",
|
||||
slave->ring_position, datagram->state);
|
||||
return;
|
||||
|
|
@ -719,7 +719,7 @@ void ec_fsm_coe_dict_entry_request(ec_fsm_coe_t *fsm
|
|||
|
||||
if (datagram->working_counter != 1) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Reception of CoE SDO entry request failed on slave %i: ",
|
||||
EC_ERR("Reception of CoE Sdo entry request failed on slave %i: ",
|
||||
slave->ring_position);
|
||||
ec_datagram_print_wc_error(datagram);
|
||||
return;
|
||||
|
|
@ -767,7 +767,7 @@ void ec_fsm_coe_dict_entry_check(ec_fsm_coe_t *fsm
|
|||
if (datagram->cycles_received
|
||||
- fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Timeout while checking SDO entry on slave %i.\n",
|
||||
EC_ERR("Timeout while checking Sdo entry on slave %i.\n",
|
||||
slave->ring_position);
|
||||
return;
|
||||
}
|
||||
|
|
@ -805,7 +805,7 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
|
|||
|
||||
if (datagram->state != EC_DATAGRAM_RECEIVED) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Failed to receive CoE SDO description response datagram from"
|
||||
EC_ERR("Failed to receive CoE Sdo description response datagram from"
|
||||
" slave %i (datagram state %i).\n",
|
||||
slave->ring_position, datagram->state);
|
||||
return;
|
||||
|
|
@ -813,7 +813,7 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
|
|||
|
||||
if (datagram->working_counter != 1) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Reception of CoE SDO description"
|
||||
EC_ERR("Reception of CoE Sdo description"
|
||||
" response failed on slave %i: ", slave->ring_position);
|
||||
ec_datagram_print_wc_error(datagram);
|
||||
return;
|
||||
|
|
@ -831,22 +831,22 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information
|
||||
if (EC_READ_U16(data) >> 12 == 0x8 && // Sdo information
|
||||
(EC_READ_U8 (data + 2) & 0x7F) == 0x07) { // error response
|
||||
EC_ERR("SDO information error response at slave %i while"
|
||||
" fetching SDO entry 0x%04X:%i!\n", slave->ring_position,
|
||||
EC_ERR("Sdo information error response at slave %i while"
|
||||
" fetching Sdo entry 0x%04X:%i!\n", slave->ring_position,
|
||||
sdo->index, fsm->subindex);
|
||||
ec_canopen_abort_msg(EC_READ_U32(data + 6));
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information
|
||||
if (EC_READ_U16(data) >> 12 != 0x8 || // Sdo information
|
||||
(EC_READ_U8(data + 2) & 0x7F) != 0x06 || // Entry desc. response
|
||||
EC_READ_U16(data + 6) != sdo->index || // SDO index
|
||||
EC_READ_U8(data + 8) != fsm->subindex) { // SDO subindex
|
||||
EC_READ_U16(data + 6) != sdo->index || // Sdo index
|
||||
EC_READ_U8(data + 8) != fsm->subindex) { // Sdo subindex
|
||||
EC_ERR("Invalid entry description response at slave %i while"
|
||||
" fetching SDO entry 0x%04X:%i!\n", slave->ring_position,
|
||||
" fetching Sdo entry 0x%04X:%i!\n", slave->ring_position,
|
||||
sdo->index, fsm->subindex);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
|
|
@ -881,7 +881,7 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
|
|||
if (data_size) {
|
||||
uint8_t *desc;
|
||||
if (!(desc = kmalloc(data_size + 1, GFP_ATOMIC))) {
|
||||
EC_ERR("Failed to allocate SDO entry name!\n");
|
||||
EC_ERR("Failed to allocate Sdo entry name!\n");
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
|
@ -900,12 +900,12 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x8 << 12); // SDO information
|
||||
EC_WRITE_U16(data, 0x8 << 12); // Sdo information
|
||||
EC_WRITE_U8 (data + 2, 0x05); // Get entry description request
|
||||
EC_WRITE_U8 (data + 3, 0x00);
|
||||
EC_WRITE_U16(data + 4, 0x0000);
|
||||
EC_WRITE_U16(data + 6, sdo->index); // SDO index
|
||||
EC_WRITE_U8 (data + 8, fsm->subindex); // SDO subindex
|
||||
EC_WRITE_U16(data + 6, sdo->index); // Sdo index
|
||||
EC_WRITE_U8 (data + 8, fsm->subindex); // Sdo subindex
|
||||
EC_WRITE_U8 (data + 9, 0x00); // value info (no values)
|
||||
|
||||
fsm->retries = EC_FSM_RETRIES;
|
||||
|
|
@ -913,7 +913,7 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
// another SDO description to fetch?
|
||||
// another Sdo description to fetch?
|
||||
if (fsm->sdo->list.next != &slave->sdo_dictionary) {
|
||||
fsm->sdo = list_entry(fsm->sdo->list.next, ec_sdo_t, list);
|
||||
|
||||
|
|
@ -922,11 +922,11 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x8 << 12); // SDO information
|
||||
EC_WRITE_U16(data, 0x8 << 12); // Sdo information
|
||||
EC_WRITE_U8 (data + 2, 0x03); // Get object description request
|
||||
EC_WRITE_U8 (data + 3, 0x00);
|
||||
EC_WRITE_U16(data + 4, 0x0000);
|
||||
EC_WRITE_U16(data + 6, fsm->sdo->index); // SDO index
|
||||
EC_WRITE_U16(data + 6, fsm->sdo->index); // Sdo index
|
||||
|
||||
fsm->retries = EC_FSM_RETRIES;
|
||||
fsm->state = ec_fsm_coe_dict_desc_request;
|
||||
|
|
@ -952,11 +952,11 @@ void ec_fsm_coe_down_start(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
uint8_t *data;
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Downloading SDO 0x%04X:%i to slave %i.\n",
|
||||
EC_DBG("Downloading Sdo 0x%04X:%i to slave %i.\n",
|
||||
sdodata->index, sdodata->subindex, slave->ring_position);
|
||||
|
||||
if (slave->sii_rx_mailbox_size < 6 + 10 + sdodata->size) {
|
||||
EC_ERR("SDO fragmenting not supported yet!\n");
|
||||
EC_ERR("Sdo fragmenting not supported yet!\n");
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
|
@ -967,7 +967,7 @@ void ec_fsm_coe_down_start(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x2 << 12); // SDO request
|
||||
EC_WRITE_U16(data, 0x2 << 12); // Sdo request
|
||||
EC_WRITE_U8 (data + 2, (0x1 // size specified
|
||||
| 0x1 << 5)); // Download request
|
||||
EC_WRITE_U16(data + 3, sdodata->index);
|
||||
|
|
@ -1051,7 +1051,7 @@ void ec_fsm_coe_down_check(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
if (datagram->cycles_received
|
||||
- fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Timeout while checking SDO configuration on slave %i.\n",
|
||||
EC_ERR("Timeout while checking Sdo configuration on slave %i.\n",
|
||||
slave->ring_position);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1120,10 +1120,10 @@ void ec_fsm_coe_down_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
|
||||
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
|
||||
if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request
|
||||
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("SDO download 0x%04X:%X (%i bytes) aborted on slave %i.\n",
|
||||
EC_ERR("Sdo download 0x%04X:%X (%i bytes) aborted on slave %i.\n",
|
||||
sdodata->index, sdodata->subindex, sdodata->size,
|
||||
slave->ring_position);
|
||||
if (rec_size < 10) {
|
||||
|
|
@ -1135,14 +1135,14 @@ void ec_fsm_coe_down_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response
|
||||
EC_READ_U8 (data + 2) >> 5 != 0x3 || // Download response
|
||||
EC_READ_U16(data + 3) != sdodata->index || // index
|
||||
EC_READ_U8 (data + 5) != sdodata->subindex) { // subindex
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("SDO download 0x%04X:%X (%i bytes) failed:\n",
|
||||
EC_ERR("Sdo download 0x%04X:%X (%i bytes) failed:\n",
|
||||
sdodata->index, sdodata->subindex, sdodata->size);
|
||||
EC_ERR("Invalid SDO download response at slave %i!\n",
|
||||
EC_ERR("Invalid Sdo download response at slave %i!\n",
|
||||
slave->ring_position);
|
||||
ec_print_data(data, rec_size);
|
||||
return;
|
||||
|
|
@ -1167,7 +1167,7 @@ void ec_fsm_coe_up_start(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
uint8_t *data;
|
||||
|
||||
if (master->debug_level)
|
||||
EC_DBG("Uploading SDO 0x%04X:%i from slave %i.\n",
|
||||
EC_DBG("Uploading Sdo 0x%04X:%i from slave %i.\n",
|
||||
entry->sdo->index, entry->subindex, slave->ring_position);
|
||||
|
||||
if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) {
|
||||
|
|
@ -1175,7 +1175,7 @@ void ec_fsm_coe_up_start(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x2 << 12); // SDO request
|
||||
EC_WRITE_U16(data, 0x2 << 12); // Sdo request
|
||||
EC_WRITE_U8 (data + 2, 0x2 << 5); // initiate upload request
|
||||
EC_WRITE_U16(data + 3, entry->sdo->index);
|
||||
EC_WRITE_U8 (data + 5, entry->subindex);
|
||||
|
|
@ -1262,7 +1262,7 @@ void ec_fsm_coe_up_check(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
if (datagram->cycles_received
|
||||
- fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Timeout while checking SDO upload on slave %i.\n",
|
||||
EC_ERR("Timeout while checking Sdo upload on slave %i.\n",
|
||||
slave->ring_position);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1334,15 +1334,15 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
}
|
||||
|
||||
if (rec_size < 3) {
|
||||
EC_ERR("Received currupted SDO upload response (%u bytes)!\n", rec_size);
|
||||
EC_ERR("Received currupted Sdo upload response (%u bytes)!\n", rec_size);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
|
||||
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
|
||||
EC_ERR("SDO upload 0x%04X:%X aborted on slave %i.\n",
|
||||
if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request
|
||||
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request
|
||||
EC_ERR("Sdo upload 0x%04X:%X aborted on slave %i.\n",
|
||||
entry->sdo->index, entry->subindex, slave->ring_position);
|
||||
if (rec_size >= 10)
|
||||
ec_canopen_abort_msg(EC_READ_U32(data + 6));
|
||||
|
|
@ -1363,19 +1363,19 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
|
||||
if (expedited) {
|
||||
if (rec_size < 7) {
|
||||
EC_ERR("Received currupted SDO expedited upload"
|
||||
EC_ERR("Received currupted Sdo expedited upload"
|
||||
" response (only %u bytes)!\n", rec_size);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response
|
||||
EC_READ_U8 (data + 2) >> 5 != 0x2 || // upload response
|
||||
EC_READ_U16(data + 3) != entry->sdo->index || // index
|
||||
EC_READ_U8 (data + 5) != entry->subindex) { // subindex
|
||||
EC_ERR("SDO upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
|
||||
EC_ERR("Invalid SDO upload response at slave %i!\n",
|
||||
EC_ERR("Sdo upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
|
||||
EC_ERR("Invalid Sdo upload response at slave %i!\n",
|
||||
slave->ring_position);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
|
|
@ -1390,7 +1390,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
}
|
||||
|
||||
if (rec_size < 6 + complete_size) {
|
||||
EC_ERR("Received currupted SDO expedited upload"
|
||||
EC_ERR("Received currupted Sdo expedited upload"
|
||||
" response (only %u bytes)!\n", rec_size);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
|
|
@ -1399,7 +1399,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
|
||||
if (!(request->data = (uint8_t *)
|
||||
kmalloc(complete_size + 1, GFP_ATOMIC))) {
|
||||
EC_ERR("Failed to allocate %i bytes of SDO data!\n",
|
||||
EC_ERR("Failed to allocate %i bytes of Sdo data!\n",
|
||||
complete_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
|
|
@ -1411,19 +1411,19 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
|
||||
} else { // normal
|
||||
if (rec_size < 10) {
|
||||
EC_ERR("Received currupted SDO normal upload"
|
||||
EC_ERR("Received currupted Sdo normal upload"
|
||||
" response (only %u bytes)!\n", rec_size);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response
|
||||
EC_READ_U8 (data + 2) >> 5 != 0x2 || // upload response
|
||||
EC_READ_U16(data + 3) != entry->sdo->index || // index
|
||||
EC_READ_U8 (data + 5) != entry->subindex) { // subindex
|
||||
EC_ERR("SDO upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
|
||||
EC_ERR("Invalid SDO upload response at slave %i!\n",
|
||||
EC_ERR("Sdo upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
|
||||
EC_ERR("Invalid Sdo upload response at slave %i!\n",
|
||||
slave->ring_position);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
|
|
@ -1442,7 +1442,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
|
||||
if (!(request->data = (uint8_t *)
|
||||
kmalloc(complete_size + 1, GFP_ATOMIC))) {
|
||||
EC_ERR("Failed to allocate %i bytes of SDO data!\n",
|
||||
EC_ERR("Failed to allocate %i bytes of Sdo data!\n",
|
||||
complete_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
|
|
@ -1454,7 +1454,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
fsm->toggle = 0;
|
||||
|
||||
if (data_size < complete_size) {
|
||||
EC_WARN("SDO data incomplete (%i / %i).\n",
|
||||
EC_WARN("Sdo data incomplete (%i / %i).\n",
|
||||
data_size, complete_size);
|
||||
|
||||
if (!(data = ec_slave_mbox_prepare_send(slave, datagram,
|
||||
|
|
@ -1463,7 +1463,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x2 << 12); // SDO request
|
||||
EC_WRITE_U16(data, 0x2 << 12); // Sdo request
|
||||
EC_WRITE_U8 (data + 2, (fsm->toggle << 4 // toggle
|
||||
| 0x3 << 5)); // upload segment request
|
||||
|
||||
|
|
@ -1553,7 +1553,7 @@ void ec_fsm_coe_up_seg_check(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
if (datagram->cycles_received
|
||||
- fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_ERR("Timeout while checking SDO upload segment on slave %i.\n",
|
||||
EC_ERR("Timeout while checking Sdo upload segment on slave %i.\n",
|
||||
slave->ring_position);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1625,25 +1625,25 @@ void ec_fsm_coe_up_seg_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
}
|
||||
|
||||
if (rec_size < 10) {
|
||||
EC_ERR("Received currupted SDO upload segment response!\n");
|
||||
EC_ERR("Received currupted Sdo upload segment response!\n");
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
|
||||
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
|
||||
EC_ERR("SDO upload 0x%04X:%X aborted on slave %i.\n",
|
||||
if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request
|
||||
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request
|
||||
EC_ERR("Sdo upload 0x%04X:%X aborted on slave %i.\n",
|
||||
entry->sdo->index, entry->subindex, slave->ring_position);
|
||||
ec_canopen_abort_msg(EC_READ_U32(data + 6));
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
|
||||
if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response
|
||||
EC_READ_U8 (data + 2) >> 5 != 0x0) { // upload segment response
|
||||
EC_ERR("SDO upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
|
||||
EC_ERR("Invalid SDO upload segment response at slave %i!\n",
|
||||
EC_ERR("Sdo upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
|
||||
EC_ERR("Invalid Sdo upload segment response at slave %i!\n",
|
||||
slave->ring_position);
|
||||
ec_print_data(data, rec_size);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
|
|
@ -1655,7 +1655,7 @@ void ec_fsm_coe_up_seg_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
data_size = rec_size - 10;
|
||||
|
||||
if (data_size != seg_size) {
|
||||
EC_WARN("SDO segment data invalid (%i / %i)"
|
||||
EC_WARN("Sdo segment data invalid (%i / %i)"
|
||||
" - Fragmenting not implemented.\n",
|
||||
data_size, seg_size);
|
||||
}
|
||||
|
|
@ -1671,7 +1671,7 @@ void ec_fsm_coe_up_seg_response(ec_fsm_coe_t *fsm /**< finite state machine */)
|
|||
return;
|
||||
}
|
||||
|
||||
EC_WRITE_U16(data, 0x2 << 12); // SDO request
|
||||
EC_WRITE_U16(data, 0x2 << 12); // Sdo request
|
||||
EC_WRITE_U8 (data + 2, (fsm->toggle << 4 // toggle
|
||||
| 0x3 << 5)); // upload segment request
|
||||
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@ struct ec_fsm_coe
|
|||
unsigned int retries; /**< retries upon datagram timeout */
|
||||
|
||||
void (*state)(ec_fsm_coe_t *); /**< CoE state function */
|
||||
ec_sdo_data_t *sdodata; /**< input/output: SDO data object */
|
||||
ec_sdo_data_t *sdodata; /**< input/output: Sdo data object */
|
||||
cycles_t cycles_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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void ec_fsm_coe_map_clear(ec_fsm_coe_map_t *fsm /**< finite state machine */)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Starts to upload an SDO from a slave.
|
||||
Starts to upload an Sdo from a slave.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_start(
|
||||
|
|
@ -163,13 +163,13 @@ void ec_fsm_coe_map_action_next_sync(
|
|||
continue;
|
||||
|
||||
if (slave->master->debug_level)
|
||||
EC_DBG("Reading PDO mapping of sync manager %u of slave %u.\n",
|
||||
EC_DBG("Reading Pdo mapping of sync manager %u of slave %u.\n",
|
||||
fsm->sync_index, slave->ring_position);
|
||||
|
||||
ec_pdo_mapping_clear_pdos(&fsm->mapping);
|
||||
|
||||
if (!(entry = ec_sdo_get_entry(fsm->sync_sdo, 0))) {
|
||||
EC_ERR("SDO 0x%04X has no subindex 0 on slave %u.\n",
|
||||
EC_ERR("Sdo 0x%04X has no subindex 0 on slave %u.\n",
|
||||
fsm->sync_sdo->index,
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_coe_map_state_error;
|
||||
|
|
@ -189,7 +189,7 @@ void ec_fsm_coe_map_action_next_sync(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Count mapped PDOs.
|
||||
* Count mapped Pdos.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo_count(
|
||||
|
|
@ -199,7 +199,7 @@ void ec_fsm_coe_map_state_pdo_count(
|
|||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to read number of mapped PDOs from slave %u.\n",
|
||||
EC_ERR("Failed to read number of mapped Pdos from slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_coe_map_state_error;
|
||||
return;
|
||||
|
|
@ -208,9 +208,9 @@ void ec_fsm_coe_map_state_pdo_count(
|
|||
fsm->sync_subindices = EC_READ_U8(fsm->request.data);
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG(" %u PDOs mapped.\n", fsm->sync_subindices);
|
||||
EC_DBG(" %u Pdos mapped.\n", fsm->sync_subindices);
|
||||
|
||||
// read first PDO
|
||||
// read first Pdo
|
||||
fsm->sync_subindex = 1;
|
||||
ec_fsm_coe_map_action_next_pdo(fsm);
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ void ec_fsm_coe_map_state_pdo_count(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read next PDO.
|
||||
* Read next Pdo.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_action_next_pdo(
|
||||
|
|
@ -230,7 +230,7 @@ void ec_fsm_coe_map_action_next_pdo(
|
|||
if (fsm->sync_subindex <= fsm->sync_subindices) {
|
||||
if (!(entry = ec_sdo_get_entry(fsm->sync_sdo,
|
||||
fsm->sync_subindex))) {
|
||||
EC_ERR("SDO 0x%04X has no subindex %u on slave %u.\n",
|
||||
EC_ERR("Sdo 0x%04X has no subindex %u on slave %u.\n",
|
||||
fsm->sync_sdo->index,
|
||||
fsm->sync_subindex,
|
||||
fsm->slave->ring_position);
|
||||
|
|
@ -265,7 +265,7 @@ void ec_fsm_coe_map_action_next_pdo(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Fetch PDO information.
|
||||
* Fetch Pdo information.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo(
|
||||
|
|
@ -275,7 +275,7 @@ void ec_fsm_coe_map_state_pdo(
|
|||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to read mapped PDO index from slave %u.\n",
|
||||
EC_ERR("Failed to read mapped Pdo index from slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_coe_map_state_error;
|
||||
return;
|
||||
|
|
@ -286,7 +286,7 @@ void ec_fsm_coe_map_state_pdo(
|
|||
|
||||
if (!(fsm->pdo = (ec_pdo_t *)
|
||||
kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate PDO.\n");
|
||||
EC_ERR("Failed to allocate Pdo.\n");
|
||||
fsm->state = ec_fsm_coe_map_state_error;
|
||||
return;
|
||||
}
|
||||
|
|
@ -297,10 +297,10 @@ void ec_fsm_coe_map_state_pdo(
|
|||
ec_sync_direction(fsm->slave->sii_syncs + fsm->sync_index);
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG(" PDO 0x%04X.\n", fsm->pdo->index);
|
||||
EC_DBG(" Pdo 0x%04X.\n", fsm->pdo->index);
|
||||
|
||||
if (!(fsm->pdo_sdo = ec_slave_get_sdo(fsm->slave, fsm->pdo->index))) {
|
||||
EC_ERR("Slave %u has no SDO 0x%04X.\n",
|
||||
EC_ERR("Slave %u has no Sdo 0x%04X.\n",
|
||||
fsm->slave->ring_position, fsm->pdo->index);
|
||||
ec_pdo_clear(fsm->pdo);
|
||||
kfree(fsm->pdo);
|
||||
|
|
@ -316,7 +316,7 @@ void ec_fsm_coe_map_state_pdo(
|
|||
}
|
||||
|
||||
if (!(entry = ec_sdo_get_entry(fsm->pdo_sdo, 0))) {
|
||||
EC_ERR("SDO 0x%04X has no subindex 0 on slave %u.\n",
|
||||
EC_ERR("Sdo 0x%04X has no subindex 0 on slave %u.\n",
|
||||
fsm->pdo_sdo->index,
|
||||
fsm->slave->ring_position);
|
||||
ec_pdo_clear(fsm->pdo);
|
||||
|
|
@ -338,7 +338,7 @@ void ec_fsm_coe_map_state_pdo(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read number of PDO entries.
|
||||
* Read number of Pdo entries.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo_entry_count(
|
||||
|
|
@ -348,7 +348,7 @@ void ec_fsm_coe_map_state_pdo_entry_count(
|
|||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to read number of mapped PDO entries from slave %u.\n",
|
||||
EC_ERR("Failed to read number of mapped Pdo entries from slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_coe_map_state_error;
|
||||
return;
|
||||
|
|
@ -357,9 +357,9 @@ void ec_fsm_coe_map_state_pdo_entry_count(
|
|||
fsm->pdo_subindices = EC_READ_U8(fsm->request.data);
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG(" %u PDO entries mapped.\n", fsm->pdo_subindices);
|
||||
EC_DBG(" %u Pdo entries mapped.\n", fsm->pdo_subindices);
|
||||
|
||||
// read first PDO entry
|
||||
// read first Pdo entry
|
||||
fsm->pdo_subindex = 1;
|
||||
ec_fsm_coe_map_action_next_pdo_entry(fsm);
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ void ec_fsm_coe_map_state_pdo_entry_count(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read next PDO entry.
|
||||
* Read next Pdo entry.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_action_next_pdo_entry(
|
||||
|
|
@ -379,7 +379,7 @@ void ec_fsm_coe_map_action_next_pdo_entry(
|
|||
if (fsm->pdo_subindex <= fsm->pdo_subindices) {
|
||||
if (!(entry = ec_sdo_get_entry(fsm->pdo_sdo,
|
||||
fsm->pdo_subindex))) {
|
||||
EC_ERR("SDO 0x%04X has no subindex %u on slave %u.\n",
|
||||
EC_ERR("Sdo 0x%04X has no subindex %u on slave %u.\n",
|
||||
fsm->pdo_sdo->index, fsm->pdo_subindex,
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_coe_map_state_error;
|
||||
|
|
@ -393,7 +393,7 @@ void ec_fsm_coe_map_action_next_pdo_entry(
|
|||
return;
|
||||
}
|
||||
|
||||
// next PDO
|
||||
// next Pdo
|
||||
fsm->sync_subindex++;
|
||||
ec_fsm_coe_map_action_next_pdo(fsm);
|
||||
}
|
||||
|
|
@ -401,7 +401,7 @@ void ec_fsm_coe_map_action_next_pdo_entry(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read PDO entry information.
|
||||
* Read Pdo entry information.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo_entry(
|
||||
|
|
@ -411,7 +411,7 @@ void ec_fsm_coe_map_state_pdo_entry(
|
|||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to read index of mapped PDO entry from slave %u.\n",
|
||||
EC_ERR("Failed to read index of mapped Pdo entry from slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_coe_map_state_error;
|
||||
return;
|
||||
|
|
@ -427,7 +427,7 @@ void ec_fsm_coe_map_state_pdo_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_coe_map_state_error;
|
||||
return;
|
||||
}
|
||||
|
|
@ -438,9 +438,9 @@ void ec_fsm_coe_map_state_pdo_entry(
|
|||
pdo_entry->bit_length = pdo_entry_info & 0xFF;
|
||||
|
||||
if (!pdo_entry->index && !pdo_entry->subindex) {
|
||||
// we have a gap in the PDO, next PDO entry
|
||||
// we have a gap in the Pdo, next Pdo entry
|
||||
if (fsm->slave->master->debug_level) {
|
||||
EC_DBG(" PDO entry gap: %u bit.\n",
|
||||
EC_DBG(" Pdo entry gap: %u bit.\n",
|
||||
pdo_entry->bit_length);
|
||||
}
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ void ec_fsm_coe_map_state_pdo_entry(
|
|||
}
|
||||
|
||||
if (!(sdo = ec_slave_get_sdo(fsm->slave, pdo_entry->index))) {
|
||||
EC_ERR("Slave %u has no SDO 0x%04X.\n",
|
||||
EC_ERR("Slave %u has no Sdo 0x%04X.\n",
|
||||
fsm->slave->ring_position, pdo_entry->index);
|
||||
ec_pdo_entry_clear(pdo_entry);
|
||||
kfree(pdo_entry);
|
||||
|
|
@ -467,7 +467,7 @@ void ec_fsm_coe_map_state_pdo_entry(
|
|||
}
|
||||
|
||||
if (!(entry = ec_sdo_get_entry(sdo, pdo_entry->subindex))) {
|
||||
EC_ERR("Slave %u has no SDO entry 0x%04X:%u.\n",
|
||||
EC_ERR("Slave %u has no Sdo entry 0x%04X:%u.\n",
|
||||
fsm->slave->ring_position, pdo_entry->index,
|
||||
pdo_entry->subindex);
|
||||
ec_pdo_entry_clear(pdo_entry);
|
||||
|
|
@ -484,14 +484,14 @@ void ec_fsm_coe_map_state_pdo_entry(
|
|||
}
|
||||
|
||||
if (fsm->slave->master->debug_level) {
|
||||
EC_DBG(" PDO entry 0x%04X \"%s\" (%u bit).\n", pdo_entry->index,
|
||||
EC_DBG(" Pdo entry 0x%04X \"%s\" (%u bit).\n", pdo_entry->index,
|
||||
pdo_entry->name ? pdo_entry->name : "???",
|
||||
pdo_entry->bit_length);
|
||||
}
|
||||
|
||||
list_add_tail(&pdo_entry->list, &fsm->pdo->entries);
|
||||
|
||||
// next PDO entry
|
||||
// next Pdo entry
|
||||
fsm->pdo_subindex++;
|
||||
ec_fsm_coe_map_action_next_pdo_entry(fsm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,18 +59,18 @@ struct ec_fsm_coe_map
|
|||
ec_fsm_coe_t *fsm_coe; /**< CoE state machine to use */
|
||||
|
||||
ec_slave_t *slave; /**< EtherCAT slave */
|
||||
ec_sdo_request_t request; /**< SDO request */
|
||||
ec_sdo_request_t request; /**< Sdo request */
|
||||
|
||||
unsigned int sync_index; /**< index of the current sync manager */
|
||||
ec_sdo_t *sync_sdo; /**< pointer to the sync managers mapping SDO */
|
||||
uint8_t sync_subindices; /**< number of mapped PDOs */
|
||||
uint16_t sync_subindex; /**< current subindex in mapping SDO */
|
||||
ec_sdo_t *sync_sdo; /**< pointer to the sync managers mapping Sdo */
|
||||
uint8_t sync_subindices; /**< number of mapped Pdos */
|
||||
uint16_t sync_subindex; /**< current subindex in mapping Sdo */
|
||||
|
||||
ec_pdo_mapping_t mapping; /**< Mapping to apply. */
|
||||
ec_pdo_t *pdo; /**< current PDO */
|
||||
ec_sdo_t *pdo_sdo; /**< current PDO SDO */
|
||||
uint8_t pdo_subindices; /**< number of PDO entries */
|
||||
uint16_t pdo_subindex; /**< current subindex in PDO SDO */
|
||||
ec_pdo_t *pdo; /**< current Pdo */
|
||||
ec_sdo_t *pdo_sdo; /**< current Pdo Sdo */
|
||||
uint8_t pdo_subindices; /**< number of Pdo entries */
|
||||
uint16_t pdo_subindex; /**< current subindex in Pdo Sdo */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -359,8 +359,8 @@ int ec_fsm_master_action_process_eeprom(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for pending SDO requests and process one.
|
||||
* \return non-zero, if an SDO request is processed.
|
||||
* Check for pending Sdo requests and process one.
|
||||
* \return non-zero, if an Sdo request is processed.
|
||||
*/
|
||||
|
||||
int ec_fsm_master_action_process_sdo(
|
||||
|
|
@ -389,19 +389,19 @@ int ec_fsm_master_action_process_sdo(
|
|||
if (slave->current_state == EC_SLAVE_STATE_INIT ||
|
||||
slave->online_state == EC_SLAVE_OFFLINE ||
|
||||
slave->error_flag) {
|
||||
EC_ERR("Discarding SDO request, slave %i not ready.\n",
|
||||
EC_ERR("Discarding Sdo request, slave %i not ready.\n",
|
||||
slave->ring_position);
|
||||
request->state = EC_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 %i...\n",
|
||||
EC_DBG("Processing Sdo request for slave %i...\n",
|
||||
slave->ring_position);
|
||||
|
||||
// start uploading SDO
|
||||
// start uploading Sdo
|
||||
fsm->idle = 0;
|
||||
fsm->slave = slave;
|
||||
fsm->sdo_request = request;
|
||||
|
|
@ -493,13 +493,13 @@ void ec_fsm_master_action_process_states(ec_fsm_master_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
// Check for a pending SDO request
|
||||
// Check for a pending Sdo request
|
||||
if (ec_fsm_master_action_process_sdo(fsm))
|
||||
return;
|
||||
|
||||
if (master->mode == EC_MASTER_MODE_IDLE) {
|
||||
|
||||
// check, if slaves have an SDO dictionary to read out.
|
||||
// check, if slaves have an Sdo dictionary to read out.
|
||||
list_for_each_entry(slave, &master->slaves, list) {
|
||||
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)
|
||||
|| slave->sdo_dictionary_fetched
|
||||
|
|
@ -509,13 +509,13 @@ void ec_fsm_master_action_process_states(ec_fsm_master_t *fsm
|
|||
|| slave->error_flag) continue;
|
||||
|
||||
if (master->debug_level) {
|
||||
EC_DBG("Fetching SDO dictionary from slave %i.\n",
|
||||
EC_DBG("Fetching Sdo dictionary from slave %i.\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_sdodict;
|
||||
|
|
@ -524,7 +524,7 @@ void ec_fsm_master_action_process_states(ec_fsm_master_t *fsm
|
|||
return;
|
||||
}
|
||||
|
||||
// check, if slaves have their PDO mapping to be read.
|
||||
// check, if slaves have their Pdo mapping to be read.
|
||||
list_for_each_entry(slave, &master->slaves, list) {
|
||||
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)
|
||||
|| slave->pdo_mapping_fetched
|
||||
|
|
@ -533,13 +533,13 @@ void ec_fsm_master_action_process_states(ec_fsm_master_t *fsm
|
|||
|| slave->online_state == EC_SLAVE_OFFLINE) continue;
|
||||
|
||||
if (master->debug_level) {
|
||||
EC_DBG("Fetching PDO mapping from slave %i via CoE.\n",
|
||||
EC_DBG("Fetching Pdo mapping from slave %i via CoE.\n",
|
||||
slave->ring_position);
|
||||
}
|
||||
|
||||
slave->pdo_mapping_fetched = 1;
|
||||
|
||||
// start fetching PDO mapping
|
||||
// start fetching Pdo mapping
|
||||
fsm->idle = 0;
|
||||
fsm->state = ec_fsm_master_state_pdomap;
|
||||
ec_fsm_coe_map_start(&fsm->fsm_coe_map, slave);
|
||||
|
|
@ -1004,7 +1004,7 @@ void ec_fsm_master_state_write_eeprom(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Master state: SDODICT.
|
||||
Master state: SdoDICT.
|
||||
*/
|
||||
|
||||
void ec_fsm_master_state_sdodict(ec_fsm_master_t *fsm /**< master state machine */)
|
||||
|
|
@ -1019,12 +1019,12 @@ void ec_fsm_master_state_sdodict(ec_fsm_master_t *fsm /**< master state machine
|
|||
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 %i SDOs and %i entries from slave %i.\n",
|
||||
EC_DBG("Fetched %i Sdos and %i entries from slave %i.\n",
|
||||
sdo_count, entry_count, slave->ring_position);
|
||||
}
|
||||
|
||||
|
|
@ -1034,7 +1034,7 @@ void ec_fsm_master_state_sdodict(ec_fsm_master_t *fsm /**< master state machine
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Scan the PDO mapping of a slave.
|
||||
* Scan the Pdo mapping of a slave.
|
||||
*/
|
||||
|
||||
void ec_fsm_master_state_pdomap(
|
||||
|
|
@ -1048,14 +1048,14 @@ void ec_fsm_master_state_pdomap(
|
|||
return;
|
||||
}
|
||||
|
||||
// fetching of PDO mapping finished
|
||||
// fetching of Pdo mapping finished
|
||||
fsm->state = ec_fsm_master_state_end;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Master state: SDO REQUEST.
|
||||
Master state: Sdo REQUEST.
|
||||
*/
|
||||
|
||||
void ec_fsm_master_state_sdo_request(ec_fsm_master_t *fsm /**< master state machine */)
|
||||
|
|
@ -1066,7 +1066,7 @@ void ec_fsm_master_state_sdo_request(ec_fsm_master_t *fsm /**< master state mach
|
|||
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 %i.\n",
|
||||
EC_DBG("Failed to process Sdo request for slave %i.\n",
|
||||
fsm->slave->ring_position);
|
||||
request->state = EC_REQUEST_FAILURE;
|
||||
wake_up(&master->sdo_queue);
|
||||
|
|
@ -1074,15 +1074,15 @@ void ec_fsm_master_state_sdo_request(ec_fsm_master_t *fsm /**< master state mach
|
|||
return;
|
||||
}
|
||||
|
||||
// SDO request finished
|
||||
// Sdo request finished
|
||||
request->state = EC_REQUEST_COMPLETE;
|
||||
wake_up(&master->sdo_queue);
|
||||
|
||||
if (master->debug_level)
|
||||
EC_DBG("Finished SDO request for slave %i.\n",
|
||||
EC_DBG("Finished Sdo request for slave %i.\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
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ struct ec_fsm_master
|
|||
ec_slave_t *slave; /**< current slave */
|
||||
ec_eeprom_write_request_t *eeprom_request; /**< EEPROM write request */
|
||||
off_t eeprom_index; /**< index to EEPROM write request data */
|
||||
ec_sdo_request_t *sdo_request; /**< SDO request to process */
|
||||
ec_sdo_request_t *sdo_request; /**< Sdo request to process */
|
||||
|
||||
ec_fsm_slave_t fsm_slave; /**< slave state machine */
|
||||
ec_fsm_sii_t fsm_sii; /**< SII state machine */
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ void ec_fsm_pdo_config_next_pdo(
|
|||
fsm->pdo->index, fsm->slave->ring_position);
|
||||
}
|
||||
|
||||
// set mapped PDO count to zero
|
||||
// set mapped Pdo count to zero
|
||||
fsm->sdodata.index = fsm->pdo->index;
|
||||
fsm->sdodata.subindex = 0; // number of configured entries
|
||||
EC_WRITE_U8(&fsm->sdo_value, 0);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/** \file
|
||||
* EtherCAT PDO configuration state machine structures.
|
||||
* EtherCAT Pdo configuration state machine structures.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -60,11 +60,11 @@ struct ec_fsm_pdo_config
|
|||
ec_fsm_coe_t *fsm_coe; /**< CoE state machine to use */
|
||||
ec_slave_t *slave; /**< Slave the FSM runs on. */
|
||||
|
||||
const ec_pdo_t *pdo; /**< Current PDO to configure. */
|
||||
const ec_pdo_t *pdo; /**< Current Pdo to configure. */
|
||||
const ec_pdo_entry_t *entry; /**< Current entry. */
|
||||
|
||||
ec_sdo_data_t sdodata; /**< SDO configuration data. */
|
||||
uint16_t sdo_value; /**< SDO value. */
|
||||
ec_sdo_data_t sdodata; /**< Sdo configuration data. */
|
||||
uint16_t sdo_value; /**< Sdo value. */
|
||||
unsigned int entry_count; /**< Number of configured entries. */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/** \file
|
||||
* EtherCAT PDO mapping state machine.
|
||||
* EtherCAT Pdo mapping state machine.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -80,7 +80,7 @@ void ec_fsm_pdo_mapping_clear(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Start PDO mapping configuration state machine.
|
||||
/** Start Pdo mapping configuration state machine.
|
||||
*/
|
||||
void ec_fsm_pdo_mapping_start(
|
||||
ec_fsm_pdo_mapping_t *fsm, /**< mapping state machine */
|
||||
|
|
@ -195,17 +195,17 @@ void ec_fsm_pdo_mapping_next_sync(
|
|||
}
|
||||
|
||||
if (fsm->slave->master->debug_level) {
|
||||
EC_DBG("Configuring PDO mapping for SM%u of slave %u.\n",
|
||||
EC_DBG("Configuring Pdo mapping for SM%u of slave %u.\n",
|
||||
fsm->sync->index, fsm->slave->ring_position);
|
||||
}
|
||||
|
||||
// set mapped PDO count to zero
|
||||
// set mapped Pdo count to zero
|
||||
fsm->sdodata.index = 0x1C10 + fsm->sync->index;
|
||||
fsm->sdodata.subindex = 0; // mapped PDO count
|
||||
EC_WRITE_U8(&fsm->sdo_value, 0); // zero PDOs mapped
|
||||
fsm->sdodata.subindex = 0; // mapped Pdo count
|
||||
EC_WRITE_U8(&fsm->sdo_value, 0); // zero Pdos mapped
|
||||
fsm->sdodata.size = 1;
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Setting PDO count to zero for SM%u.\n", fsm->sync->index);
|
||||
EC_DBG("Setting Pdo count to zero for SM%u.\n", fsm->sync->index);
|
||||
|
||||
fsm->state = ec_fsm_pdo_mapping_state_zero_count;
|
||||
ec_fsm_coe_download(fsm->fsm_coe, fsm->slave, &fsm->sdodata);
|
||||
|
|
@ -214,16 +214,16 @@ void ec_fsm_pdo_mapping_next_sync(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Process mapping of next PDO.
|
||||
/** Process mapping of next Pdo.
|
||||
*/
|
||||
ec_pdo_t *ec_fsm_pdo_mapping_next_pdo(
|
||||
const ec_fsm_pdo_mapping_t *fsm, /**< mapping state machine */
|
||||
const struct list_head *list /**< current PDO list item */
|
||||
const struct list_head *list /**< current Pdo list item */
|
||||
)
|
||||
{
|
||||
list = list->next;
|
||||
if (list == &fsm->mapping->pdos)
|
||||
return NULL; // no next PDO
|
||||
return NULL; // no next Pdo
|
||||
return list_entry(list, ec_pdo_t, list);
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ void ec_fsm_pdo_mapping_add_pdo(
|
|||
fsm->sdodata.size = 2;
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Mapping PDO 0x%04X at position %u.\n",
|
||||
EC_DBG("Mapping Pdo 0x%04X at position %u.\n",
|
||||
fsm->pdo->index, fsm->sdodata.subindex);
|
||||
|
||||
fsm->state = ec_fsm_pdo_mapping_state_add_pdo;
|
||||
|
|
@ -250,7 +250,7 @@ void ec_fsm_pdo_mapping_add_pdo(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Set the number of mapped PDOs to zero.
|
||||
/** Set the number of mapped Pdos to zero.
|
||||
*/
|
||||
void ec_fsm_pdo_mapping_state_zero_count(
|
||||
ec_fsm_pdo_mapping_t *fsm /**< mapping state machine */
|
||||
|
|
@ -259,31 +259,31 @@ void ec_fsm_pdo_mapping_state_zero_count(
|
|||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to clear PDO mapping for slave %u.\n",
|
||||
EC_ERR("Failed to clear Pdo mapping for slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_pdo_mapping_state_error;
|
||||
return;
|
||||
}
|
||||
|
||||
// map all PDOs belonging to the current sync manager
|
||||
// map all Pdos belonging to the current sync manager
|
||||
|
||||
// find first PDO
|
||||
// find first Pdo
|
||||
if (!(fsm->pdo = ec_fsm_pdo_mapping_next_pdo(fsm, &fsm->mapping->pdos))) {
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("No PDOs to map for SM%u of slave %u.\n",
|
||||
EC_DBG("No Pdos to map for SM%u of slave %u.\n",
|
||||
fsm->sync->index, fsm->slave->ring_position);
|
||||
ec_fsm_pdo_mapping_next_sync(fsm);
|
||||
return;
|
||||
}
|
||||
|
||||
// add first PDO to mapping
|
||||
// add first Pdo to mapping
|
||||
fsm->pdo_count = 1;
|
||||
ec_fsm_pdo_mapping_add_pdo(fsm);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Add a PDO to the sync managers mapping.
|
||||
/** Add a Pdo to the sync managers mapping.
|
||||
*/
|
||||
void ec_fsm_pdo_mapping_state_add_pdo(
|
||||
ec_fsm_pdo_mapping_t *fsm /**< mapping state machine */
|
||||
|
|
@ -292,21 +292,21 @@ void ec_fsm_pdo_mapping_state_add_pdo(
|
|||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to map PDO 0x%04X for SM%u of slave %u.\n",
|
||||
EC_ERR("Failed to map Pdo 0x%04X for SM%u of slave %u.\n",
|
||||
fsm->pdo->index, fsm->sync->index, fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_pdo_mapping_state_error;
|
||||
return;
|
||||
}
|
||||
|
||||
// find next PDO
|
||||
// find next Pdo
|
||||
if (!(fsm->pdo = ec_fsm_pdo_mapping_next_pdo(fsm, &fsm->pdo->list))) {
|
||||
// no more PDOs to map. write PDO count
|
||||
// no more Pdos to map. write Pdo count
|
||||
fsm->sdodata.subindex = 0;
|
||||
EC_WRITE_U8(&fsm->sdo_value, fsm->pdo_count);
|
||||
fsm->sdodata.size = 1;
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Setting number of mapped PDOs to %u.\n",
|
||||
EC_DBG("Setting number of mapped Pdos to %u.\n",
|
||||
fsm->pdo_count);
|
||||
|
||||
fsm->state = ec_fsm_pdo_mapping_state_pdo_count;
|
||||
|
|
@ -315,14 +315,14 @@ void ec_fsm_pdo_mapping_state_add_pdo(
|
|||
return;
|
||||
}
|
||||
|
||||
// add next PDO to mapping
|
||||
// add next Pdo to mapping
|
||||
fsm->pdo_count++;
|
||||
ec_fsm_pdo_mapping_add_pdo(fsm);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Set the number of mapped PDOs.
|
||||
/** Set the number of mapped Pdos.
|
||||
*/
|
||||
void ec_fsm_pdo_mapping_state_pdo_count(
|
||||
ec_fsm_pdo_mapping_t *fsm /**< mapping state machine */
|
||||
|
|
@ -331,14 +331,14 @@ void ec_fsm_pdo_mapping_state_pdo_count(
|
|||
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
|
||||
|
||||
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
|
||||
EC_ERR("Failed to set number of mapped PDOs for slave %u.\n",
|
||||
EC_ERR("Failed to set number of mapped Pdos for slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->state = ec_fsm_pdo_mapping_state_error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fsm->slave->master->debug_level)
|
||||
EC_DBG("Successfully set PDO mapping for SM%u of slave %u.\n",
|
||||
EC_DBG("Successfully set Pdo mapping for SM%u of slave %u.\n",
|
||||
fsm->sync->index, fsm->slave->ring_position);
|
||||
|
||||
// mapping configuration for this sync manager complete.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
/**
|
||||
\file
|
||||
EtherCAT PDO mapping state machine structures.
|
||||
EtherCAT Pdo mapping state machine structures.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -66,8 +66,8 @@ struct ec_fsm_pdo_mapping
|
|||
const ec_pdo_mapping_t *mapping; /**< Target Pdo mapping. */
|
||||
const ec_pdo_t *pdo; /**< Current Pdo. */
|
||||
|
||||
ec_sdo_data_t sdodata; /**< SDO configuration data. */
|
||||
uint16_t sdo_value; /**< SDO value. */
|
||||
ec_sdo_data_t sdodata; /**< Sdo configuration data. */
|
||||
uint16_t sdo_value; /**< Sdo value. */
|
||||
unsigned int pdo_count; /**< Number of mapped Pdos. */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -869,7 +869,7 @@ void ec_fsm_slave_conf_state_preop(ec_fsm_slave_t *fsm /**< slave state machine
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for SDO configurations to be applied.
|
||||
* Check for Sdo configurations to be applied.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_sdo_conf(ec_fsm_slave_t *fsm /**< slave state machine */)
|
||||
|
|
@ -883,12 +883,12 @@ void ec_fsm_slave_conf_enter_sdo_conf(ec_fsm_slave_t *fsm /**< slave state machi
|
|||
}
|
||||
|
||||
// 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_conf_enter_mapping(fsm);
|
||||
return;
|
||||
}
|
||||
|
||||
// start SDO configuration
|
||||
// start Sdo configuration
|
||||
fsm->state = ec_fsm_slave_conf_state_sdo_conf;
|
||||
fsm->sdodata =
|
||||
list_entry(fsm->slave->config->sdo_configs.next, ec_sdo_data_t, list);
|
||||
|
|
@ -909,14 +909,14 @@ void ec_fsm_slave_conf_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_state_error;
|
||||
return;
|
||||
}
|
||||
|
||||
// Another SDO to configure?
|
||||
// Another Sdo to configure?
|
||||
if (fsm->sdodata->list.next != &fsm->slave->config->sdo_configs) {
|
||||
fsm->sdodata =
|
||||
list_entry(fsm->sdodata->list.next, ec_sdo_data_t, list);
|
||||
|
|
@ -925,21 +925,21 @@ void ec_fsm_slave_conf_state_sdo_conf(
|
|||
return;
|
||||
}
|
||||
|
||||
// All SDOs are now configured.
|
||||
// All Sdos are now configured.
|
||||
ec_fsm_slave_conf_enter_mapping(fsm);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for PDO mappings to be applied.
|
||||
* Check for Pdo mappings to be applied.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_mapping(
|
||||
ec_fsm_slave_t *fsm /**< slave state machine */
|
||||
)
|
||||
{
|
||||
// start configuring PDO mapping
|
||||
// start configuring Pdo mapping
|
||||
fsm->state = ec_fsm_slave_conf_state_mapping;
|
||||
ec_fsm_pdo_mapping_start(&fsm->fsm_pdo_map, fsm->slave);
|
||||
ec_fsm_pdo_mapping_exec(&fsm->fsm_pdo_map); // execute immediately
|
||||
|
|
@ -958,7 +958,7 @@ void ec_fsm_slave_conf_state_mapping(
|
|||
if (ec_fsm_pdo_mapping_exec(&fsm->fsm_pdo_map)) return;
|
||||
|
||||
if (!ec_fsm_pdo_mapping_success(&fsm->fsm_pdo_map)) {
|
||||
EC_ERR("PDO mapping configuration failed for slave %u.\n",
|
||||
EC_ERR("Pdo mapping configuration failed for slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
fsm->slave->error_flag = 1;
|
||||
fsm->state = ec_fsm_slave_state_error;
|
||||
|
|
@ -997,7 +997,7 @@ void ec_fsm_slave_conf_state_pdo_conf(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for PDO sync managers to be configured.
|
||||
* Check for Pdo sync managers to be configured.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_pdo_sync(
|
||||
|
|
@ -1043,7 +1043,7 @@ void ec_fsm_slave_conf_enter_pdo_sync(
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Configure PDO sync managers.
|
||||
* Configure Pdo sync managers.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_state_pdo_sync(ec_fsm_slave_t *fsm /**< slave state machine */)
|
||||
|
|
@ -1101,7 +1101,7 @@ void ec_fsm_slave_conf_enter_fmmu(ec_fsm_slave_t *fsm /**< slave state machine *
|
|||
fmmu = &slave->config->fmmu_configs[i];
|
||||
if (!(sync = ec_slave_get_pdo_sync(slave, fmmu->dir))) {
|
||||
fsm->state = ec_fsm_slave_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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ struct ec_fsm_slave
|
|||
unsigned int retries; /**< Retries on datagram timeout. */
|
||||
|
||||
void (*state)(ec_fsm_slave_t *); /**< State function. */
|
||||
ec_sdo_data_t *sdodata; /**< SDO configuration data. */
|
||||
ec_sdo_data_t *sdodata; /**< Sdo configuration data. */
|
||||
uint16_t sii_offset; /**< SII offset in words. */
|
||||
|
||||
ec_fsm_sii_t fsm_sii; /**< SII state machine. */
|
||||
|
|
|
|||
|
|
@ -57,7 +57,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
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
|
|||
master->stats.corrupted = 0;
|
||||
master->stats.unmatched = 0;
|
||||
master->stats.output_jiffies = 0;
|
||||
master->pdo_slaves_offline = 0; // assume all PDO slaves online
|
||||
master->pdo_slaves_offline = 0; // assume all Pdo slaves online
|
||||
master->frames_timed_out = 0;
|
||||
|
||||
for (i = 0; i < HZ; i++) {
|
||||
|
|
@ -1007,7 +1007,7 @@ ssize_t ec_master_info(ec_master_t *master, /**< EtherCAT master */
|
|||
master->slave_count);
|
||||
off += sprintf(buffer + off, "Status: %s\n",
|
||||
master->fsm.tainted ? "TAINTED" : "sane");
|
||||
off += sprintf(buffer + off, "PDO slaves: %s\n",
|
||||
off += sprintf(buffer + off, "Pdo slaves: %s\n",
|
||||
master->pdo_slaves_offline ? "INCOMPLETE" : "online");
|
||||
|
||||
off += sprintf(buffer + off, "\nDevices:\n");
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ struct ec_master
|
|||
|
||||
int debug_level; /**< master debug level */
|
||||
ec_stats_t stats; /**< cyclic statistics */
|
||||
unsigned int pdo_slaves_offline; /**< number of slaves, for which PDOs
|
||||
unsigned int pdo_slaves_offline; /**< number of slaves, for which Pdos
|
||||
were registered and that are offline
|
||||
(used for bus status) */
|
||||
unsigned int frames_timed_out; /**< there were frame timeouts in the last
|
||||
|
|
@ -161,10 +161,10 @@ struct ec_master
|
|||
wait_queue_head_t eeprom_queue; /**< wait queue for EEPROM
|
||||
write requests from user space */
|
||||
|
||||
struct list_head sdo_requests; /**< SDO access requests */
|
||||
struct list_head sdo_requests; /**< Sdo access requests */
|
||||
struct semaphore sdo_sem; /**< semaphore protecting the list of
|
||||
SDO access requests */
|
||||
wait_queue_head_t sdo_queue; /**< wait queue for SDO access requests
|
||||
Sdo access requests */
|
||||
wait_queue_head_t sdo_queue; /**< wait queue for Sdo access requests
|
||||
from user space */
|
||||
};
|
||||
|
||||
|
|
|
|||
18
master/pdo.c
18
master/pdo.c
|
|
@ -48,10 +48,10 @@ void ec_pdo_clear_entries(ec_pdo_t *);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** 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
|
||||
|
|
@ -87,9 +87,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);
|
||||
|
|
@ -101,11 +101,11 @@ void ec_pdo_clear(ec_pdo_t *pdo /**< EtherCAT PDO */)
|
|||
|
||||
/** 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);
|
||||
|
|
@ -129,7 +129,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 -1;
|
||||
}
|
||||
memcpy(pdo->name, name, len + 1);
|
||||
|
|
@ -153,7 +153,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 -1;
|
||||
}
|
||||
|
||||
|
|
@ -261,7 +261,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 -1;
|
||||
}
|
||||
memcpy(entry->name, name, len + 1);
|
||||
|
|
|
|||
16
master/pdo.h
16
master/pdo.h
|
|
@ -49,25 +49,25 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** PDO description.
|
||||
/** Pdo description.
|
||||
*/
|
||||
typedef struct {
|
||||
struct list_head list; /**< List item. */
|
||||
ec_direction_t dir; /**< PDO direction. */
|
||||
uint16_t index; /**< PDO index. */
|
||||
ec_direction_t dir; /**< Pdo direction. */
|
||||
uint16_t index; /**< Pdo index. */
|
||||
int8_t sync_index; /**< Assigned sync manager. */
|
||||
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;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** 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;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void ec_pdo_mapping_clear_pdos(ec_pdo_mapping_t *pm /**< Pdo mapping. */)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Calculates the total size of the mapped PDO entries.
|
||||
/** Calculates the total size of the mapped Pdo entries.
|
||||
*
|
||||
* \retval Data size in byte.
|
||||
*/
|
||||
|
|
@ -121,20 +121,20 @@ uint16_t ec_pdo_mapping_total_size(
|
|||
*/
|
||||
int ec_pdo_mapping_add_pdo(
|
||||
ec_pdo_mapping_t *pm, /**< Pdo mapping. */
|
||||
const ec_pdo_t *pdo /**< PDO to add. */
|
||||
const ec_pdo_t *pdo /**< Pdo to add. */
|
||||
)
|
||||
{
|
||||
ec_pdo_t *mapped_pdo;
|
||||
|
||||
// PDO already mapped?
|
||||
// Pdo already mapped?
|
||||
list_for_each_entry(mapped_pdo, &pm->pdos, 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 -1;
|
||||
}
|
||||
|
||||
if (!(mapped_pdo = kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate memory for PDO mapping.\n");
|
||||
EC_ERR("Failed to allocate memory for Pdo mapping.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ int ec_pdo_mapping_add_pdo_info(
|
|||
entry_info = &pdo_info->entries[i];
|
||||
|
||||
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");
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
|
|
@ -260,14 +260,14 @@ out_return:
|
|||
*/
|
||||
int ec_pdo_mapping_copy(
|
||||
ec_pdo_mapping_t *pm, /**< Pdo mapping. */
|
||||
const ec_pdo_mapping_t *other /**< PDO mapping to copy from. */
|
||||
const ec_pdo_mapping_t *other /**< Pdo mapping to copy from. */
|
||||
)
|
||||
{
|
||||
ec_pdo_t *other_pdo;
|
||||
|
||||
ec_pdo_mapping_clear_pdos(pm);
|
||||
|
||||
// PDO already mapped?
|
||||
// Pdo already mapped?
|
||||
list_for_each_entry(other_pdo, &other->pdos, list) {
|
||||
if (ec_pdo_mapping_add_pdo(pm, other_pdo))
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** EtherCAT PDO mapping.
|
||||
/** EtherCAT Pdo mapping.
|
||||
*/
|
||||
typedef struct {
|
||||
struct list_head pdos; /**< List of Pdos. */
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ int ec_slave_init(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
goto out_slave_put;
|
||||
}
|
||||
|
||||
// init SDO kobject and add it to the hierarchy
|
||||
// init Sdo kobject and add it to the hierarchy
|
||||
memset(&slave->sdo_kobj, 0x00, sizeof(struct kobject));
|
||||
kobject_init(&slave->sdo_kobj);
|
||||
slave->sdo_kobj.ktype = &ktype_ec_slave_sdos;
|
||||
|
|
@ -188,7 +188,7 @@ int ec_slave_init(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
goto out_sdo_put;
|
||||
}
|
||||
if (kobject_add(&slave->sdo_kobj)) {
|
||||
EC_ERR("Failed to add SDOs kobject.\n");
|
||||
EC_ERR("Failed to add Sdos kobject.\n");
|
||||
goto out_sdo_put;
|
||||
}
|
||||
|
||||
|
|
@ -216,13 +216,13 @@ void ec_slave_destroy(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_destroy(sdo);
|
||||
}
|
||||
|
||||
// free SDO kobject
|
||||
// free Sdo kobject
|
||||
kobject_del(&slave->sdo_kobj);
|
||||
kobject_put(&slave->sdo_kobj);
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ void ec_slave_clear(struct kobject *kobj /**< kobject of the slave */)
|
|||
kfree(slave->sii_syncs);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
|
@ -277,10 +277,10 @@ void ec_slave_clear(struct kobject *kobj /**< kobject of the slave */)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* SDO kobject clear method.
|
||||
* Sdo kobject clear method.
|
||||
*/
|
||||
|
||||
void ec_slave_sdos_clear(struct kobject *kobj /**< kobject for SDOs */)
|
||||
void ec_slave_sdos_clear(struct kobject *kobj /**< kobject for Sdos */)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -490,7 +490,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
|
||||
*/
|
||||
|
||||
|
|
@ -498,7 +498,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. */
|
||||
)
|
||||
{
|
||||
ec_pdo_t *pdo;
|
||||
|
|
@ -507,7 +507,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 -1;
|
||||
}
|
||||
|
||||
|
|
@ -529,7 +529,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 -1;
|
||||
}
|
||||
|
||||
|
|
@ -549,12 +549,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 (pdo->sync_index >= slave->sii_sync_count) {
|
||||
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 -1;
|
||||
}
|
||||
|
|
@ -722,7 +722,7 @@ ssize_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
|
|||
}
|
||||
|
||||
if (slave->sii_sync_count) {
|
||||
buf += sprintf(buf, "Sync managers / PDO mapping:\n");
|
||||
buf += sprintf(buf, "Sync managers / Pdo mapping:\n");
|
||||
|
||||
for (i = 0; i < slave->sii_sync_count; i++) {
|
||||
sync = &slave->sii_syncs[i];
|
||||
|
|
@ -733,10 +733,10 @@ ssize_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
|
|||
sync->enable ? "enable" : "disable");
|
||||
|
||||
if (list_empty(&sync->mapping.pdos)) {
|
||||
buf += sprintf(buf, " No PDOs mapped.\n");
|
||||
buf += sprintf(buf, " No Pdos mapped.\n");
|
||||
} else if (sync->mapping_source != EC_SYNC_MAPPING_NONE) {
|
||||
buf += sprintf(buf,
|
||||
" PDO mapping information from %s.\n",
|
||||
" Pdo mapping information from %s.\n",
|
||||
sync->mapping_source == EC_SYNC_MAPPING_SII
|
||||
? "SII" : "CoE");
|
||||
}
|
||||
|
|
@ -760,7 +760,7 @@ ssize_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
|
|||
|
||||
// type-cast to avoid warnings on some compilers
|
||||
if (!list_empty((struct list_head *) &slave->sii_pdos)) {
|
||||
buf += sprintf(buf, "Available PDOs from SII:\n");
|
||||
buf += sprintf(buf, "Available Pdos from SII:\n");
|
||||
|
||||
list_for_each_entry(pdo, &slave->sii_pdos, list) {
|
||||
buf += sprintf(buf, " %s 0x%04X \"%s\"",
|
||||
|
|
@ -1111,7 +1111,7 @@ ssize_t ec_store_slave_attribute(struct kobject *kobj, /**< slave's kobject */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Get the sync manager for either Rx- or Tx-PDOs.
|
||||
* Get the sync manager for either Rx- or Tx-Pdos.
|
||||
* \return pointer to sync manager, or NULL.
|
||||
*/
|
||||
|
||||
|
|
@ -1161,11 +1161,11 @@ int ec_slave_validate(const ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
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 */
|
||||
)
|
||||
|
|
@ -1188,13 +1188,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;
|
||||
|
|
|
|||
|
|
@ -152,12 +152,12 @@ struct ec_slave
|
|||
char *sii_name; /**< slave name acc. to EEPROM */
|
||||
int16_t sii_current_on_ebus; /**< power consumption */
|
||||
|
||||
struct kobject sdo_kobj; /**< kobject for SDOs */
|
||||
struct list_head sdo_dictionary; /**< SDO dictionary list */
|
||||
struct kobject sdo_kobj; /**< kobject for Sdos */
|
||||
struct list_head sdo_dictionary; /**< Sdo dictionary list */
|
||||
uint8_t sdo_dictionary_fetched; /**< dictionary has been fetched */
|
||||
unsigned long jiffies_preop; /**< time, the slave went to PREOP */
|
||||
|
||||
uint8_t pdo_mapping_fetched; /**< PDO mapping has been fetched */
|
||||
uint8_t pdo_mapping_fetched; /**< Pdo mapping has been fetched */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ void ec_slave_config_clear(struct kobject *kobj /**< kobject of the config. */)
|
|||
for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++)
|
||||
ec_pdo_mapping_clear(&sc->mapping[dir]);
|
||||
|
||||
// free all SDO configurations
|
||||
// free all Sdo configurations
|
||||
list_for_each_entry_safe(sdodata, next_sdodata, &sc->sdo_configs, list) {
|
||||
list_del(&sdodata->list);
|
||||
kfree(sdodata->data);
|
||||
|
|
@ -195,7 +195,7 @@ void ec_slave_config_clear(struct kobject *kobj /**< kobject of the config. */)
|
|||
int ec_slave_config_prepare_fmmu(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
ec_domain_t *domain, /**< Domain. */
|
||||
ec_direction_t dir /**< PDO direction. */
|
||||
ec_direction_t dir /**< Pdo direction. */
|
||||
)
|
||||
{
|
||||
unsigned int i;
|
||||
|
|
@ -263,7 +263,7 @@ ssize_t ec_slave_config_info(
|
|||
|
||||
// type-cast to avoid warnings on some compilers
|
||||
if (!list_empty((struct list_head *) &sc->sdo_configs)) {
|
||||
buf += sprintf(buf, "\nSDO configurations:\n");
|
||||
buf += sprintf(buf, "\nSdo configurations:\n");
|
||||
|
||||
list_for_each_entry(sdodata, &sc->sdo_configs, list) {
|
||||
switch (sdodata->size) {
|
||||
|
|
@ -304,7 +304,7 @@ ssize_t ec_show_slave_config_attribute(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Adds an SDO configuration.
|
||||
/** Adds an Sdo configuration.
|
||||
*/
|
||||
int ec_slave_config_sdo(ec_slave_config_t *sc, uint16_t index,
|
||||
uint8_t subindex, const uint8_t *data, size_t size)
|
||||
|
|
@ -319,12 +319,12 @@ int ec_slave_config_sdo(ec_slave_config_t *sc, uint16_t index,
|
|||
|
||||
if (!(sdodata = (ec_sdo_data_t *)
|
||||
kmalloc(sizeof(ec_sdo_data_t), GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate memory for SDO configuration object!\n");
|
||||
EC_ERR("Failed to allocate memory for Sdo configuration object!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(sdodata->data = (uint8_t *) kmalloc(size, GFP_KERNEL))) {
|
||||
EC_ERR("Failed to allocate memory for SDO configuration data!\n");
|
||||
EC_ERR("Failed to allocate memory for Sdo configuration data!\n");
|
||||
kfree(sdodata);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -481,7 +481,7 @@ int ecrt_slave_config_reg_pdo_entry(
|
|||
}
|
||||
}
|
||||
|
||||
EC_ERR("PDO entry 0x%04X:%u is not mapped in slave config %u:%u.\n",
|
||||
EC_ERR("Pdo entry 0x%04X:%u is not mapped in slave config %u:%u.\n",
|
||||
index, subindex, sc->alias, sc->position);
|
||||
return -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ struct ec_slave_config {
|
|||
ec_slave_t *slave; /**< Slave pointer. This is \a NULL, if the slave is
|
||||
offline. */
|
||||
|
||||
ec_pdo_mapping_t mapping[2]; /**< Output and input PDO mapping. */
|
||||
ec_pdo_mapping_t mapping[2]; /**< Output and input Pdo mapping. */
|
||||
|
||||
struct list_head sdo_configs; /**< SDO configurations. */
|
||||
struct list_head sdo_configs; /**< Sdo configurations. */
|
||||
|
||||
ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]; /**< FMMU configurations. */
|
||||
uint8_t used_fmmus; /**< Number of FMMUs used. */
|
||||
|
|
|
|||
|
|
@ -98,13 +98,13 @@ void ec_sync_config(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Adds a PDO to the list of known mapped PDOs.
|
||||
/** Adds a Pdo to the list of known mapped Pdos.
|
||||
*
|
||||
* \return 0 on success, else < 0
|
||||
*/
|
||||
int ec_sync_add_pdo(
|
||||
ec_sync_t *sync, /**< EtherCAT sync manager. */
|
||||
const ec_pdo_t *pdo /**< PDO to map. */
|
||||
const ec_pdo_t *pdo /**< Pdo to map. */
|
||||
)
|
||||
{
|
||||
return ec_pdo_mapping_add_pdo(&sync->mapping, pdo);
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** EtherCAT sync manager PDO mapping information source.
|
||||
/** EtherCAT sync manager Pdo mapping information source.
|
||||
*/
|
||||
typedef enum {
|
||||
EC_SYNC_MAPPING_NONE, /**< No PDO mapping information. */
|
||||
EC_SYNC_MAPPING_SII, /**< PDO mapping information from SII. */
|
||||
EC_SYNC_MAPPING_COE, /**< PDO mapping information from CoE dictionary. */
|
||||
EC_SYNC_MAPPING_CUSTOM, /**< PDO mapping configured externally. */
|
||||
EC_SYNC_MAPPING_NONE, /**< No Pdo mapping information. */
|
||||
EC_SYNC_MAPPING_SII, /**< Pdo mapping information from SII. */
|
||||
EC_SYNC_MAPPING_COE, /**< Pdo mapping information from CoE dictionary. */
|
||||
EC_SYNC_MAPPING_CUSTOM, /**< Pdo mapping configured externally. */
|
||||
} ec_sync_mapping_source_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Reference in New Issue