XMC Peripheral Library for XMC4000 Family: ECAT

XMC Peripheral Library for XMC4000 Family

XMC Peripheral Library for XMC4000 Family  2.1.16

Data Structures

union  XMC_ECAT_CONFIG_t
 
struct  XMC_ECAT_PORT_CTRL_t
 

Enumerations

Functions

void XMC_ECAT_Disable (void)
 
void XMC_ECAT_DisableEvent (uint32_t event)
 
void XMC_ECAT_DisableSyncManChannel (const uint8_t channel)
 
void XMC_ECAT_Enable (void)
 
void XMC_ECAT_EnableEvent (uint32_t event)
 
void XMC_ECAT_EnableSyncManChannel (const uint8_t channel)
 
uint16_t XMC_ECAT_GetALEventMask (void)
 
uint16_t XMC_ECAT_GetALEventRegister (void)
 
uint32_t XMC_ECAT_GetEventStatus (void)
 
void XMC_ECAT_Init (XMC_ECAT_CONFIG_t *const config)
 
XMC_ECAT_STATUS_t XMC_ECAT_ReadPhy (uint8_t phy_addr, uint8_t reg_addr, uint16_t *data)
 
void XMC_ECAT_SetALEventMask (uint16_t intMask)
 
void XMC_ECAT_SetPortControl (const XMC_ECAT_PORT_CTRL_t port_ctrl)
 
XMC_ECAT_STATUS_t XMC_ECAT_WritePhy (uint8_t phy_addr, uint8_t reg_addr, uint16_t data)
 

Detailed Description

EtherCAT is an Ethernet-based fieldbus system. The EtherCAT Slave Controller (ECAT) read the data addressed to them while the telegram passes through the device. An EtherCAT Slave Controller (ESC) takes care of the EtherCAT communication as an interface between the EtherCAT fieldbus and the slave application. EtherCAT uses standard IEEE 802.3 Ethernet frames, thus a standard network controller can be used and no special hardware is required on master side. EtherCAT has a reserved EtherType of 0x88A4 that distinguishes it from other Ethernet frames. Thus, EtherCAT can run in parallel to other Ethernet protocols. EtherCAT does not require the IP protocol, however it can be encapsulated in IP/UDP. The EtherCAT Slave Controller processes the frame in hardware. Thus, communication performance is independent from processor power.

The XMC_ECAT low level driver provides functions to configure and initialize the ECAT hardware peripheral. For EHTERCAT stack integration, the necessary hardware accees layer APIs shall be explicitly implemented depending upon the stack provider. The XMC_ECAT lld layer provides only the hardware initialization functions for start up and basic functionalities.

Enumeration Type Documentation

EtherCAT event enumeration types

Enumerator
XMC_ECAT_EVENT_AL_CONTROL 

Application control event mask

XMC_ECAT_EVENT_DC_LATCH 

Distributed Clock latch event mask

XMC_ECAT_EVENT_DC_SYNC0 

State of distributed clock sync-0 event mask

XMC_ECAT_EVENT_DC_SYNC1 

State of distributed clock sync-1 event mask

XMC_ECAT_EVENT_SM_ACTIVATION_REGISTER 

SyncManager activation register mask

XMC_ECAT_EVENT_EEPROM 

EEPROM Emulation event mask

XMC_ECAT_EVENT_WATCHDOG 

WATCHDOG process data event mask

XMC_ECAT_EVENT_SM0 

Sync Manager 0 event mask

XMC_ECAT_EVENT_SM1 

Sync Manager 1 event mask

XMC_ECAT_EVENT_SM2 

Sync Manager 2 event mask

XMC_ECAT_EVENT_SM3 

Sync Manager 3 event mask

XMC_ECAT_EVENT_SM4 

Sync Manager 4 event mask

XMC_ECAT_EVENT_SM5 

Sync Manager 5 event mask

XMC_ECAT_EVENT_SM6 

Sync Manager 6 event mask

XMC_ECAT_EVENT_SM7 

Sync Manager 7 event mask

ECAT status return values

Enumerator
XMC_ECAT_STATUS_OK 

Driver accepted application request

XMC_ECAT_STATUS_BUSY 

Driver is busy and cannot handle request

XMC_ECAT_STATUS_ERROR 

Driver could not fulfil application request

Function Documentation

void XMC_ECAT_Disable ( void  )
Parameters
None
Returns
None
Description:
Disable the EtherCAT peripheral
The function asserts the peripheral reset.
void XMC_ECAT_DisableEvent ( uint32_t  event)
Parameters
eventSingle or logically OR'd events specified in the enum type
Returns
None
Description:
Disable an ECAT event(s)
The function can be used to disable ECAT event(s).
void XMC_ECAT_DisableSyncManChannel ( const uint8_t  channel)
Parameters
channelSyncManager channel number.
Returns
None
Description:
Disables selected SyncManager channel
Sets bit 0 of the corresponding 0x807 register.
void XMC_ECAT_Enable ( void  )
Parameters
None
Returns
None
Description:
Enable the EtherCAT peripheral
The function de-asserts the peripheral reset.
void XMC_ECAT_EnableEvent ( uint32_t  event)
Parameters
eventSingle or logically OR'd events specified in the enum type
Returns
None
Description:
Enable ECAT event(s)
The function can be used to enable ECAT event(s).
void XMC_ECAT_EnableSyncManChannel ( const uint8_t  channel)
Parameters
channelSyncManager channel number.
Returns
None
Description:
Enables selected SyncManager channel
Resets bit 0 of the corresponding 0x807 register.
uint16_t XMC_ECAT_GetALEventMask ( void  )
Parameters
None
Returns
uint16_t Content of register 0x220-0x221
Description:
Get content of AL event register
Get the first two bytes of the AL Event register (0x220-0x221).
uint16_t XMC_ECAT_GetALEventRegister ( void  )
Parameters
None
Returns
uint16_t Content of register 0x220-0x221
Description:
Get content of AL event register
Get the first two bytes of the AL Event register (0x220-0x221).
uint32_t XMC_ECAT_GetEventStatus ( void  )
Parameters
None
Returns
uint32_t Event status
Description:
Get event status
The function returns the ECAT status and interrupt status as a single word. The user can then check the status of the events by using an appropriate mask.
void XMC_ECAT_Init ( XMC_ECAT_CONFIG_t *const  config)
Parameters
configXMC_ECAT_CONFIG_t
Returns
XMC_ECAT_STATUS_t ECAT Initialization status
Description:
Initialize the Ethernet MAC peripheral
The function sets the link speed, applies the duplex mode, sets auto-negotiation and loop-back settings.
XMC_ECAT_STATUS_t XMC_ECAT_ReadPhy ( uint8_t  phy_addr,
uint8_t  reg_addr,
uint16_t *  data 
)
Parameters
phy_addrPHY address
reg_addrRegister address
dataThe destination to which the read data needs to be copied to.
Returns
XMC_ECAT_STATUS_t EtherCAT Read PHY API return status
Description:
Read a PHY register
The function reads a PHY register. It essentially polls busy bit during max PHY_TIMEOUT time and reads the information into 'data' when not busy.
void XMC_ECAT_SetALEventMask ( uint16_t  intMask)
Parameters
intMaskInterrupt mask (disabled interrupt shall be zero)
Returns
None
Description:
Sets application event mask register
Performs a logical OR with the AL Event Mask register (0x0204 : 0x0205).
void XMC_ECAT_SetPortControl ( const XMC_ECAT_PORT_CTRL_t  port_ctrl)
Parameters
port_ctrlPort control configuration
Returns
None
Description:
Set port control configuration
The function sets the port control by writing the configuration into the ECAT CON register.
XMC_ECAT_STATUS_t XMC_ECAT_WritePhy ( uint8_t  phy_addr,
uint8_t  reg_addr,
uint16_t  data 
)
Parameters
phy_addrPHY address
reg_addrRegister address
dataThe data to write
Returns
XMC_ECAT_STATUS_t EtherCAT Write PHY API return status
Description:
Write a PHY register
The function reads a PHY register. It essentially writes the data and polls the busy bit until it is no longer busy.
Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by   doxygen 1.8.11