- Fixed a bug at the new counter driver
SKIPPED: psi/el737hpdriv.c psi/el737hpv2driv.c psi/make_gen psi/psi.c psi/tas.c psi/tasdrive.c psi/tasinit.c psi/tasscan.c psi/tasutil.c
This commit is contained in:
183
evcontroller.c
183
evcontroller.c
@ -1143,6 +1143,114 @@
|
||||
}
|
||||
return 0; /* not reached */
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static pEVControl InstallCommonControllers(SicsInterp *pSics,
|
||||
SConnection *pCon,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
pEVControl pNew = NULL;
|
||||
pEVDriver pDriv = NULL;
|
||||
char pBueffel[512],pError[132];
|
||||
int iRet;
|
||||
int (*Wrapper)(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]) = EVControlWrapper;
|
||||
|
||||
if(strcmp(argv[3],"sim") == 0) /* SIM driver */
|
||||
{
|
||||
/* Create a Sim Driver */
|
||||
pDriv = CreateSIMEVDriver(argc-4,&argv[4]);
|
||||
if(!pDriv)
|
||||
{
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to create Environment Device driver",
|
||||
eError);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[3],"tcl") == 0) /* Tcl driver */
|
||||
{
|
||||
/* Create a Tcl driver */
|
||||
pDriv = CreateTclDriver(argc-4,&argv[4],argv[2], pCon);
|
||||
if(!pDriv)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: failed to create TCL device driver",eError);
|
||||
return NULL;
|
||||
}
|
||||
/* got a driver, initialise everything */
|
||||
pNew = CreateEVController(pDriv,argv[2],&iRet);
|
||||
if(!pNew)
|
||||
{
|
||||
SCWrite(pCon,"ERROR creating Environment Controller",eError);
|
||||
DeleteEVDriver(pDriv);
|
||||
return NULL;
|
||||
}
|
||||
if(!iRet)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: problem initialising Environment controller",
|
||||
eError);
|
||||
pDriv->GetError(pDriv,&iRet,pError,131);
|
||||
sprintf(pBueffel,"HW reported: %s",pError);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
}
|
||||
Wrapper = TclEnvironmentWrapper;
|
||||
pNew->iTcl = 1;
|
||||
/* make ev parameters available to Tcl */
|
||||
UpdateTclVariable(pNew->pDriv,"tolerance",
|
||||
ObVal(pNew->pParam,TOLERANCE));
|
||||
UpdateTclVariable(pNew->pDriv,"upperlimit",
|
||||
ObVal(pNew->pParam,UPLIMIT));
|
||||
UpdateTclVariable(pNew->pDriv,"lowerlimit",
|
||||
ObVal(pNew->pParam,LOWLIMIT));
|
||||
}
|
||||
else if(strcmp(argv[3],"gencon") == 0) /* general controller */
|
||||
{
|
||||
/* Create a driver */
|
||||
pDriv = MakeControllerEnvironmentDriver(argc-4,&argv[4]);
|
||||
if(!pDriv)
|
||||
{
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to create Controller Environment driver",
|
||||
eError);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
return NULL; /* not recognized */
|
||||
}
|
||||
|
||||
|
||||
if(pNew == NULL) /* not yet initialized */
|
||||
{
|
||||
pNew = CreateEVController(pDriv,argv[2],&iRet);
|
||||
if(!pNew)
|
||||
{
|
||||
SCWrite(pCon,"ERROR creating Environment Controller",eError);
|
||||
DeleteEVDriver(pDriv);
|
||||
return NULL;
|
||||
}
|
||||
if(!iRet)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: problem initialising Environment controller",
|
||||
eError);
|
||||
pDriv->GetError(pDriv,&iRet,pError,131);
|
||||
sprintf(pBueffel,"HW reported: %s",pError);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
}
|
||||
}
|
||||
|
||||
/* install command */
|
||||
iRet = AddCommand(pSics,argv[2],Wrapper,
|
||||
DeleteEVController,
|
||||
pNew);
|
||||
if(!iRet)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: duplicate command %s not created",
|
||||
argv[2]);
|
||||
DeleteEVController((void *)pNew);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return NULL;
|
||||
}
|
||||
return pNew;
|
||||
}
|
||||
/*-------------------------------------------------------------------------
|
||||
EVControlFactory implements a SICS command which creates and deletes
|
||||
Controllers at run-time. Syntax:
|
||||
@ -1156,7 +1264,6 @@
|
||||
int argc, char *argv[])
|
||||
{
|
||||
pEVControl pNew = NULL;
|
||||
pEVDriver pDriv = NULL;
|
||||
char pBueffel[512],pError[132];
|
||||
int iRet;
|
||||
CommandList *pCom = NULL;
|
||||
@ -1223,78 +1330,8 @@
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
if(strcmp(argv[3],"sim") == 0) /* SIM driver */
|
||||
{
|
||||
/* Create a Sim Driver */
|
||||
|
||||
pDriv = CreateSIMEVDriver(argc-4,&argv[4]);
|
||||
if(!pDriv)
|
||||
{
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to create Environment Device driver",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[3],"tcl") == 0) /* Tcl driver */
|
||||
{
|
||||
/* Create a driver */
|
||||
pDriv = CreateTclDriver(argc-4,&argv[4],argv[2], pCon);
|
||||
if(!pDriv)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: failed to create TCL device driver",eError);
|
||||
return 0;
|
||||
}
|
||||
/* got a driver, initialise everything */
|
||||
pNew = CreateEVController(pDriv,argv[2],&iRet);
|
||||
if(!pNew)
|
||||
{
|
||||
SCWrite(pCon,"ERROR creating Environment Controller",eError);
|
||||
DeleteEVDriver(pDriv);
|
||||
return 0;
|
||||
}
|
||||
if(!iRet)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: problem initialising Environment controller",
|
||||
eError);
|
||||
pDriv->GetError(pDriv,&iRet,pError,131);
|
||||
sprintf(pBueffel,"HW reported: %s",pError);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
}
|
||||
/* install command */
|
||||
iRet = AddCommand(pSics,argv[2],TclEnvironmentWrapper,
|
||||
DeleteEVController,
|
||||
pNew);
|
||||
if(!iRet)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: duplicate command %s not created",
|
||||
argv[2]);
|
||||
DeleteEVController((void *)pNew);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
pNew->iTcl = 1;
|
||||
/* make ev parameters available to Tcl */
|
||||
UpdateTclVariable(pNew->pDriv,"tolerance",
|
||||
ObVal(pNew->pParam,TOLERANCE));
|
||||
UpdateTclVariable(pNew->pDriv,"upperlimit",
|
||||
ObVal(pNew->pParam,UPLIMIT));
|
||||
UpdateTclVariable(pNew->pDriv,"lowerlimit",
|
||||
ObVal(pNew->pParam,LOWLIMIT));
|
||||
}
|
||||
else if(strcmp(argv[3],"gencon") == 0) /* general controller */
|
||||
{
|
||||
/* Create a driver */
|
||||
pDriv = MakeControllerEnvironmentDriver(argc-4,&argv[4]);
|
||||
if(!pDriv)
|
||||
{
|
||||
SCWrite(pCon,
|
||||
"ERROR: failed to create Controller Environment driver",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
pNew = InstallCommonControllers(pSics,pCon,argc,argv);
|
||||
if(pNew == NULL)
|
||||
{
|
||||
site = getSite();
|
||||
if(site != NULL){
|
||||
|
Reference in New Issue
Block a user