1 Commits

Author SHA1 Message Date
867c9f6a06 Depend on ecmc 9 2024-09-13 09:07:12 +02:00
2 changed files with 48 additions and 14 deletions

View File

@@ -2,9 +2,6 @@ include /ioc/tools/driver.makefile
MODULE = ecmc_plugin_daq
# "Transfer" module name to plugin
USR_CFLAGS +=-DECMC_PLUGIN_MODULE_NAME=${MODULE}
BUILDCLASSES = Linux
ARCH_FILTER = deb10%
@@ -19,7 +16,7 @@ OPT_CXXFLAGS_YES = -O3
# dependencies
ECmasterECMC_VERSION = v1.1.0
ecmc_VERSION = v10.0.0_RC1
ecmc_VERSION = 9
BASE_DIR = .
SRC_DIR = $(BASE_DIR)/src

View File

@@ -32,11 +32,11 @@ static char* lastConfStr = NULL;
static int alreadyLoaded = 0;
/** Optional.
* Will be called once after successful load into ecmc.
* Will be called once after successfull load into ecmc.
* Return value other than 0 will be considered error.
* configStr can be used for configuration parameters.
**/
static int daqConstruct(char *configStr)
int daqConstruct(char *configStr)
{
if(alreadyLoaded) {
printf("Error: Plugin ecmc_plugin_daq already loaded and can only be loaded once.");
@@ -51,7 +51,7 @@ static int daqConstruct(char *configStr)
/** Optional function.
* Will be called once at unload.
**/
static void daqDestruct(void)
void daqDestruct(void)
{
// Segfaults here during destruction?! need to check..
//deleteAllDAQs();
@@ -61,19 +61,19 @@ static void daqDestruct(void)
}
/** Optional function.
* Will be called each realtime cycle if defined
* ecmcError: Error code of ecmc. Makes it possible for
* Will be called each realtime cycle if definded
* ecmcError: Error code of ecmc. Makes it posible for
* this plugin to react on ecmc errors
* Return value other than 0 will be considered to be an error code in ecmc.
**/
static int daqRealtime(int ecmcError)
int daqRealtime(int ecmcError)
{
lastEcmcError = ecmcError;
return executeDAQs();
}
static int daqEnterRT(){
int daqEnterRT(){
return validateDAQs(); //linkDataToDAQs();
}
@@ -81,16 +81,31 @@ static int daqEnterRT(){
* Will be called once just before leaving realtime mode
* Return value other than 0 will be considered error.
**/
static int daqExitRT(void){
int daqExitRT(void){
return 0;
}
// // Plc function for clear of buffers
// double daq_clear(double index) {
// return (double)clearDAQ((int)index);
// }
// Plc function for enable
//double daq_enable(double index, double enable) {
// return 0; //(double)enableDAQ((int)index, (int)enable);
//}
// // Plc function for trigg new measurement (will clear buffers)
// double daq_trigg(double index) {
// return (double)triggDAQ((int)index);
// }
// Register data for plugin so ecmc know what to use
static struct ecmcPluginData pluginDataDef = {
struct ecmcPluginData pluginDataDef = {
// Allways use ECMC_PLUG_VERSION_MAGIC
.ifVersion = ECMC_PLUG_VERSION_MAGIC,
// Name
.name = "ecmc_plugin_daq",
.name = "ecmcPlugin_DAQ",
// Description
.desc = "DAQ plugin for use with ecmc.",
// Option description
@@ -109,6 +124,28 @@ static struct ecmcPluginData pluginDataDef = {
.realtimeExitFnc = daqExitRT,
// PLC funcs
.funcs[0] = {0},
// { /*----fft_clear----*/
// // Function name (this is the name you use in ecmc plc-code)
// .funcName = "daq_enable",
// // Function description
// .funcDesc = "daq_enable(index,enable) : Enable/disaable daq[index].",
// /**
// * 12 different prototypes allowed (only doubles since reg in plc).
// * Only funcArg${argCount} func shall be assigned the rest set to NULL.
// **/
// .funcArg0 = NULL,
// .funcArg1 = NULL,
// .funcArg2 = daq_enable,
// .funcArg3 = NULL,
// .funcArg4 = NULL,
// .funcArg5 = NULL,
// .funcArg6 = NULL,
// .funcArg7 = NULL,
// .funcArg8 = NULL,
// .funcArg9 = NULL,
// .funcArg10 = NULL,
// .funcGenericObj = NULL,
// },
.consts[0] = {0}, // last element set all to zero..
};