- Modified collective drive operations to run motors in individual tasks

- Added a processnode methos to scriptcontext. processnode waits for the
  scriptchain of a node to finish.
- Fixed a bug in sicsget
- Made histmemsec dim and rank manager privilege. To allow chnage at runtime.
  Is required for SANS
- Fixed some issues with multicountersec, mostly relating to passing things through
  in a sensible way.
- Updated motorsec.c to work with a client based driver


SKIPPED:
	psi/polterwrite.c
	psi/tabledrive.c
	psi/tabledrive.h
This commit is contained in:
koennecke
2014-02-18 13:25:32 +00:00
parent 95d37fea12
commit 33e122ea9e
22 changed files with 240 additions and 241 deletions

View File

@@ -48,6 +48,7 @@ typedef struct SctData {
int inMacro;
Hdb *node;
long syncid;
int busy;
} SctData;
/* data for updatescript */
@@ -422,7 +423,10 @@ static char *SctActionHandler(void *actionData, char *lastReply,
} else {
con = controller->conn;
}
data->busy = 1;
/*
* Check if this is a followup call.
* If this is a followup call, the I/O system will have set the
* property result to the data from the device. Read this now and
* print it if diagnostics is required.
@@ -445,6 +449,8 @@ static char *SctActionHandler(void *actionData, char *lastReply,
}
/*
* Make sure that the state property is set to the name of the property
* which holds the name of the script to run at this stage.
* When this is a followup, we use the content of the
* state field as the property storing the next script to
* run. If this is the start of a chain this is set to the
@@ -491,6 +497,9 @@ static char *SctActionHandler(void *actionData, char *lastReply,
}
SyncedEnd(data->syncid);
sct->sendNode = NULL;
/*
* Process the results of the script run
*/
if (ret == 0) {
/*
* an error occurred in the script: store error message in
@@ -588,7 +597,8 @@ static char *SctActionHandler(void *actionData, char *lastReply,
free(script);
script = NULL;
/*
* If there is data to send, check it and do so
* If there is data to send, check it and do so. This also exits the
* quick script loop by returning the data to send to Devser.
*/
if (sct->sendCalled) {
send = GetProp(node, controller->node, "send");
@@ -610,6 +620,10 @@ static char *SctActionHandler(void *actionData, char *lastReply,
}
SCPrintf(con, eLogError, "ERROR: too many quick scripts chained");
finish:
/*
* This section is always called when the script chain ends: either due to
* error or by successfull termination.
*/
if (strcmp(data->name, "write") == 0) {
if (GetHdbProp(node, "writestatus") != NULL) {
SetHdbProperty(node, "writestatus", "commandsent");
@@ -624,6 +638,7 @@ finish:
SCDeleteConnection(data->conCtx);
data->conCtx = NULL;
}
data->busy = 0;
return send;
}
@@ -835,6 +850,7 @@ static hdbCallbackReturn SctActionCallback(Hdb * node, void *userData,
data->inMacro = SCinMacro(con);
tracePar(node->name,"Queued %s to %s",node->name, GetCharArray(text));
data->syncid = SyncedIncr(0);
data->busy = 1;
DevQueue(data->controller->devser, data, prio,
SctWriteHandler, SctMatch, SctEndData, SctDataInfo);
/* kill function SctEndData does not kill, data is owned by the node (callback list) */
@@ -1149,7 +1165,7 @@ void SctQueueNode(SctController * controller, Hdb * node,
data->answered = 1;
data->syncid = SyncedIncr(0);
data->busy = 1;
if (DevQueue(data->controller->devser, data, prio,
SctWriteHandler, SctMatch, SctKillData, SctDataInfo)) {
if (con != NULL) {
@@ -1531,6 +1547,50 @@ static int SctSendCmd(pSICSOBJ ccmd, SConnection * con,
return 1;
}
static int SctProcessCmd(pSICSOBJ ccmd, SConnection * con,
Hdb * cmdNode, Hdb * par[], int nPar)
{
SctData *data = NULL;
SctController *c;
c = (SctController *) ccmd->pPrivate;
if(nPar < 1 || par[0] == NULL){
SCWrite(con,"ERROR: no node to process found", eError);
return 0;
}
data = calloc(sizeof(SctData), 1);
if (data == NULL) {
SCWrite(con, "ERROR: out of memory in SctProcessCommand", eError);
return 0;
}
data->node = FindHdbNode(NULL,par[0]->value.v.text, con);
if(data->node == NULL){
SCPrintf(con,eError,"ERROR: node %s to process not found", par[0]->value.v.text);
return 0;
}
if(nPar > 1) {
data->name = strdup(par[1]->value.v.text);
} else {
data->name = strdup("read");
}
data->controller = c;
data->conCtx = SCCopyConnection(con);
data->busy = 1;
data->inMacro = SCinMacro(con);
DevQueue(c->devser, data, WritePRIO,
SctWriteHandler, SctMatch, NULL, SctDataInfo);
while (data->busy == 1) {
TaskYield(pServ->pTasker);
}
SctKillData(data);
return 1;
}
static int SctDisconnect(pSICSOBJ ccmd, SConnection * con,
Hdb * cmdNode, Hdb * par[], int nPar)
{
@@ -1857,6 +1917,11 @@ static int SctMakeController(SConnection * con, SicsInterp * sics,
AddSICSHdbPar(cmd, "data", usMugger, MakeHdbText(""));
AddSICSHdbPar(cmd, "prio", usMugger, MakeHdbText(""));
cmd = AddSICSHdbPar(controller->node,
"processnode", usUser, MakeSICSFunc(SctProcessCmd));
AddSICSHdbPar(cmd, "node", usUser, MakeHdbText(""));
AddSICSHdbPar(cmd, "command", usUser, MakeHdbText("read"));
cmd = AddSICSHdbPar(controller->node,
"disconnect", usMugger, MakeSICSFunc(SctDisconnect));