From 399023e023718ea78501c4ad4ea749a54a194767 Mon Sep 17 00:00:00 2001 From: Anders Sandstrom Date: Tue, 9 Mar 2021 13:47:02 +0100 Subject: [PATCH] Add SDO and PDO iocsh commands --- .../src/.vscode/settings.json | 58 ++++- .../src/ecmcCANOpenDevice.cpp | 5 + .../src/ecmcCANOpenDevice.h | 1 + .../src/ecmcCANOpenMaster.cpp | 6 +- .../src/ecmcSocketCAN.cpp | 141 +++++++++- .../src/ecmcSocketCAN.h | 34 ++- .../src/ecmcSocketCANDefs.h | 4 +- .../src/ecmcSocketCANWrap.cpp | 244 ++++++++++++++++-- iocsh/pvs.log | 24 +- 9 files changed, 462 insertions(+), 55 deletions(-) diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/.vscode/settings.json b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/.vscode/settings.json index 2db369c..3beec43 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/.vscode/settings.json +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/.vscode/settings.json @@ -1,6 +1,62 @@ { "files.associations": { "typeindex": "cpp", - "typeinfo": "cpp" + "typeinfo": "cpp", + "stdexcept": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "csetjmp": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "array": "cpp", + "atomic": "cpp", + "strstream": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cfenv": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "list": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "fstream": "cpp", + "functional": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "numeric": "cpp", + "ratio": "cpp", + "scoped_allocator": "cpp", + "sstream": "cpp", + "streambuf": "cpp", + "system_error": "cpp", + "thread": "cpp", + "regex": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "valarray": "cpp" } } \ No newline at end of file diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.cpp b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.cpp index d367600..4b2ec9e 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.cpp +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.cpp @@ -162,3 +162,8 @@ int ecmcCANOpenDevice::addSDO(uint32_t cobIdTx, // 0x580 + CobId sdoCounter_++; return 0; } + +uint32_t ecmcCANOpenDevice::getNodeId() { + return nodeId_; +} + diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.h b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.h index 392162b..4d369cd 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.h +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenDevice.h @@ -58,6 +58,7 @@ class ecmcCANOpenDevice { uint32_t ODSize, int readSampleTimeMs, const char* name); + uint32_t getNodeId(); protected: int validateFrame(can_frame *frame); ecmcSocketCANWriteBuffer *writeBuffer_; diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenMaster.cpp b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenMaster.cpp index 938ce6c..7d42457 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenMaster.cpp +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcCANOpenMaster.cpp @@ -33,7 +33,7 @@ ecmcCANOpenMaster::ecmcCANOpenMaster(ecmcSocketCANWriteBuffer* writeBuffer, syncPdo_ = NULL; heartPdo_ = NULL; isMaster_ = true; - + int errorCode = 0; // lssPdo_ = new ecmcCANOpenPDO( writeBuffer_, 0x7E5,DIR_WRITE,0,0,1000,exeSampleTimeMs_,"lss", cfgDbgMode_); @@ -51,12 +51,12 @@ ecmcCANOpenMaster::ecmcCANOpenMaster(ecmcSocketCANWriteBuffer* writeBuffer, // Test sync signal // can0 0x80 [0] // syncPdo_ = new ecmcCANOpenPDO( writeBuffer_, 0x80,DIR_WRITE,0,0,1000,exeSampleTimeMs_,"sync", cfgDbgMode_); - errorCode = addPDO(0x80, // uint32_t cobId, + errorCode = addPDO(0x80, // uint32_t cobId, DIR_WRITE, // ecmc_can_direction rw, 0, // uint32_t ODSize, 0, // int readTimeoutMs, 1000, // int writeCycleMs, if < 0 then write on demand. - "sync"); // const char* name); + "sync"); // const char* name); if(errorCode) { throw std::runtime_error( "Sync PDO NULL."); diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.cpp b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.cpp index cfab4f7..af6643f 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.cpp +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.cpp @@ -56,22 +56,27 @@ ecmcSocketCAN::ecmcSocketCAN(char* configStr, char* portName, int exeSampleTimeMs) { // Init - cfgCanIFStr_ = NULL; - cfgDbgMode_ = 0; + cfgCanIFStr_ = NULL; + cfgDbgMode_ = 0; cfgAutoConnect_ = 1; - destructs_ = 0; - socketId_ = -1; - connected_ = 0; - writeBuffer_ = NULL; - //testSdo_ = NULL; - //testPdo_ = NULL; - //lssPdo_ = NULL; - //syncPdo_ = NULL; - //heartPdo_ = NULL; + destructs_ = 0; + socketId_ = -1; + connected_ = 0; + writeBuffer_ = NULL; + //testSdo_ = NULL; + //testPdo_ = NULL; + //lssPdo_ = NULL; + //syncPdo_ = NULL; + //heartPdo_ = NULL; //basicConfSdo_ = NULL; - testDevice_ = NULL; - testMaster_ = NULL; - cycleCounter_ = 0; + testDevice_ = NULL; + testMaster_ = NULL; + cycleCounter_ = 0; + deviceCounter_ = 0; + masterDev_ = NULL; + for(int i = 0; inewRxFrame(&rxmsg_); // } + // forward all data to devices (also master) + for(int i = 0; i < deviceCounter_; i++){ + devices_[i]->newRxFrame(&rxmsg_); + } + if(testDevice_) { testDevice_->newRxFrame(&rxmsg_); } @@ -371,6 +386,10 @@ void ecmcSocketCAN::execute() { testDevice_->execute(); } + for(int i = 0; i < deviceCounter_; i++){ + devices_[i]->execute(); + } + // cycleCounter_++; // if(basicConfSdo_) { // basicConfSdo_->execute(); @@ -614,3 +633,97 @@ std::string ecmcSocketCAN::to_string(int value) { // return asynSuccess; //} // + +void ecmcSocketCAN::addMaster(uint32_t nodeId, + const char* name) { + if(masterDev_) { + throw std::runtime_error("Master already added."); + } + if(deviceCounter_ >= ECMC_CAN_MAX_DEVICES) { + throw std::out_of_range("Device array full."); + } + if(nodeId >= 128) { + throw std::out_of_range("Node id out of range."); + } + + masterDev_ = new ecmcCANOpenMaster(writeBuffer_,nodeId,exeSampleTimeMs_,name, cfgDbgMode_); + // add as a normal device also for execute and rxframe + devices_[deviceCounter_] = masterDev_; + deviceCounter_++; +} + +void ecmcSocketCAN::addDevice(uint32_t nodeId, + const char* name){ + if(deviceCounter_ >= ECMC_CAN_MAX_DEVICES) { + throw std::out_of_range("Device array full."); + } + if(nodeId >= 128) { + throw std::out_of_range("Node id out of range."); + } + + devices_[deviceCounter_] = new ecmcCANOpenDevice(writeBuffer_,nodeId,exeSampleTimeMs_,name, cfgDbgMode_); + deviceCounter_++; +} + +int ecmcSocketCAN::findDeviceWithNodeId(uint32_t nodeId) { + for(int i=0; i < deviceCounter_;i++) { + if(devices_[i]) { + if(devices_[i]->getNodeId() == nodeId) { + return i; + } + } + } + return -1; +} + +void ecmcSocketCAN::addPDO(uint32_t nodeId, + uint32_t cobId, + ecmc_can_direction rw, + uint32_t ODSize, + int readTimeoutMs, + int writeCycleMs, //if <0 then write on demand. + const char* name) { + int devId = findDeviceWithNodeId(nodeId); + if(devId < 0) { + throw std::out_of_range("Node id not found in any configured device."); + } + + int errorCode = devices_[devId]->addPDO(cobId, + rw, + ODSize, + readTimeoutMs, + writeCycleMs, + name); + if(errorCode > 0) { + throw std::runtime_error("AddPDO() failed."); + } +} + +void ecmcSocketCAN::addSDO(uint32_t nodeId, + uint32_t cobIdTx, // 0x580 + CobId + uint32_t cobIdRx, // 0x600 + Cobid + ecmc_can_direction rw, + uint16_t ODIndex, // Object dictionary index + uint8_t ODSubIndex, // Object dictionary subindex + uint32_t ODSize, + int readSampleTimeMs, + const char* name) { + + int devId = findDeviceWithNodeId(nodeId); + if(devId < 0) { + throw std::out_of_range("Node id not found in any configured device."); + } + + int errorCode = devices_[devId]->addSDO(cobIdTx, + cobIdRx, + rw, + ODIndex, + ODSubIndex, + ODSize, + readSampleTimeMs, + name); + if(errorCode > 0) { + throw std::runtime_error("AddSDO() failed."); + } + +} diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.h b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.h index 2533dc7..6a45dbf 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.h +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCAN.h @@ -36,6 +36,7 @@ #include #define ECMC_CAN_MAX_WRITE_CMDS 128 +#define ECMC_CAN_MAX_DEVICES 128 #define ECMC_CAN_ERROR_WRITE_FULL 10 #define ECMC_CAN_ERROR_WRITE_BUSY 11 #define ECMC_CAN_ERROR_WRITE_NO_DATA 12 @@ -80,6 +81,32 @@ class ecmcSocketCAN { uint8_t data7); int getlastWritesError(); void execute(); // ecmc rt loop + + void addMaster(uint32_t nodeId, + const char* name); + + void addDevice(uint32_t nodeId, + const char* name); + + void addPDO(uint32_t nodeId, + uint32_t cobId, + ecmc_can_direction rw, + uint32_t ODSize, + int readTimeoutMs, + int writeCycleMs, //if <0 then write on demand. + const char* name); + + void addSDO(uint32_t nodeId, + uint32_t cobIdTx, // 0x580 + CobId + uint32_t cobIdRx, // 0x600 + Cobid + ecmc_can_direction rw, + uint16_t ODIndex, // Object dictionary index + uint8_t ODSubIndex, // Object dictionary subindex + uint32_t ODSize, + int readSampleTimeMs, + const char* name); + + int findDeviceWithNodeId(uint32_t nodeId); private: void parseConfigStr(char *configStr); @@ -104,7 +131,9 @@ class ecmcSocketCAN { int lastWriteSumError_; int exeSampleTimeMs_; + int deviceCounter_; ecmcSocketCANWriteBuffer *writeBuffer_; + //ecmcCANOpenSDO *testSdo_; //ecmcCANOpenPDO *testPdo_; //ecmcCANOpenPDO *lssPdo_; @@ -113,7 +142,10 @@ class ecmcSocketCAN { //ecmcCANOpenSDO *basicConfSdo_; ecmcCANOpenDevice *testDevice_; - ecmcCANOpenDevice *testMaster_; + ecmcCANOpenMaster *testMaster_; + + ecmcCANOpenDevice *devices_[ECMC_CAN_MAX_DEVICES]; + ecmcCANOpenMaster *masterDev_; int cycleCounter_; }; diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANDefs.h b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANDefs.h index d09af11..53200b4 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANDefs.h +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANDefs.h @@ -19,8 +19,8 @@ #define ECMC_PLUGIN_CONNECT_OPTION_CMD "CONNECT=" enum ecmc_can_direction { - DIR_READ, - DIR_WRITE }; + DIR_WRITE = 1, + DIR_READ = 2 }; enum ecmc_read_states { READ_IDLE, diff --git a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANWrap.cpp b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANWrap.cpp index b3fe56c..c997dcd 100644 --- a/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANWrap.cpp +++ b/ecmc_plugin_socketcan/ecmc_plugin_socketcanApp/src/ecmcSocketCANWrap.cpp @@ -152,7 +152,7 @@ void deleteSocketCAN() { void ecmcCANOpenAddMasterPrintHelp() { printf("\n"); - printf(" Use \"ecmcCANOpenAddMaster(, \n"); + printf(" Use ecmcCANOpenAddMaster(, )\n"); printf(" : Name of master device.\n"); printf(" : CANOpen node id of master.\n"); printf("\n"); @@ -170,8 +170,19 @@ int ecmcCANOpenAddMaster(const char* name, int nodeId) { return asynSuccess; } - /* CODE HERE*/ + if(!can) { + printf("Plugin not initialized/loaded.\n"); + return asynError; + } + try { + can->addMaster((uint32_t)nodeId,name); + } + catch(std::exception& e) { + printf("Exception: %s. Add master failed.\n",e.what()); + return asynError; + } + return asynSuccess; } @@ -194,9 +205,9 @@ static void initCallFunc_0(const iocshArgBuf *args) { void ecmcCANOpenAddDevicePrintHelp() { printf("\n"); - printf(" Use \"ecmcCANOpenAddDevice(, \n"); + printf(" Use ecmcCANOpenAddDevice(, )\n"); printf(" : Name of device.\n"); - printf(" : CANOpen node id of master.\n"); + printf(" : CANOpen node id of device.\n"); printf("\n"); } @@ -212,7 +223,18 @@ int ecmcCANOpenAddDevice(const char* name, int nodeId) { return asynSuccess; } - /* CODE HERE*/ + if(!can) { + printf("Plugin not initialized/loaded.\n"); + return asynError; + } + + try { + can->addDevice((uint32_t)nodeId,name); + } + catch(std::exception& e) { + printf("Exception: %s. Add device failed.\n",e.what()); + return asynError; + } return asynSuccess; } @@ -236,13 +258,28 @@ static void initCallFunc_1(const iocshArgBuf *args) { void ecmcCANOpenAddSDOPrintHelp() { printf("\n"); - printf(" Use \"ecmcCANOpenAddSDO(, \n"); - printf(" : Name of master device.\n"); - printf(" : CANOpen node id of master.\n"); + printf(" Use ecmcCANOpenAddSDO(, ,.....)\n"); + printf(" : Name of master device.\n"); + printf(" : CANOpen node id of device/master.\n"); + printf(" : CANOpen cob id of Tx of slave SDO.\n"); + printf(" : CANOpen cob id of Rx of slave SDO.\n"); + printf(" : Direction 1=write and 2=read.\n"); + printf(" : OD index of SDO.\n"); + printf(" : OD sub index of SDO.\n"); + printf(" : OS Size.\n"); + printf(" : Readtimeout in ms.\n"); printf("\n"); } -int ecmcCANOpenAddSDO(const char* name, int nodeId) { +int ecmcCANOpenAddSDO(const char* name, + int nodeId, + int cobIdTx, + int cobIdRx, + int dir, + int ODIndex, + int ODSubIndex, + int ODSize, + int readTimeoutMs) { if(!name) { printf("Error: name.\n"); ecmcCANOpenAddSDOPrintHelp(); @@ -254,8 +291,71 @@ int ecmcCANOpenAddSDO(const char* name, int nodeId) { return asynSuccess; } - /* CODE HERE*/ + if(cobIdRx < 0) { + printf("Error: invalid cobIdRx.\n"); + ecmcCANOpenAddSDOPrintHelp(); + return asynError; + } + if(cobIdTx < 0) { + printf("Error: invalid cobIdTx.\n"); + ecmcCANOpenAddSDOPrintHelp(); + return asynError; + } + + if(dir > 2 || dir <= 0) { + printf("Error: invalid dir.\n"); + ecmcCANOpenAddSDOPrintHelp(); + return asynError; + } + + if(ODIndex < 0) { + printf("Error: invalid ODIndex.\n"); + ecmcCANOpenAddSDOPrintHelp(); + return asynError; + } + + if(ODSubIndex < 0) { + printf("Error: invalid ODSubIndex.\n"); + ecmcCANOpenAddSDOPrintHelp(); + return asynError; + } + + if(ODSize < 0) { + printf("Error: invalid ODSize.\n"); + ecmcCANOpenAddSDOPrintHelp(); + return asynError; + } + + if(readTimeoutMs < 0) { + printf("Error: invalid readTimeoutMs.\n"); + ecmcCANOpenAddSDOPrintHelp(); + return asynError; + } + + + ecmc_can_direction tempDir = DIR_READ; + if(dir == 1) { + tempDir = DIR_WRITE; + } + + try { + can->addSDO((uint32_t)nodeId, + cobIdTx, + cobIdRx, + tempDir, + ODIndex, + ODSubIndex, + ODSize, + readTimeoutMs, + name); + + + } + catch(std::exception& e) { + printf("Exception: %s. Add PDO failed.\n",e.what()); + return asynError; + } return asynSuccess; } @@ -263,28 +363,67 @@ static const iocshArg initArg0_2 = { "Name", iocshArgString }; static const iocshArg initArg1_2 = { "Node Id", iocshArgInt }; +static const iocshArg initArg2_2 = +{ "COB id TX", iocshArgInt }; +static const iocshArg initArg3_2 = +{ "COB id RX", iocshArgInt }; +static const iocshArg initArg4_2 = +{ "Direction", iocshArgInt }; +static const iocshArg initArg5_2 = +{ "OD Index", iocshArgInt }; +static const iocshArg initArg6_2 = +{ "OD sub index", iocshArgInt }; +static const iocshArg initArg7_2 = +{ "OD size", iocshArgInt }; +static const iocshArg initArg8_2 = +{ "Read timeout ms", iocshArgInt }; static const iocshArg *const initArgs_2[] = { &initArg0_2, - &initArg1_2}; + &initArg1_2, + &initArg2_2, + &initArg3_2, + &initArg4_2, + &initArg5_2, + &initArg6_2, + &initArg7_2, + &initArg8_2}; -static const iocshFuncDef initFuncDef_2 = { "ecmcCANOpenAddSDO", 2, initArgs_2 }; +static const iocshFuncDef initFuncDef_2 = { "ecmcCANOpenAddSDO", 9, initArgs_2 }; static void initCallFunc_2(const iocshArgBuf *args) { - ecmcCANOpenAddSDO(args[0].sval, args[1].ival); + ecmcCANOpenAddSDO(args[0].sval, + args[1].ival, + args[2].ival, + args[3].ival, + args[4].ival, + args[5].ival, + args[6].ival, + args[7].ival, + args[8].ival); } /** * EPICS iocsh shell command: ecmcCANOpenAddPDO */ - void ecmcCANOpenAddPDOPrintHelp() { printf("\n"); - printf(" Use \"ecmcCANOpenAddPDO(, \n"); - printf(" : Name of master device.\n"); - printf(" : CANOpen node id of master.\n"); + printf(" Use \"ecmcCANOpenAddSDO(, \n"); + printf(" : Name of master device.\n"); + printf(" : CANOpen node id of device/master.\n"); + printf(" : CANOpen cob id of PDO.\n"); + printf(" : Direction 1=write and 2=read.\n"); + printf(" : Size of PDO (max 8 bytes).\n"); + printf(" : Readtimeout in ms.\n"); + printf(" : Cycle time for write (if <= 0 then only write on change).\n"); printf("\n"); } -int ecmcCANOpenAddPDO(const char* name, int nodeId) { +int ecmcCANOpenAddPDO(const char* name, + int nodeId, + int cobId, + int dir, + int ODSize, + int readTimeoutMs, + int writeCycleMs) { if(!name) { printf("Error: name.\n"); ecmcCANOpenAddPDOPrintHelp(); @@ -296,8 +435,47 @@ int ecmcCANOpenAddPDO(const char* name, int nodeId) { return asynSuccess; } - /* CODE HERE*/ + if(dir > 2 || dir <= 0) { + printf("Error: invalid dir.\n"); + ecmcCANOpenAddPDOPrintHelp(); + return asynError; + } + if(ODSize < 0) { + printf("Error: invalid ODSize.\n"); + ecmcCANOpenAddPDOPrintHelp(); + return asynError; + } + + if(readTimeoutMs < 0) { + printf("Error: invalid readTimeoutMs.\n"); + ecmcCANOpenAddPDOPrintHelp(); + return asynError; + } + + if(writeCycleMs < 0) { + printf("Error: invalid writeCycleMs.\n"); + ecmcCANOpenAddPDOPrintHelp(); + return asynError; + } + + ecmc_can_direction tempDir = DIR_READ; + if(dir == 1) { + tempDir = DIR_WRITE; + } + + try { + can->addPDO((uint32_t)nodeId, + cobId, + tempDir, + ODSize, + readTimeoutMs, + writeCycleMs,name); + } + catch(std::exception& e) { + printf("Exception: %s. Add PDO failed.\n",e.what()); + return asynError; + } return asynSuccess; } @@ -305,13 +483,35 @@ static const iocshArg initArg0_3 = { "Name", iocshArgString }; static const iocshArg initArg1_3 = { "Node Id", iocshArgInt }; +static const iocshArg initArg2_3 = +{ "COB Id", iocshArgInt }; +static const iocshArg initArg3_3 = +{ "Direction", iocshArgInt }; +static const iocshArg initArg4_3 = +{ "ODSize", iocshArgInt }; +static const iocshArg initArg5_3 = +{ "Read Timeout ms", iocshArgInt }; +static const iocshArg initArg6_3 = +{ "Write cycle ms", iocshArgInt }; static const iocshArg *const initArgs_3[] = { &initArg0_3, - &initArg1_3}; + &initArg1_3, + &initArg2_3, + &initArg3_3, + &initArg4_3, + &initArg5_3, + &initArg6_3 + }; -static const iocshFuncDef initFuncDef_3 = { "ecmcCANOpenAddPDO", 2, initArgs_3 }; +static const iocshFuncDef initFuncDef_3 = { "ecmcCANOpenAddPDO", 7, initArgs_3 }; static void initCallFunc_3(const iocshArgBuf *args) { - ecmcCANOpenAddPDO(args[0].sval, args[1].ival); + ecmcCANOpenAddPDO(args[0].sval, + args[1].ival, + args[2].ival, + args[3].ival, + args[4].ival, + args[5].ival, + args[6].ival); } /** diff --git a/iocsh/pvs.log b/iocsh/pvs.log index 86b43e5..338332c 100644 --- a/iocsh/pvs.log +++ b/iocsh/pvs.log @@ -1,15 +1,15 @@ IOC_TEST:PLC-0-enable -REQMOD:mcag-trgt-muts--16738:MODULES -REQMOD:mcag-trgt-muts--16738:VERSIONS -REQMOD:mcag-trgt-muts--16738:MOD_VER -REQMOD:mcag-trgt-muts--16738:exit -REQMOD:mcag-trgt-muts--16738:BaseVersion -REQMOD:mcag-trgt-muts--16738:require_VER -REQMOD:mcag-trgt-muts--16738:ecmccfg_VER -REQMOD:mcag-trgt-muts--16738:asyn_VER -REQMOD:mcag-trgt-muts--16738:exprtk_VER -REQMOD:mcag-trgt-muts--16738:motor_VER -REQMOD:mcag-trgt-muts--16738:ecmc_VER -REQMOD:mcag-trgt-muts--16738:ecmc_plugin_socketcan_VER +REQMOD:mcag-trgt-muts--29223:MODULES +REQMOD:mcag-trgt-muts--29223:VERSIONS +REQMOD:mcag-trgt-muts--29223:MOD_VER +REQMOD:mcag-trgt-muts--29223:exit +REQMOD:mcag-trgt-muts--29223:BaseVersion +REQMOD:mcag-trgt-muts--29223:require_VER +REQMOD:mcag-trgt-muts--29223:ecmccfg_VER +REQMOD:mcag-trgt-muts--29223:asyn_VER +REQMOD:mcag-trgt-muts--29223:exprtk_VER +REQMOD:mcag-trgt-muts--29223:motor_VER +REQMOD:mcag-trgt-muts--29223:ecmc_VER +REQMOD:mcag-trgt-muts--29223:ecmc_plugin_socketcan_VER IOC_TEST:PLC-0-scantime IOC_TEST:PLC-0-error