fixed broken command registration for iocsh
Warning, cannot access the index:
_darcs/index: opening of '_darcs/index' failed: permission denied (Permission denied)
diff -rN -u old-highland/hiddg85xApp/drvHIDDG85x.c new-highland/hiddg85xApp/drvHIDDG85x.c
--- old-highland/hiddg85xApp/drvHIDDG85x.c 2022-09-28 11:49:00.002853739 +0200
+++ new-highland/hiddg85xApp/drvHIDDG85x.c 2022-09-28 11:49:00.002853739 +0200
@@ -291,18 +291,12 @@
* calling hiddg85x_debug with a level greater than 0 will turn
* ever increasing levels of verbose debugging messages on
*/
-static const iocshArg set_debugArg = {"debug_level", iocshArgInt};
-static const iocshArg *const set_debugArgs[1] = {&set_debugArg};
-static const iocshFuncDef set_debugDef = {"hiddg85x_set_debug", 1, set_debugArgs};
epicsStatus hiddg85x_set_debug(int level)
{
hiddg85x.debug_level = level;
return 0;
}
-static const iocshArg set_base_addrArg = {"base_addr", iocshArgInt};
-static const iocshArg *const set_base_addrArgs[1] = {&set_base_addrArg};
-static const iocshFuncDef set_base_addrDef = {"hiddg85x_set_base_addr", 1, set_base_addrArgs};
epicsStatus hiddg85x_set_base_addr(int base_addr)
{
if (hiddg85x.pinfo) {
@@ -315,9 +309,6 @@
return 0;
}
-static const iocshArg set_max_cardsArg = {"max_cards", iocshArgInt};
-static const iocshArg *const set_max_cardsArgs[1] = {&set_max_cardsArg};
-static const iocshFuncDef set_max_cardsDef = {"hiddg85x_set_max_cards", 1, set_max_cardsArgs};
epicsStatus hiddg85x_set_max_cards(int ncards)
{
if (hiddg85x.pinfo) {
@@ -330,10 +321,6 @@
return 0;
}
-static const iocshArg configArg0 = {"cards", iocshArgInt};
-static const iocshArg configArg1 = {"base_addr", iocshArgInt};
-static const iocshArg *const configArgs[2] = {&configArg0, &configArg1};
-static const iocshFuncDef configDef = {"hiddg85x_config", 1, configArgs};
epicsStatus hiddg85x_config(int ncards, int base_addr)
{
epicsStatus status;
@@ -351,12 +338,6 @@
* this routine should be called only *after* base_addr and max_cards
* have been defined
*/
-static const iocshArg config_cardArg0 = {"card", iocshArgInt};
-static const iocshArg config_cardArg1 = {"vlo", iocshArgDouble};
-static const iocshArg config_cardArg2 = {"vhi", iocshArgDouble};
-static const iocshArg config_cardArg3 = {"trg_lvl", iocshArgDouble};
-static const iocshArg *const cconfig_cardArgs[4] = {&config_cardArg0, &config_cardArg1, &config_cardArg2, &config_cardArg3};
-static const iocshFuncDef config_cardDef = {"hiddg85x_config_card", 1, cconfig_cardArgs};
epicsStatus hiddg85x_config_card(int card, double vlo, double vhi, double trg_lvl)
{
hiddg85x_info *pinfo;
@@ -882,23 +863,56 @@
/* registrar for ioshell */
-static registryFunctionRef mySubRef[] = {
- {"hiddg85x_set_debug", (REGISTRYFUNCTION)hiddg85x_set_debug},
- {"hiddg85x_set_base_addr", (REGISTRYFUNCTION)hiddg85x_set_base_addr},
- {"hiddg85x_set_max_cards", (REGISTRYFUNCTION)hiddg85x_set_max_cards},
- {"hiddg85x_config", (REGISTRYFUNCTION)hiddg85x_config},
- {"hiddg85x_config_card", (REGISTRYFUNCTION)hiddg85x_config_card}
-};
+static const iocshArg set_debugArg = {"debug_level", iocshArgInt};
+static const iocshArg *const set_debugArgs[] = {&set_debugArg};
+static const iocshFuncDef set_debugDef = {"hiddg85x_set_debug", 1, set_debugArgs};
+static void set_debugCall(const iocshArgBuf *args) {
+ hiddg85x_set_debug(args[0].ival);
+}
+
+static const iocshArg set_base_addrArg = {"base_addr", iocshArgInt};
+static const iocshArg *const set_base_addrArgs[] = {&set_base_addrArg};
+static const iocshFuncDef set_base_addrDef = {"hiddg85x_set_base_addr", 1, set_base_addrArgs};
+static void set_base_addrCall(const iocshArgBuf *args) {
+ hiddg85x_set_base_addr(args[0].ival);
+}
+
+static const iocshArg set_max_cardsArg = {"max_cards", iocshArgInt};
+static const iocshArg *const set_max_cardsArgs[] = {&set_max_cardsArg};
+static const iocshFuncDef set_max_cardsDef = {"hiddg85x_set_max_cards", 1, set_max_cardsArgs};
+static void set_max_cardsCall(const iocshArgBuf *args) {
+ hiddg85x_set_max_cards(args[0].ival);
+}
+
+static const iocshArg configArg0 = {"cards", iocshArgInt};
+static const iocshArg configArg1 = {"base_addr", iocshArgInt};
+static const iocshArg *const configArgs[] = {&configArg0, &configArg1};
+static const iocshFuncDef configDef = {"hiddg85x_config", 2, configArgs};
+static void configCall(const iocshArgBuf *args) {
+ hiddg85x_config(args[0].ival, args[1].ival);
+}
+
+static const iocshArg config_cardArg0 = {"card", iocshArgInt};
+static const iocshArg config_cardArg1 = {"vlo", iocshArgDouble};
+static const iocshArg config_cardArg2 = {"vhi", iocshArgDouble};
+static const iocshArg config_cardArg3 = {"trg_lvl", iocshArgDouble};
+static const iocshArg *const cconfig_cardArgs[] = {&config_cardArg0, &config_cardArg1, &config_cardArg2, &config_cardArg3};
+static const iocshFuncDef config_cardDef = {"hiddg85x_config_card", 4, cconfig_cardArgs};
+static void config_cardCall(const iocshArgBuf *args) {
+ hiddg85x_config_card(args[0].ival, args[1].dval, args[2].dval, args[3].dval);
+}
void drvHIDDG85x_registrar(void)
{
- registryFunctionRefAdd(mySubRef, NELEMENTS(mySubRef));
-
- iocshRegister(&set_debugDef, (iocshCallFunc)hiddg85x_set_debug);
- iocshRegister(&set_base_addrDef, (iocshCallFunc)hiddg85x_set_base_addr);
- iocshRegister(&set_max_cardsDef, (iocshCallFunc)hiddg85x_set_max_cards);
- iocshRegister(&configDef, (iocshCallFunc)hiddg85x_config);
- iocshRegister(&config_cardDef, (iocshCallFunc)hiddg85x_config_card);
+ static int firstTime = 1;
+ if (firstTime) {
+ firstTime = 0;
+ iocshRegister(&set_debugDef, set_debugCall);
+ iocshRegister(&set_base_addrDef, set_base_addrCall);
+ iocshRegister(&set_max_cardsDef, set_max_cardsCall);
+ iocshRegister(&configDef, configCall);
+ iocshRegister(&config_cardDef, config_cardCall);
+ }
}
epicsExportRegistrar(drvHIDDG85x_registrar);
patch a191bf315405476ee18ad420a5e4951a305d8918
Author: Ben Franksen <benjamin.franksen@helmholtz-berlin.de>
Date: Mon Feb 5 19:32:54 CET 2018
* fixed broken command registration for iocs