- Added Sycamore protocol and command context to SICS

- Added sinfo to SICS
- Added driver for TCP/IP Astrium velocity selector
- Added driver for TCP/IP Astrium chopper controller


SKIPPED:
	psi/amor2t.c
	psi/amorstat.c
	psi/dornier2.c
	psi/ecb.c
	psi/el734hp.c
	psi/fowrite.c
	psi/libpsi.a
	psi/make_gen
	psi/nextrics.c
	psi/pardef.c
	psi/pimotor.c
	psi/pipiezo.c
	psi/polterwrite.c
	psi/psi.c
	psi/scontroller.c
	psi/serial.c
	psi/tasinit.c
	psi/tasscan.c
	psi/tcpdocho.c
	psi/tcpdornier.c
	psi/tricssupport.c
	psi/velodornier.c
This commit is contained in:
koennecke
2005-12-22 22:16:10 +00:00
parent 603a4fc14b
commit b3138f1197
67 changed files with 4650 additions and 682 deletions

104
histmem.c
View File

@ -439,6 +439,7 @@
free(pNew);
return NULL;
}
StringDictAddPair(pNew->pOption,"driver",driver);
StringDictAddPair(pNew->pOption,"update","0");
/* initialise driver */
@ -531,6 +532,8 @@
SCWrite(pCon,pBueffel,eError);
return 0;
}
StringDictAddPair(pNew->pOption,"name",argv[1]);
/* install HM as command */
iRet = AddCommand(pSics,argv[1],HistAction,DeleteHistMemory,(void *)pNew);
@ -918,7 +921,8 @@ void HistDirty(pHistMem self)
return 0;
}
/*----------------------------------------------------------------------*/
static int HMCountInterest(int iEvent, void *pEvent, void *pUser)
static int HMCountInterest(int iEvent, void *pEvent, void *pUser,
commandContext cc)
{
SConnection *pCon = NULL;
char pBueffel[512];
@ -927,14 +931,14 @@ void HistDirty(pHistMem self)
{
pCon = (SConnection *)pUser;
assert(pCon);
SCWrite(pCon,"HMCOUNTSTART",eWarning);
SCWriteInContext(pCon,"HMCOUNTSTART",eWarning,cc);
return 1;
}
else if(iEvent == COUNTEND)
{
pCon = (SConnection *)pUser;
assert(pCon);
SCWrite(pCon,"HMCOUNTEND",eWarning);
SCWriteInContext(pCon,"HMCOUNTEND",eWarning,cc);
return 1;
}
return 0;
@ -955,6 +959,89 @@ static int checkHMEnd(pHistMem self, char *text){
}
}
}
/*--------------------------------------------------------------------------*/
void HMListOption(pHistMem self, SConnection *pCon)
{
char pBuffer[512];
char name[20];
char pValue[128];
const char *pKey;
int i,iRet,iLen,iRank,iDiscard,tofMode;
float fVal;
char *pMode[] = {"timer","monitor",NULL};
memset(pBuffer, 0, sizeof(pBuffer));
memset(pValue, 0, sizeof(pValue));
memset(name, 0, sizeof(name));
iRet = StringDictGet(self->pOption,"name",name,19);
if(0==iRet) {
strcpy(name,"*");
}
iRet = StringDictGet(self->pOption,"driver",pValue,sizeof(pValue)-1);
if(0<iRet) {
sprintf(pBuffer,"%s.driver = %s",name,pValue);
SCWrite(pCon,pBuffer,eStatus);
}
iRet = StringDictGetAsNumber(self->pOption,"update",&fVal);
if(0<iRet) {
sprintf(pBuffer,"%s.update = %d",name,(int)rint(fVal));
} else {
sprintf(pBuffer,"%s.update = 0 (no buffering)",name);
}
SCWrite(pCon,pBuffer,eStatus);
iRet = StringDictGetAsNumber(self->pOption,"rank",&fVal);
if(0<iRet) {
iRank = (int)rint(fVal);
sprintf(pBuffer,"%s.rank = %d",name,iRank);
SCWrite(pCon,pBuffer,eStatus);
} else {
iRank = 0;
}
for(i=0; i<iRank; i++){
sprintf(pValue,"dim%1.1d",i);
iRet = StringDictGetAsNumber(self->pOption,pValue,&fVal);
if(0<iRet){
sprintf(pBuffer,"%s.dim%1.1d = %d",name,i,(int)rint(fVal));
SCWrite(pCon,pBuffer,eStatus);
}
}
pKey = StringDictGetNext(self->pOption,pValue,sizeof(pValue)-1);
while(pKey != NULL) {
iDiscard=0;
if(0==strcmp("name",pKey)) iDiscard=1;
if(0==strcmp("driver",pKey)) iDiscard=1;
if(0==strcmp("update",pKey)) iDiscard=1;
if(0==strcmp("rank",pKey)) iDiscard=1;
if(NULL!=strstr(pKey,"dim")) iDiscard=1;
if(0==iDiscard) {
sprintf(pBuffer,"%s.%s = %s",name,pKey,pValue,sizeof(pValue)-1);
SCWrite(pCon,pBuffer,eStatus);
}
pKey = StringDictGetNext(self->pOption,pValue,sizeof(pValue)-1);
}
/* Display Count Mode */
sprintf(pBuffer,"%s.CountMode = %s",name,pMode[self->pDriv->eCount]);
SCWrite(pCon,pBuffer,eStatus);
/* Display Preset */
sprintf(pBuffer,"%s.preset = %f",name,self->pDriv->fCountPreset);
SCWrite(pCon,pBuffer,eStatus);
if(self->pDriv->data->nTimeChan > 2) {
tofMode = 1;
} else {
tofMode = 0;
}
sprintf(pBuffer,"%s.tofMode = %d",name,tofMode);
SCWrite(pCon,pBuffer,eStatus);
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
int HistAction(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
@ -998,10 +1085,12 @@ static int checkHMEnd(pHistMem self, char *text){
strtolower(argv[1]);
if(strcmp(argv[1],"interest") == 0)
{
lID = RegisterCallback(self->pCall, COUNTSTART, HMCountInterest,
lID = RegisterCallback(self->pCall, SCGetContext(pCon),
COUNTSTART, HMCountInterest,
pCon, NULL);
SCRegister(pCon,pSics, self->pCall,lID);
lID = RegisterCallback(self->pCall, COUNTEND, HMCountInterest,
lID = RegisterCallback(self->pCall, SCGetContext(pCon),
COUNTEND, HMCountInterest,
pCon, NULL);
SCRegister(pCon,pSics, self->pCall,lID);
SCSendOK(pCon);
@ -1165,6 +1254,11 @@ static int checkHMEnd(pHistMem self, char *text){
return 0;
}
}
else if(strcmp(argv[1],"list") == 0)
{
HMListOption(self,pCon);
return 1;
}
/* normal counting*/
else if(strcmp(argv[1],"count") == 0)
{