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
ecmcMisc.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* ecmcMisc.h
7*
8* Created on: Jan 10, 2019
9* Author: anderssandstrom
10*
11\*************************************************************************/
12
18#ifndef ECMC_MISC_H_
19#define ECMC_MISC_H_
20
21#define CHECK_COMMAND_LIST_RETURN_IF_ERROR(commandListIndex)\
22 {\
23 if (indexCommandList >= ECMC_MAX_COMMANDS_LISTS ||\
24 indexCommandList < 0) {\
25 LOGERR("ERROR: Command list index out of range.\n");\
26 return ERROR_COMMAND_LIST_INDEX_OUT_OF_RANGE;\
27 }\
28 if (commandLists[indexCommandList] == NULL) {\
29 LOGERR("ERROR: Command list object NULL.\n");\
30 return ERROR_COMMAND_LIST_NULL;\
31 }\
32 }\
33
34#define CHECK_EVENT_RETURN_IF_ERROR(indexEvent)\
35 {\
36 if (indexEvent >= ECMC_MAX_EVENT_OBJECTS || indexEvent < 0) {\
37 LOGERR("ERROR: Event index out of range.\n");\
38 return ERROR_MAIN_EVENT_INDEX_OUT_OF_RANGE;\
39 }\
40 if (events[indexEvent] == NULL) {\
41 LOGERR("ERROR: Event object NULL.\n");\
42 return ERROR_MAIN_EVENT_NULL;\
43 }\
44 }\
45
46#define CHECK_STORAGE_RETURN_IF_ERROR(indexStorage)\
47 {\
48 if (indexStorage >= ECMC_MAX_DATA_STORAGE_OBJECTS ||\
49 indexStorage < 0) {\
50 LOGERR("ERROR: Data storage index out of range.\n");\
51 return ERROR_MAIN_DATA_STORAGE_INDEX_OUT_OF_RANGE;\
52 }\
53 if (dataStorages[indexStorage] == NULL) {\
54 LOGERR("ERROR: Data storage object NULL.\n");\
55 return ERROR_MAIN_DATA_STORAGE_NULL;\
56 }\
57 }\
58
59#define CHECK_RECORDER_RETURN_IF_ERROR(indexRecorder)\
60 {\
61 if (indexRecorder >= ECMC_MAX_DATA_RECORDERS_OBJECTS ||\
62 indexRecorder < 0) {\
63 LOGERR("ERROR: Data recorder index out of range.\n");\
64 return ERROR_MAIN_DATA_RECORDER_INDEX_OUT_OF_RANGE;\
65 }\
66 if (dataRecorders[indexRecorder] == NULL) {\
67 LOGERR("ERROR: Data recorder object NULL.\n");\
68 return ERROR_MAIN_DATA_RECORDER_NULL;\
69 }\
70 }\
71
72# ifdef __cplusplus
73extern "C" {
74# endif // ifdef __cplusplus
75
76
102int createEvent(int index);
103
131int linkEcEntryToEvent(int indexEvent,
132 int eventEntryIndex,
133 int slaveBusPosition,
134 char *entryIDString,
135 int bitIndex);
136
149int setEventType(int indexEvent,
150 int type);
151
169int setEventSampleTime(int indexEvent,
170 int sampleTime);
171
185int setEventTriggerEdge(int indexEvent,
186 int triggerEdge);
187
201int setEventEnable(int indexEvent,
202 int enable);
203
217int getEventEnabled(int indexEvent,
218 int *enabled);
219
235int setEventEnableArmSequence(int indexEvent,
236 int enable);
237
248int setEventEnablePrintouts(int indexEvent,
249 int enable);
250
262int triggerEvent(int indexEvent);
263
275int armEvent(int indexEvent);
276
301int createDataStorage(int index,
302 int elements,
303 int bufferType);
304
316int clearStorage(int indexStorage);
317
329int getStorageDataIndex(int indexStorage,
330 int *index);
331
342int setStorageEnablePrintouts(int indexStorage,
343 int enable);
344
354int printStorageBuffer(int indexStorage);
355
367int readStorageBuffer(int indexStorage,
368 double **data,
369 int *size);
370
382int writeStorageBuffer(int indexStorage,
383 double *data,
384 int size);
385
397int appendStorageBuffer(int indexStorage,
398 double *data,
399 int size);
400
416 int position);
417
437int createRecorder(int indexRecorder);
438
449int linkStorageToRecorder(int indexStorage,
450 int indexRecorder);
451
478int linkEcEntryToRecorder(int indexRecorder,
479 int recorderEntryIndex,
480 int slaveBusPosition,
481 char *entryIDString,
482 int bitIndex);
483
530int linkAxisDataToRecorder(int indexRecorder,
531 int axisIndex,
532 int dataToStore);
533
546int setRecorderEnable(int indexRecorder,
547 int enable);
548
561int getRecorderEnabled(int indexRecorder,
562 int *enabled);
563
574int setRecorderEnablePrintouts(int indexRecorder,
575 int enable);
576
589int linkRecorderToEvent(int indexRecorder,
590 int indexEvent,
591 int consumerIndex);
592
604int triggerRecorder(int indexRecorder);
605
626int createCommandList(int indexCommandList);
627
640int linkCommandListToEvent(int indexCommandList,
641 int indexEvent,
642 int consumerIndex);
643
656int setCommandListEnable(int indexCommandList,
657 int enable);
658
669int setCommandListEnablePrintouts(int indexCommandList,
670 int enable);
671
683int addCommandListCommand(int indexCommandList,
684 char *expr);
685
697int triggerCommandList(int indexCommandList);
698
707
708# ifdef __cplusplus
709}
710# endif // ifdef __cplusplus
711
712#endif /* ECMC_MISC_H_ */
int setRecorderEnablePrintouts(int indexRecorder, int enable)
Enable diagnostic printouts from recorder object. .
int readStorageBuffer(int indexStorage, double **data, int *size)
Reads contents of storage buffer. .
int getStorageDataIndex(int indexStorage, int *index)
Get current index of data in storage buffer. .
int createCommandList(int indexCommandList)
Create a command list object.
int setCommandListEnable(int indexCommandList, int enable)
Enable command list. .
int writeStorageBuffer(int indexStorage, double *data, int size)
Writes data to storage buffer. .
int createRecorder(int indexRecorder)
Create recorder object.
int linkRecorderToEvent(int indexRecorder, int indexEvent, int consumerIndex)
Link recorder object to event object. .
int linkStorageToRecorder(int indexStorage, int indexRecorder)
Link storage object to recorder object.
int triggerCommandList(int indexCommandList)
Force trigger command list. .
int triggerEvent(int indexEvent)
Force trigger event. .
int linkCommandListToEvent(int indexCommandList, int indexEvent, int consumerIndex)
Link command list object to event object. .
int getEventEnabled(int indexEvent, int *enabled)
Get event enabled. .
int clearStorage(int indexStorage)
Clear data storage buffer.
int createDataStorage(int index, int elements, int bufferType)
Create a data storage object.
int setEventTriggerEdge(int indexEvent, int triggerEdge)
Set event trigger edge. .
int setRecorderEnable(int indexRecorder, int enable)
Enable recorder. .
int setCommandListEnablePrintouts(int indexCommandList, int enable)
Enable diagnostic printouts from command list object. .
int armEvent(int indexEvent)
Arm event. .
int linkAxisDataToRecorder(int indexRecorder, int axisIndex, int dataToStore)
Links an axis data source to a recorder object. .
int setEventEnableArmSequence(int indexEvent, int enable)
Enable arm sequence. .
int appendStorageBuffer(int indexStorage, double *data, int size)
Appends data to the end of storage buffer. .
int getRecorderEnabled(int indexRecorder, int *enabled)
Get recorder enabled. .
int setEventEnable(int indexEvent, int enable)
Enable event. .
int setEventType(int indexEvent, int type)
Set event type. .
int linkEcEntryToRecorder(int indexRecorder, int recorderEntryIndex, int slaveBusPosition, char *entryIDString, int bitIndex)
Links an EtherCAT entry to a recorder object. .
int setEventSampleTime(int indexEvent, int sampleTime)
Set event sampling time (cycle counts). .
int createEvent(int index)
Create an event object.
int printStorageBuffer(int indexStorage)
Print contents of buffer. .
int addCommandListCommand(int indexCommandList, char *expr)
Add command to command list. .
int triggerRecorder(int indexRecorder)
Force trigger recorder. .
int setStorageEnablePrintouts(int indexStorage, int enable)
Enable diagnostic printouts from data storage object. .
int linkEcEntryToEvent(int indexEvent, int eventEntryIndex, int slaveBusPosition, char *entryIDString, int bitIndex)
Links an EtherCAT entry to an event object. .
int createShm()
Create SHM Object. .
int setEventEnablePrintouts(int indexEvent, int enable)
Enable diagnostic printouts from event object. .
int setDataStorageCurrentDataIndex(int indexStorage, int position)
Set current data index of storage buffer. .