概述
<pre name="code" class="cpp">/**
defgroup ecatslv ecatslv.c: EtherCAT State Machine
brief Changes to version V5.0:
brief V5.01 APPL3: Include library demo application
brief V5.01 ESC2: Add missed value swapping
brief V5.01 ESM1: Don't overwrite the error reason in case of an failed PS transition
brief V5.01 ESM2: Don't check the "appl trigger" flag in case on an regular transition to a lower state (OS, SP, PI).
brief V5.01 ESM3: Call Error acknowledge indication only if error was acknowledged by the master
brief V5.01 HW3: Update blink code of an SM watchdog error
brief Changes to version V4.42:
brief V5.0 ECAT1: Support Explicit Device ID.
brief V5.0 ECAT2: Application specific functions are moved to application files.
brief V5.0 ECAT3: Global dummy variables used for dummy ESC operations.
brief V5.0 ESC1: ESC 32Bit Access added.
brief V5.0 ESC2: Support ESC EtherCAT LED Indication.
brief V5.0 ESC3: Support EEPROM Emulation.
brief V5.0 ESM1: Update "LocalErrorFlag" handling.
brief V5.0 ESM2: Update Error Acknowledge by ALControl INIT (without error acknowledge)
brief V5.0 ESM3: Handle pending ESM transition
brief V5.0 ESM4: ECAT_StateChange() will only be called form application. In case of an communication error AL_ControlInd is called.
brief V5.0 MBX1: Support configuration without mailbox protocol support.
brief V5.0 TEST1: Add test application. See Application Note ET9300 for more details.
brief Changes to version V4.40:n
brief V4.42 ESM1: Reset local error flag if master set the acknowledge bit (0x120.4)
brief Changes to version V4.30:n
brief V4.40 ESM5: Enable output SyncManager if local error acknowledged
brief V4.40 HW0: Use common hardware access functions
brief V4.40 PDO3: Add support if only input process data is used
brief V4.40 ECAT4: Add read SM activation register to acknowledge SM Change event
brief V4.40 PDO2: Check if max process data size was exceed
brief V4.40 DIAG1: add diagnosis message support
brief V4.40 ESM4: Change Check WD setup; add define OP_PD_REQUIRED (defines if process data required in state change to OP)
brief V4.40 WD1: change WD behaviour depending if process data required in OP state
brief V4.40 MBX4: Change processing order of mailbox SyncManager flags
brief V4.40 ECAT1: Merge content of HW_Main (spihw.c /mcihw.c) to ECAT_Main
brief V4.40 ECAT2: Added CheckIfLocalError() to check local flags and set ALStatus /Al Status code if required. This function is called cyclic from MainLoop.
brief V4.40 ESM2: Add AL_ControlRes() to complete pending state requests. Change SafeOP to OP state response
brief V4.40 ESM1: Prevent double call of StopOutputHandler()
brief V4.40 BOOT1: Enable Mailbox SyncManger on state change to BOOT state (to enable FoE)
brief V4.40 ESM3: Change State machine behaviour according to ETG.1000 V1.0.2 (state change #26)
brief V4.40 LED1: Set error blink code
brief V4.40 TIMER1: Added DC_CheckWatchdog() triggered from ECAT_CheckTimer(). Change local Sync0 watchdog variables. Change bus cycle calculation
brief V4.40 WD1: Change check process data watchdog settings
brief Changes to version V4.20:n
brief V4.30 OBJ 3: initialize the object dictionary in state change INIT->PREOP; clear object dictionary in state change PREOP->INIT
brief V4.30 SYNC: add 0x1C32:10; 0x1C33:10 (Sync0 cycle), change synchronisation control functionality
brief V4.30 CiA402: add CiA402_Init() call in state change from PREOP to SAFEOP if DC synchronisation is enabled,
brief else the Init function is called when bus cycle time is calculated [CalcSMCycleTime() ].
brief trigger error handling if the EtherCAT state machine gets a transition from OP to an "lower" state
brief V4.20 ECAT 1: add LEGACY_MODE behaviour in ECAT_CheckWatchdog()
brief V4.20 DC 1: Add DC pending state machine handling and Dc watchdog functionality
brief V4.20 ESM 2: Add State transition from BOOT to INIT
brief V4.20 ESM 1: Non LEGACY_MODE State change handling
brief V4.11 Renamed the function parameter "code" of Function "SendSmFailedEmergency() to avoid
brief problems with some compilers"n
brief V4.11 ECAT 1: Fixed a possible problem with state change Init -> SafeOP. The output syncmanager
brief was enabled by the state change-flag and not by the actual staten
brief V4.11 LED 1: Clear the error LED during error acknowledgementn
brief V4.11 ESC 1: fixed size of MBXHEADER in the TFOEMBX struct n
brief Changes to version V4.08:n
brief V4.10 ECAT 1: clear bEcatOutputsReceived in startMailboxhandler()n
brief V4.10 ECAT 2: clear bEcatOutputsReceived in stopMailboxhandler()n
brief V4.10 ECAT 3: when switching from INIT to BOOT the SM settings shall be checkedn
brief V4.10 ECAT 4: APPL_StartInputHandler shall always be called and bEcatInputUpdateRunning shall always be set
brief in StartInputHandler independent of the input sizen
brief V4.10 ECAT 5: AL_ControlInd: the error acknowledge behaviour was changed
brief according to the protocol enhancements and the conformance testn
brief V4.10 ECAT 6: AL_ControlInd: if a state transitions failed the corresponding stop function is
brief called to get a consistent set of variablesn
brief V4.10 ECAT 7: the local application requested to leave the state OP so we have to disable the SM2
brief and make the state change from OP to SAFEOP by calling StopOutputHandlern
brief V4.10 ECAT 8: the AL Status Code has to be reset if the error was acknowledged by the mastern
brief V4.10 ECAT 9: ECAT_StateChange: when waiting for a State Change response from the application the
brief AL Status shall only be written if the final state was reachedn
brief Changes to version V4.07:n
brief V4.08 ECAT 1: The watchdog value was not rounded upn
brief V4.08 ECAT 2: The value of u16WdValue was not set 0 if the register 0x420 is 0n
brief V4.08 ECAT 3: The AlStatusCode is changed as parameter of the function AL_ControlIndn
brief V4.08 ECAT 4: In a state transition OP2PREOP, SAFEOP2INIT or OP2INIT is requested,
brief this was not working correctly if one of the application functions
brief APPL_StopInputHandler or APPL_StopOutputHandler were returning NOERROR_INWORK
brief (because only the first state transition was made in that case)n
brief V4.08 AOE 1: AoE was addedn
brief Changes to version V4.06:n
brief V4.07 ECAT 1: The sources for SPI and MCI were merged (in ecat_def.h
brief set the switch MCI_HW to 1 when using the MCI,
brief set the switch SPI_HW to 1 when using the SPIn
brief Changes to version V4.00:n
brief V4.01 ECAT 1: The Output sync Manager was not disabled when the state OP was left
brief by a local request (watchdog or io error)n
brief V4.01 ECAT 2: APPL_StopOutputHandler returns an UINT16n
brief V4.01 ECAT 3: TwinCAT compatibility mode: The state transition to OP is allowed when the
brief WD-Trigger-Bit of the SM2-Control-Byte (0x814.6) is FALSE, in that case the
brief watchdog will not be started before the outputs were received the first timen
brief V4.01 ECAT 4: "else" was too muchn
brief Changes to version V3.20:n
brief V4.00 ECAT 1: The handling of the Sync Manager Parameter was included according to
brief the EtherCAT Guidelines and Protocol Enhancements Specificationn
brief V4.00 ECAT 2: The output sync manager is initialized during the state transition
brief from PREOP to SAFEOP that the master can check if the slave could update
brief inputs and outputs before switching the slave to OPn
brief behaviour according to the EtherCAT Guidelines and Protocol Enhancements Specificationn
brief V4.00 ECAT 3: The watchdog will be enabled in SAFE-OP that it can be checked if the last SM event
brief was received during the watchdog time before switching to OPn
brief V4.00 ECAT 4: The function CheckSmChannelParameters is included in the function
brief CheckSmSettings to get a better overviewn
brief V4.00 ECAT 5: In synchronous mode the slave should support 1- and 3-buffer mode, 3-buffer mode
brief should be the standard setting, because the controlling if the process data was updated
brief should be done with the TxPDO Toggle, but the 1-buffer mode should be setable too,
brief that the master could easily check if all slaves are synchronous by checking the
brief the working counter (if the outputs were not read or the inputs were not written
brief the ESC of the slave would not increment the working counter with expected value
brief if the 1-buffer mode is running)n
brief V4.00 ECAT 6: The function ECAT_StateChange was added, which the application should call if a local error
brief is detected (with the parameters alStatus = STATE_SAFEOP, alStatusCode = error code (> 0x1000))
brief or gone (with the parameters alStatus = STATE_OP, alStatusCode = 0)
brief or if one of the functions APPL_StartMailboxHandler, APPL_StopMailboxHandler, APPL_StartInputHandler,
brief APPL_StopInputHandler, APPL_StartOutputHandler, APPL_StopOutputHandler has returned NOERROR_INWORK
brief to acknowledge the last state transition (with the parameters alStatus = new AL-Status, alStatusCode =
brief new AL-Status-Code)n
brief V4.00 ECAT 7: The return values for the AL-StatusCode were changed to UINT16n
version 5.01
*/
//---------------------------------------------------------------------------------------
/**
ingroup ecatslv
file ecatslv.c
brief Implementation.
*/
//---------------------------------------------------------------------------------------
/*-----------------------------------------------------------------------------------------
------
------ Includes
------
-----------------------------------------------------------------------------------------*/
#define _ECATSLV_ 1
#include "ecatslv.h"
#undef _ECATSLV_
#define _ECATSLV_ 0
#include "mailbox.h"
#include "ecatcoe.h"
#include "ecatappl.h"
#include "objdef.h"
#include "coeappl.h"
#include "el9800appl.h"
论文查重需要。。。全部删除。。。
最后
以上就是小巧春天为你收集整理的ecatslv.c及注释的全部内容,希望文章能够帮你解决ecatslv.c及注释所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复