ECMC: EtherCAT open source motion control.
Motion control based on the open source EtherCAT master (www.etherlab.org). The motion package is integerated into the ESS EPCIS environment (E3).
Loading...
Searching...
No Matches
ecmcEthercat.h
Go to the documentation of this file.
1/*************************************************************************\
2* Copyright (c) 2019 European Spallation Source ERIC
3* ecmc is distributed subject to a Software License Agreement found
4* in file LICENSE that is included with this distribution.
5*
6* ecmcEthercat.h
7*
8* Created on: Jan 10, 2019
9* Author: anderssandstrom
10*
11\*************************************************************************/
12
18#ifndef ECMC_ETHERCAT_H_
19#define ECMC_ETHERCAT_H_
20
21# ifdef __cplusplus
22extern "C" {
23# endif // ifdef __cplusplus
24
34int ecSetMaster(int masterIndex);
35
53int ecResetMaster(int masterIndex);
54
86int ecAddSlave(uint16_t alias,
87 uint16_t position,
88 uint32_t vendorId,
89 uint32_t productCode);
90
92int ecAddSyncManager(int slaveIndex,
93 int direction,
94 uint8_t syncMangerIndex);
95
97int ecAddPdo(int slaveIndex,
98 int syncManager,
99 uint16_t pdoIndex);
100
150 uint16_t slaveBusPosition,
151 uint32_t vendorId,
152 uint32_t productCode,
153 int direction,
154 uint8_t syncMangerIndex,
155 uint16_t pdoIndex,
156 uint16_t entryIndex,
157 uint8_t entrySubIndex,
158 uint8_t bits,
159 char *entryIDString,
160 int signedValue);
161
227 uint16_t slaveBusPosition,
228 uint32_t vendorId,
229 uint32_t productCode,
230 int direction,
231 uint8_t syncMangerIndex,
232 uint16_t pdoIndex,
233 uint16_t entryIndex,
234 uint8_t entrySubIndex,
235 char *datatype,
236 char *entryIDString,
237 int updateInRealTime);
238
273 uint16_t slaveBusPosition,
274 uint16_t entryIndex,
275 uint8_t entrySubIndex,
276 char *datatype,
277 char *idString);
278
314 char *ecPath,
315 size_t byteSize,
316 int direction,
317 char *dataType,
318 char *memMapIDString);
319
348 uint16_t startEntryBusPosition,
349 char *startEntryIDString,
350 size_t byteSize,
351 int direction,
352 char *memMapIDString);
353
393 char *ecPath,
394 size_t entryByteOffset,
395 size_t entryBitOffset,
396 int direction,
397 char *dataType,
398 char *idString
399 );
400
411int ecGetMemMapId(char *memMapIDString,
412 int *id);
413
438 int slaveBusPosition,
439 uint16_t assignActivate,
440 uint32_t sync0Cycle,
441 int32_t sync0Shift,
442 uint32_t sync1Cycle,
443 int32_t sync1Shift );
444
458int ecSelectReferenceDC(int masterIndex,
459 int slaveBusPosition);
460
488int ecAddSdo(uint16_t slaveBusPosition,
489 uint16_t sdoIndex,
490 uint8_t sdoSubIndex,
491 uint32_t value,
492 int byteSize);
493
531int ecAddSdoDT(uint16_t slavePosition,
532 uint16_t sdoIndex,
533 uint8_t sdoSubIndex,
534 char *valueString,
535 char *datatype);
536
561int ecAddSdoComplete(uint16_t slaveBusPosition,
562 uint16_t sdoIndex,
563 const char *valueBuffer,
564 int byteSize);
565
592int ecAddSdoBuffer(uint16_t slavePosition,
593 uint16_t sdoIndex,
594 uint8_t sdoSubIndex,
595 const char *valueBuffer,
596 int byteSize);
597
623int ecWriteSdo(uint16_t slavePosition,
624 uint16_t sdoIndex,
625 uint8_t sdoSubIndex,
626 uint32_t value,
627 int byteSize);
628
638int ecSetDomAllowOffline(int allow);
639
649int ecSetEcAllowOffline(int allow);
650
661int ecAddDomain(int rateCycles,
662 int offsetCycles);
663
670/*int ecWriteSdoComplete(uint16_t slavePosition,
671 uint16_t sdoIndex,
672 uint32_t value,
673 int byteSize);*/
674
700int ecReadSdo(uint16_t slavePosition,
701 uint16_t sdoIndex,
702 uint8_t sdoSubIndex,
703 int byteSize,
704 uint32_t *value);
705
731int ecVerifySdo(uint16_t slavePosition,
732 uint16_t sdoIndex,
733 uint8_t sdoSubIndex,
734 uint32_t verValue,
735 int byteSize);
736
757int ecReadSoE(uint16_t slavePosition,
758 uint8_t driveNo,
759 uint16_t idn,
760 size_t byteSize,
761 uint8_t *value
762 );
763
784int ecWriteSoE(uint16_t slavePosition,
785 uint8_t driveNo,
786 uint16_t idn,
787 size_t byteSize,
788 uint8_t *value
789 );
790
810int ecSlaveConfigWatchDog(int slaveBusPosition,
811 int watchdogDivider,
812 int watchdogIntervals);
813
827int ecApplyConfig(int masterIndex);
828
845int writeEcEntry(int slaveIndex,
846 int entryIndex,
847 uint64_t value);
848
869int writeEcEntryIDString(int slaveBusPosition,
870 char *entryIdString,
871 uint64_t value);
872
889int readEcEntry(int slaveIndex,
890 int entryIndex,
891 uint64_t *value);
892
913int readEcEntryIDString(int slavePosition,
914 char *entryIDString,
915 uint64_t *value);
916
945int readEcEntryIndexIDString(int slavePosition,
946 char *entryIDString,
947 int *value);
948
970int readEcSlaveIndex(int slavePosition,
971 int *value);
972
973
995int readEcMemMap(const char *memMapIDString,
996 uint8_t *data,
997 size_t bytesToRead,
998 size_t *bytesRead);
999
1021 uint16_t slavePosition,
1022 char *entryIDString,
1023 int updateInRealtime);
1024
1043int ecSetDiagnostics(int enable);
1044
1064
1081
1099int ecEnablePrintouts(int value);
1100
1114int ecSetDelayECOkAtStartup(int milliseconds);
1115
1125
1133int ecPrintSlaveConfig(int slaveIndex);
1134
1156 char *entryIDString);
1157
1183int ecVerifySlave(uint16_t alias,
1184 uint16_t slavePos,
1185 uint32_t vendorId,
1186 uint32_t productCode,
1187 uint32_t revisionNum );
1188
1201int ecGetSlaveVendorId(uint16_t alias,
1202 uint16_t slavePos,
1203 uint32_t *result);
1204
1217int ecGetSlaveProductCode(uint16_t alias,
1218 uint16_t slavePos,
1219 uint32_t *result);
1220
1233int ecGetSlaveRevisionNum(uint16_t alias,
1234 uint16_t slavePos,
1235 uint32_t *result);
1236
1249int ecGetSlaveSerialNum(uint16_t alias,
1250 uint16_t slavePos,
1251 uint32_t *result);
1252
1267int ecUseClockRealtime(int useClkRT);
1268
1269# ifdef __cplusplus
1270}
1271# endif // ifdef __cplusplus
1272
1273#endif /* ECMC_ETHERCAT_H_ */
int readEcEntryIDString(int slavePosition, char *entryIDString, uint64_t *value)
Read a value from an EtherCAT entry addressed by slaveBusPosition and entryIdString....
int ecResetError()
Reset error on all EtherCat objects. .
int writeEcEntry(int slaveIndex, int entryIndex, uint64_t value)
Writes a value to an EtherCAT entry. .
int readEcSlaveIndex(int slavePosition, int *value)
Read the object Index of an slave addressed by slaveBusPosition. .
int ecAddSdo(uint16_t slaveBusPosition, uint16_t sdoIndex, uint8_t sdoSubIndex, uint32_t value, int byteSize)
Adds a Service Data Object for writing.
int ecAddDataDT(char *ecPath, size_t entryByteOffset, size_t entryBitOffset, int direction, char *dataType, char *idString)
Adds a data item object to access data directly from EtherCAT domain. This object type only support s...
int ecSetDomAllowOffline(int allow)
Allow domain to be offline.
int ecResetMaster(int masterIndex)
Retry configuring slaves for an selected EtherCAT master. .
int ecAddSlave(uint16_t alias, uint16_t position, uint32_t vendorId, uint32_t productCode)
Adds an EtherCAT slave to the hardware configuration. .
int ecWriteSdo(uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, uint32_t value, int byteSize)
Write to a Service Data Object.
int ecUseClockRealtime(int useClkRT)
Use CLOCK_REALTIME.
int ecGetSlaveVendorId(uint16_t alias, uint16_t slavePos, uint32_t *result)
Read vendor id of selected ethercat slave.
int ecSlaveConfigWatchDog(int slaveBusPosition, int watchdogDivider, int watchdogIntervals)
Configure Slave watch dog. .
int ecSetDomainFailedCyclesLimit(int cycles)
Set allowed bus cycles in row of none complete domain data transfer. .
int readEcEntry(int slaveIndex, int entryIndex, uint64_t *value)
Read a value from an EtherCAT entry. .
int ecSetMaster(int masterIndex)
Selects EtherCAT master to use. .
int linkEcEntryToEcStatusOutput(int slaveIndex, char *entryIDString)
Links an EtherCAT entry to the ethecat master object for hardware status output .
int ecAddSyncManager(int slaveIndex, int direction, uint8_t syncMangerIndex)
obsolete command. Use ecAddEntryComplete() command instead.
int ecPrintAllHardware()
Prints all hardware connected to selected master. .
int ecWriteSoE(uint16_t slavePosition, uint8_t driveNo, uint16_t idn, size_t byteSize, uint8_t *value)
Write SoE .
int ecSetEcAllowOffline(int allow)
Allow master to be offline.
int ecApplyConfig(int masterIndex)
Apply hardware configuration to master. .
int ecPrintSlaveConfig(int slaveIndex)
Prints hardware configuration for a selected slave. .
int ecGetMemMapId(char *memMapIDString, int *id)
Get index of a memmap object based on its name id string.
int ecReadSdo(uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, int byteSize, uint32_t *value)
Write to a Service Data Object.
int ecVerifySlave(uint16_t alias, uint16_t slavePos, uint32_t vendorId, uint32_t productCode, uint32_t revisionNum)
Verfy slave at position.
int ecGetSlaveRevisionNum(uint16_t alias, uint16_t slavePos, uint32_t *result)
revision number id of selected ethercat slave
int ecGetSlaveSerialNum(uint16_t alias, uint16_t slavePos, uint32_t *result)
Read serial number of selected ethercat slave.
int ecAddMemMap(uint16_t startEntryBusPosition, char *startEntryIDString, size_t byteSize, int direction, char *memMapIDString)
Adds a memory map object to access data directly from EtherCAT domain. Support for this syntax might...
int readEcMemMap(const char *memMapIDString, uint8_t *data, size_t bytesToRead, size_t *bytesRead)
Read EtherCAT memory map object.
int ecSetDiagnostics(int enable)
Enable EtherCAT bus diagnostics. .
int ecAddEntry(uint16_t slaveBusPosition, uint32_t vendorId, uint32_t productCode, int direction, uint8_t syncMangerIndex, uint16_t pdoIndex, uint16_t entryIndex, uint8_t entrySubIndex, char *datatype, char *entryIDString, int updateInRealTime)
Adds an EtherCAT slave to the hardware configuration. .
int ecReadSoE(uint16_t slavePosition, uint8_t driveNo, uint16_t idn, size_t byteSize, uint8_t *value)
Read SoE .
int ecVerifySdo(uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, uint32_t verValue, int byteSize)
Verify a Service Data Object.
int readEcEntryIndexIDString(int slavePosition, char *entryIDString, int *value)
Read the object Index of an entry addressed by slaveBusPosition and entryIdString....
int writeEcEntryIDString(int slaveBusPosition, char *entryIdString, uint64_t value)
Writes a value to an EtherCAT entry addressed by slaveBusPosition and entryIdString....
int ecAddSdoComplete(uint16_t slaveBusPosition, uint16_t sdoIndex, const char *valueBuffer, int byteSize)
Adds a Service Data Object for writing.
int ecAddDomain(int rateCycles, int offsetCycles)
Add domain.
int ecGetSlaveProductCode(uint16_t alias, uint16_t slavePos, uint32_t *result)
Read product code of selected ethercat slave.
int ecAddPdo(int slaveIndex, int syncManager, uint16_t pdoIndex)
obsolete command. Use ecAddEntryComplete() command instead.
int ecEnablePrintouts(int value)
Enable diagnostic printouts from EtherCAT objects. .
int ecSelectReferenceDC(int masterIndex, int slaveBusPosition)
Select EtherCAT reference clock. .
int ecSetEntryUpdateInRealtime(uint16_t slavePosition, char *entryIDString, int updateInRealtime)
Set update in realtime bit for an entry.
int ecAddSdoDT(uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, char *valueString, char *datatype)
Adds a Service Data Object for writing.
int ecSlaveConfigDC(int slaveBusPosition, uint16_t assignActivate, uint32_t sync0Cycle, int32_t sync0Shift, uint32_t sync1Cycle, int32_t sync1Shift)
Configure slave DC clock. .
int ecAddSdoBuffer(uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, const char *valueBuffer, int byteSize)
Adds a Service Data Object for writing.
int ecSetDelayECOkAtStartup(int milliseconds)
Delay ethercat OK status for a time.
int ecAddEntryComplete(uint16_t slaveBusPosition, uint32_t vendorId, uint32_t productCode, int direction, uint8_t syncMangerIndex, uint16_t pdoIndex, uint16_t entryIndex, uint8_t entrySubIndex, uint8_t bits, char *entryIDString, int signedValue)
int ecAddSdoAsync(uint16_t slaveBusPosition, uint16_t entryIndex, uint8_t entrySubIndex, char *datatype, char *idString)
Adds an async SDO object. .
int ecAddMemMapDT(char *ecPath, size_t byteSize, int direction, char *dataType, char *memMapIDString)
Adds a memory map object to access data directly from EtherCAT domain. This is the preferred syntax....